akhauriyash/Code-Regression huggingface dataset:
#include <map>
#include <set>
#include <ctime>
#include <queue>
#include <stack>
#include <cmath>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cctype>
#include <string>
#include <numeric>
#include <cstring>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std ;
#define rep(i, a, b) for (register int i = (a); i <= (b); ++i)
#define per(i, a, b) for (register int i = (a); i >= (b); --i)
#define loop(it, v) for (auto it = v.begin(); it != v.end(); it++)
#define cont(i, x) for (register int i = head[x]; i; i = edge[i].nex)
#define clr(a) memset(a, 0, sizeof(a))
#define ass(a, cnt) memset(a, cnt, sizeof(a))
#define cop(a, b) memcpy(a, b, sizeof(a))
#define lowbit(x) (x & -x)
#define all(x) x.begin(), x.end()
#define SC(t, x) static_cast <t> (x)
#define ub upper_bound
#define lb lower_bound
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define pof pop_front
#define pob pop_back
#define fi first
#define se second
#define y1 y1_
#define Pi acos(-1.0)
#define iv inline void
#define enter putchar('\n')
#define siz(x) ((int)x.size())
#define file(x) freopen(x".in", "r", stdin),freopen(x".out", "w", stdout)
typedef double db ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair <int, int> pii ;
typedef vector <int> vi ;
typedef vector <pii> vii ;
typedef queue <int> qi ;
typedef queue <pii> qii ;
typedef set <int> si ;
typedef map <int, int> mii ;
typedef map <string, int> msi ;
const int maxn = 2e6 + 100 ;
const int inf = 0x3f3f3f3f ;
const int iinf = 1 << 30 ;
const ll linf = 2e18 ;
const ll mod = 998244353 ;
const double eps = 1e-7 ;
template <class T = int> T read()
{
	T f = 1, a = 0;
	char ch = getchar() ;
	while (!isdigit(ch)) { if (ch == '-') f = -1 ; ch = getchar() ; }
	while (isdigit(ch)) { a =  (a << 3) + (a << 1) + ch - '0' ; ch = getchar() ; }
	return a * f ;
}

int n, ans = inf;

char a[maxn], b[maxn];

vi posa, posb;

signed main()
{
	scanf("%d", &n);
	scanf("%s %s", a + 1, b + 1);
	rep(i, 1, (n / 2 + 1) * 2) posa.pb(0);
	if(a[1] == b[1]) posa.pb(0);
	rep(i, 1, n) if(a[i] != a[i - 1]) posa.pb(i - 1);
	rep(i, 1, (n / 2 + 1) * 2) posa.pb(n);
	rep(i, 2, n) if(b[i] != b[i - 1]) posb.pb(i - 1);

	// puts("-------------------init--------------------");
	// int nmsl = 0;
	// for(int i : posa) printf("%d : %d\n", nmsl ++, i);
	// enter;
	// nmsl = 0;
	// for(int i : posb) printf("%d : %d\n", nmsl ++, i);
	// enter;

	rep(i, 0, siz(posa) - siz(posb) - 1)
	{
		int sum = 0;
		rep(j, 0, siz(posb) - 1) sum += abs(posa[i + j] - posb[j]);
		per(j, i - 1, 0) if(posa[j]) sum += posa[j];
		rep(j, i + siz(posb), siz(posa) - 1) if(posa[j] != n) sum += n - posa[j];
		// if(sum < ans) printf("%d\n", i);
		ans = min(ans, sum);
		i ++;
	}
	printf("%d\n", ans);
	return 0;
}

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

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(long long base, long long exp, long long mod = MOD) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if((exp & 1) == 1) tot = tot * base % mod;
       base = base * base % mod;
    }
    return tot;
}
long long slow_mult(long long base, long long exp, long long mod = MOD) {
    long long tot = 0;
    for(;exp > 0;exp >>= 1){
       if((exp & 1) == 1) tot = (tot + base) % mod;
       base = base * 2 % mod;
    }
    return tot;
}

long long nck[2003][2003];

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, k; cin >> n >> k;

    nck[0][0] = 1;
    for(int i = 1; i <= 2002; ++i)
        for(int j = 0; j <= i; ++j)
            nck[i][j] = (nck[i - 1][j] + (j > 0 ? nck[i - 1][j - 1] : 0)) % MOD;

    for(int i = 1; i <= k; ++i){
        // r - k choose i
        // b - 1 choose i
        cout << nck[n - k + 1][i] * nck[k - 1][i - 1] % MOD << "\n";
    }

    return 0;
}


Measured memory_bytes: 30208
#include <bits/stdc++.h>
#define db long double

using namespace std;

int n, x;
db d, sum;

db solve(int n, db d, db x)
{
	if (n == 1)
		return (2 * d + x) / 2;
	return solve(n - 1, d * (n + 1) / n + x * 5 / n / 2, x * (n + 2) / n) + (2 * d + (n * 2 - 1) * x) / 2;
}

int main()
{
	cin >> n >> d >> x;
	cout << fixed << setprecision(10) << solve(n, d, x) << endl;
	return 0;
}


Measured memory_bytes: 16260
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    class SegmentTree():
        def __init__(self,n,ide_ele,segfunc):
            self.ide_ele=ide_ele
            self.segfunc=segfunc
            self.num=2**(n-1).bit_length()
            self.dat=[ide_ele]*2*self.num
        
        def init(self,iter):
            for i in range(n):
                self.dat[i+self.num-1]=iter[i]
            for i in range(self.num-2,-1,-1):
                self.dat[i]=self.segfunc(self.dat[2*i+1],self.dat[2*i+2])
        
        def update(self,k,x):
            k+=self.num-1
            self.dat[k]=x
            while k:
                k=(k-1)//2
                self.dat[k]=self.segfunc(self.dat[k*2+1],self.dat[k*2+2])
        
        def query(self,p,q):
            if q<=p:
                return self.ide_ele
            p+=self.num-1
            q+=self.num-2
            res=self.ide_ele
            while q-p>1:
                if p&1==0:
                    res=self.segfunc(res,self.dat[p])
                if q&1==1:
                    res=self.segfunc(res,self.dat[q])
                    q-=1
                p=p//2
                q=(q-1)//2
            if p==q:
                res=self.segfunc(res,self.dat[p])
            else:
                res=self.segfunc(self.segfunc(res,self.dat[p]),self.dat[q])
            return res
    
    n,q=map(int,input().split())
    seg=SegmentTree(n,INF,min)
    seg.init([2**31-1]*n)
    
    for _ in range(q):
        c,x,y=map(int,input().split())
        if c==0:
            seg.update(x,y)
        else:
            y+=1
            print(seg.query(x,y))

if __name__ == '__main__':
    main()



Measured memory_bytes: 9408
/*
题意是求一个序列中"所有子序列的中位数"所组成的序列的中位数 
看题解了，完全不会。https://www.cnblogs.com/quzhizhou/p/9535597.html  

首先我们先二分最后序列的中位数。设tot为中位数 >= mid的区间个数，若中位数序列的中位数 >= mid，
则有tot >= n(n+1)/4。
我们另外构造一个序列b[i], 当a[i]>=mid时b[i]=1, 否则bi=-1. 
那么若区间[l, r]的中位数 >= mid, 则b[l]+...+b[r] >= 0. 
于是我们求出序列b[i]的前缀和序列sum[i]，那么问题就变成了求满足l <= r且sum[r]-sum[l-1]>=0的数对(l,r)数量(0<=l,r<=n)，
这个问题可以用与求逆序对数量相似的方法解决. 树状数组即可. 
*/ 
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;

const int NN = 110000;
int a[NN], l, r, n, mid, ans;
int s[NN * 2];  
//树状数组，注意，[-n-1, n], 为了让每一个存的值都是>0, 都加上n即可（因为树状数组不能从0开始）
//所以开双倍空间给数组 

int lowbit(int x){
	return x & (-x);
} 

void add1(int x, int k){
	while (x <= n * 2){
		s[x] += k;
		x += lowbit(x);
	}
}

int getsum(int x){
	int sum = 0;
	while (x > 0){
		sum += s[x];
		x -= lowbit(x);
	}
	return sum;
}

int check(int mid){
	//memset(s, 0, sizeof(s));  //树状数组清0 
	 for(int i=1;i<=2*n;i++)s[i]=0;
	//与求逆序对的方法相同 
	add1(n, 1);  //因为在每个数的基础上都加了n，所以这句话相当于在和等于0的点+1
	long long sum = 0;
	long long tmp = 0;
	for (int i=1; i<=n; i++){
		if (a[i] >= mid) sum++;
		else sum--;
		tmp += getsum(sum + n);
		add1(sum + n, 1);
	} 
	return tmp>=1ll*n*(n+1)/4;
	/*long long nn = n * (n + 1) / 4; //注意！nn必须给long long 
	if (tmp >= nn) return true;
	else return false; */
}
/*
int check(int mid)
{
    for(int i=1;i<=2*n;i++)s[i]=0;
    ll tot=0, sum=0;
    add1(n,1);
    for(int i=1;i<=n;i++){
        sum+=(a[i]>=mid?1:-1);
        tot+=getsum(sum+n);
        add1(sum+n,1);
    }
//    printf("%d %lld\n",mid,tot);
    return tot>=1ll*n*(n+1)/4;
}*/

int main(){
	//freopen("atcoderarc101d.in", "r", stdin);
	
	scanf("%d", &n);
	l = 0x7fffffff; r = 0;
	for (int i=1; i<=n; i++){
		scanf("%d", &a[i]);
		if (a[i] >= r) r = a[i];
		if (a[i] <= l) l = a[i];
	}
	//printf("%d %d\n", l, r);
	while (l <= r){
		mid = (l + r) / 2;
		if (check(mid)){
			ans = mid; 
			l = mid + 1;
		} else r = mid-1;
	}
	printf("%d", ans);
	
	return 0;
} 

Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const long long INF = 9999999999;
const long long MOD = 1e9 + 7;
const double pi = 3.1415926535897932384626;
const int SIZE = 1 << 17;

int main() {
	long long a, b, k[100005], mon;
	cin >> a >> b;
	mon = a;
	vector<long long>dis;
	for (int i = 0; i < a; ++i) {
		cin >> k[i];
		if (i) {
			dis.push_back(k[i] - 1 - k[i - 1]);
			mon += k[i] - 1 - k[i - 1];
		}
	}
	sort(dis.rbegin(), dis.rend());
	for (int i = 0; i < b - 1; ++i) {
		mon -= dis[i];
	}
	cout << mon << endl;
}


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

using namespace std;

typedef long long ll;

int main() {
    int n;
    cin >> n;
    
    vector<ll> a(n);
    for (int i = n - 1; i >= 0; --i) {
        cin >> a[i];
    }
    
    
    ll mins = 2, maxs = 2;
    for (int i = 0; i < n; ++i) {
        ll l = 0, r = 1e18 + 1;
        while (r - l > 1) {
            ll mid = (l + r) / 2;
            
            if ((mid / a[i]) * a[i] >= mins) {
                r = mid;
            } else {
                l = mid;
            }
        }
        mins = r;
        
        l = -1, r = 1e18 + 1;
        while (r - l > 1) {
            ll mid = (l + r) / 2;
            
            if ((mid / a[i]) * a[i] <= maxs) {
                l = mid;
            } else {
                r = mid;
            }
        }
        maxs = l;
        
        if (mins > maxs) {
            cout << -1 << endl;
            return 0;
        }
    }
    
    cout << mins << " " << maxs << endl;
    
    return 0;
}


Measured memory_bytes: 1152
//file_name:ABC78_A.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    string s;
    cin >> s;
    string ss;
    cin >> ss;

    int a=s[0];
    int b=ss[0];


    if(a==b){
        cout << '=' << endl;
    }
    if(a<b){
        cout << '<' << endl;
    }
    if(a>b){
        cout << '>' << endl;
    }
    return 0;
}



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

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A1 = sc.nextInt();
    int A2 = sc.nextInt();
    int ans = gcd(A1,A2);
    for(int i = 2;i < N; i++){
      A2 = sc.nextInt();
      ans = gcd(ans,A2);
    }
    System.out.println(ans);
  }
  static int gcd(int a,int b){
    if (b == 0)
    return a;
    return gcd(b,a % b);
  }
  
}


Measured memory_bytes: 49820
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
#define all(x) x.begin(),x.end()

int N,M;

#include <vector>
using namespace std;

struct UnionFind {
  vector<int> par_;
  vector<int> rank_;

  void init(int size) {
    par_.resize(size, 0);
    rank_.resize(size, 0);
    for (int i = 0; i < size; i++) {
      par_[i] = i;
      rank_[i] = 0;
    }
  }
  int root(int x) { return par_[x] == x ? x : par_[x] = root(par_[x]); }

  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return true;

    if (rank_[x] < rank_[y]) {
      par_[x] = y;
    } else {
      par_[y] = x;
      if (rank_[x] == rank_[y]) rank_[x]++;
    }
    return false;
  }
  bool same(int x, int y) { return root(x) == root(y); }
};

vector<int> A,B;

vector<vector<int>> edges;

int main(){
  cin >> N >> M;
  A.resize(M);
  B.resize(M);
  edges.resize(N,vector<int>(N));
  UnionFind uf;
  uf.init(N);
  rep(i,0,M - 1){
    cin >> A[i] >> B[i];
    A[i]--;
    B[i]--;
    edges[A[i]][B[i]] = edges[B[i]][A[i]] = 1;
    uf.unite(A[i],B[i]);
    uf.root(A[i]);
    uf.root(B[i]);
  }
  map<int,vector<int>> mp;
  rep(i,0,N - 1){
    mp[uf.root(i)].push_back(i);
  }

  if(mp.size() >= 3){
    cout << -1 << endl;
    return 0;
  }
  if(mp.size() == 2){
    vector<int> v = mp.begin()->second;
    int a = v.size();
    for(auto i : v){
      for(auto j : v){
        if(i == j) continue;
        if(!edges[i][j]){
          cout << -1 << endl;
          return 0;
        }
      }
    }
    vector<int> v2 = (--mp.end())->second;
    int b = v2.size();
    for(auto i : v2){
      for(auto j : v2){
        if(i == j) continue;
        if(!edges[i][j]){
          cout << -1 << endl;
          return 0;
        }
      }
    }
    cout << a * (a - 1) / 2 + b * (b - 1) / 2 << endl;
    return 0;
  }


  vector<vector<int>> G(N);
  rep(i,0,N - 1){
    rep(j,0,N - 1){
      if(i == j) continue;
      if(!edges[i][j]){
        G[i].push_back(j);
        G[j].push_back(i);
      }
    }
  }

  vector<int> vis(N,-1);

  vector<pair<int,int>> vec;

  rep(i,0,N - 1){
    if(vis[i] == -1){
      vis[i] = 0;
      vector<int> co(N,-1);
      queue<pair<int,int>> que;
      co[i] = 0;
      que.push({i,0});

      while(!que.empty()){
        int v = que.front().first;
        int d = que.front().second;
        que.pop();
        vis[v] = 1;

        for(int to : G[v]){
          if(co[to] == -1){
            co[to] = d ^ 1;
            que.push({to,co[to]});
          }
          else if(co[to] == co[v]){
            cout << -1 << endl;
            return 0;
          }
        }
      }

      vector<int> cnt(2,0);
      rep(i,0,N - 1){
        if(co[i] != -1)
        cnt[co[i]]++;
      }
      int a = cnt[0];
      int b = cnt[1];
      vec.push_back({a,b});
    }
  }


  bitset<10101> bit;
  bit[0] = 1;
  for(auto p : vec){
    bit = (bit << p.first) | (bit << p.second);
  }
  i64 ans = M;
  rep(i,0,N){
    if(bit[i])
    {
      int a = i;
      i64 b = N - i;
      ans = min(ans , i * (i - 1) / 2 + b * (b - 1) / 2);
    }
  }

  cout << ans << endl;
}


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

typedef long long ll;

int main()
{
    ll ans = 0;
    ll N;
    cin >> N;
    for (int i = 0; i < N; ++i)
    {
        ll temp;
        cin >> temp;
        if (temp % 2 == 0)
        {
            while (temp % 2 == 0)
            {
                temp = temp / 2;
                ++ans;
                if (temp % 2 == 1)
                {
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3544
#include<iostream>
using namespace std;
int main(){
    int n,q,key;
    int count=0;
    cin>>n;
    int S[n];
    for(int i=0;i<n;i++){
        cin>>S[i];
    }
    int SNumber = sizeof S / sizeof S[0];
    cin>>q;
    for(int i=0;i<q;i++){
        int left = 0;
        int right = SNumber ;
        cin>>key;    
    while(left < right){
        int mid = (left + right) / 2;
        if (S[mid] == key){
            count ++;
            break;
        }
        else if (key < S[mid]){
            right = mid;
        }
        else left = mid + 1;
    }
    }
    cout<<count<<endl;
}


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

int main()
{
  int n;cin>>n;
  vector<int> x(n);
  vector<int> l(n);
  int i;
  for(i=0;i<n;i++)cin>>x.at(i)>>l.at(i);
  vector<int> le(n);
  vector<int> ri(n);
  for(i=0;i<n;i++)
  {
    le.at(i)=x.at(i)-l.at(i);
    ri.at(i)=x.at(i)+l.at(i);
  }
  vector<pair<int,int>> p(n);
  for(i=0;i<n;i++)p.at(i)=make_pair(ri.at(i),le.at(i));
  sort(p.begin(),p.end());
  int ans=0;
  int last=-1000000007;
  for(i=0;i<n;i++)
  {
    if(p.at(i).second>=last)
    {
      ans++;
      last=p.at(i).first;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);
ll dp[51][51][5000];
int main() {
    int n,a;
    cin>>n>>a;
    vector<int> x(n);
    rep(i,n){
        cin>>x[i];
    }
    dp[0][0][0]=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<i+1;j++){
            for(int k=0;k<5001;k++){
                dp[i+1][j][k]+=dp[i][j][k];
                if(k-x[i]>=0){dp[i+1][j+1][k]+=dp[i][j][k-x[i]];}
            }
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
        ans+=dp[n][i][i*a];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 99840
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int N, t;

int main(void)
{
	double big = 0;
	cin >> N >> t;
	for (int i = 0; i < N; ++i) {
		double x, h;
		cin >> x >> h;
		big = max(big, h / x);
	}
	cout.precision(10);
	cout << big * t << endl;
	return 0;
}



Measured memory_bytes: 3292
import sys
input = sys.stdin.readline
N, A, B, C, D = map(int, input().split())
for i in range(N - 1):
  r = D * (N - i - 1) + A
  l = C * (N - i - 1) + A

  r -= C * i
  l -= D * i
  #print(l, r, i)
  if B in range(l, r + 1):
    print("YES")
    exit(0)
print("NO")

Measured memory_bytes: 40428
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
	int x,y;
	cin >> x >> y;
	if(y&1)
		cout << "No\n";
	else{
		int c = 2*x-(y/2);
		int t = (y/2)-x;
		if(c >= 0 && t >= 0)
			cout << "Yes\n";
		else
			cout << "No\n";
	}
}

Measured memory_bytes: 3624
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = int.Parse(line[0] + line[1]);
        var roota = (int)Math.Sqrt(a);
        Console.WriteLine(roota * roota == a ? "Yes" : "No");
    }
}



Measured memory_bytes: 11092
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>
#include <queue>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

int main()
{
    int h, w;
    cin >> h >> w;
    
    string board[50];
    for (int i = 0; i < h; i++)
    {
        cin >> board[i];
    }
    
    const int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
    const int dy[8] = {1, 1, 1, 0, 0, -1, -1, -1};

    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if (board[i][j] == '#')
            {
                continue;
            }
            
            int num = 0;
            for (int d = 0; d < 8; d++)
            {
                const int ni = i + dy[d];
                const int nj = j + dx[d];
                if (ni < 0 or ni >= h)
                {
                    continue;
                }
                if (nj < 0 or nj >= w)
                {
                    continue;
                }
                if (board[ni][nj] == '#')
                {
                    num++;
                }
            }
            board[i][j] = num + '0';
        }
    }
    
    for (int i = 0; i < h; i++)
    {
        cout << board[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> as(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> as[i];
    }
    vector<bool> visited(n + 1, false);

    int count = 0;
    int index = 1;
    bool success = false;
    while (true)
    {
        visited[index] = true;
        count++;
        index = as[index];
        if (index == 2)
        {
            success = true;
            break;
        }
        else if (visited[index])
        {
            break;
        }
    }
    cout << (success ? count : -1) << endl;
}


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

const int INF = -1;

int main() {
    int N, M, S, T;
    cin >> N >> M;
    vector<int> graph[N];
    rep(i, M) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        graph[u].push_back(v);
    }
    cin >> S >> T;
    S--; T--;

    int dist[N][3];
    rep(i, N) rep(j, 3) dist[i][j] = INF;
    queue<P> que;
    que.push(P(S, 0));
    dist[S][0] = 0;
    while (que.size()) {
        int now = que.front().first;
        int step = que.front().second;
        que.pop();
        for (int to: graph[now]) {
            int next_step = (step + 1) % 3;
            if (dist[to][next_step] != INF) continue;
            que.push(P(to, next_step));
            dist[to][next_step] = dist[now][step] + 1;
        }
    }

    int ans = dist[T][0];
    if (ans != INF) ans /= 3;
    cout << ans << endl;
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) {
        ll d = euclid(b, a % b, y, x);
        return y -= a / b * x, d;
    }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1)
            ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1);
        return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e)
            return Mod(1);
        Mod r = *this ^ (e / 2);
        r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    cin.exceptions(cin.failbit);

    int n;
    cin >> n;
    vector<char> v(n);
    rep(i, 0, n) cin >> v[i];
    set<int> s;
    rep(i, 0, n) rep(j, 1, 9) {
        if (i + j - 1 >= n)
            continue;
        string str;
        rep(k, i, i + j) { str += v[k]; }
        s.insert(stoi(str));
    }
    vector<int> vv(s.begin(), s.end());
    vv.push_back(0x3f3f3f3f);
    for (int i = 0;; i++) {
        if (vv[i] != i) {
            cout << i << endl;
            break;
        }
    }
}



Measured memory_bytes: 3540
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    int n;cin>>n;
    VEC(int,h,n);
    int mx = 0;
    int res = 0;
    rep(i,n){
        if(h[i]>=mx)res++;
        mx = max(mx,h[i]);
    }
    cout<<res;
}



Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
using namespace std;
int main(void){
   int A,B;
   cin>>A>>B;
   if(B%A==0){cout<<A+B;}
   else {cout<<B-A;}
   return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

count = 0
for i in range(n+1):
    rg = 0
    if i == 0:
        rg = range(0, 1)
    elif i == n:
        rg = range(-1, 0)
    else:
        rg = range(-1, 1)

    for j in rg:
        if a[i] > b[i+j]:
            count += b[i+j]
            a[i] -= b[i+j]
            b[i+j] = 0
        else:
            count += a[i]
            b[i+j] -= a[i]
            a[i] = 0

print(str(count))


Measured memory_bytes: 18476
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;

LL gcd(LL m, LL n) {
    if (n ==  0) return abs(m);
    else return gcd(n, m % n);
}
LL calc(LL n, LL c, LL d) {
    LL g = gcd(c, d);
    LL l = c / g * d;
    return n - n / c - n / d + n / l;
}
int main() {
    LL a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << calc(b, c, d) - calc(a - 1, c, d) << endl;
    return 0;
}


Measured memory_bytes: 888
k = int(input())
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(l[k-1])

Measured memory_bytes: 3060
//Fat Elephant!!!!
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int n;
int a[3003];
ll dp[3003][3003];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	for(int l=n;l>=1;l--)
		for(int r=l;r<=n;r++){
			dp[l][r]=max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
		}
	printf("%lld\n",dp[1][n]);
	ll ans=0;
	return 0;
}

Measured memory_bytes: 70016
#include<iostream>
#include<cmath>
#include<iomanip>

using namespace std;

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

    int x[N], y[N];
    for(int i = 0; i<N; i++){
        cin >> x[i] >> y[i];
    }

    double d[N][N];
    for(int i =0 ;i<N; i++){
        for(int j = 0;j<N; j++){
            d[i][j] = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]);
            d[i][j] = sqrt( double(d[i][j]) );
        }
    }

    double ans  =0;

    for(int i = 0; i<N; i++){
        for(int j = 0; j<N; j++){
            double temp = d[i][j];
            for(int i = 1; i < N; i++){
                temp *= i;
            }
            ans += temp;
        }
    }
    for(int i =1 ; i<=N; i++){
        ans /= i;
    }
    cout << setprecision(7) << ans  << endl;
    return 0;
}

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

int main() {
  int L, R, d;
  cin >> L >> R >> d;
  int counter = 0;
  for (int i = L; i <= R; i++) {
    if (i % d == 0)
      counter++;
  }
  cout << counter << endl;
}

Measured memory_bytes: 3580
/*

結果:
*/
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>  
#include <stdbool.h>   
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define PI 3.14159265358979323846;
#define EPS 1e-10
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
/*
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r)
*/
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r)
#define TYPE long long
#define ll long long
#define MEMSET(a) memset(a,0,sizeof(a))
#define MEMSET_U(a) memset(a,-1,sizeof(a))
const int mod = (int)1e09 + 7;

//#define DEBUG1
//#define DEBUG2
//#define DEBUGF
#define DUMMY

int in(void) { int i; scanf("%d", &i); return i; }
long long llin(void) { long long i; scanf("%lld", &i); return i; }
double din(void) { double i; scanf("%lf", &i); return i; }
void chin(char s[]) { scanf("%s", s); }

void print(int a) { printf("%d\n", a); }
void llprint(long long a) { printf("%lld\n", a); }
void dprint(double a) { printf("%.10f\n", a); }
void print2(int a, int b) { printf("%d %d\n", a, b); }
int Max(int a, int b) { if (a > b) { return a; }return b; }
int Min(int a, int b) { if (a < b) { return a; }return b; }
long long llmax(long long a, long long b) { return a > b ? a : b; }
long long llmin(long long a, long long b) { return a < b ? a : b; }
double dmax(double a, double b) { return a > b ? a : b; }
double dmin(double a, double b) { return a < b ? a : b; }
//long long llmax(long long a, long long b) { return a > b ? a : b; }
//long long llmin(long long a, long long b) { return a < b ? a : b; }
//double dmax(double a, double b) { return a > b ? a : b; }
int cmp(const void *a, const void *b) { return *(TYPE *)a - *(TYPE *)b; }
int cmp_r(const void *a, const void *b) { return *(TYPE *)b - *(TYPE *)a; }
int char_cmp(const void *a, const void *b) { return strcmp((char *)a, (char *)b); }
int char_cmp_r(const void *a, const void *b) { return strcmp((char *)b, (char *)a); }
void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; }
int ABS(int a) { return a >= 0 ? a : -a; }



int main() {

	int A, B, i, tmp;
	scanf("%d%d", &A, &B);
	for (i = 10; i <= B; i *= 10) {};
	tmp = A * i + B;
	for (i = 1; i*i < tmp; i++) {}
	if (i*i == tmp) {
		puts("Yes");
	}
	else {
		puts("No");
	}


#ifdef DEBUGF
	getch();
#endif
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#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()
int main(){
    int x;
    cin>>x;
    cout<<"ai1"<<string(x/100+3,'3')<<endl;
    return 0;
}


Measured memory_bytes: 3144
#include <iostream>
#include <cmath>
#define MAX_SQUARE 142
#define MAX 20001
using namespace std;

bool isDivisor(int p, int q, int m, int n) {
  int temp1 = m * p + n * q;
  int temp2 = m * q - n * p;
  int square = m * m + n * n;
  if (temp1 % square == 0 && temp2 % square == 0) return true;
  return false;
}

bool isPrime(int p, int q) {
  int square = p * p + q * q;
  int count = 0;
  for (int m = 0; m * m <= square; m++) {
    for (int n = 0; m * m + n * n <= square; n++) {
      if (m * m + n * n == 0) continue;

      if (isDivisor(p, q, m, n)) {
	count++;
      }

      if (m != 0 && isDivisor(p, q, -m, n)) {
	count++;
      }

      if (n != 0 && isDivisor(p, q, m, -n)) {
	count++;
      }

      if (m != 0 && n != 0 && isDivisor(p, q, -m, -n)) {
	count++;
      }
    }
  }

  if (count == 8) return true;
  return false;
}

int main() {
  int number;
  cin >> number;
  for (int times = 0; times < number; times++) {
    int m, n;
    cin >> m >> n;

    if (isPrime(m, n)) cout << "P" << endl;
    else cout << "C" << endl;
  }

  return 0;
}

Measured memory_bytes: 3052
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int[] m = new int[2];
    int[] d = new int[2];
    for(int i=0; i<2; i++){
      m[i] = sc.nextInt();
      d[i] = sc.nextInt();
    }
    
    if(m[0] != m[1]){
      System.out.println(1);
    }
    else{
      System.out.println(0);
    }
  }
}

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

using namespace std;

using int64 = long long;


template< typename T >
struct Dinic
{
  struct edge
  {
    int to;
    T cap;
    int rev;
  };

  const T INF;
  vector< vector< edge > > graph;
  vector< T > min_cost;
  vector< int > iter;

  Dinic(int n) : INF(numeric_limits< T >::max())
  {
    graph.resize(n);
  }

  void add_edge(int from, int to, T cap)
  {
    graph[from].push_back((edge) {to, cap, (int) graph[to].size()});
    graph[to].push_back((edge) {from, 0, (int) graph[from].size() - 1});
  }

  bool bfs(int s, int t)
  {
    min_cost.assign(graph.size(), -1);
    queue< int > que;
    min_cost[s] = 0;
    que.push(s);
    while(!que.empty()) {
      int p = que.front();
      que.pop();
      for(auto &e : graph[p]) {
        if(e.cap > 0 && min_cost[e.to] == -1) {
          min_cost[e.to] = min_cost[p] + 1;
          que.push(e.to);
        }
      }
    }
    return (min_cost[t] != -1);
  }

  T dfs(int idx, const int t, T flow)
  {
    if(idx == t) return (flow);
    for(int &i = iter[idx]; i < graph[idx].size(); i++) {
      edge &e = graph[idx][i];
      if(e.cap > 0 && min_cost[idx] < min_cost[e.to]) {
        T d = dfs(e.to, t, min(flow, e.cap));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return (d);
        }
      }
    }
    return (0);
  }

  T max_flow(int s, int t)
  {
    T flow = 0;
    while(bfs(s, t)) {
      iter.assign(graph.size(), 0);
      T f = 0;
      while((f = dfs(s, t, INF)) > 0) {
        flow += f;
      }
    }
    return (flow);
  }
};

int main()
{
  int N, A[100];

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

  Dinic< int64 > flow(N + 2);
  int S = N, T = N + 1;

  for(int i = 1; i <= N; i++) {
    for(int j = i + i; j <= N; j += i) {
      flow.add_edge(i - 1, j - 1, flow.INF);
    }
  }

  int64 sum = 0;
  for(int i = 0; i < N; i++) {
    if(A[i] > 0) {
      sum += A[i];
      flow.add_edge(i, T, A[i]);
    } else {
      flow.add_edge(S, i, -A[i]);
    }
  }

  cout << sum - flow.max_flow(S, T) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;
int main(){
    ll h,n;
    cin >> h >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }
    ll max = accumulate(a.begin(),a.end(),0);
    if(max >= h){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<queue>
#include<functional>

using namespace std;

typedef long long ll;

int N, K;
ll A[50 + 10];

int main() {
	cin >> N >> K;
	for (int i = 0; i < N; i++)cin >> A[i];

	ll ans = 0;
	for (int i = 0; i <= min(N, K); i++) {
		//最終的にとる個数i
		for (int j = 0; j <= i; j++) {
			int k = i - j;
			//左からj個、右からk個抜き取る
			priority_queue<ll, vector<ll>, greater<ll>> pq;
			for (int l = 0; l < j; l++)pq.push(A[l]);
			for (int l = 0; l < k; l++)pq.push(A[N - 1 - l]);
			
			ll tmp = 0;
			for (int l = 0; l < K - i && pq.size(); l++) {
				if (pq.top() >= 0)break;
				pq.pop();
			}
			while (pq.size()) {
				tmp += pq.top();
				pq.pop();
			}
			ans = max(ans, tmp);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
  int N, K;
  string s;
  cin >> N >> s >> K;
  for(int i = 0; i < s.size(); i++) {
    if (s[i] != s[K-1]) s[i] = '*';
  }
  cout << s << endl;
}


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

const int N = 2000 + 5;
int h,w;
int hcnt[N][N], wcnt[N][N];
string s[N];

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>h>>w;
    
    for (int i = 0; i < h; i++)cin>>s[i];
    
    
    for (int i = 1; i <= h; i++){
        for (int j = 1; j <= w; j++){
            if(s[i-1][j-1] == '.'){
                hcnt[i][j] = hcnt[i][j-1] + 1;
                wcnt[i][j] = wcnt[i-1][j] + 1;
            }
        }
    }
    
    for (int i = h; i >= 1; i--){
        for (int j = w; j >=1 ; j--){
            if(s[i-1][j-1] == '.'){
                hcnt[i][j] = max(hcnt[i][j], hcnt[i][j+1]);
            }
        }
    }
    
    
    for (int j = w; j >=1 ; j--){
        for (int i = h; i >= 1; i--){
            if(s[i-1][j-1] == '.'){
                wcnt[i][j] = max(wcnt[i][j], wcnt[i+1][j]);
            }
        }
    }

    
    int ans = 0;
    for (int j = w; j >=1 ; j--){
        for (int i = h; i >= 1; i--){
            if(s[i-1][j-1] == '.'){
                ans = max(ans , hcnt[i][j] + wcnt[i][j]-1 );
            }
        }
    }
    cout<<ans<<endl;
    
    
    return 0;
}


Measured memory_bytes: 35840
#include <iostream>
#include <map>
#include <string>
using namespace std;

string S[1009]; int n, sz[52]; map<int, int>M[52]; int c[128]; bool flag = false;

int number(string U, int L, int R) {
	if (U[L] >= '0' && U[L] <= '9') return stoi(U.substr(L, R - L + 1));
	int G = number(U, L + 2, R - 1);
	int ID = c[(int)(U[L])];
	if (G == -1 || G >= sz[ID]) return -1;
	return M[ID][G] - 1;
}

int position(string U) {
	return number(U.substr(2, U.size() - 3), 0, U.size() - 4);
}

bool bugged(int ID, int L, int R) {
	string T = S[ID]; bool I = false;
	for (int i = 0; i < T.size(); i++) {
		if (T[i] == '=')I = true;
	}
	if (I == true) {
		int pos = 0;
		for (int i = 0; i < T.size(); i++) { if (T[i] == '=')pos = i; }
		string F1 = T.substr(0, pos);
		string F2 = T.substr(pos + 1, T.size() - (pos + 1));
		int P1 = position(F1);
		int P2 = number(F2, 0, F2.size() - 1);
		int ID = c[(int)(F1[0])];
		if (P1 == -1 || P1 >= sz[ID] || P2 == -1) return true;
		M[ID][P1] = P2 + 1;
		return false;
	}
	else {
		char C = T[0];
		int size_ = stoi(T.substr(2, T.size() - 3));
		sz[c[(int)C]] = size_;
		return false;
	}
	return true;
}

int main() {
	int cnte = 0;
	for (char i = 'A'; i <= 'Z'; i++) { c[(int)i] = cnte; cnte++; }
	for (char i = 'a'; i <= 'z'; i++) { c[(int)i] = cnte; cnte++; }
	while (true) {
		n = 0; flag = false;
		while (true) {
			cin >> S[n]; if (S[n] == ".") { break; }
			n++;
		}
		if (n == 0) break;
		for (int i = 0; i < 52; i++) { M[i].clear(); sz[i] = -1; }
		for (int i = 0; i < n; i++) {
			if (bugged(i, 0, S[i].size() - 1) == true) { cout << i + 1 << endl; flag = true; break; }
		}
		if (flag == false) { cout << "0" << endl; }
	}
	return 0;
}


Measured memory_bytes: 3320
#include<iostream>
using namespace std;
int main(void)
{
	int a=0,b=0,n[8],i;
	for(i=1;i<=8;i++){
		cin>>n[i];
		if(4>=i) a+=n[i];
		else b+=n[i];
	}
	if(a>=b) cout<<a<<endl;
	else cout<<b<<endl;
	return 0;
}


Measured memory_bytes: 3116
#include <stdint.h>
#include <stdio.h>

int main(void) {
  int64_t N;
  // cin >> N;
  scanf("%ld", &N);
  int64_t a[5];
  for (int64_t i = 0; i < 5; ++i) scanf("%ld", a + i);
  int64_t mn = 1000000000000000;

  for (int64_t i = 0; i < 5; ++i) {
    if (a[i] < mn) {
      mn = a[i];
    }
  }
  printf("%ld\n", (N + mn - 1) / mn + 4);

  return 0;
}


Measured memory_bytes: 1708
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	if s == "abc" || s == "acb" || s == "bac" || s == "bca" || s == "cab" || s == "cba" {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner (System. in);
		int K = sc.nextInt(), S = sc.nextInt(),Z;
		int count = 0;
		for(int i = 0; i <= K; i++) {
			for(int j = 0; j <= K; j++) {
				Z = S - i - j;
				if(Z >= 0 && Z <= K) count++;

				Z = 0;
			}
		}
		System.out.println(count);
	}

}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int A,B,C,D,E,F;
  cin >> A >> B >> C >> D >> E >> F;
  double r=-100.0;
  double r1,r2,x,y,z;
  for(int i=0; i<31;i++){
    x=100*A*i;
    for(int j=0;j<31;j++){
      x=100*A*i+100*B*j;
      for(int k=0;k<51;k++){
        y= k*C;
        z=100*A*i+100*B*j+ k*C;
        for(int  l=0;l<51;l++){
          y=k*C+l*D;
          z=100*A*i+100*B*j+k*C+l*D;
          if(z>0 && z<=F && y<=(E*x)/100 && r<(100*y)/z){
            r=(100*y)/z;
            r1=z;
            r2=y;
          }
        }
      }
    }
  }
  cout << r1 << " "<< r2<< endl;
}

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

import sys
input=sys.stdin.readline

r,c,k=map(int,input().split())
items=[0]*(r*c)
for _ in range(k):
    tr,tc,tv=map(int,input().split())
    items[c*(tr-1)+tc-1]=tv
dp=[0]*(4*r*c)
for i in range(1,r+1):
    for j in range(1,c+1):
        tv=items[c*(i-1)+j-1]
        change_pos=4*(c*(i-1)+j-1)
        left_pos=4*(c*(i-2)+j-1)
        up_pos=4*(c*(i-1)+j-2)
        if i!=1:
          left_max=max(dp[left_pos],dp[left_pos+1],dp[left_pos+2],dp[left_pos+3])
        else:
          left_max=0
        if j!=1:
          dp[change_pos]=max(dp[up_pos],left_max)
          dp[change_pos+1]=max(dp[up_pos+1],dp[up_pos]+tv,left_max+tv)        
          dp[change_pos+2]=max(dp[up_pos+2],dp[up_pos+1]+tv)
          dp[change_pos+3]=max(dp[up_pos+3],dp[up_pos+2]+tv)
        else:
          dp[change_pos]=left_max
          dp[change_pos+1]=left_max+tv
print(max(dp[-1],dp[-2],dp[-3],dp[-4]))

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

    int total = m + n + l ;

    if (total >=22) {
      System.out.println("bust");
    } else {
      System.out.println("win");
    }
  }
}


Measured memory_bytes: 22868
class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x


def main():
    import sys
    from collections import Counter
    # readline = sys.stdin.readline
    readlines = sys.stdin.readlines
    N, K, L = map(int, input().split())
    uf1 = UnionFind(N)
    uf2 = UnionFind(N)

    IN = readlines()
    for i in range(K):
        p, q = map(int, IN[i].split())
        p -= 1; q -= 1
        uf1.union(p, q)
    for j in range(K, K + L):
        r, s = map(int, IN[j].split())
        r -= 1; s -= 1
        # if uf1.find(r) == uf1.find(s):
        uf2.union(r, s)
    
    # ans = []
    # for i in range(N):
    #     ans.append(-uf2.parents[uf2.find(i)])
    # print(*ans)
    path = []
    C = Counter()
    for i in range(N):
        pair = (uf1.find(i), uf2.find(i))
        path.append(pair)
        C[pair] += 1

    ans = []
    for i in range(N):
        ans.append(C[path[i]])
    print(*ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 57480
#ifdef Prateek
  #include "Prateek.h"
#else
  #include <bits/stdc++.h>
  using namespace std;
  #define debug(...) 42
#endif
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
const int MOD = 1e9+7, N = 1e8 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   int p = 7;
   int cur = 1;
   int n;
   cin >> n;
   while(cur <= N){
      p %= n;
      // debug(p);
      if(p == 0){
         cout << cur << '\n';
         return 0;
      }
      cur++;
      p = p*10+7;
   }
   cout << -1;
   return 0;
} 

Measured memory_bytes: 3648