akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int N; cin>>N;
  vii A(N,vi(N));
  rep(i,0,N){
    rep(j,0,N)
      cin>>A[i][j];
  }
  vii B(N,vi(N));
  int ans=0;
  rep(i,0,N){
    queue<pii> Q;
    Q.push(mp(0,i));
    while(Q.size()>0){
      int X=Q.front().second,Y=Q.front().first;
      Q.pop();
      rep(j,0,N){
        if(j!=X){
        if(Y+A[X][j]==A[i][j]){
          B[i][j]++;
          if(B[i][j]==1)
          Q.push(mp(Y+A[X][j],j));
        }
        else if(Y+A[X][j]<A[i][j]){
          cout<<-1<<endl;
          return 0;
        }
        }
      }
    }
  }
  rep(i,0,N){
    rep(j,0,N){
      if(B[i][j]==1)
        ans+=A[i][j];
    }
  }
  cout<<ans/2<<endl;
  return 0;
  }


Measured memory_bytes: 1664
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// AtCoder_A
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int ans = 0;
		// 出力
		if(a == 1) {
			System.out.println(0);
		} else {
			System.out.println(1);
		}
	    // Scannerクラスのインスタンスをクローズ
		sc.close();
	}
}


Measured memory_bytes: 35616
#include<stdio.h>

int main(void){
    int c0 = 0,c1 = 0;
    char buf[100001];
    scanf("%s",buf);
    while(buf[c0+c1])if(buf[c0+c1] - '0')c1++;else c0++;
    printf("%d",(c0<c1?c0 * 2:c1 * 2));
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n,min,cnt=0;
	int num[3];

	cin>>n;
	for(int i=0;i<n;++i){
		cin>>num[i];
	}
	min=num[0];
	for(int i=1;i<n;++i){
		if(min>num[i])min=num[i];
	}
	cout<<1<<endl;
	for(int i=2;i<=min;++i){
		for(int j=0;j<n;++j){
			if(num[j]%i==0)cnt++;
			else break;
		}
		if(cnt==n)
			cout<<i<<endl;
		cnt=0;
	}
	return 0;
}


Measured memory_bytes: 3068
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            String S = sc.next();

            char[] cs = S.toCharArray();

            int count = 0;
            for (int i = 0; i < N - 2; i++) {
                if (cs[i] == 'A' && cs[i + 1] == 'B' && cs[i + 2] == 'C') {
                    count++;
                }
            }

            System.out.println(count);
        }
    }
}

Measured memory_bytes: 27040
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  string S; cin >> S;
  ll K; cin >> K;

  int result = 0;
  int i = 0;
  while (K>0) {
    if (S[i]=='1') { result = 1; K--; }
    else { result = S[i]-'0'; break; }
    i++;
  }
  cout << result << endl;
  return 0;
}

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

int main() {
  int64_t n;
  int64_t a[5];
  std::cin >> n;
  for (int i = 0; i < 5; i++) {
    std::cin >> a[i];
  }

  int64_t count = 5;
  int64_t min = *std::min_element(std::begin(a), std::end(a));
  std::cout << count + (n - 1) / min << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const double PI=3.14159265358979323846;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "

int main(void){
    int a;string s;cin>>a>>s;
    co(a>=3200?s:"red");
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using Graph = vector<vector<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;
}
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for(auto p : prime_factor(n)) {
         ll x = p.second;
         ll y = (ll)sqrt(2 * p.second);
         for(ll z:{y-1,y,y+1,y+2}){
             if(z*(z+1) <= 2*x && 2*x < (z+1) * (z+2)){
                 ans += z;
             }
         }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for (int i=1;i<=n;i++)
#define REP(i,a,b) for (int i=a;i<=b;i++)
 
#define pb push_back
 
typedef long long ll;
 
const int inf=0x3f3f3f3f;
const int N=500000+10;
const int MOD=338;

ll n,m;
ll ans;
int main() {
    ios::sync_with_stdio(false);
	cin>>n>>m;
    cout<<(1<<m)*(100*(n-m)+1900*m);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define arep(i, x, n) for (int i = int(x); i < (int)(n); i++)
#define rep(i, n) for (long long i = 0; i < n; ++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9 + 7
using ll = long long;

int main(){
    char s;
    cin >> s;

    if (isupper(s))
   {
       cout << "A" << endl;
   }
   else
   {
       cout << "a" << endl;
   }

   return 0;

}

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

using namespace std;
using ll =long long;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> PII;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
using P = pair<int,int>;
//Write From this Line

vector<P> to[100010];
ll cost[100010];

int n;
void dfs(int from,int p,ll dist) {
	cost[p]=dist;
	for(auto x: to[p]){
		if(x.first == from) continue;
		dfs(p, x.first, dist + x.second);
	}
	return ;
}
int main()
{
	cin >> n;
	rep(i,n-1){
		int a, b, c;
		cin >> a >> b >> c;
		a--, b--;
		to[a].push_back({b,c});
		to[b].push_back({a,c});
	}
	int q, k;
	cin >> q >> k;
	--k;
	dfs(-1,k,0);
	vector<ll> ans(q);
	rep(i,q){
		int x, y;
		cin >> x >> y;
		--x, --y;
		ans[i] = cost[x] + cost[y];
	}
	rep(i,q) cout << ans[i] << endl;
}


Measured memory_bytes: 13568
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int hp = sc.nextInt();
    int at = sc.nextInt();

    int i = 0;
    while (hp > 0) {
      hp = hp - at;
      i++;
    }

    System.out.println(i);
  }
}


Measured memory_bytes: 23892
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <string.h>
#include <string>
#include <cmath>
#include <cstdio>
#include <functional>
#include <map>
#include <typeinfo>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<double, double> pd;


int main()
{
  ll n;
  scanf("%lld", &n);
  
  ll a, b;
  scanf("%lld %lld", &a, &b);
  
  if(abs(a-b)%2 == 0)
    printf("%lld\n", abs(a-b)/2);
  else
  {
    if(n-b > a-1)
      printf("%lld\n", a+(b-a-1)/2);
    else
      printf("%lld\n", (n-b)+1+(n-(a+(n-b+1)))/2);
  }
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<map>
#include<deque>
#include<string>
#include<algorithm>

#define all(x) (x).begin(),(x).end()
#define puts(x) cout<< x << endl;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define fore(i,a) for(auto i:a)
#define ll long long
using namespace std;
ll x;
int main(){
    cin>>x;
    int checker=1;
    while(checker==1){
        checker=0;
        rep(i,2,x/2){
            if(x%i==0){
                checker=1;
            }
        }
        if(checker==1){
            x++;    
        }else{
            puts(x);
        }
    }
}

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

int main() {
    int r, d, x;
    cin >> r >> d >> x;
    rep(i,10) {
        x = r * x - d;
        cout << x << endl;
    }
}

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

const int MOD=(int)1e9+7;

int main(){
  string S;
  cin >> S;

  long long h=1;
  vector<long long> abc(3,0);
  for(int i=0;i<S.size();i++){
    if(S.at(i)=='A'){
      abc.at(0)+=h;
      abc.at(0)%=MOD;
    }
    else if(S.at(i)=='B'){
      abc.at(1)+=abc.at(0);
      abc.at(1)%=MOD;
    }
    else if(S.at(i)=='C'){
      abc.at(2)+=abc.at(1);
      abc.at(2)%=MOD;
    }
    else if(S.at(i)=='?'){
      long long a=abc.at(0)*3+h;
      long long b=abc.at(1)*3;
      long long c=abc.at(2)*3;
      abc.at(2)=c+abc.at(1);
      abc.at(1)=b+abc.at(0);
      abc.at(0)=a;
      abc.at(0)%=MOD;
      abc.at(1)%=MOD;
      abc.at(2)%=MOD;
      h*=3;
      h%=MOD;
    }
    //for(int j=0;j<3;j++)  cout << abc.at(j) << ",";cout << endl;
  }
  cout << abc.at(2) << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>

using namespace std;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
long gcd(long a, long b) { return b ? gcd(b, a % b) : a; } // 最大公約数
long lcm(long a, long b) { return a * b / gcd(a, b); };    // 最小公倍数
long digitSum(int n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; }
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

void Main()
{
    // int n;
    // cin >> n;
    // vector<int> a(n);
    // rep(i, n)
    // {
    //     cin >> a[i];
    // }

    string str;
    cin >> str;
    int ans = 0;
    vector<string> list = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    rep(i, 7)
    {
        if (str == list[i])
        {
            ans = 7 - i;
        }
    }

    cout << ans << endl;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

vec d[100001];
ll K[100001];
int N,u,v; 
ll Max=0;
ll Par[100001];

void dfs(ll x){
    ll P=d[x].size();
    rep(i,P){
        ll y=d[x].at(i);
        if(K[y]==-1) {
            K[y]=K[x]+1;
            Par[y]=x;
            dfs(y);
        }
    }
    return;
}

void Sons(ll x){
    ll P=d[x].size();
    rep(i,P){
        ll y=d[x].at(i);
        if(K[y]==K[x]+1) {
            Max=max(Max,K[y]);
            Sons(y);
        }
    }
    return;
}

int main(){
    cin>>N>>u>>v;
    rep(i,100001) K[i]=-1;
    K[v]=0;
    rep(i,N-1){
        ll A,B; cin>>A>>B;
        d[A].push_back(B);
        d[B].push_back(A);
    }
    
    dfs(v);
    ll A=K[u];
    
    A=(A-1)/2;
    ll t=u;
    
    rep(i,A) t=Par[t];
    //cout<<t<<endl;
    Max=K[u];
    Sons(t);
    
    cout<<Max-1<<endl;




    
}

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

string a[53], b[54];
int n, m; 

bool check(int x, int y) {
	for (int i = x; i < x+m; ++i)
		for (int j = y; j < y+m; ++j)
			if (a[i][j] != b[i-x][j-y])
				return false;
	return true;
}

void solve() {
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i < m; ++i) {
		cin >> b[i];
	}
	for (int i = 0; i <= n-m; ++i) {
		for (int j = 0; j <= n-m; ++j) {
			if (check(i, j)) {
				cout << "Yes";
				return;
			}
		}
	}
	cout << "No";
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

    int N = 7;

    map<int, int> hist;
    int i = 1;
    while (1) {
        N %= K;
        if (hist[N] != 0) {
            cout << -1 << endl;
            return 0;
        }
        if (N == 0) {
            cout << i << endl;
            return 0;
        }
        hist[N]++;
        N = N * 10 + 7;
        i++;
    }

    return 0;
}


Measured memory_bytes: 50480
#include<stdio.h>
#define NM 10000
int main(void){
    int m,f,r,i=0,j=0,M[10000],F[10000],R[10000];
    while(i++>=0){
        scanf("%d %d %d",&m,&f,&r);
        j++;
        if(m==-1&&f==-1&&r==-1)break;
        M[i]=m;
        F[i]=f;
        R[i]=r;
    }
    for(i=1;i<j;i++){
        if(M[i]==-1||F[i]==-1)printf("F");
        else if(M[i]+F[i]>=80)printf("A");
        else if(M[i]+F[i]>=65&&M[i]+F[i]<80)printf("B");
        else if(M[i]+F[i]>=50&&M[i]+F[i]<65)printf("C");
        else if(M[i]+F[i]>=30&&M[i]+F[i]<50){
            if(R[i]>=50)printf("C");
            else printf("D");
        }
        else if(M[i]+F[i]<30)printf("F");
        printf("\n");
    }






    return 0;
}

Measured memory_bytes: 1664
import math
K = int(input())
ans = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            if (i == j == k):
                ans += i
            if(i == j and j!= k ):
                    ans += 3*math.gcd(k,math.gcd(i,j))
            if(i<j<k and i != j != k):
                    ans += 6*math.gcd(k,math.gcd(i,j))

print(ans)

Measured memory_bytes: 9208
a,b,c = map(int, input().split())

abc = [a,b,c]
abcs = sorted(abc)

ac =abcs[2]-abcs[0]
bc =abcs[2]-abcs[1]

res = 0

res += ac//2
res += bc//2

dx = ac % 2
dy = bc % 2

if dx + dy ==0:
    print(res)
elif dx + dy ==2:
    print(res+1)
else:
    print(res+2)

Measured memory_bytes: 9188
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String[] tokens = in.nextLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int M = Integer.parseInt(tokens[1]);
		int[] foods = new int[M];
		Arrays.fill(foods, 0);
		for (int i = 0; i < N; ++i) {
			Set<Integer> likeFoods = new HashSet<>();
			tokens = in.nextLine().split(" ");
			int K = Integer.parseInt(tokens[0]);
			for (int j = 1; j <= K; ++j) {
				int food = Integer.parseInt(tokens[j]);
				foods[food - 1]++;
			}
		}
		in.close();
		int result = 0;
		for (int i = 0; i < foods.length; ++i) {
			if (foods[i] == N) {
				++result;
			}
		}
		System.out.println(result);

	}

}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());

typedef long long ll;

int main(){
  
  int n,k;
  cin >> n >> k;
  
  int cnt = 0;
  
  while(1){
    if(pow(k,cnt) > n) break;
    cnt ++;
  }
  
  cout << cnt << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int X;
    cin >> X;
    for(int i = 1; i <= X / 100; i++){
        if(0 <= (X - i * 100) && (X - i * 100) <= i * 5){
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 0 << endl;
}



Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N;
string S;

int main() {
    cin >> N >> S;
    int ans = 0;
    string i = "0123456789";

    for (char a : i) {
        for (char b : i) {
            for (char c : i) {
                int state = 0;
                for (char t : S) {
                    if ((state == 0 && t == a) || (state == 1 && t == b) || (state == 2 && t == c))
                        state++;
                }
                if (state == 3) {
                    ans++;
                }
            }
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod  = 1e9 + 7;
const ll N = 1e6 + 5;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({a*c,a*d,b*c,b*d})<<'\n';
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<math.h>

using namespace std;

int main(){
	int n;
	string ret1,ret2;
	vector<int> result;
	int num = 0, ret = 0;
	int j;

	cin >> n;

	for (int i = 0;i < n;i++){

		ret = 0;

		cin >> ret1 >> ret2;


		if (ret1.size() > 80 || ret2.size() > 80){
			cout << "overflow" << endl;
			continue;
		}

		for (j = 1;j <= ret1.size() && j <= ret2.size();j++){
			num = (ret1.at(ret1.size() - j) - '0' + ret2.at(ret2.size() - j) - '0' + ret) % 10;
			ret = (ret1.at(ret1.size() - j) - '0' + ret2.at(ret2.size() - j) - '0' + ret);
			ret = (ret - num)/10;
			//cout << "ret:" << ret << endl;
			result.push_back(num);
		}

		if (ret1.size() == ret2.size()){
			if (ret != 0)
				result.push_back(ret);
		}
		else if(ret1.size() > ret2.size()){
			for (; j <= ret1.size(); j++){
				num = (ret1.at(ret1.size() - j) - '0' + ret) % 10;
				ret = ret1.at(ret1.size() - j) - '0' + ret;
				ret = (ret - num) / 10;
				//cout << "ret:" << ret << endl;
				result.push_back(num);
			}
			if (ret != 0)
				result.push_back(ret);
		}
		else if (ret1.size() < ret2.size()){
			for (; j <= ret2.size(); j++){
				num = (ret2.at(ret2.size() - j) - '0' + ret) % 10;
				ret = ret2.at(ret2.size() - j) - '0' + ret;
				ret = (ret - num) / 10;
				//cout << "ret:" << ret << endl;
				result.push_back(num);
			}
			if (ret != 0)
				result.push_back(ret);
		}

		if (result.size() > 80){
			cout << "overflow" << endl;
			while (result.empty() != true){
				result.pop_back();
			}
			continue;
		}


		while (result.empty() != true){
			cout << result[result.size()-1];
			result.pop_back();
		}
		cout << endl;

	}


	return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
int64_t dp[5][200010];
static const int64_t INF=1000000000000000;
int64_t L;
int64_t A[200010];
int main(){
  cin>>L;
  for(int i=0;i<L;i++)
    cin>>A[i];
  dp[0][0]=A[0];dp[4][0]=INF;
  dp[1][0]=max(A[0]%2,2-A[0]);dp[3][0]=INF;
  dp[2][0]=(A[0]+1)%2;
  for(int j=1;j<L;j++){
dp[0][j]=dp[0][j-1]+A[j];
    dp[1][j]=min(dp[0][j-1],dp[1][j-1])+max(A[j]%2,2-A[j]);
    dp[2][j]=min(dp[2][j-1],min(dp[0][j-1],dp[1][j-1]))+(A[j]+1)%2;
    dp[3][j]=min(dp[2][j-1],dp[3][j-1])+max(A[j]%2,2-A[j]);
    dp[4][j]=min(dp[1][j-1],min(dp[4][j-1],min(dp[2][j-1],dp[3][j-1])))+A[j];
  }int64_t ans=INF;
  for(int i=0;i<5;i++)
    if(dp[i][L-1]<ans)
      ans=dp[i][L-1];
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 12996
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int main(){    
    int n,k ;
    cin >> n >> k ;
    int ans = 1 ;
    while(1){
        n /= k ;
        if (n > 0)
        {
            ans ++ ;
        }else
        {
            break ;
        }
        
        
    }
    cout << ans << endl ;
}

Measured memory_bytes: 256
f :: Int -> [Int] -> [Int]
f n xs | n < 10 = n : xs
       | n >= 10 = (n `mod` 10) : f (n `div` 10) xs

ans :: [Int] -> String
ans xs | reverse xs == xs = "Yes"
       | otherwise = "No"

main :: IO()
main = do
    num <- getLine
    putStrLn $ ans $ f (read num) []

Measured memory_bytes: 508
#include<stdio.h>
int main(void){
  int N,M;
  scanf("%d",&N);
  M=N%10;
  if(M==7){
   printf("Yes");
   return 0;}
  M=N%100;
  M=M/10;
  if(M==7){
    printf("Yes");
    return 0;}
  M=N/100;
  if(M==7){
    printf("Yes");
    return 0;}
  printf("No");
  return 0;
}

Measured memory_bytes: 1732
//i ll be the king
#include<bits/stdc++.h>
#define ll long long int
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define rep(n) for(ll i2=0;i2<n;i2++)
#define vmp(v,a,b) v.push_back(make_pair(a,b))
#define si(a) scanf("%lld",&a)
#define pi(a) printf("%lld",a)
#define aset(a,n,k) for(ll i3=0;i3<n;i3++)a[i3]=k; 	
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define f first
#define s second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,greater_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val) *s.find_by_orde(ind)
using namespace std;
ll cnt[1000000],prnt[1000000];
ll root(ll n)
{
	if(prnt[n]==n)
	return n;
	return prnt[n]=root(prnt[n]);
}
void unify(ll x,ll y)
{
	ll px=root(x);
	ll py=root(y);
	if(px==py)
	return ;
	else if(cnt[px]>cnt[py])
	{
		cnt[px]+=cnt[py];
		prnt[py]=px;
	}
	else
	{
		cnt[py]+=cnt[px];
		prnt[px]=py;
	}
}
int main()
{
	sync;
	ll n,m;
	cin>>n>>m;
	for(ll i=0;i<1e6;i++)
	prnt[i]=i,cnt[i]=1;
	for(ll i=1;i<=m;i++)
	{
		ll x,y,z;
		cin>>x>>y>>z;
		unify(x,y);
	}
	set<ll>s;
	for(ll i=1;i<=n;i++)
	s.insert(root(i));
	cout<<s.size();
}
	

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

int main() {
  int A , B ;
  cin >> A >> B ;
  int ans=0;
  for(int i=A; i<=B; i++){
    string str = to_string(i);
    if(str[0] == str[4] && str[1] == str[3]) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <time.h>
#include <queue>
#include <list>
#include <string.h>
#define sf scanf
#define pf printf
#define lf double
#define ll long long
#define p123 printf("123\n");
#define pn printf("\n");
#define pk printf(" ");
#define p(n) printf("%d",n);
#define pln(n) printf("%d\n",n);
#define s(n) scanf("%d",&n);
#define ss(n) scanf("%s",n);
#define ps(n) printf("%s",n);
#define sld(n) scanf("%lld",&n);
#define pld(n) printf("%lld",n);
#define slf(n) scanf("%lf",&n);
#define plf(n) printf("%lf",n);
#define sc(n) scanf("%c",&n);
#define pc(n) printf("%c",n);
#define gc getchar();
#define re(n,a) memset(n,a,sizeof(n));
#define len(a) strlen(a)
#define LL long long
#define eps 1e-6
using namespace std;
const double pi = 3.1415926535;
/*
https://codeforces.com/contest/1106/problems
https://codeforces.com/contest/1106/submit
*/
int a[1000][100];
int main(){
	int a[5];
	s(a[0]) s(a[1]) s(a[2])
	sort(a,a+3);
	int sum = a[0] + a[2] + a[1];
	if(a[0]+a[1] == a[2]){
		puts("Yes");
	}else{
		puts("No");
	}
	

    return 0;

}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  
  long long int ac,ad,bc,bd;
  ac = (long long int) a*c;
  ad = (long long int) a*d;
  bc = (long long int) b*c;
  bd = (long long int) b*d;
  
  long long int ans = -(1000000000000000000);
  if(ans<ac){ans=ac;}
  if(ans<ad){ans=ad;}
  if(ans<bc){ans=bc;}
  if(ans<bd){ans=bd;}
  
  printf("%lld\n",ans);
}

Measured memory_bytes: 1732
//#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<n;++i)
#define mod (ll)(1e9+7)
#define FIX(a) ((a)%mod+mod)%mod
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define fi first
#define se second
#define pb push_back
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,h;
    cin >> a >> b >> h;
    cout << (a+b)*h/2 << endl;

    return 0;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,k = inpl()
a = inpl()
a.sort(reverse=True)
print(sum(a[:k]))

Measured memory_bytes: 38384
paper = [[0 for i in range(10)] for j in range(10)]

def drop_ink(x, y, s):
    for i in range(-1, 2):
        for j in range(-1, 2):
            if s == 1 and i * j != 0:
                continue
            if 0 <= x + i < 10 and 0 <= y + j < 10:
                paper[x+i][y+j] += 1
    if s == 3:
        if x - 2 >= 0:
            paper[x-2][y] += 1
        if x + 2 < 10:
            paper[x+2][y] += 1
        if y - 2 >= 0:
            paper[x][y-2] += 1
        if y + 2 < 10:
            paper[x][y+2] += 1

while True:
    try:
        x, y, s = map(int, input().split(','))
        drop_ink(x, y, s)
    except:
        break

count = 0
max_density = 0
for i in range(10):
    for j in range(10):
        if paper[i][j] == 0:
            count += 1
        elif paper[i][j] > max_density:
            max_density = paper[i][j]
print(count)
print(max_density)

Measured memory_bytes: 5608
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<climits>
#include<cstring>
using namespace std;
int a,b;
int main()
{
	scanf("%d%d",&a,&b);
	if((a*b)%2==0)printf("Even\n");
	else printf("Odd\n");
}

Measured memory_bytes: 384
from functools import reduce
from operator import and_, or_

N = int(input())
S, T, U, V = [[int(a) for a in input().split()] for _ in range(4)]
X = [[U[i] & V[j] if S[i] and T[j] else U[i] if T[j] else V[j] if S[i] else U[i] | V[j] for j in range(N)] for i in range(N)]

for _ in range(2):
    A1 = [-1] * N
    A2 = [[-1] * N for _ in range(N)]
    for i in range(N-1)[::-1]:
        for j in range(N):
            A2[i][j] = A2[i+1][j] & X[i+1][j]
    for i in range(N):
        a = ~U[i] | reduce(or_, X[i])
        for j in range(N):
            if S[i] and not T[j]:
                X[i][j] |= ~(A1[j] & A2[i][j] | a)
                a |= X[i][j]
            A1[j] &= X[i][j]
    
    if [reduce(or_ if S[i] else and_, x) for i, x in enumerate(X)] != U:
        print(-1)
        exit()
    
    X = [[X[j][i] for j in range(N)] for i in range(N)]
    S, T, U, V = T, S, V, U

for x in X:
    print(*x)

Measured memory_bytes: 143108
#include <iostream>

using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
  ll x;
  std::cin >> x;

  ll sum = 100;
  ll cnt = 0;
  while (sum < x) {
    sum += sum / 100;
    cnt++;
  }

  std::cout << cnt << '\n';
  return 0;
}


Measured memory_bytes: 3632
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int n = sc1.nextInt();
		int[] a = new int[n];
		long total = 0;

		for ( int i = 0 ; i < n ; i++) {
			a[i] = sc1.nextInt();
			total += a[i];
		}

		Arrays.sort(a);

		System.out.println(a[0] + " " + a[n-1] + " " + total);

		sc1.close();

	}

}


Measured memory_bytes: 41760
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;
int main(int argc, char *argv[])
{
  vector<int> x;
  int input;
  for(int i = 0; i < 3; i++) {
    cin >> input;
    x.push_back(input);
  }
  sort(x.begin(), x.end());

  cout << x[0] << " " << x[1] << " " << x[2] << endl;
  return 0;
}



Measured memory_bytes: 3152
#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, char *argv[])
{
	int K, X;

	cin >> K >> X;

	for (int i = X - (K - 1); i <= X + (K - 1); i++) {
		if (-1000000 <= i && i <= 1000000) {
			printf("%d ", i);
		}
	}
	puts("");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
main()
{
    int l[10],v1,v2;
    while(1){
        for(int i=0;i<10;i++)if(!~scanf("%d,",l+i))break;
        if(!~scanf("%d,%d",&v1,&v2))break;
        int s=0;
        for(int i=0;i<10;i++)s+=l[i];
        double p=v1*1.0/(v1+v2);
        double u=s*p,t=0;
        for(int i=0;i<10;i++)
        {
            t+=l[i];
            if(u<=t)
            {
                cout<<i+1<<endl;
                break;
            }
        }
    }
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    set<int> s;
    int cnt_over_3200 = 0;
    rep(i, n)
    {
        cin >> a.at(i);
        if (a.at(i) >= 3200)
        {
            cnt_over_3200++;
        }
        else
        {
            s.insert(a.at(i) / 400);
        }
    }

    int ans_min = max(1, int(s.size()));
    int ans_max = int(s.size()) + cnt_over_3200;

    if ((ans_min == 0) & (cnt_over_3200 >= 1))
    {
        ans_min = 1;
        ans_max = min(8, cnt_over_3200);
    }

    cout << ans_min << " " << ans_max << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

 
int main(int argc, char* argv[])
{
    long a,b,c;
    scanf("%ld %ld %ld", &a, &b, &c);

    printf("%ld\n", a*b/2);
 
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  cout<<fixed;
  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  ll acc=a[0];
  repeat(i,1,n)
    acc=acc^a[i];
  if(acc==0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 1024
//longest path in a directed graph
#include<bits/stdc++.h>
using namespace std;
int dp[100001];  //dp[i]= len of longest path starting at node i;

vector<int>Graph[100001];
int solve(int src)
{
    if(dp[src]!=-1)
    return dp[src];
    
    int bestchild=0;
     bool leaf=1;
     for(int child:Graph[src])  //O(M)
     {
         leaf=0;
         bestchild=max(bestchild,solve(child));
     }
     return dp[src]=leaf?0:1+bestchild;



}





int main()
{
    int n,m;
    cin>>n>>m;
    memset(dp,-1,sizeof dp);
  
    for(int i=0;i<m;i++)
    {
        int u,v;
        cin>>u>>v;
        Graph[u].push_back(v);
    }
    int ans=0;
    for(int i=1;i<=n;i++)   //O(N)
    ans=max(ans,solve(i));
    cout<<ans;
    return 0;

}


Measured memory_bytes: 8192
#include<iostream>
#include<cstdio>
#define ll long long
#define N 12345
int n,t,cot,c,tc;
int maxn=-N,minn=N;
int main()
{
	scanf("%d%d",&n,&t);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&c);
		if(i)
		{
			if(c > tc)
            {
				if(c-minn>maxn) maxn=c-minn,cot = 1;
				else if(c-minn==maxn) cot++;
            }
			if(minn > c) minn = c;
        }
		else minn = c;
		tc = c;
    }
    printf("%d\n",cot);
	return 0;
}

Measured memory_bytes: 256
<?php

$length = preg_replace('/(\\r|\\n|\\r\\n)/', '',fgets(STDIN));
$inputList = explode(' ', preg_replace('/(\\r|\\n|\\r\\n)/', '',fgets(STDIN)));

$minNumber = $inputList[0];
$passCount = 0;
for($i = 0; $i < $length; $i++){
    if($inputList[$i] <= $minNumber){
        $passCount ++;
        $minNumber = $inputList[$i];
    }
}

echo $passCount.PHP_EOL;

Measured memory_bytes: 40452
/// Code By t_bone_289 (Tushar Singh)
/// An Immature Programmer.... I'm still developing !!
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef double d;
typedef long double ld;
template <typename T>
void ContainerError(T &v){cout<<"{";for(auto &x:v){cout<<x<<',';}cout<<"}"<<endl;return;}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll mpow(ll base,ll exp){ll res=1;while(exp>0){if(exp%2==1) res=(res*base);base=(base*base);exp/=2;}return (res);}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}

//ll sol(ll i,ll n,vector<vector<ll> > &v,vector<vector<ll> > &vis)
//{
//    if(i==n)
//    {
//        return 1;
//    }
//    ll ans=0;
//    for(ll j=0;j<n;j++)
//    {
//        if(v[i][j])
//        {
//            bool f=0;
//            for(ll k=0;k<i;k++)
//            {
//                if(vis[k][j])
//                {
//                    f=1;
//                    break;
//                }
//            }
//            if(!f)
//            {
//                vis[i][j]=1;
//                ans+=sol(i+1,n,v,vis);
//                vis[i][j]=0;
//            }
//        }
//    }
//    return ans;
//}

ll sol(ll i,ll bitval,ll n,vector<vector<ll> > &v,vector<vector<ll> > &dp)
{
    if(i==n)
    {
        return 1;
    }
    if(dp[i][bitval]!=-1)
    {
        return dp[i][bitval];
    }
    ll ans = 0;
    for(ll j=0;j<n;j++)
    {
        if(v[i][j])
        {
            ll x = (1<<j)&(bitval);
            if(!x)
            {
                ll nbit = (1<<j)|(bitval);
                ans = (ans+sol(i+1,nbit,n,v,dp))%M;
            }
        }
    }
    return dp[i][bitval] = ans;
}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin>>n;
    vector<vector<ll> > v(n,vector<ll>(n,0));
    for(auto &x:v)
    {
        for(auto &y:x)
        {
            cin>>y;
        }
    }
    ll bitval = 1<<(n);
    bitval--;
    vector<vector<ll> > dp(n,vector<ll>(bitval,-1));
    ll ans = sol(0,0,n,v,dp);
    cout<<ans;
    return 0;
}




Measured memory_bytes: 360832
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N, K = map(int, input().split())
    A = tuple(map(int, input().split()))

    for i in range(K, N):
        if A[i - K] < A[i]:
            print("Yes")
        else:
            print("No")


main()


Measured memory_bytes: 31576
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int r,c;
    cin>>r>>c;
    int n;
    cin>>n;
    vp dat;
    REP(i,n){
        vp v(2);
        bool f=true;
        REP(j,2){
            cin>>v[j].fi>>v[j].se;
            if(!(v[j].fi==0||v[j].fi==r||v[j].se==0||v[j].se==c)){
                f=false;
            }
        }
        if(!f){
            continue;
        }
        REP(j,2){
            if(v[j].se==0){
                dat.pb({v[j].fi,i});
            }else if(v[j].fi==r){
                dat.pb({r+v[j].se,i});
            }else if(v[j].se==c){
                dat.pb({r+c+(r-v[j].fi),i});
            }else{
                dat.pb({r+c+r+(c-v[j].se),i});
            }
        }
    }
    sort(all(dat));
    stack<int> st;
    REP(i,dat.size()){
        if(st.size()&&st.top()==dat[i].se){
            st.pop();
        }else{
            st.push(dat[i].se);
        }
    }
    if(st.size()){
        cout<<"NO"<<endl;
    }else{
        cout<<"YES"<<endl;
    }
    return 0;
}

Measured memory_bytes: 6384
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6,inf=1e9;
int main()
{
  ios_base::sync_with_stdio(0);cin.tie(0);
  string a;cin>>a;
  for(int i=1;i<=a.size();i++)
    cout<<'x';
  cout<<endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		//入力
		long N = sc.nextLong();

		long min = Long.MAX_VALUE;
		for(int i=0; i<5; i++) {
			min = Math.min(min, sc.nextLong());
		}

		System.out.println((N%min==0) ? N/min + 4 : N/min + 5);

		sc.close();
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
int check(string str)
{

    int n = str.length();
    int digitSum = 0;
    for (int i = 0; i < n; i++)
        digitSum += (str[i] - '0');

    return (digitSum % 9 == 0);
}
int main()
{
    string n;
    int sum = 0;
    cin >> n;
    if (n == "0")
    {
        cout << "Yes";
        return 0;
    }

    check(n) ? cout << "Yes" : cout << "No";
    return 0;
}

Measured memory_bytes: 3912
#include<bits/stdc++.h>
using namespace std;
#define stop exit(0)
int main(){
    vector <long long> v;
    long long a,b,c=0,d=0,e=0,f=0,g=0,i,j,k=1,l=0,r=1,n,m,z,h,p[10001];
    string s,t,x,y;
    double q,u,w;
    cin>>a;
    b=a%10;
    if(b==2||b==4||b==5||b==7||b==9){
        cout<<"hon";
        stop;
    }
    if(b==3){
        cout<<"bon";
        stop;
    }
    cout<<"pon";
}


Measured memory_bytes: 3628
#include<stdio.h>
#include<iostream>

#define MAX_N 105

using namespace std;

int arr[MAX_N];

int main(){
    int N;
    scanf("%d", &N);
    for(int i=0; i<N; i++)
        scanf("%d", arr+i);
    for(int j=0; j<N; j++){
        int i, temp;
        for(i=j-1; i>=0; i--){
            if(arr[j]>=arr[i])
                break;
        }
        temp = arr[j];
        for(int cur=j; cur>i+1; cur--)
            arr[cur] = arr[cur-1];
        arr[i+1] = temp;
        //print
        printf("%d", arr[0]);
        for(int cur=1; cur<N; cur++)
            printf(" %d", arr[cur]);
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 3208
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N;
    cin >> N;

    int table[N][3];
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> table[i][j];
        }
    }

    int dp[N][3];
    fill(dp[0], dp[N], -1);
    for (int j = 0; j <= 2; j++) {
        dp[0][j] = table[0][j];
    }

    for (int i = 0; i < N - 1; i++) {
        for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
                if (j == k) continue;
                dp[i+1][j] = max(dp[i+1][j], dp[i][k] + table[i+1][j]);
            }
        }
    }

    int ret = -1;
    for (int j = 0; j < 3; j++) {
        ret = max(ret, dp[N-1][j]);
    }

    cout << ret << endl;

    return 0;
}

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

#define N 200005

char s[N], t[N];

int n, h, w;
int sx, sy;

int main() {
	scanf("%d %d %d", &h, &w, &n);
	scanf("%d %d", &sx, &sy);
    scanf("%s %s", s, t);
    int ty = sy; bool flag = 0;
    for (int i = 0; i < n && !flag; i ++) {
        if (s[i] == 'R') ty ++;
        if (ty > w) flag = 1;
        if (t[i] == 'L' && ty > 1) ty --;
    }
    ty = sy;
    for (int i = 0; i < n && !flag; i ++) {
        if (s[i] == 'L') ty --;
        if (ty < 1) flag = 1;
        if (t[i] == 'R' && ty < w) ty ++;
    }
    int tx = sx;
    for (int i = 0; i < n && !flag; i ++) {
        if (s[i] == 'U') tx --;
        if (tx < 1) flag = 1;
        if (t[i] == 'D' && tx < h) tx ++;
    }
    tx = sx;
    for (int i = 0; i < n && !flag; i ++) {
        if (s[i] == 'D') tx ++;
        if (tx > h) flag = 1;
        if (t[i] == 'U' && tx > 1) tx --;
    }
    puts(flag ? "NO" : "YES");
	return 0;
}


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

using i64 = int64_t;

i64 popcount(i64 n){
    i64 res = 0;
    while(n > 0){
        res += (n&1);
        n >>= 1;
    }
    return res;
}

vector<i64> func(int n, int x, int horz, int h, int w, vector<string> v){
    vector<i64> cnt(n);
    int idx = 0;
    for(int i=0;i<h;++i){
        if(v[i][x] == '1')cnt[idx]++;
        if(horz&(1<<i))idx++;
    }
    return cnt;
}

int main(){
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> v;
    for(int i=0;i<h;++i){
        string s;
        cin >> s;
        v.push_back(s);
    }

    i64 ans = h*w;
    for(int horz=0;horz<(1<<(h-1));++horz){
        i64 bits = popcount(horz);
        i64 tmp = bits;
        vector<i64> cnt = func(bits+1, 0, horz, h, w, v);
        bool ok = true;
        for(auto e: cnt){
            if(e > k){
                ok = false;
                break;
            }
        }
        if(!ok)continue;
        for(int j=1;j<w;++j){
            vector<i64> cnt2 = func(bits+1, j, horz, h, w, v);
            for(auto e: cnt2){
                if(e > k){
                    ok = false;
                    break;
                }
            }
            if(!ok)break;
            for(int i=0;i<=bits;++i){
                cnt[i] += cnt2[i];
                if(cnt[i] > k){
                    tmp++;
                    for(int k=0;k<=bits;++k){
                        cnt[k] = cnt2[k];
                    }
                    break;
                }
            }
        }
        if(!ok)continue;
        ans = min(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>


int main()
{
	int i, k = 0;
	double a, b, c, d, e, f, j;
	double num[200] = { 100 };


	while (scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f) != EOF)
	{
		if ((a >= -10000 && a <= 10000) && (b >= -1000 && b <= 1000) && (c >= -1000 && c <= 1000) && (d >= -1000 && d <= 1000) && (e >= -1000 && e <= 1000) && (f >= -1000 && f <= 1000))
		{
			if (b*f == c*e)
			{
				num[k] = 0;
			}
			else
			{
				num[k] = (b*f - c*e) / (b*d - a*e);
			}
			++k;
			if (c*d == a*f)
			{
				num[k] = 0;
			}
			else
			{
				num[k] = (c*d - a*f) / (b*d - a*e);
			}
			++k;
		}
	}

	for (i = 0; i < k;)
	{
		printf("%.3f %.3f\n", num[i], num[i + 1]);
		i += 2;
	}
	
	return 0;
}


Measured memory_bytes: 652
#!/usr/local/bin/python3

def solve(n, l):
	minaji = 9999999999
	res = -1
	for i in range(n):
		aji = i + l
		if abs(aji) < minaji:
			minaji = abs(aji);
			res = i
	sumaji = 0
	for i in range(n):
		aji = i + l
		if i != res:
			sumaji = sumaji + aji
	return sumaji


n, l = map(int, input().split())
ans = solve(n, l)
print(ans)


Measured memory_bytes: 3064
while true
    m,f,l = gets.chomp.split.map(&:to_i)
    if m == -1 && f == -1 && l == -1
        break
    end
    sum = m + f
    if m != -1 && f != -1
        if sum >= 80
            puts "A"
        elsif  sum >= 65
            puts "B"
        elsif sum >= 50 || l >= 50
            puts "C"
        elsif sum >= 30
            puts "D"
        else 
            puts "F"
        end
    else puts "F"
    end
end

Measured memory_bytes: 6100
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>


int main(){
	char s1[102],s2[102];
	scanf("%s %s",s1,s2);

	int len1=strlen(s1);
	int len2=strlen(s2);
	int i;
	int j=0;
	
	if(len1<len2) printf("LESS\n");
	else if(len2<len1) printf("GREATER\n");
	else{
		for(i=0;i<len1;i++){
			if(s1[i]<s2[i]){
				j=-1;
				break;
			}
			else if(s1[i]>s2[i]){
				j=1;
				break;
			}
			else continue;
		}
		if(j<0) printf("LESS\n");
		else if (j>0) printf("GREATER\n");
		else printf("EQUAL\n");
	}
	return 0;
}

Measured memory_bytes: 128