akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<string>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<iostream>
#include<algorithm>
#include<unordered_map>
#include<unordered_set>
#define PI acos(-1)
#define pb push_back
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
#define dd(x) cout<<#x<<" = "<<x<<","
#define de(x) cout<<#x<<" = "<<x<<"\n"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=1e5+5;
const int mod=1e9+7;
ll cnt[N];
ll qpow(ll a,ll n){
	ll re=1;
	while(n>0){
		if(n&1){
			re*=a;
			re%=mod;
		}
		a*=a;
		a%=mod;
		n>>=1;
	}
	return re;
}
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++){
		cnt[i]=i;
	}
	ll ans=0;
	for(int i=1;i<=k;i++){
		ans+=cnt[i]*qpow(k/i,n)%mod;
		ans%=mod;
		for(int j=i+i;j<=k;j+=i){
			cnt[j]-=cnt[i];
		}
	}
	printf("%lld",ans);
}


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

int main() {
    string s;
    cin >> s;
    vector<bool> exist(26);
    for (int i=0; i<s.size(); i++) {
        if (exist[s[i] - 'a']) {
            cout << "no" << endl;
            return 0;
        }
        else exist[s[i] - 'a'] = true;
    }
    cout << "yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
using namespace std;
typedef long long int lo;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ft front
#define inf 1e9+7
lo a,b,c,d,e,n,m,k,x,y,z,t,a1[500005],a2[100005];
char c1,c2,c3,c4; 
string s1,s2,s3,s4;
double d1;
// map <lo,bool> id;
bool av=false;
vector <lo> v[10000];
map <pair<lo,lo >,lo> mp1;
bool vis[10000];
int main(){
    // freopen("gir.gir","r",stdin);
    // freopen("cik.cik","w",stdout);
    cin>>a>>b;
    a=a*500;
    if(a>=b){
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
template<typename T>
inline void read(T &x)
{
	x=0;
	int f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') f=-1;
		ch=getchar();
}
	while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
	x*=f;
	return;
}	
template<typename T>
void write(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>=10) write(x/10);
	putchar(x%10+'0');
	return;
}
const int MAXN=110,inf=999999999;
int n;
int a[MAXN];
int ans=inf;
int main()
{
    read(n);
    for(int i=1;i<=n;i++) read(a[i]);
    for(int i=1;i<=100;i++)
    {
        int cnt=0;
        for(int j=1;j<=n;j++) cnt+=(a[j]-i)*(a[j]-i);
        ans=min(ans,cnt);
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+7;
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int a[10] = {0},b;
    for(int i=0;i<4;i++){
        cin>>b;
        a[b]++;
    }
    if(a[1] && a[9] && a[7] && a[4])
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<queue>
#include<vector>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if(a>8||b>8)
    cout<<":(";
  else
    cout<<"Yay!";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,sum;
int main()
{
	scanf("%d%d",&n,&m);
	for (int i=1,a;i<=m;i++) scanf("%d",&a), sum+=a;
	printf("%d\n",(sum>n)?-1:n-sum);
}

Measured memory_bytes: 3760
n = input()
d = [0 for _ in range(9)]
seq = [int(x) for x in input().split()]
for val in seq:
    val = min(val, 3300)
    d[(val // 400)] += 1
a = sum(1 for val in d[:-1] if val > 0)
print(max(1,a), a + d[-1])

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

int main(){
  int n,count = 0;
 
  cin >> n ;
  
  vector<int> a(n);
  
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
  }
  
  while(true){
    bool odd = false;
    
    for(int i = 0; i < n; i++){
    	if(a.at(i) % 2 != 0){
      		odd = true;
        }
    }
    
    if(odd){
      break;
    }
    
    for(int i = 0; i < n;i++){
    	a.at(i) /= 2;
  	}
    count ++;
  }
  
  
  cout << count << endl;
  
  return 0;
}


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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
        #define eprintf(...) 42
#endif

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;

const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;

/*
  P
  B P P P B
  B BPPPB P BPPPB B

  f(n+1) = B f(n) P f(n) B
*/

ll dfs(ll a, ll b)
{
  if(a == 0) return 1;

  ll res = 0;
  ll n = (1LL<<(a+2))-3;

  if(b >= n/2){
    res += (1LL<<a)-1;
    if(b == n){
      res += (1LL<<a)-1;
    }else if(b > n/2+1){
      res += dfs(a-1, b-n/2-1);
    }
  }else{
    if(b > 1){
      res += dfs(a-1, b-1);
    }
  }

  if(b > n/2){
    res++;
  }
  
  return res;
}

int main()
{
  ll n, x;
  cin >> n >> x;

  cout << dfs(n, x) << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define itn int
#define REP(i,n) for(int i=0;i<(n);i++)
#define IREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(n);i++)
#define REPEACH(itr,k) for(auto&& itr : k)
#define MOD 1000000007

using namespace std;
typedef long long ll;

const ll INF = 1LL<<60;
typedef pair<double,int> P;

int main(){
  map<int,int> m;
  int n;
  cin >> n;
  REP(i,n){
    int a;
    cin >> a;
    m[a]++;
  }
  int ans=0;
  REPEACH(i,m){
    if(i.first>i.second){
      ans+=i.second;
    }
    else if(i.first<i.second){
      ans+=i.second-i.first;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4736
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();

		System.out.println( a % 2 == 0 || b % 2 == 0 ? "Even" : "Odd");
	}
}

Measured memory_bytes: 35616
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int in[14][14]={0};
	char d;
	int a,b,c;
	while(cin>>b>>d>>a>>d>>c){
		a+=2;b+=2;
		if(c==2)
			loop(i,-1,2)loop(j,-1,2)in[a+i][b+j]++;
		else if(c==1){
			loop(i,-1,2)loop(j,-1,2)if(i*j==0)in[a+i][b+j]++;
		}else{
			loop(i,-2,3)loop(j,-2,3)if(i*j==0||(abs(i)!=2&&abs(j)!=2))in[a+i][b+j]++;
		}
	}
	int co=0,ma=0;
	loop(i,2,12)loop(j,2,12){
		if(!in[i][j])co++;
		ma=max(ma,in[i][j]);
	}
	cout<<co<<endl;
	cout<<ma<<endl;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int a, b;
    cin >> a >> b;
    int sa = max(a,b) - min(a,b);

    if(sa <= (16 - 2 * min(a, b)) / 2) cout << "Yay!" << endl;
    else cout << ":(" << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <math.h>

using namespace std;
#define SQR(x) ((x)*(x))

int main(void) {
    int n;
    cin >> n;
    while (n--) {
        double x1, x2, x3, y1, y2, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

        double a = x1 - x2;
        double b = y1 - y2;
        double c = - 1 * (SQR(x1) - SQR(x2) + SQR(y1) - SQR(y2));
        double d = x1 - x3;
        double e = y1 - y3;
        double f = - 1 * (SQR(x1) - SQR(x3) + SQR(y1) - SQR(y3));

        double l = (c * e - b * f) / (e * a - b * d);
        double m = (d * c - a * f) / (d * b - e * a);

        double n = -1 * (SQR(x1) + SQR(y1) + l * x1 + m * y1);

        cout << fixed << setprecision(3)
             << l / -2 << " "
             << m / -2 << " "
             << sqrt(SQR(l) + SQR(m) - 4 * n) / 2 << endl;
    }
}

Measured memory_bytes: 1288
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl
typedef long long ll;

typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;

using namespace std;

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

    cout << a/3<< endl;
    return 0;
}
    



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] b = new int[n];
        int ans = 0;

        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }

        for (int i = 0; i < n; i++) {
            int x = b[i];
            for (int j = i + 1; j < n; j++) {
                int y = b[j];
                ans += x * y;
            }
        }

        System.out.println(ans);

        sc.close();
    }    
}


Measured memory_bytes: 21972
//by (111110101)2
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
string u,s,t;
int a,b;
int main()
{
	cin>>s>>t>>a>>b>>u;
	if(u==s)
	{
		cout<<a-1<<' '<<b<<endl;
	}
	else
	{
		cout<<a<<' '<<b-1<<endl;
	}
	return 0;
}

Measured memory_bytes: 768
from math import gcd

def main():
    N = int(input())
    mod = 10**9 + 7
    AB = {}
    pos = set()
    for _ in range(N):
        a, b = map(int, input().split())
        g = gcd(a, b)
        if g == 0:
            AB[(0, 0)] = AB.get((0, 0), 0) + 1
            continue
        a, b = a // g, b // g
        if a * b < 0 and a > 0:
            a, b = -a, -b
        if a * b > 0 and a < 0:
            a, b = -a, -b
        if a * b == 0:
            a, b = abs(a), abs(b)
        if a * b > 0:
            pos.add((a, b))
        AB[(a, b)] = AB.get((a, b), 0) + 1
    t = N - AB.get((0, 0), 0)
    r = 1
    for a, b in pos:
        p = AB[(a, b)]
        n = AB.get((-b, a), 0)
        r *= (pow(2, p, mod) - 1) + (pow(2, n, mod) - 1) + 1
        r %= mod
        t -= (p + n)
    p = AB.get((0, 1), 0)
    n = AB.get((1, 0), 0)
    r *= (pow(2, p, mod) - 1) + (pow(2, n, mod) - 1) + 1
    t -= (p + n)
    r *= pow(2, t, mod)
    r -= 1

    if (0, 0) in AB:
        r += AB[(0, 0)]

    return r % mod

print(main())


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

int main() {
    string S,T;
    cin >> S >>T;
    vector<set<int>> salpha(26);
    for(int i=0;i<S.size();i++){
        int t = S[i] -'a';
        salpha[t].insert(i);
    }
    ll N = S.size();
    ll ans =0;
    ll cursor =0;
    for(int i=0;i<T.size();i++){
        int t = T[i]-'a';
        if(salpha[t].size()==0){
            cout<< -1 << endl;
            return 0;
        }
        auto itr = salpha[t].lower_bound(cursor);
        if(itr == salpha[t].end()){
            ans += (N-cursor);
            cursor = 0;
            itr = salpha[t].lower_bound(cursor);
        }
        ans += (*itr)-cursor+1;
        cursor = (*itr) +1;        
    }
    cout << ans << endl;

    return 0;
}

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

int main()
{
    for (int i = 0; i < 5; i++)
    {
        int a;
        cin >> a;
        if(a == 0){
            cout << i+1 << endl;
            return 0;
        }
    }
    
    return 0;
}

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

int main() {
	int n;
	cin >> n;
	double val = 0.0;
	for (int i = 0; i < n; ++i) {
		double x;
		string u;
		cin >> x >> u;
		if (u == "JPY") {
			val += x; 
		} else {
			val += 380000.0 * x; 
		}
	}
	cout << val << endl;
	return 0;
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl

const ll MOD = 1000000007;
const ll i2 = (MOD + 1) / 2;
const int MN = 3010;

int N, Q;
int A[MN];
int X[MN], Y[MN];
ll p[MN][MN]; // <

int main() {
	cin >> N >> Q;
	rep(i, N) cin >> A[i];
	rep(i, N) {
		rep(j, N) {
			if (A[i] < A[j]) {
				p[i][j] = 1;
			}
		}
	}

	rep(i, Q) {
		cin >> X[i] >> Y[i];
		--X[i]; --Y[i];
	}

	rep(n, Q) {
		int a = X[n], b = Y[n];

		ll t1 = (p[a][b] + p[b][a]) * i2 % MOD;
		p[a][b] = p[b][a] = t1;

		rep(i, N) if (i != a && i != b) {
			ll t = (p[i][a] + p[i][b]) * i2 % MOD;
			p[i][a] = p[i][b] = t;
			t = (p[a][i] + p[b][i]) * i2 % MOD;
			p[a][i] = p[b][i] = t;
		}

	}

	ll ans = 0;
	rep(i, N) {
		rep(j, i) {
			ans = (ans + p[i][j]) % MOD;
		}
	}

	rep(i, Q) ans = ans * 2 % MOD;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 70784
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

ll n, m;
int a[100010], b[100010];
ll c[100010];

template <typename T>
struct UnionFind
{
    vector<T> data;

    UnionFind(int sz)
    {
        data.assign(sz, -1);
    }

    bool connected(T x, T y)
    {
        x = find(x), y = find(y);
        if (x == y)
            return true;
        else
            return false;
    }

    bool unite(T x, T y)
    {
        x = find(x), y = find(y);
        if (x == y)
            return false;
        if (data[x] > data[y])
            swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }

    int find(T k)
    {
        if (data[k] < 0)
            return k;
        return (data[k] = find(data[k]));
    }

    T size(T k)
    {
        return (-data[find(k)]);
    }
};

int main()
{
    cin >> n >> m;
    UnionFind<ll> uf(n);
    for (int i = 0; i < m; i++)
    {
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
    }
    c[m] = n * (n - 1) / 2;
    for (int i = m - 1; i > 0; i--)
    {
        if (uf.connected(a[i], b[i]))
        {
            c[i] = c[i + 1];
        }
        else
        {
            c[i] = c[i + 1] - uf.size(a[i]) * uf.size(b[i]);
            uf.unite(a[i], b[i]);
        }
    }
    for (int i = 1; i <= m; i++)
    {
        cout << c[i] << endl;
    }
}


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

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

    switch (c)
    {
    case 'A':
        cout << 'T' << endl;
        break;

    case 'C':
        cout << 'G' << endl;
        break;
    case 'G':
        cout << 'C' << endl;
        break;
    case 'T':
        cout << 'A' << endl;
        break;
    default:
        break;
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(co) begin(co), end(co)

int main() {
	int n, l;
while (cin >> n >> l && n && l) {
	map<int, int> mp;		
	rep(i, 100) {
		mp[n] = i;
		string s = to_string(n);
		rep(i, l)if (s.size() < l) s += "0";
		string mi = s, ma = s;
		sort(all(mi));
		sort(all(ma), greater<int>());
		n = atoi(ma.c_str()) - atoi(mi.c_str());
		if (mp.count(n)) {
			cout << mp[n] << " " << n << " " << i + 1 - mp[n] << endl;
			break;
		}
	}
}
}

Measured memory_bytes: 3292
import collections
h,w = map(int, input().split())
s=[input()for _ in range(h)]

r=[[1,0],[-1,0],[0,1],[0,-1]]
def bfs(i,j):
    global h,w,r
    f=[-1 for _ in range(h*w)]
    que = collections.deque([[i,j,0]])
    f[i*w+j] =0
    while que:
        i,j,k = que.popleft()
        for sr in r:
            ti = i + sr[0]
            tj = j + sr[1]
            if ti>=0 and tj>=0 and ti<h and tj<w:
                if s[ti][tj] == ".":
                    if f[ti*w+tj] == -1:
                        f[ti*w+tj] = k+1
                        que.append([ti,tj,k+1])
    return max(f)


res = 0
for i in range(h):
    for j in range(w):
        if s[i][j] ==".":
            tres = bfs(i,j)
            res = max(res,tres)
print(res)


Measured memory_bytes: 44268
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>

using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	if( a==2||b==2 ) {
		cout << "No";
	}else if( a==4||a==6||a==9||a==11 ){
		if( b==4||b==6||b==9||b==11 ) {
			cout << "Yes";
		}else {
			cout << "No";
		}
	}else {
		if( b==4||b==6||b==9||b==11 ) {
			cout << "No";
		}else {
			cout << "Yes";
		}
	}
//    int n;
//    int a, b;
//    vector<int> num;
//    int m;
//    cin >> n >> a >> b;;
//    for( int i=0; i<n; i++ ) {
//    	cin >> m;
//    	num.push_back(m);
//	}
//	int cnt = 0;
//	sort(num.begin(), num.end(), [](int a, int b){
//			return a>b;
//		});
//	do{
//		num[0] -= a;
//		int len = num.size();
//		for( int i=1; i<len; i++ ) {
//			num[i] -= b;
//		}
////		for( int i=0; i<n; i++ ) {
////			cout << num[i];
////		}
//		cnt++;
//		sort(num.begin(), num.end(), [](int a, int b){
//			return a>b;
//		});
//		cout << '1' << endl;
//	}while( num[0]>0 );
//	cout << endl << cnt;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (int i = (a); i >= (b); i--)
#define LFOR(i, a, b) for (long long int i = (a); i <= (b); i++)
#define LRFOR(i, a, b) for (long long int i = (a); i >= (b); i--)
#define MOD 1000000007
#define INF 1000000000           // 2000000000
#define LINF 1000000000000000000 // 9000000000000000000
#define DINF 1000000000000000.0
#define PI 3.14159265358979

//.size()はunsigned int　0-1をするとオーバーフローする

using namespace std;
typedef long long int ll;
typedef pair<long long int, long long int> P;

int dy[5] = {-1, 0, 1, 0, 0};
int dx[5] = {0, -1, 0, 1, 0};

int main(void) {
    int n;
    int count=0;
    int now=1;

    cin>>n;
    int a;
    FOR(i,1,n){
        cin>>a;
        if(a==now){
            count++;
            now++;
        }
    }
    if(now!=1){
        cout<<n-count<<endl;
    }else{
        cout<<-1<<endl;
    }
}


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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	
		int N = sc.nextInt();
		int K = sc.nextInt();
		int Q = sc.nextInt();
		int A[] = new int[Q];
		for(int i=0; i<Q; i++) {
			A[i] =sc.nextInt();
		}
		//N個分のポイントの配列を作成
		int point[] = new int[N];
      	//すべての要素をK-Qにする
		Arrays.fill(point, K-Q);
		//A[i]-1番目の要素に+1ずづ加算する
		for(int i=0; i<Q; i++) {
			point[A[i]-1]++;
		}
		//point[i]が0の場合はYes、そうでなければNo
		for(int i=0; i<N; i++) {
			if(point[i]<=0) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
		}
	}
}

Measured memory_bytes: 60008
#ifdef DBG1
  #define LOCAL
#endif

#ifdef LOCAL
  #define _GLIBCXX_DEBUG
#endif

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifdef DBG1
    #define dbg(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dbg(...)
#endif

using namespace std;

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

int getRoot(vector<int> & up, int x) {
  if (up[x] == x) {
    return x;
  } else {
    return up[x] = getRoot(up, up[x]);
  }
}

void join(vector<int> & up, int x, int y) {
  x = getRoot(up, x);
  y = getRoot(up, y);
  up[x] = y;
}

bool solve() {
  int n;
  if (scanf("%d", &n) != 1) { return false; }
  int m;
  scanf("%d", &m);
  dbg("n = %d\n", n);
  vector <int> p(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &p[i]);
    --p[i];
  }

  vector<int> up(n);
  for (int i = 0; i < n; ++i) {
    up[i] = i;
  }

  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x, --y;
    join(up, x, y);
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    if (getRoot(up, i) == getRoot(up, p[i])) {
      res++;
    }
  }
  printf("%d\n", res);
  return true;
}

int main() {
  while (solve());
  return 0;
}

Measured memory_bytes: 1024
n=int(raw_input())
g=raw_input().split()
a=[int(x) for x in g]
g=raw_input().split()
b=[int(x) for x in g]
#n=len()
acc=0
for i in range(n):
	inc=min(a[i],b[i])
	a[i]-=inc
	b[i]-=inc
	acc+=inc
	inc=min(a[i+1],b[i])
	a[i+1]-=inc
	b[i]-=inc
	acc+=inc
print(acc)


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

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define endl "\n";
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

ll const inf = 1e18;
ll const maxn = 1e6+5;
ll const mod = 1e9+7;

// code begins here

int main(){
    fast;
    
    ll x;
    cin>>x;
    
    cout<<360/__gcd(360LL, x)<<endl;
    
    return 0;
}

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

int main() {
	// your code goes here
	long long t;
	cin>>t;
	long long  x=100;
	long long flag=0;
	long long interest=0;
	while(x<t)
	{
		interest=x/100;
		x+=interest;
		flag++;
	}
	cout<<flag;
	return 0;
}

Measured memory_bytes: 3192
/* Simplicity and Goodness */

#include <bits/stdc++.h>
using namespace std;
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define deb(x) cout << #x << ' ' << x << '\n'
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define per(i,ini) for(int i=ini;i>=0;i--)
#define tc int tt; scn(tt); while(tt --)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
const int inf = INT_MAX;
const int ninf = INT_MIN;
const int mod = 998244353;
const int N = 2e5+2;

int main()
{
    ll p;
    lscn(p);

    ll a = 100;

    int cnt = 0;

    while(a < p)
    {
        cnt ++;

        a = a * (1 + 0.01);
    }   

    prin(cnt);

    return 0;
}

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

typedef long long ll;

int main() {
    ll h, w, m;
    cin >> h >> w >> m;
    vector<pair<ll, ll>> bombs(m);
    vector<ll> h_count(h), w_count(w);
    for (ll i = 0; i < m; i++) {
        ll hi, wi;
        cin >> hi >> wi;
        hi--;
        wi--;
        bombs[i] = {hi, wi};
        h_count[hi]++;
        w_count[wi]++;
    }
    vector<ll> h_orig = h_count, w_orig = w_count;
    sort(h_count.begin(), h_count.end());
    sort(w_count.begin(), w_count.end());
    ll h_max = h_count[(ll)h_count.size()-1];
    ll w_max = w_count[(ll)w_count.size()-1];
    ll h_len = h_count.end() - lower_bound(h_count.begin(), h_count.end(), h_max);
    ll w_len = w_count.end() - lower_bound(w_count.begin(), w_count.end(), w_max);
    ll c = 0;
    for (ll i = 0; i< m; i++) {
        auto p = bombs[i];
        if (h_orig[p.first] + w_orig[p.second] == h_max + w_max)
            c++;
    }
    if (c < h_len * w_len)
        cout << h_max + w_max;
    else
        cout << h_max + w_max - 1;
    return 0;
}

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

vector<vector<int>> G;
vector<vector<int>> W;
vector<bool> visited;
vector<int> dist;

void dfs(int u) {
    visited[u] = true;

    for (int i = 0; i < G[u].size(); i++) {
        int v = G[u][i];
        if (visited[v]) continue;
        dist[v] = dist[u] + W[u][i];
        visited[v] = true;
        dfs(v);
    }
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> L(M), R(M), D(M);
    G.resize(N); W.resize(N);
    for (int i = 0; i < M; i++) {
        int l, r, d;
        cin >> l >> r >> d;
        l--; r--;
        L[i] = l, R[i] = r, D[i] = d;
        G[l].push_back(r); W[l].push_back(d);
        G[r].push_back(l); W[r].push_back(-d);
    }

    visited.resize(N, false);
    dist.resize(N, 0);
    for (int i = 0; i < N; i++) {
        if (!visited[i]) dfs(i);
    }

    for (int i = 0; i < M; i++) {
        if (D[i] != dist[R[i]] - dist[L[i]]) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 18816
#include<stdio.h>
int main ()
{
    int X,A,E,S,a;
    scanf ("%d",&X);
        a=X%500;
        A=X/500;
        E=a/5;
        S=(A*500*2)+(E*5);
        printf ("%d\n",S);

     return 0;
}


Measured memory_bytes: 1708
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

int main(){
    int n;
    cin >> n;
    P mx1 = P(0, -1), mx2 = P(0, -1);
    rep(i, n){
        int num;
        cin >> num;
        if(num > mx1.first){
            swap(mx1, mx2);
            mx1.first = num;
            mx1.second = i;
        }else{
            if(num > mx2.first){
                mx2.first = num;
                mx2.second = i;
            }
        }
    }
    rep(i, n){
        if(mx1.second != i) cout << mx1.first << endl;
        else cout << mx2.first << endl;
    }
}

Measured memory_bytes: 3632
using namespace std;
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 100010
#define ll long long
#define mo 1000000007
int n;
char s[N];
int sum[N][2];
int nxt[N][2][3];
int f[N];
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for (int i=1;i<=n;++i)
		s[i]-='a';
	bool spj=1;
	for (int i=1;i<n && spj;++i)
		spj&=(s[i]!=s[i+1]);
	if (spj){
		printf("1\n");
		return 0;
	}
	for (int i=1;i<=n;++i){
		sum[i][0]=sum[i-1][0]+(s[i]==0);
		sum[i][1]=sum[i-1][1]+(s[i]==1);
	}
	nxt[n+1][0][0]=nxt[n+1][0][1]=nxt[n+1][0][2]=
	nxt[n+1][1][0]=nxt[n+1][1][1]=nxt[n+1][1][2]=n+1;
	for (int i=n;i>=1;--i){
		memcpy(nxt[i],nxt[i+1],sizeof nxt[i]);
		nxt[i][0][(sum[i][0]+i)%3]=i;
		nxt[i][1][(sum[i][1]+i)%3]=i;
	}
	f[0]=1;
	ll ans=0;
	for (int i=0;i<n;++i)
		for (int c=0;c<2;++c){
			int d=(sum[i][c^1]+i+1)%3,j=nxt[i+1][c^1][d];
			if (j<=n)
				(f[j]+=f[i])%=mo;
			if ((sum[n][c^1]+n)%3==(sum[i][c^1]+i+1)%3)
				(ans+=f[i])%=mo;
		}
//	for (int i=0;i<n;++i)
//		printf("%d ",f[i]);
//	printf("\n");
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 5320
#include <bits/stdc++.h>
using namespace std;
int n, m;
int sum = 0;
int main()
{
    cin >> n >> m;
    vector<int> x(m);
    vector<int> dif(m - 1);
    for (int i = 0; i < m; i++)
        cin >> x[i];
    sort(x.begin(), x.end());
    for (int i = 0; i < m - 1; i++)
        dif[i] = x[i + 1] - x[i];
    sort(dif.begin(), dif.end());
    for (int i = 0; i < m - n; i++)
    {
        sum += dif[i];
    }
    cout << sum << endl;
    return 0;
}

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

int main() {long H; long W; cin >> H >> W;

char str[H][W];
for(int i = 0; i < H; i++){
  for(int j = 0; j < W; j++){
    cin >> str[i][j];
  }
}
vector<int> s(H); vector<int> t(W);
for(int i = 0; i < H; i++){
  for(int j = 0; j < W; j++){
    if(str[i][j] == '#'){
      s.at(i) = 1;
      break;
    }
  }
}
  for(int j = 0; j < W; j++){
    for(int i = 0; i < H; i++){
    if(str[i][j] == '#'){
      t.at(j) = 1;
      break;
    }
  }
}

for(int i = 0; i < H; i++){
  if(s.at(i) == 1){
  for(int j = 0; j < W; j++){
    if(t.at(j) == 1){
      cout << str[i][j];
    }
  }
  cout << endl;
  }
}




// char ans = str[1][1];
//  cout << ans << endl;
 return 0;
 }

Measured memory_bytes: 256
import heapq
import sys

H, W = map(int, input().split())
c = [[int(j) for j in input().split()] for i in range(10)]
A = [[int(j) for j in input().split()] for i in range(H)]
ans = 0
for i in A:
	for j in i:
		if j == -1:
			continue
		a = [(0, j)]
		b = [False] * 10
		d = [sys.maxsize] * 10
		d[j] = 0
		while len(a):
			e = heapq.heappop(a)
			b[e[1]] = True
			for k in range(len(c[e[1]])):
				if b[k]:
					continue
				if d[e[1]] + c[e[1]][k] < d[k]:
					d[k] = d[e[1]] + c[e[1]][k]
					heapq.heappush(a, (d[k], k))
		ans += d[1]
print(ans)

Measured memory_bytes: 62556
s=gets.strip!
c=0
big=0
for i in 0...s.length do
  if i>=2 && i<=s.length-2 && s[i]=="C" then
    c+=1
  end
  if s[i]!="A" && s[i]!="C" && s[i].ord>=65 && s[i].ord<=90 then
    big+=1
  end
end
if s[0]=="A" && c==1 && big==0 then
  puts "AC"
else
  puts "WA"
end


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define ALL(a) a.begin(), a.end()
#define REP(i,a) for(ll i(0), _##i(a); i < _##i; ++i)
#define FOR(i,a,b) for(ll i(a), _##i(b); i <= _##i; ++i)
using namespace std;
using ll = long long;

void solve(){
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << " " << b << " " << c << "\n";
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    int T = 1;
    //cin >> T;
    FOR(i,1,T){
        solve();
    }
}


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

#define LL long long
#define fi first
#define se second
#define mp make_pair
#define pb push_back

using namespace std;

LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}
LL lcm(LL a,LL b){return a/gcd(a,b)*b;}
LL powmod(LL a,LL b,LL MOD){LL ans=1;while(b){if(b%2)ans=ans*a%MOD;a=a*a%MOD;b/=2;}return ans;}
const int N = 2e5 +11;
int n,a[N];
priority_queue<int>q;
int b[N],cnt;
int main(){
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=n;i>=1;i--){
		int res=0;
		//cnt=0;
		for(int j=2*i;j<=n;j+=i){
			res+=b[j];
		}
		if((res%2)!=a[i])b[i]=1;
		// if()
		if(b[i])cnt++;
	}
	cout<<cnt<<endl;
	for(int i=1;i<=n;i++)if(b[i])cout<<i<<' ';
	return 0;
}

Measured memory_bytes: 2432
#define DEBUG 0
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<class T>using numr=std::numeric_limits<T>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll LLINF = 1e16;
const int MOD = 1000000007;
const int MOD2 = 998244353;
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#if DEBUG
#define debug(...)\
    do {\
        std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        std::cerr << std::noboolalpha;\
    } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
    { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
os << "{";
    for (auto it = v.begin(); it != v.end(); it++)
        {os << (it != v.begin() ? "," : "") << *it;}
    return os << "}";
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s == "SSS") cout << "0" << endl;    
    else if(s == "SRR"|| s == "RRS") cout << "2" << endl;
    else if(s == "RRR") cout << "3" << endl;
    else cout << "1" << endl;
}

Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;

vector<vector<int>> make_graph(int n, int d) {
  int N = n * 2;
  vector<vector<int>> ans(N * N);
  for (int i = 0; i * i <= d; i = -i + (i <= 0)) {
    for (int j = 0; i * i + j * j <= d; j = -j + (j <= 0)) {
      if (i * i + j * j == d) {
        for (int y = 0; y < N; y++) {
          for (int x = 0; x < N; x++) {
            int yy = y + i;
            int xx = x + j;
            if (yy < 0 || xx < 0 || yy >= N || xx >= N) continue;
            ans[y * N + x].push_back(yy * N + xx);
          }
        }
      }
    }
  }
  return ans;
}

vector<int> coloring(vector<vector<int>> g) {
  vector<int> ans(g.size(), 2);
  for (int i = 0; i < g.size(); i++) {
    if (ans[i] != 2) continue;
    ans[i] = 0;
    queue<int> q;
    q.push(i);
    while (!q.empty()) {
      int u = q.front(); q.pop();
      for (int v : g[u]) {
        if (ans[v] == 2) {
          ans[v] = ans[u] ^ 1;
          q.push(v);
        }
      }
    }
  }
  return ans;
}

int main() {
  int n, d1, d2;
  cin >> n >> d1 >> d2;
  int N = n * 2;
  auto g1 = make_graph(n, d1);
  auto g2 = make_graph(n, d2);
  vector<int> c1 = coloring(g1);
  vector<int> c2 = coloring(g2);
  vector<int> cnt(4);
  for (int i = 0; i < c1.size(); i++) {
    cnt[c1[i] << 1 | c2[i]]++;
  }
  int k = max_element(cnt.begin(), cnt.end()) - cnt.begin();
  int left = n * n;
  for (int i = 0; i < n * 2; i++) {
    for (int j = 0; j < n * 2; j++) {
      int u = i * n * 2 + j;
      if ((c1[u] << 1 | c2[u]) == k && left > 0) {
        left--;
        cout << i << ' ' << j << endl;
      }
    }
  }
}


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

int main() {
	int n;
	cin >> n;
	if(n%10 == 3){
		cout << "bon";
	} else if(n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8){
		cout << "pon";
	} else {
		cout << "hon";
	}
}

Measured memory_bytes: 3604
N = int(input())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
S1 = 0
S2 = 0
for n in range(N):
    S1 += a[n]
    S2 += a[n]
    if n%2 == 0:
        if S1 >= -1:
            ans1 += S1 + 1
            S1 = -1
        if S2 <= 1:
            ans2 += 1 - S2
            S2 = 1
    if n%2 == 1:
        if S1 <= 1:
            ans1 += 1 - S1
            S1 = 1
        if S2 >= -1:
            ans2 += S2 + 1
            S2 = -1
print(min(ans1,ans2))


Measured memory_bytes: 14468
#include<iostream>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<bitset>
#include<functional>
#include<iterator>
#include<complex>
#include<fstream>
#include<random>
using namespace std;
//#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
//#define REP(i, n) FOR(i, 0, n - 1)
#define REP(i,n) for (int i = 0; i < (n); ++i)
//#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using PII = pair<ll, ll>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
ll mypow(ll x, ll n, ll m) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 0) {
		return mypow(x*x%m, n / 2, m);
	}
	else {
		return x * mypow(x, n - 1, m) % m;
	}
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
const double PI=3.14159265358979323846;
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
//テーブルをつくる前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;//mod pにおける1,2,,,nの逆元
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i%INF;
		inv[i] = INF - inv[INF%i] * (INF / i) % INF;
		finv[i] = finv[i - 1] * inv[i] % INF;
	}
}

ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}
///////////////////////////////////////

int c[10][1005];
int main() {
	int h, w, k; cin >> h >>w >> k;
	vector<string>s(11);
	REP(i, h)cin >> s[i];
	int ans = INF;
	REP(div, 1 << (h - 1)) {
		int g = 0;
		vector<int>id(h);
		REP(i, h) {
			id[i] = g;
			if (div >> i & 1)++g;
		}
		g++;
		REP(i, g)REP(j, w)c[i][j] = 0;
		REP(i, h)REP(j, w)c[id[i]][j] += (s[i][j] - '0');
		int num = g - 1;
		vector<int>now(11,0);
		bool ok = true;
		REP(j, w) {
			REP(i, g) {
				now[i] += c[i][j];
			}
			REP(i, g) {
				if (now[i] > k) {
					num++;
					now = vector<int>(g,0);
					REP(l, g) {
						now[l] += c[l][j];
					}
					REP(l, g) {
						if (now[l] > k) {
							ok = false;
						}
					}
				}
			}
		}
		if (ok) {
			ans = min(ans, num);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
long long n,h[101],ans,b[101],mini=0;
int main(){
	cin>>n;
	int cnt=n;
	for(int i=0;i<n;i++){
		cin>>h[i];}
		for(int i=n;i>0;i--){
			for(int j=0;j<i;j++){
				if(h[i]<h[j]){
				cnt--;
				break;}
		}
	}
		cout<<cnt+1;}


Measured memory_bytes: 256
/*
   * * * * *       *        * * * * * * * * * * * * * * * * * * * * * * * *     * * * * * * *               * *               * * * * * * * * * *
   * * * * *      * *       * * * * * * * * * * * * * * * * * * * * * *    *    * * * * * * *              * * *             * ** * * * * * * * * *
   * *           * * *            * *     * *     * *      * *          * * *   * * *       *             * * * *           * * * *       * *    * *
   * * * * *    * * * *           * *     * *     * *       * * * * * * *  * *  * * * * * * *            * * * * *         * *  * *       * * * * *
   * * * * *   * * * * *          * *     * *     * *        * * * * ** *   * * * * * * * * *           * * * * * *       * *   * * * *   * * * *
         * *  * * * * * *   * *   * *     * *     * *       * * * * * * *    * ** *     * * *          * * * * * * *     * *    * * * *   * *  * *
         * * * *       * *  * *   * *     * *     * *      * *          *     * * *     * * *         * *       * * *   * *     * *       * *   * *
   * * * * ** *         * * * * * * * * * * * * * * * * * * * * * * * * *      *  * * * * * * * * * ** *         * * * * *      * * * * * * *    * *
   * * * * * *           * ** * * * * * * * * * * * * * * * * * * * * * *       * * * * * * * * * * * *           * * * *       * * * * * * *     * *
*/

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <set>
#define ll long long
#define rep(i, a, b) for (int i = int(a); i <= int(b); i++)
#define sz(a) int((a).size())
#define shit while(t--)
#define fr for(int i=0;i<n;i++)
int maxo=1e9+7;
using namespace std;
int arr[95];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll x;
    cin>>x;
    if(x==0)
    {
        cout<<"1"<<endl;
    }
    else if(x==1)
    {
        cout<<"0"<<endl;
    }

    return 0;
}

Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>
void view(const std::vector<T> &v)
{
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

#pragma region sieve
struct sieve
{
    int n;
    vector<int> f, primes;

    sieve(int n = 1) : n(n), f(n + 1)
    {
        for (int i = 2; i <= n; i++)
        {
            if (f[i])
                continue;
            primes.push_back(i);
            f[i] = i;
            for (ll j = i * i; j <= n; j += i)
            {
                if (!f[j])
                    f[j] = i;
            }
        }
    }

    bool isPrime(int x)
    {
        return f[x] == x;
    }

    vector<int> factorList(int x)
    {
        vector<int> res;
        while (x != 1)
        {
            res.push_back(f[x]);
            x /= f[x];
        }
        return res;
    }
    vector<pair<int, int>> factor(int x)
    {
        auto fl = factorList(x);
        if (fl.size() == 0)
        {
            return {};
        }
        vector<P> res(1, P(fl[0], 0));
        for (int p : fl)
        {
            if (res.back().first == p)
            {
                res.back().second++;
            }
            else
            {
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
};
#pragma endregion

int main()
{
    ll a, b;
    cin >> a >> b;
    ll x = gcd(a, b);
    ll y = sqrt(x);

    ll ans = 1;
    for (int i = 2; i <= y; ++i)
    {

        if (x % i == 0)
        {
            ans++;
        }

        while (x % i == 0)
            x /= i;
    }
    ans += x > 1;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int n;
int ax[5000],ay[5000];
int bx[5000],by[5000];
 
vector< ll > X,Y;
 
vector< int > Ga[5000];
vector< int > Gb[5000];
int f[5000];
 
int main(){
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>ax[i]>>ay[i]>>bx[i]>>by[i];
    X.push_back(ax[i]);
    Y.push_back(ay[i]);
    X.push_back(bx[i]);
    Y.push_back(by[i]);
  }
  sort(X.begin(),X.end());
  sort(Y.begin(),Y.end());
  X.erase( unique( X.begin(), X.end()) , X.end() );
  Y.erase( unique( Y.begin(), Y.end()) , Y.end() );
   
  for(int i=0;i<n;i++){
    ax[i]=lower_bound(X.begin(),X.end(),ax[i])-X.begin();
    ay[i]=lower_bound(Y.begin(),Y.end(),ay[i])-Y.begin();
    bx[i]=lower_bound(X.begin(),X.end(),bx[i])-X.begin();
    by[i]=lower_bound(Y.begin(),Y.end(),by[i])-Y.begin();
 
    Ga[ ay[i] ].push_back( ax[i] );
    Ga[ ay[i] ].push_back( bx[i] );
    Gb[ by[i] ].push_back( ax[i] );
    Gb[ by[i] ].push_back( bx[i] );
  }
  ll ans=0;
 
  for(int y=0;y+1<(int)Y.size();y++){
    for(int i=0;i<(int)Ga[y].size();i+=2){
      int si=Ga[y][i];
      int ti=Ga[y][i+1];
      for(int x=si;x<ti;x++)f[x]++;
    }
    for(int i=0;i<(int)Gb[y].size();i+=2){
      int si=Gb[y][i];
      int ti=Gb[y][i+1];
      for(int x=si;x<ti;x++)f[x]--;
    }
    for(int x=0;x+1<(int)X.size();x++){
      if(f[x]==0)continue;
      ans+=(Y[y+1]-Y[y])*(X[x+1]-X[x]);
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N);
int sum = 0;
 for (int i = 0; i < N; ++i) {
 cin >> a[i];
 sum += a[i];
 }

 int mini = sum;
 int prefix_sum = 0;
 for (int i = 0; i < N; ++i) {
 cin >> a[i];
 prefix_sum += a[i];
 mini = min(mini, abs(prefix_sum - (sum - prefix_sum)));
 }

 cout << mini << endl;
 return 0;
 }

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

int main(){
    int n,m;
    cin >> n >> m;
    int a[m],d[m];
    fill(d,d+m,0);
    for(int i=0; i<m; i++){
        int b;
        cin >> a[i] >> b;
        for(int j=0; j<b; j++){
            int c;
            cin >> c;
            d[i] += pow(2,c-1);
        }
    }
    int max_state = pow(2,n);
    int dp[m+1][max_state];
    int inf = 1000000000;
    for(int i=0; i<m+1; i++){
        for(int j=0; j<max_state; j++){
            dp[i][j] = inf;
        }
    }
    for(int i=0; i<m+1; i++){
        dp[i][0] = 0;
    }
    for(int i=1; i<m+1; i++){
        for(int j=1; j<max_state; j++){
            dp[i][j] = dp[i-1][j];
        }
        for(int j=0; j<max_state; j++){
            int k = j|d[i-1];
            if(dp[i][k] > dp[i-1][j] + a[i-1]) dp[i][k] = dp[i-1][j] + a[i-1];
        }
    }
    if(dp[m][max_state-1] == inf) cout << -1 << endl;
    else cout << dp[m][max_state-1] << endl;
    return 0;
}


Measured memory_bytes: 16256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fr first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int H,W;cin>>H>>W;
  vector<string> G(H);
  REP(i,0,H)cin>>G[i];
  vector<vector<int>> visited(H,vector<int>(W,0));
  REP(i,0,H)REP(j,0,W){
    visited[i][j]=(G[i][j]=='#'?1:0);
  }

  queue<P> que;
  bool possible=false;
  que.push(make_pair(0,0));
  while(que.size()){
    P p = que.front();que.pop();
    visited[p.fr][p.se]=0;
    if(p.first==H-1&&p.se==W-1){
      possible=true;
      break;
    }
    P under,right;
    if(p.fr+1<H){
      under=P(p.fr+1,p.se);
    }
    if(p.second+1<W){
      right=P(p.first,p.second+1);
    }
    if(p.first+1<H&&p.second+1<W){
      if(G[under.fr][under.se]=='#'&&G[right.fr][right.se]=='#'){
        print("Impossible");
        re 0;
      }
    }
    if(p.first+1<H&&G[under.fr][under.se]=='#'){
      que.push(under);
    }
    if(p.second+1<W&&G[right.fr][right.se]=='#'){
      que.push(right);
    }
  }
  REP(i,0,H)REP(j,0,W){
    if(visited[i][j]==1)possible=false;
  }
  print((possible?"Possible":"Impossible"));

}


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

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

  int x = 0;
  for (int i = 0; i < n.size(); i++) x += (int)(n[i] - '0');

  if (x % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3728