akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define low lower_bound
#define upp upper_bound
#define inf 1000000007 //10^9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort(all(vec));
#define rever(vec) reverse(all(vec));
#define unsort(vec) sort(vec); rever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
using namespace std;
signed main() {
  int n,m;
  cin>>n>>m;
  cout<<((n-m)*100+m*1900)*(pow(2,m))<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    N = int(input())
    T = list(map(int,input().split()))
    M = int(input())
    t = sum(T)
    for _ in range(M):
        p,x = map(int,input().split())
        s = t - T[p-1] + x
        print(s)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import sys
readline = sys.stdin.buffer.readline

N = int(readline())
S = [readline().rstrip().decode() for _ in range(N)]

def count_cb_ob(s):
    st = []
    for i, si in enumerate(s):
        if si == '(' or len(st) == 0 or st[-1] != '(':
            st.append(si)
        else:
            st.pop()
    return st.count(')'), st.count('(')

cb_obs = list(map(count_cb_ob, S))
f = list(filter(lambda cb_ob: cb_ob[0] < cb_ob[1] , cb_obs))
b = list(filter(lambda cb_ob: cb_ob[0] > cb_ob[1] , cb_obs))
s = list(filter(lambda cb_ob: cb_ob[0] == cb_ob[1] , cb_obs))

f = sorted(f)
b = sorted(b, key=lambda x:x[1], reverse=True)

count = 0
ans = 'Yes'
for down, up in (*f, *s, *b):
    count -= down
    if count < 0:
        ans = 'No'
    count += up

if count != 0:
    print('No')
else:
    print(ans)

Measured memory_bytes: 115276
#include <bits/stdc++.h>

#define INF 1 << 29
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)

using namespace std;

typedef pair<int,int> pii;
typedef long long int ll;

void gen_sosuu(int sosuu[]){
  REP(i,100010){
    sosuu[i] = true;
  }
  sosuu[0] = false;
  sosuu[1] = false;
  sosuu[2] = true;
  FOR(i,2,sqrt(100000)+1){
    if(sosuu[i] == false) continue;
    for(int j = 2; i*j<=100000;j++){
      //printf("%d %d %d\n",i*j,i,j);
      sosuu[i*j] =false;
    }
  }
}

int n;

int main(){
  scanf("%d",&n);
  printf("ABC%d\n",n);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}
int mypow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}
int x[100000];
signed main(){
	int a,b,ans=0;
	cin>>a>>b;
	f(i,a){
		int c;
		cin>>c;
		if(c>=b)ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 764
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(S, s) S.find(s) != string::npos

#define NMAX 105
#define WMAX 10005
#define DIAGONAL 1
#define TOP 0

struct Item {
    int value, weight;
};

int N, W;
Item items[NMAX + 1];
int C[NMAX + 1][WMAX + 1], G[NMAX + 1][WMAX + 1];

void compute(int& maxValue, vector<int>& selection) {
    for (int w = 0; w <= W; w++) {
        C[0][w] = 0;
        G[0][w] = DIAGONAL;
    }
    for (int i = 1; i <= N; i++) C[i][0] = 0;
    for (int i = 1; i <= N; i++) {
        for (int w = 1; w <= W; w++) {
            C[i][w] = C[i - 1][w];
            G[i][w] = TOP;
            if (items[i].weight > w) continue;
            if (items[i].value + C[i - 1][w - items[i].weight] > C[i - 1][w]) {
                C[i][w] = items[i].value + C[i - 1][w - items[i].weight];
                G[i][w] = DIAGONAL;
            }
        }
    }
    maxValue = C[N][W];
    selection.clear();
    for (int i = N, w = W; i >= 1; i--) {
        if (G[i][w] == DIAGONAL) {
            selection.push_back(i);
            w -= items[i].weight;
        }
    }
    reverse(selection.begin(), selection.end());
}

void input() {
    cin >> N >> W;
    for (int i = 1; i <= N; i++) {
        cin >> items[i].value >> items[i].weight;
    }
}

int main() {
    int maxValue;
    vector<int> selection;
    input();
    compute(maxValue, selection);
    cout << maxValue << endl;
    return 0;
}


Measured memory_bytes: 11048
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  
  if (n % 1000 % 111 == 0 || n / 10 % 111 == 0) 
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int x = sc.nextInt();
        int max = 0;
        for (int i = 1; i < 32; i++) {
            for (int j = 2; j < 10; j++) {
                int beki = (int) Math.pow(i, j);
                if (beki > x) {
                    continue;
                }

                max = Math.max(beki, max);
            }
        }
        System.out.println(max);
    }
}

Measured memory_bytes: 20564
import math

N = int(input())

tax = 1.08
ans_floor = math.floor(N/tax)
ans_ceil  = math.ceil(N/tax)

if math.floor(ans_floor * tax) == N:
  print(ans_floor)
elif math.floor(ans_ceil * tax) == N:
  print(ans_ceil)
else:
  print(":(")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    int x, t;
    cin >> x >> t;
    if(x > t){
        cout << x-t << endl;
    }
    else{
        cout << 0 << endl;
    }
    
}

Measured memory_bytes: 256
#ABC118

n,m = list(map(int,input().split()))
food = [0] * m
for i in range(n):
    a = list(map(int,input().split()))
    for j in a[1:]:
        food[j-1] += 1
        
l = [food[i] for i in range(len(food)) if food[i] == n]
print(len(l))

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n,num=1;
    cin>>n;
    char  ara[n];
    cin>>ara;
    for(int i=0;i<n-1;i++){
        if(ara[i]!=ara[i+1]) num++;
    }
    cout<<num<<endl;
    return 0;

}


Measured memory_bytes: 384
from sys import stdin, stdout

input = lambda: stdin.readline().rstrip()
write = stdout.write

def main():
    S = input()
    K = int(input())

    if K == 1:
        print(S[0])
    else:
        for s in S:
            if s == '1':
                K -= 1
            else:
                print(s)
                break
            if not K:
                print(s)
                break

main()


Measured memory_bytes: 3060
#include <iostream>

using namespace std;
    int N=0;
    int Y=0;

    int ans1000     = -1;
    int ans5000     = -1;
    int ans10000    = -1;

void solve(void){
    for(int i=0; i<=N; i++){
        if(i * 10000 > Y){
            return;
        }
        for(int j=0; j<=N; j++){
            if( (i+j) >N){
                break;
            }
            
            if(
                (
                (i * 10000)
                +(j * 5000)
                +( (N-(i+j)) * 1000 )
                ) == Y
                &&
                (N-(i+j) >= 0 )
                
            ){
                ans10000 = i;
                ans5000 = j;
                ans1000 =(N-(i+j));
            }
        }
    }
}

int main(void){

    cin >> N;
    cin >> Y;

    solve();

    cout << ans10000 << " " << ans5000 << " " << ans1000 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n; cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];

    int hi = 0, low = 0;
    int x = 0;
    int c = 0;
    for (int i = 0; i <= 7; ++i) {
        int lp = i * 400;
        int hp = (i+1) * 400;
        for (int j = 0; j < n; ++j) {
            if (lp <= a[j] && hp > a[j]) {
                ++c;
                break;
            }
        }
    }
    for (int i = 0; i < n; ++i) if (3200 <= a[i]) ++x;

    if (x) {
        hi = x + c;
    } else {
        hi = c;
    }
    if (c >= 1) low = c;
    else low = 1;

    cout << low << " " << hi << endl;

    return 0;
}



Measured memory_bytes: 256
/* ex4_1
   seira3 */

#include<stdio.h>

int main(void){
    int num, d, ans; //変数宣言
    scanf("%d %d",&num,&d); //入力
    if(num%(2*d+1)==0){ //割り切れる場合
        ans = num/(2*d+1);
    }
    else{ //割り切れない場合
        ans = num/(2*d+1)+1;
    }
    printf("%d\n",ans); //答えを出力
    return 0;
}

Measured memory_bytes: 128
#include<math.h>
#include<stdio.h>
#include<utility>
#include<algorithm>

int main() {
	int a, b, d, r;
	double f;
	scanf("%d %d", &a, &b);
	d = a / b;
	r = a%b;
	f = 1.000000*a / b;
	printf("%d %d %6lf\n", d, r, f);
	return 0;
}

Measured memory_bytes: 2760
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
#include <map>
using namespace std;

const double PI=acos(-1);

int main(){
    long n;
    cin >> n;
    vector<long> l(n);
    long four = 0, even = 0, odd = 0;
    for(long i = 0; i < n; i++){
        cin >> l[i];
        if(l[i]%4 == 0) four++;
        else if(l[i]%2 == 0) even++;
        else odd++;
    }
    if(four >= n/2 || (four + even >= n/2 && even >= 2 && four >= odd)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 1024
const log = console.log;

const parseLines = (s: string) => s.trim().split("\n");
const parseDecimalInt = (s: string) => parseInt(s);

// ----

function Main(input: string): void {
  const [n, a] = parseLines(input).map(parseDecimalInt);

  log(n % 500 <= a ? "Yes" : "No");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
S = int(input())
P = S//3

if S < 3:
	print(0)
	exit()
elif S <6:
	print(1)
	exit()
    
count = 1

import math

for i in range (2, P+1):
	count+=math.comb(S-i*3+i-1, i-1)

print(count%(10**9+7))

Measured memory_bytes: 9176
#include<stdio.h>
int main()
{
	int A, B, C, D;
	scanf("%d %d %d %d", &A, &B, &C, &D);
	if ((A < D) && (C < B))
		if (B > D)
			if (C > A)
				printf("%d", D - C);
			else
				printf("%d", D - A);
		else
			if (C > A)
				printf("%d", B - C);
			else
				printf("%d", B - A);
	else
		printf("0");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
#define BOOST        std::ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define sp           <<" "<<
#define ll           long long
#define ld           long double
#define For(i,k,n)   for(ll i=k;i<n;i++)
#define Ford(i,n)    for(ll i=n-1;i>=0;i--)
#define AZI(i,x)     for(auto i=x.begin();i!=x.end();i++)
#define AZ(x)        x.begin(),x.end()
#define P(x,y)       pair < x,y >
#define V(x)         vector < x >
#define fi           first
#define se           second
#define pb           push_back
#define mp           make_pair
#define PI           3.14159265358979323846264338327950288419716939937510
 
const ll mod=1e9+7,N=1e5+5;
ll dp[105][100005];

int main() 
{ 
    BOOST

    int n,w;
    cin>>n>>w;

    memset(dp,0,sizeof(dp));

    int we[n];
    ll v[n];

    for(int i=0;i<n;i++)
        cin>>we[i]>>v[i];

    for(int i=0; i<=w; i++)
        dp[0][i] =  we[0]>i?0:v[0];

    for(int i=1; i<n; i++)
    {
        for(int j=0; j<=w; j++)
        {
            if(we[i]>j)
                dp[i][j] = dp[i-1][j];

            else
                dp[i][j] = max(v[i]+dp[i-1][j-we[i]],dp[i-1][j]);
        }
    }

    // for(int i=0; i<n; i++)
    // {
    //     for(int j=0; j<=w; j++)
    //         cout<<dp[i][j]<<" ";

    //     cout<<"\n";
    // }
    cout<<dp[n-1][w]<<"\n";
    
    return 0; 
} 

Measured memory_bytes: 82304
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {

		 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		 try{

			 int x = Integer.parseInt(br.readLine());

			 System.out.println(x*x*x);

		 }catch(IOException e){
			 e.printStackTrace();
		 }
	}
}


Measured memory_bytes: 24424
#include <bits/stdc++.h>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); --i)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = 1LL * INF * INF;

const int MAX = 1000;

int D[MAX][MAX];

int f(int x, int y)
{
	if (D[x][y] != -1) return D[x][y];

	if (x <= 1 && y <= 1) return D[x][y] = 0;

	FOR (i, 2, x+1)
	{
		if (i & 1) continue;
		if (f(x - i, y + i/2) == 0) return D[x][y] = 1;
	}

	FOR (i, 2, y+1)
	{
		if (i & 1) continue;
		if (f(x + i / 2, y - i) == 0) return D[x][y] = 1;
	}

	return D[x][y] = 0;

}

int main()
{
	//freopen("in.txt", "r", stdin);
	//ios::sync_with_stdio(false); cin.tie(0);

	LL x, y;
	cin>>x>>y;
	if (abs(x-y) <= 1)
	{
		cout<<"Brown"<<endl;
	}
	else
	{
		cout<<"Alice"<<endl;
	}
return 0;

	FILL(D, -1);

	FOR (i, 0, 100)
	{
		FOR (j, 0, 100)
		{
			cout<<f(i, j)<<' ';
		}
		cout<<endl;
	}

}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int i, n;
    int min, max;
    long long sum = 0;
    
    scanf("%d",&n);
    
    int num[n];
    
    for(i=0;i<n;i++){
        scanf("%d", &num[i]);
    }
    
    min = num[0];
    max = num[0];
    sum += num[0];
    
    for(i=1;i<n;i++){
        if(min > num[i]){
            min = num[i];
        }
        if(max < num[i]){
            max = num[i];
        }
        
        sum += num[i];
    }
    printf("%d %d %lld\n", min, max, sum);
    return 0;
}



Measured memory_bytes: 2080
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();

    if (n%1000==0) {
      System.out.println(0);
    }else{
      System.out.println(1000-n%1000);
    }

  }
}


Measured memory_bytes: 35664
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 60;
constexpr double EPS = 1e-9;

struct custom_tf : numpunct<char> {
  string do_truename() const { return "Yes"; }
  string do_falsename() const { return "No"; }
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new custom_tf));
  }
} initializer;

template<typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &pa) {
  return os << "(" << pa.first << ", " << pa.second << ")";
}

template<typename T>
ostream &operator<<(ostream &os, const set<T> &se) {
  os << "{";
  for (auto it = se.begin(); it != se.end(); ++it) {
    if (it != se.begin()) os << ", ";
    os << *it;
  }
  return os << "}";
}

template<typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &ma) {
  os << "{";
  for (auto it = ma.begin(); it != ma.end(); ++it) {
    if (it != ma.begin()) os << ", ";
    os << it->first << ": " << it->second;
  }
  return os << "}";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }
#define dump(...) cout<<#__VA_ARGS__<<": [L_"<<__LINE__<<"]"<<'\n'; print(__VA_ARGS__);cout<<'\n';

template<class T, class U>inline bool chmax(T &a, const U &b) { if(a<b){ a=b; return 1; } return 0; }
template<class T, class U>inline bool chmin(T &a, const U &b) { if(b<a){ a=b; return 1; } return 0; }


int main() {
  int n, k; cin>>n>>k;
  vector<int> h(n); cin>>h;
  vector<int> dp(n, INF);
  dp[0] = 0;
  rep(i, n) {
    REP(j, 1, k+1) {
      if (i+j >= n) break;
      dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
    }
  }
  print(dp[n-1]);

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
using ll = long long;

const int M = 1000005;

int main(){
	int n;
  	cin >> n;
  	vector<int> a(n);
  	rep(i, n) cin >> a[i];
  	
  	vector<int> cnt(M);
  	for(int x: a){
    	if(cnt[x] != 0){
        	cnt[x] = 2;
          	continue;
        }
      	for(int i = x; i < M; i += x) cnt[i]++;
    }
  
  	int ans = 0;
  	for(int x : a){
    	if(cnt[x] == 1) ans++;
    }
  
  	cout << ans << endl;
}

Measured memory_bytes: 8016
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on

void main()
{
    long N = lread();
    auto D = lreads(N);
    D.sort().uniq().walkLength.writeln();

}


Measured memory_bytes: 3692
#include <bits/stdc++.h>

using namespace std;

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;

const int N = (int) 1e5 + 7;
int n;
ll a[N];
ll b[N];
ll suf[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = n; i >= 1; i--) {
    suf[i] = suf[i + 1] + a[i];
  }
  if (n == 0) {
    if (a[0] == 1) {
      cout << "1\n";
    } else {
      cout << "-1\n";
    }
    return 0;
  }
  if (a[0] != 0) {
    cout << "-1\n";
    return 0;
  }
  b[0] = 1;
  for (int i = 1; i <= n; i++) {
    ll lim = min(2 * b[i - 1] - a[i], suf[i + 1]);
    if (lim < b[i - 1] - a[i] || lim < 0) {
      cout << "-1\n";
      return 0;
    }
    b[i] = lim;
  }
  ll sol = 0;
  for (int i = 0; i <= n; i++) {
    sol += a[i] + b[i];
  }
  cout << sol << "\n";
  return 0;
}


Measured memory_bytes: 6024
#include <bits/stdc++.h>

using namespace std;
const int NMAX = 8;
const int MMAX = (NMAX * (NMAX - 1)) / 2;
bool graph[NMAX][NMAX];
int N, M;

int dfs(int v, bool visited[NMAX]) {
  bool isValid = true;
  for (int i = 0; i < N; ++i) {
    if (!visited[i]) isValid = false;
  }
  
  if (isValid) return 1;
  int ret = 0;
  for (int i = 1; i < N; ++i) {
    if (!graph[v][i]) continue;
    if (visited[i]) continue;
    visited[i] = true;
    ret += dfs(i, visited);
    visited[i] = false;
  }

  return ret;
}

int main() {
  cin >> N >> M;
  vector<int> a(M);
  vector<int> b(M);
  for (int i = 0; i < M; ++i) {
    cin >> a[i] >> b[i];
    a[i]--; b[i]--;
    graph[a[i]][b[i]] = true;
    graph[b[i]][a[i]] = true;
  }
  bool visited[NMAX];
  for (int i = 0; i < NMAX; ++i) visited[i] = false;
  visited[0] = true;
  cout << dfs(0, visited) << endl;
  return 0;
}



Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>

int main() {
	std::string s1, s2;
	std::cin >> s1 >> s2;
	std::vector<char> vc1, vc2;
	
	int i=0;
	while(s1[i]) {
		vc1.push_back(s1[i]);
		i++;
	}
	
	int j=0;
	while(s2[j]) {
		vc2.push_back(s2[j]);
		j++;
	}

	for(int i=0; i<s2.length(); i++) {
		if(vc1==vc2) {
			std::cout << "Yes" << std::endl;
			return 0;
		} else {
			vc1.push_back(vc1[0]);
			vc1.erase(vc1.begin());
		}
	}
	
	std::cout << "No" <<std::endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

class Main {

    static final int NONE = Integer.MIN_VALUE;
    
    public static void main( final String[] args ) {

	final Scanner stdin = new Scanner( System.in );

	while ( true ) {

	    final int W = stdin.nextInt();
	    final int Q = stdin.nextInt();

	    if ( W == 0 && Q == 0 ) {
		break;
	    }

	    final int[] ar = new int[ W ];
	    Arrays.fill( ar, NONE );
	    
	    for ( int i = 0; i < Q; i++ ) {
		final String word = stdin.next();
		final int id = stdin.nextInt();
		if ( "s".equals( word ) ) {
		    final int w = stdin.nextInt();
		    final int index = find( ar, id, w );
		    if ( index < 0 ) {
			System.out.println( "impossible" );
		    } else {
			System.out.println( index );
		    }
		} else {
		    remove( ar, id );
		}		
	    }
	    System.out.println( "END" );
	}	
    }

    static int find( final int[] array, final int id, final int w ) {
	int count = 0;
	for ( int i = 0; i < array.length; i++ ) {
	    if ( array[ i ] == NONE ) {
		count++;
		if ( count == w ) {
		    Arrays.fill( array, i - w + 1, i + 1, id );
		    return i - w + 1;
		}
	    } else {
		count = 0;
	    }
	}
	return -1;
    }

    static void remove( final int[] array, final int id ) {
	for ( int i = 0; i < array.length; i++ ) {
	    if ( array[ i ] == id ) {
		array[ i ] = NONE;
	    }
	}
    }    
}

Measured memory_bytes: 20632
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define all(a) a.begin(), a.end()

signed main() {
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int n;
	cin >> n;

	vector <int> a(n + 1);
	for(int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	vector <int> ans(n + 1, INT_MAX);

	ans[1] = 0;

	for(int i = 2; i <= n; i++) {
		if(i - 2 >= 1) {
			ans[i] = min(ans[i], ans[i - 2] + abs(a[i] - a[i - 2]));
		}

		ans[i] = min(ans[i], ans[i - 1] + abs(a[i] - a[i - 1]));
	}

	cout << ans[n] << endl;

	return 0;



	return 0;
}

Measured memory_bytes: 4784
n = int(input())
l = list(map(int,input().split()))
count = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i] == l[j] or l[j] == l[k] or l[k] == l[i]:
                continue
            if l[i]+l[j] > l[k] and l[i]+l[k] > l[j] and l[j]+l[k] > l[i]:
                count+=1
print(count)

Measured memory_bytes: 68096
S = input()
ans = "No"
if len(set(S)) == 2:
    if S[0] == S[1] and S[2] == S[3]:
        ans = "Yes"
    if S[0] == S[2] and S[1] == S[3]:
        ans = "Yes"
    if S[0] == S[3] and S[1] == S[2]:
        ans = "Yes"
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

//--------------------------------------------

int main(){
  string s;

  cin >> s;

  if ((s.substr(0, 3) == string(3, s[0])) || (s.substr(1, 3) == string(3, s[3])))
    printf("Yes\n");
  else
    printf("No\n");
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n, x;
    cin >> n >> x;
    vector<i64> a(n);
    for (auto& e : a) cin >> e;
    sort(all(a));
    partial_sum(all(a), begin(a));
    i64 ans = upper_bound(all(a), x) - begin(a);
    if (a[n - 1] < x) ans--;
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define P pair<int,int>
#define PP pair<P,int>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
signed main(){
    int n;
    cin>>n;
    vi vec(n);
    REP(i,n){
        cin>>vec[i];
    }
    int ans=0;
    REP(i,n){
        int r=i,sum=0;
        while(r<n&&vec[r]){
            sum+=vec[r];
            r++;
        }
        ans+=sum/2;
        i=r;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	let a = parseInt(input[0], 10);
	let b = parseInt(input[1], 10);
	let c = parseInt(input[2], 10);
	let d = parseInt(input[3], 10);
	let e = parseInt(input[4], 10);
    let f = '0';

  if (a==0) {
    f='1';
  } 
  if (b==0) {
    f='2';
  } 
  if (c==0) {
    f='3';
  } 
  if (d==0) {
    f='4';
  } 
  if (e==0) {
    f='5';
  } 
 
 	//出力
	console.log(f);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29624
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

// 素因数分解; 返り値は(素数, 乗数)のvector配列
vector<pair<ll, int>> factorize(ll n) {
	vector<pair<ll, int>> res;
	for (ll i = 2; i * i <= n; ++i) {
		if (n % i) continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1) res.emplace_back(n, 1);
	return res;
}

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };
constexpr auto MAX = 100000;

// ──────────────────────────────────────────────────────────────────

int dp[50];

int main() {
	int n;
	cin >> n;

	rep(i, n) dp[i] = -1;
	dp[0] = 1;
	dp[1] = 1;

	for (int i = 2; i <= n; ++i) {
		dp[i] = dp[i - 1] + dp[i - 2];
	}
	cout << dp[n] << endl;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  long double a, b;
  cin >> a >> b;
  cout << (ll)(a*b) << endl;
  return 0;
}

Measured memory_bytes: 3792
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll n,k;
    cin >> n >> k;
    vi a(n);
    rep(i,n) cin >> a.at(i);
    rep(i,min(k,(ll)50)){
        vi flg(n+1), next(n);
        vector<P> p(n);
        rep(l,n){
            flg.at(max((ll)0,l-a.at(l)))++;
            flg.at(min(n-1,l+a.at(l))+1)--;
        }
        next.at(0) = flg.at(0);
        rep(l,n-1) next.at(l+1) = flg.at(l+1) + next.at(l);
        a = next;
    }
    rep(i,n) cout << a.at(i) << " ";
    cout << endl;
}


Measured memory_bytes: 11124
#include"iostream"
#include"string"
using namespace std;

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < n; i++)
	{
		int num = 0;
		for (char c = 'a'; c <= 'z'; c++)
		{
			bool light = false, right = false;
			for (int j = 0; j < i; j++)
			{
				if (s[j] == c)	light = true;
			}
			for (int j = i; j < n; j++)
			{
				if (s[j] == c)	right = true;
			}
			if (light&&right)num++;
		}
		if (num > ans)ans = num;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
// GRL_1_C
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る

ll inf=pow(10,18);
vector<vector<ll>> dp(110,vector<ll>(110,inf));
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int v,e;
    cin>>v>>e;
    rep(i,v){
        dp[i][i]=0;
    }
    rep(i,e){
        ll s,t,d;
        cin>>s>>t>>d;
        dp[s][t]=d;
    }
    for(int k=0;k<v;k++){
        for(int i=0;i<v;i++){
            for(int j=0;j<v;j++){
                if(dp[i][k]<inf && dp[k][j]<inf) dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
            }
        }
    }
    bool flag=true;
    rep(i,v){
        if(dp[i][i]<0){
            flag=false;
            break;
        } 
    }
    if(flag){
        rep(i,v){
            rep(j,v-1){
                if(dp[i][j]==inf) cout<<"INF"<<" ";
                else cout<<dp[i][j]<<" ";
            }
            if(dp[i][v-1]==inf) cout<<"INF"<<endl;
            else cout<<dp[i][v-1]<<endl;
        }
    }else cout<<"NEGATIVE CYCLE"<<endl;
    return 0;
}


Measured memory_bytes: 3324
#include<bits/stdc++.h>
using namespace std;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pint;
typedef vector<long long> vlong;
#define _GLIBCXX_DEBUG
#define vpush(a,x) a.push_back(x);
#define rep(i, n) REP(i, 0, n)
#define all(v) v.begin(), v.end()
#define REP(i, x, n) for(int i = x; i < n; i++)
const int INF = 1 << 30;
const int dx[] = {1,0,-1,0,1,1,-1,-1};
const int dy[] = {0,-1,0,1,1,-1,-1,1};
#define stp(x)  setprecision(x)
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  char c='a';
  set<char> S;
  int si=s.size();
  rep(i,si){
    S.insert(s[i]);
  }
  rep(i,26){
    si=S.size();
    S.insert(c);
    int si2=S.size();
    if(si!=si2){
      cout<<c<<'\n';
      return(0);
    }
    c++;
  }
  cout<<"None"<<'\n';
  return(0);
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;

constexpr int M = 4010;
constexpr int mod = 1e9 + 7;
int C[M][M];

int main() {
  for (int i = 0; i < M - 1; ++i) {
    C[i][0] = C[i][i] = 1;
    for (int j = 1; j < i; ++j) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
  }
  int n, k;
  scanf("%d%d", &n, &k);
  int m = n - k;
  for (int i = 1; i <= k; ++i) {
    if (i > m + 1) {
      puts("0");
      continue;
    }
    uint64_t a = C[k - 1][i - 1];
    uint64_t b = C[m + 1][i];
    printf("%d\n", int(a * b % mod));
  }
  return 0;
}



Measured memory_bytes: 61568
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        new Program().Calc();
    }

    Scanner cin;

    public Program() { }

    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void Calc()
    {
        cin = new Scanner();

        int N = cin.nextInt();
        int D = cin.nextInt();

        int[,]X = new int[N,D];

        for (int i = 0; i < N; ++i)
        {
            for (int j = 0; j < D; ++j)
            {
                X[i, j] = cin.nextInt();
            }
        }

        int ans = 0;

        for (int i = 0; i < N - 1; ++i)
        {
            for (int j = i + 1; j < N; ++j)
            {
                float disSq = 0.0f;
                for (int k = 0; k < D; ++k)
                {
                    int tmp = X[i, k] - X[j, k];
                    disSq += tmp * tmp;
                }

                if (Math.Sqrt(disSq) % 1.0f == 0.0f)
                {
                    ++ans;
                }
            }
        }

        WriteLine(ans);
    }
}

public static class StringExtension
{
    public static char GetChar1(this string str, int indexOneBase)
    {
        return str[indexOneBase - 1];
    }
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;

  vector<int> v, w;
  rep(i,N){
    int a;
    cin >> a;
    v.push_back(a);
    w.push_back(a);
  }
  sort(ALLOF(w));
  reverse(ALLOF(w));
  
  rep(i,N){
    if(v[i] == w[0]){
      cout << w[1] << endl;
    }else{
      cout << w[0] << endl;
    }
  }
  
  
  return 0;
}

Measured memory_bytes: 3436
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    int N;cin>>N;
    vector<ll> A(N);
    ll S=0;
    REP(i, N) cin >> A[i],S+=A[i];
    vector<ll> L(N,0);
    L[0]=S;
    for(int i=1;i<=N-2;i+=2) L[0]-=2*A[i];
    REP(i,N-1) L[i+1]=2*A[i]-L[i];
    REP(i,N) cout<<L[i]<<" \n"[i==N-1];
}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

void angshuGod()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){    

    int n,p;
    cin>>n>>p;

    string s;
    cin>>s;

    int curr = 0, ans = 0;
    int arr[N];
    mem(arr,0);
    arr[0]++;
    int po = 1;
    if(p==2){
        fo(i,n){
            if((int)(s[i]-'0')%2==0) ans += i+1;
        }
    }
    else if(p==5){
        fo(i,n){
            if((int)(s[i]-'0')%5==0) ans += i+1;
        }   
    }
    else{
        for(int i = n-1;i>=0;i--){
            curr = curr + (s[i]-'0')*po;
            curr = curr%p;
            po = (po*10)%p;
            ans += arr[curr];
            arr[curr]++;
        }
    }
    cout<<ans;
}

 
int32_t main()
{
    angshuGod();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 4464
#include<bits/stdc++.h>
using namespace std;

int main(){
  string s; cin>>s;
  vector<char> vec1(s.size()),vec2(s.size());//全体の回文
  for(int i=0;i<s.size();i++){
    vec1[i]=s[i];
    vec2[i]=s[i];
  }
  reverse(vec1.begin(),vec1.end());
  bool a=true;
  for(int i=0;i<s.size();i++){
    if(vec1[i]!=vec2[i]){
      a=false;
      break;
    }
  }
  if(!a){
    cout<<"No"<<endl;
    return 0;
  }
  
  int half=(s.size()-1)/2;
  vector<char> vec3(half),vec4(half);//半分までの回文
  for(int i=0;i<half;i++){
    vec3[i]=vec2[i];
    vec4[i]=vec3[i];
  }
  reverse(vec3.begin(),vec3.end());
  for(int i=0;i<half;i++){
    if(vec3[i]!=vec4[i]){
      a=false;
      break;
    }
  }
  if(!a)
    cout<<"No"<<endl;
  else
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 3608
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>

using namespace std;
typedef pair<int,bool> Pair;

int main(){

  int H,W,N;
  int countW,countH;

  cin >> H >> W >> N;

  countH = 0;

  for(int i = 1; i <= W;++i){

      countH++;

    if(N <= H*i){
      break;
    }
  }

  countW = 0;

  for(int i = 1; i <= H;++i){

      countW++;

    if(N <= W*i){
      break;
    }

  }

  if(countW < countH)
    cout << countW << endl;
  else
    cout << countH << endl;

    return 0;

}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

  int N , T , c , t;
  int count = 0;
  int min_cost = 1000;
  scanf("%d %d", &N , &T);

  for(int i = 0 ; i < N ; i++){
    scanf("%d %d", &c , &t);

    if(t <= T){
      min_cost = (c < min_cost) ? c : min_cost;
    }else{
      count++;
    }

  }

  if(count == N){
    puts("TLE");
  }else{
    printf("%d", min_cost);
  }

  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define int long long
using namespace std;

signed main(){
    int N;cin>>N;
    vector<int> A(N),B(N);
    REP(i,N) cin>>A[i]>>B[i];
    int ans=0;
    for(int i=N-1;i>=0;--i){
        A[i]+=ans;
        int c=A[i]%B[i];
        if(c!=0) c=B[i]-c;
        ans+=c;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;

int main(){
  int A, B;
  cin >> A >> B;
  int max;
  if(A+B >= A-B && A+B >= A*B){
    max = A+B;
  }
  else if(A-B > A+B && A-B >= A*B){
    max = A-B;
  }
  else{
    max = A*B;
  }
  cout << max << endl;
}
   

Measured memory_bytes: 256
#include<iostream>
using namespace std;

int main(){
	int H, W;
		while(cin >> H >> W)
		if (H == 0 && W == 0) {
			return 0;
		} else {
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					cout << "#";
				}cout << endl;
			}cout << endl;
		}
		
	return 0;
}

Measured memory_bytes: 3100
n = int(input())
l = list(map(int, input().split())) # list()でリスト化、それを変数に代入。
count = 0
l.sort()

for i in range(n-2):
    for j in range(i+1,n-1):
        if l[i] == l[j]:
            continue
        for k in range(j+1,n):
            if l[j] == l[k] or l[i] == l[k]:
                continue
            if l[i] + l[j] > l[k]:
                count += 1

print(count)


Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<vector<int>> a(2,vector<int>(n));
	rep(i,2)rep(j,n) cin>>a[i][j];
	int ans=0;
	rep(i,n){
		int now=0;
		rep(j,i+1){
			now+=a[0][j];
		}
		FOR(j,i,n) now+=a[1][j];
		chmax(ans,now);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: Training Camp
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

typedef long long ll;
const ll MOD = 1000000007;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int n;
  cin >> n;

  ll pm = 1;
  for (int i = 2; i <= n; i++) pm = (pm * i) % MOD;

  printf("%lld\n", pm);
  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let d = read::<i32>();
  if (d == 22) {
    println!("Christmas Eve Eve Eve");
  }

  if (d == 23) {
    println!("Christmas Eve Eve");
  }


  if (d == 24) {
    println!("Christmas Eve");
  }

  if (d == 25) {
    println!("Christmas");
  }

}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
# define ll  long long  int
# define ld  long double
# define pb push_back
# define pp pop_back
# define ff first
# define ss second
# define mp make_pair
# define ac accumulate
# define mod 1000000007
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;     
  
    x = x % p;  
  
    while (y > 0) 
    { 
      
        if (y & 1) 
            res = (res*x) % p; 
  
      
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
} 
bool sortinrev(const pair<ll,ll> &a,  
               const pair<ll,ll> &b) 
{ 
       return (a.first > b.first); 
}
typedef pair<int,int> ii;
// bool cmp(ii a,ii b)
// {
// 	if(a.ff==b.ff)
// 	{
// 		return a.ss>b.ss;
// 	}
// 	else
// 		a.ff<b.ff;
// }
   ll dp[27][200004]={0};
   bool visit[100000]={0};
int  main()
{
//    #ifndef ONLINE_JUDGE
//    freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
//    #endif
   IOS;
 	ll a,b;
 	cin>>a>>b;
 	set<ll>ele;
 	ele.insert(a);
 	ele.insert(b);
 	for(ll i=1;i<=3;i++)
 	{
 		if(ele.find(i)==ele.end())
 		{
 			cout<<i;
 			return 0;
 		}
 	}
}


Measured memory_bytes: 256
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    a, b = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    print(int((a+b+2-1)/2))


resolve()

Measured memory_bytes: 38256