akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

using namespace std;

typedef long long ll;
ll N;

int juclid(ll a,ll b){
  ll tmp;
  if(a<b){
    tmp=a;
    a=b;
    b=tmp;
  }
  ll r;
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}


int main(){
  cin >> N;
  ll A[N];
  for(int n=0;n<N;n++){
    cin >> A[n];
  }
  ll init = A[0];
  for(int n=0;n<N;n++){
    init=juclid(init,A[n]);
  }
  cout << init << endl;
}


Measured memory_bytes: 1400
#include<stdio.h>
#define N 501


static const int WH = 0;
static const int GR = 1;
static const int BL = 2;

int num,M[N][N];
int co[N],da[N],fa[N],tta;

void sea(int x){
  int v;
  co[x] =GR;
  tta++;
  da[x]=tta;
  for(v=0;v<num;v++){
    if(M[x][v] == 0){
      continue;
    }
    if(co[v] == WH){
     sea(v);
    }
  }
  co[x] = BL;
  fa[x] = ++tta;
}

void ho(){
  int i,x;
  for(i=0;i<num;i++){
    co[i] = WH;
  }
  tta=0;
  for(x=0;x<num;x++){
    if(co[x] == WH){
      sea(x);
    }
  }
  for(i=0;i<num;i++){
    printf("%d %d %d\n",i+1,da[i],fa[i]);
  }
}

int main(){
  int x,h,w;
  int i,j;

  scanf("%d",&num);

  for(i=0;i<num;i++){
    for(j=0;j<num;j++){
      M[i][j]=0;
    }
  }

  for(i=0;i<num;i++){
    scanf("%d %d",&x,&h);
    x--;
    for(j=0;j<h;j++){
      scanf("%d",&w);
      w--;
      M[x][w] =1;
    }
  }
  ho();

  return 0;
}



Measured memory_bytes: 2088
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	scanf("%d",&a);
	int ans=0;
	for(int i=1;i<=a;++i){
		int x;
		scanf("%d",&x);
		if(i%2&&x%2)ans++;
	}
	printf("%d\n",ans);
	return 0;
} 

Measured memory_bytes: 3820
#include<stdio.h>
int main(){
    char S[5];
    scanf("%s",S);
    if(S[0]==S[1]){
        if(S[0]!=S[2] && S[2]==S[3]){
            printf("%s\n","Yes");
        }else{
            printf("%s\n","No");
        }
    }else if(S[0]==S[2] && S[1]==S[3] || S[0]==S[3] && S[1]==S[2] ){
       printf("%s\n","Yes");
    }else{
       printf("%s\n","No");
    }
    return 0;
  }

Measured memory_bytes: 128
# ABC 76, B - addition and multiplication
n = int(input())
k = int(input())

X = []
for i in range(2**n):
    x = 1
    for j in range(n):
        if (i >> j) & 1:
            x = 2*x
        else:
            x = x+k
    X.append(x)

print(min(X))


Measured memory_bytes: 2940
#include<stdio.h>
int main(){
	int a[10],i,i2,work;
	for(i=0;i<10;i++)scanf("%d",&a[i]);
	for(i=0;i<9;i++){
		for(i2=i+1;i2<10;i2++){
			if(a[i]<a[i2]){
				work=a[i];
				a[i]=a[i2];
				a[i2]=work;
			}
		}
	}
	printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

ll chk(char a, char b, char c){
    if(a == b && b == c && c == a) return 0;
    else if(a != b && b != c && c != a) return 2;
    else return 1;
}

int main(){
    Init();
    string a, b,c; ll n, ans = 0;
    cin >> n >> a >> b >> c;
    rep(i, n) ans += chk(a[i], b[i], c[i]);
    cout << ans << endl;
}

Measured memory_bytes: 3600
import Control.Monad (replicateM)

main = do
    n <- readLn
    if n == 0 then return () else do
        print $ solve n
        main

solve :: Int -> Int
solve n = counts [500,100,50,10,5,1] (1000-n)
    where
    counts [] _ = 0
    counts (c:cs) r = (r `div` c) + counts cs (r `mod` c)

Measured memory_bytes: 3568
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;

int main() {
	int x, a, b;
	cin >> x >> a >> b;
	x = x - a;
	int tmp = -1;
	for (int i = 0; b * i <= x; i++) {
		tmp++;
	}

	cout << x - tmp * b;
}

	

Measured memory_bytes: 256
n,m = map(int, input().split())

num = 0
dic = {}

for i in range(m):
  s,c = map(int, input().split())
  if n!=1 and s==1 and c==0: 
    print(-1)
    exit()
  if s not in dic:
    dic[s] = c
    num = num + c*(10**(n-s))
  elif c!=dic[s]:
    print(-1)
    exit()

if 1 not in dic and n>1:
  num = num + 10**(n-1)

print(num)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define maxn 100000
int main()
{
	int n,x;
    cin>>n>>x;

	ll a,b,cnt=0;
        cin>>a;
	if(a>x){
		cnt+=a-x;
		a=x;
	}
	for(int i=1;i<n;i++)
	{
		cin>>b;
		if((a+b)>x)
		{
			cnt+=a+b-x;
			a=x-a;
		}
		else {
                a=b;
        }
	}
	cout<<cnt<<endl;
	return 0;
}

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

int n;
long double p[3005];
long double dp[3005][3005];

long double f(int i, int j) {
    if(j < i) return 0;
    
    if(dp[i][j] >= 0) return dp[i][j];
    if(i == 0 and j == 0) return dp[i][j] = 1;
    if(i == 0) return dp[i][j] = f(i, j-1)*(1-p[j]);
    
    return dp[i][j] = p[j]*f(i-1, j-1) + (1-p[j])*f(i, j-1);
}

int main() {
	// your code goes here
	cin >> n;
	for(int i = 1; i <= n; i++) {
	    cin >> p[i];
	}
	memset(dp, -1, sizeof dp);
	
	long double res = 0.0;
	for(int i = n/2+1; i <= n; i++) {
	    res += f(i, n);
	}
	
	cout << setprecision(9) << res;
	return 0;
}


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



int main()
{
	long long int i, j, k, l, m, n, sum, flag,K, N, M,cnt;
	cin >> N;
	flag = 0;
	for (i = 0; i <= 25; i++) {
		for (j = 0; j < 15; j++) {
			if (N == 4 * i + 7 * j) {
				flag = 1;
				break;
			}
		}
	}
	if (flag)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;



    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<string.h>
#include<queue>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<cstdlib>
#include<math.h>
#include<set>
#include<array>
using namespace std;

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



#define rep(n) for(int i=0;i<n;i++)
typedef pair<int, int> pii;

typedef long long ll;
typedef pair<ll, ll>pll;
const int MOD = 1000000007;
const int INF = 1 << 29;


int main() {
	
	int a, b;
	char s[100];
	cin >> a >> b;
	for (int i = 0; i < a + b + 1; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < a + b + 1; i++) {
		if (i == a && s[i] != '-') {
			cout << "No" << endl;
			return 0;
		}
		if (i != a && ((s[i]=='-') ||( s[i] - '0' > 9 && s[i] - '0' < 0))) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
	
}


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

const int MOD = 1e9 + 7;
const long long MAX = 5*1e5+1;
long long fact[MAX], fact_inv[MAX], inv[MAX];
 
void init_nCk() {
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX;i++) {
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
}
 

long long nCk(int n, int k) {
    if(n<k) return 0;
    else if(n<0||k<0) return 0;
    else return fact[n] * (fact_inv[k] * fact_inv[n - k] % MOD) % MOD;
}
long long nPk(int n,int k){
    if(n<k) return 0;
    else if(n<0||k<0) return 0;
    else return fact[n]*(fact_inv[n-k]%MOD)%MOD;

}

int main(){
   long long temp,ans,M,N;
    temp=0;
    std::cin>>N>>M;
    init_nCk();
        for(int i=0;i<=N;i++){
            temp+=(1-i%2*2)*((nPk(M,i)*(nPk(M-i,N-i))%MOD)*((nPk(M-i,N-i))*nCk(N,i)%MOD))%MOD;
            temp=(temp+MOD)%MOD;
        }
    ans=(nPk(M,N)*nPk(M,N)%MOD-temp%MOD)%MOD;
    std::cout<<temp; 
    return 0;
   
}


Measured memory_bytes: 14844
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cstring>

using namespace std;

int main()
{
	int n;
	const double pi = 3.141592653589793;

	scanf("%d", &n);

	printf("%.10lf\n", pi*(double)(n * 2));

	return 0;
}

Measured memory_bytes: 1740
// ===================================
//   author: M_sea
//   website: http://m-sea-blog.com/
// ===================================
#include <bits/stdc++.h>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

int main() {
    int a=read(),b=read();
    if (a==b) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        Console.WriteLine(getAns(n, a) ? "APPROVED" : "DENIED");
    }
    static bool getAns(int n, int[] a)
    {
        for (int i = 0; i < n; i++)
            if (a[i] % 2 == 1) continue;
            else
            {
                if (a[i] % 3 == 0 | a[i] % 5 == 0) continue;
                else { return false; }
            }
        return true;
    }
}


Measured memory_bytes: 13140
package main

import "fmt"

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	n %= k
	for {
		bn := n
		n = min(n, abs(n-k))
		if n == bn {
			fmt.Println(n)
			return
		}
	}
}


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

#define pb                     push_back
#define ll                     long long
#define forn(i,n)              for(int i=0; i<(int)n; i++)
#define forn1(i,n)              for(int i=1; i<=(int)n; i++)

#define sfd(a)                 scanf("%d", &a)
#define sffd(a,b)              scanf("%d%d", &a, &b)
#define sffl(a,b)              scanf("%lld%lld", &a,&b)
#define sfl(a)                 scanf("%lld", &a)

#define pii                    pair<int , int>
#define pll                    pair<ll , ll>
#define ff                     first
#define ss                     second
#define mem(a, val)            memset(a, val, sizeof(a))
#define all(x)                 (x).begin(), (x).end()

//#define mx                     200005
#define INF_mx                 1e18
#define gcd(a,b)               __gcd(a, b)
#define lcm(a,b)               (a*b)/__gcd(a,b)
#define PRINT                  cout<<"hi"<<endl
#define PI acos(-1)
#define fast_in_out          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Q    int q; cin>>q; while(q--)
/*
tree<
       int,
     null_type,
     less<int>,
     rb_tree_tag,
     tree_order_statistics_node_update>t;
*/

int main()
{
   int n;
   cin>>n;
   string s;
   cin>>s;
   set<int>R;
   set<int>G;
   set<int>B;

   for(int i=0; i<s.size(); i++){
      if(s[i]=='R') R.insert(i+1);
      else if(s[i]=='G') G.insert(i+1);
      else B.insert(i+1);
   }
//   cout<<"R = "<<R.size()<<endl;
//   for(auto r:R) cout<<r<<" ";
//   cout<<"\n";
//   cout<<"G = "<<G.size()<<endl;
//   for(auto r:G) cout<<r<<" ";
//   cout<<"\n";
//   cout<<"B = "<<B.size()<<endl;
//   for(auto r:B) cout<<r<<" ";
//   cout<<"\n";
//
   ll ans=0;
//cout<<" hala = "<<B.count(0)<<endl;
int tmm=B.size();
   for(auto r:R){
    for(auto g:G){
            int gg=g, rr=r;
            ll tm=tmm;
            if(gg<rr) swap(gg, rr);

        int df=abs(g-r);




       // if(r-df>0 && g+df<=n){
            if(B.count(gg+df)) tm--;

            if(B.count(rr-df)) tm--;
        //}



        int md;
        if( (g%2==0 && r%2==0) || (g%2!=0 && r%2!=0) )
           {
               md=(g+r)/2;

               if(B.count(md)) {tm--; }
           }



            ans+=tm;
    }
   }
   cout<<ans<<endl;
    return 0;
}
/*
1
21 7
wudixiaoxingxingheclp
*/


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

int main(){
  int N;
  cin>>N;
  map<int,int> A;
  for(int i=0;i<N;i++){
    int a;
    cin>>a;
    A[a]++;
  }
  int j=0,k=0;
  for(pair<int,int> i:A){
    if(i.second>=2){
      j=k;
      k=i.first;
    }if(i.second>=4){
      j=i.first;
    }
  }
  cout<<(int64_t)j*(int64_t)k<<endl;
}

Measured memory_bytes: 4992
/*"Success isn't permanent, failure isn't fatal,
                                      it's the courage to continue that counts"*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define ll long long 
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define lpri(n) printf("%lld",n)
#define pri(n) printf("%d",n)
#define pln() printf("\n")
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define pb push_back     
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define inf INT_MAX
#define ninf INT_MIN
const int mod=1e9+7;         
const int N=2e5+4;

int main()
{
	int k,n;

	scn(k); scn(n);

	int a[n];

	rep(i,0,n)
	scn(a[i]);

	int mx=0;

	rep(i,1,n)
	mx=max(mx,a[i]-a[i-1]);

	mx=max(mx,k-(a[n-1]-a[0]));

	pri(k-mx);

    return 0;
}

Measured memory_bytes: 1024
'use strict';
process.stdin.on('data', function(chunk) {
  var inputs = chunk.toString().trim();
  var S = Number(inputs);
  var h = Math.floor(S/3600);
  /*var m = Math.floor((S-(h*3600))/60);*/
  var m=Math.floor(S%3600/60);
  var s=S%60;

console.log([h,m,s].join(':'));
});
process.stdin.resume();
process.stdin.setEncoding('utf8');

Measured memory_bytes: 15548
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
bool prime[1000001];
int main(){
	int n;
		prime[1] = true;
		for(int i = 2; i * i <= 1000000; i++){
			if(!prime[i]){
				for(int j = i + i; j <= 1000000; j += i){
					prime[j] = true;
				}
			}
		}
	while(cin >> n){
		int ans = 0;
		for(int i = 1; i <= n; i++){
			if(!prime[i])ans++;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 2136
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll w, h, n;
	cin >> w >> h >> n;
	ll lw = 0, lh = 0;
	ll x[n], y[n], a[n];
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i] >> a[i];

		if (a[i] == 1) {
			lw = max(x[i], lw);
		} else if (a[i] == 2) {
			w = min(w, x[i]);
		} else if (a[i] == 3) {
			lh = max(y[i], lh);
		} else if (a[i] == 4){
			h = min(h, y[i]);
		}
	}
	if (w - lw <=0 || h - lh <= 0) return cout << 0 << endl,0;
	cout <<  (ll) (w - lw) * (h - lh);
	return 0;

}


Measured memory_bytes: 3520
function main(input) {
    const args = input.split(' ');
    const X = parseInt(args[0], 10);
    const A = parseInt(args[1], 10);

    if (X >= A) {
        console.log('10');
    } else {
        console.log('0');
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

using namespace std;

typedef long long int ll;

const long double pi = 3.141592653589793238462643;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);cout.tie(0);

  cout << fixed << setprecision(18);

  double a, b, h, m;
  cin >> a >> b >> h >> m;
  double teta = abs(((h * 60 + m) / 2) - 6 * m);
  double ans = sqrt(a * a + b * b - 2 * a * b * cos(teta * pi / 180.0));

  cout << ans << '\n';
}


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

int main(void) {
	int C1, C2, C3;
	int sum, over20, under20;
	
	while(cin >> C1 >> C2 >> C3) {
		sum = C1 + C2;
		over20 = 0;
		under20 = 0;
		int card[10 + 1] = {};
		++card[C1];
		++card[C2];
		++card[C3];
		
		for(int i = 1; i <= 10; ++i) {
			if(card[i] == 0) {
				if(sum + i <= 20) {
					++under20;
				} else {
					++over20;
				}
			}
		}
		if(under20 >= over20) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 3004
#include<stdio.h>

int main()
{
    int a,h,n,i;
    scanf("%d %d",&h,&n);
    for(i=0;i<n;i++){
        scanf("%d",&a);
        h = h - a;
    }
    if(h <= 0){
        printf("Yes");
    }
    else{
        printf("No");
    }

    return 0;
}

Measured memory_bytes: 128
from collections import defaultdict

n, m = list(map(int, input().split()))

sc = [list(map(int, input().split())) for _ in range(m)]

flag = True

num = {}

for s, c in sc:
    if s == 1 and c == 0 and n >= 2:
        flag = False
        break
    elif num.get(s) == None:
        num[s] = c
    else:
        if num.get(s) != c:
            flag = False
            break

a = -1

if flag:
    a = 0
    for k, v in num.items():
        a += v * (10**(n-k))
    if 1 not in num.keys() and n != 1:
        a += 10**(n-1)


print(a)

Measured memory_bytes: 3316
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
	public static void main(String[] args) {  
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		long x = I.nextLong();
		long y = I.nextLong();
		long ans = 0;
		while (x<=y) {
			ans++;
			x*=2;
		}
		O.pln(ans);
	}
	public static long abs(long x, long y) {return Math.abs(x-y);}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
		double nextDouble() {return Double.parseDouble(next());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}


Measured memory_bytes: 25572
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) ((x).begin(), (x).end())
using namespace std;
using ll = long long;
template <typename T> using V = vector<T>;

constexpr int Mod = 998244353;
constexpr int mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

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

/*-------------------------------------------*/

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

    string s;
    int n, k;
    cin >> n >> k >> s;
    s[k - 1] += 'a' - 'A';
    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2e5+5;
int n,q;
int head[maxn],nex[maxn*2],to[maxn*2];
ll sum[maxn];
int tot=0;
void add(int u,int v)
{
    to[++tot]=v,nex[tot]=head[u],head[u]=tot;
}
void dfs(int u,int fa)
{
    sum[u]+=sum[fa];
    for(int i=head[u];i;i=nex[i])
    {
        int v=to[i];
        if(v==fa)
            continue;
        dfs(v,u);
    }
}
int main()
{
    scanf("%d%d",&n,&q);
    for(int i=1; i<n; i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        add(u,v);
        add(v,u);
    }
    while(q--)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        sum[a]+=b;
    }
    dfs(1,0);
    printf("%lld",sum[1]);
    for(int i=2; i<=n; i++)
        printf(" %lld",sum[i]);
}


Measured memory_bytes: 14080
#include<iostream>
using namespace std;
int main()
{
    char a=getchar(),b,c;
    int ans=-3;//我们会遇到3个多余的，分别是最后一个字母，\r和EOF
    putchar(a);
    while(a!=EOF)//当没有字符可以读取时退出循环
    {
        ans++;//长度+1
        c=b;//这里是因为getchar后b的值是\r而不是要输出的字符，所以建变量存储b的信息
        b=a;//这里是因为getchar后a的值是EOF而不是要输出的字符，所以建变量存储a的信息
        a=getchar();
    }
    cout<<ans;
    putchar(c);
    puts("");//刷AT题不换行的都是神仙
    return 0;
}

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

int main() {
	int a, b;
	cin >> a >> b;
	
	if (a==1) a+=15;
	if (b==1) b+=15;
	if (a==b) cout << "Draw\n";
	else if (a>b) cout << "Alice\n";
	else if (b>a) cout << "Bob\n";

	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int a, b; cin >> a >> b;
	cout << (a + b) % 24 << endl;
	return 0;
}

Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

public class Main { //christmas gifts
    static StringTokenizer st;
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args)throws IOException {
        int N = readInt();
        String s = next();
        for(int i =0; i < s.length(); i++){
            char ch = s.charAt(i);
            if(ch+N>90)
                ch = (char)(65 + (N+ch-91));
            else
                ch = (char)(ch + N);
            System.out.print(ch);
        }
    }
    static class Pair {
        int p , s;
        public Pair(int p, int s){
            this.p = p;
            this.s = s;
        }
    }
    static String next() throws IOException{
        while(st==null||!st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
    static int readInt() throws IOException{
        return Integer.parseInt(next());
    }
}


Measured memory_bytes: 24148
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/

#pragma comment(linker, "/STACK:268435456")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define endl ("\n")
#define deb(n) cerr << #n << " = " << (n) << '\n'
#define FOR(i, n) for (int(i) = 0; (i) < n; (i)++)
#define PI (3.141592653589)
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define MOD 1000000007

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed;
    cout.precision(10);
    // Those who cannot acknowledge themselves, will invariably fail
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    long long dp[n][n];
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
        {
            dp[i][j] = 0;
        }
    for (int gap = 0; gap < n; gap++)
    {
        for (int i = 0; i + gap < n; i++)
        {
            int j = i + gap;
            if ((gap + 1) % 2 == n % 2)
            {
                // first player
                if (i == j)
                {
                    dp[i][j] = arr[i];
                }
                else
                {
                    dp[i][j] = max(dp[i][j - 1] + arr[j], dp[i + 1][j] + arr[i]);
                }
            }
            else
            {
                // second player
                if (i == j)
                {
                    dp[i][j] = -arr[i];
                }
                else
                {
                    dp[i][j] = min(dp[i][j - 1] - arr[j], dp[i + 1][j] - arr[i]);
                }
            }
        }
    }
    cout << dp[0][n - 1];

    return 0;
}

Measured memory_bytes: 70528
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

constexpr int P = 1000000007;

ll modinv(int n) {
    int m = P, y = 0, v = 1;
    while (1) {
        int q = m / n;
        int r = m % n;
        if (r == 0) return v < 0 ? v + P : v;
        y -= v * q;
        swap(y, v);
        m = n;
        n = r;
    }
}

int sgn(int a) {
    return a < 0 ? -1 : a == 0 ? 0 : 1;
}

ll solve() {
    int n, k;
    cin >> n >> k;

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end(), [&](const int &a0, const int &a1) {
        return abs(a0) > abs(a1);
    });

    ll r = 1;
    int s = 1;
    ll mi[2] = {};
    ll ma[2] = {}; ma[0] = -1;
    for (int i = 0; i < k; i++) {
        r = r * a[i] % P;
        s = s * sgn(a[i]);
        mi[a[i] < 0] = a[i];
    }

    if (s >= 0) return r;

    for (int i = n - 1; i >= k; i--) {
        ma[a[i] < 0] = a[i];
    }

    int m = 0;
    if (mi[0] && ma[1]) m |= 1;
    if (mi[1] && ma[0] >= 0) m |= 2;
    if (m > 0) {
        if (m == 1 || (m == 3 && abs(ma[1] * mi[1]) > abs(ma[0] * mi[0]))) {
            r = r * ma[1] % P * modinv(mi[0]) % P;
        } else {
            r = r * ma[0] % P * modinv(mi[1] + P) % P;
        }
        return r;
    }

    r = 1;
    for (int i = 0; i < k; i++) {
        r = r * a[n - 1 - i] % P;
    }
    return r;
}

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

    ll r = solve();
    r %= P;
    if (r < 0) r += P;
    cout << r << endl;

    return 0;
}

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

int main() {
int a[5];
for(int i=0; i<5; i++) cin >> a[i];
sort(a, a+5, greater<int>() );
for(int i=0; i<4; i++) printf("%d ",a[i]);
printf("%d\n",a[4]);
return 0;
}

Measured memory_bytes: 1160
/*input
-1000000000 0 -1000000000 0
*/

// Nihesh Anderson - knandy

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key
ll MOD=1000000007;

#define endl '\n'
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
ll INF = 2000000000000000001;
long double EPS = 1e-9;
ll power(ll a, ll n, ll md){if(n==0){return 1;}else{ll res=power(a,n/2,md);res=(res*res)%md;if(n%2!=0){res=(res*a)%md;}return res;}}
random_device rndm;
mt19937 grndm(rndm());
void mix(ll* a, ll* b){shuffle(a,b,grndm);}

int main(){
	fast_cin();
	// freopen("input.in","r",stdin);
	// freopen("output.out","w",stdout);
	vector<ll> a(2), b(2);
	cin >> a[0] >> a[1];
	cin >> b[0] >> b[1];
	ll ans = -INF;
	for(ll i = 0; i < 2; i++) {
		for(ll j = 0; j < 2; j++) {
			ans = max(ans, a[i] * b[j]);
		}
	}
	cout << ans << endl;
	return 0;
}




















Measured memory_bytes: 3656
#include <stdio.h>
int main (void){
    long long int a,b;
    scanf("%lld %lld",&a,&b);
    if(a>0 && b>0){
        printf("Positive\n");
        return 0;
    }
    if(a==0 || b==0 || (a<0 && b>0)){
        printf("Zero\n");
        return 0;
    }
    if((b-a)%2==0){
        printf("Negative\n");
        return 0;
    }else{
        printf("Positive\n");
        return 0;
    }
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<size_t I,class H,class...T>struct TupleReaderWriter{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple_cat(tuple<H>(v),TupleReaderWriter<sizeof...(T)-1,T...>::r(i));}static void w(ostream&o,tuple<H,T...>&t,string d){TupleReaderWriter<I-1,H,T...>::w(o,t,d);o<<d<<get<I>(t);}};
template<class H,class...T>struct TupleReaderWriter<0,H,T...>{static tuple<H,T...> r(istream&i){H v;i>>v;return tuple<H>(v);}static void w(ostream&o,tuple<H,T...>&t,string d){o<<get<0>(t);}};
template<class...T>istream&operator>>(istream&i,tuple<T...>&t){t=TupleReaderWriter<sizeof...(T),T...>::r(i);return i;}
template<class...T>ostream&operator<<(ostream&o,tuple<T...>&t){string delim=" ";TupleReaderWriter<sizeof...(T)-1,T...>::w(o,t,delim);return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(auto&x:v)i>>x;return i;}
template<class T>ostream&operator<<(ostream&o,vector<T>&v){string delim="";for(auto&x:v)o<<delim<<x,delim=" ";return o;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int x;fixprec(int d):x(d){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.x);}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
using P = pair<int, int>;
int main() {
    int N, M;
    cin >> N;
    cout << N * (N - 1) / 2 - N / 2 << endl;
    for(int i = 1; i <= N; i++) {
        for(int j = i + 1; j <= N; j++) {
            if(i + j != N / 2 * 2 + 1) {
                cout << i << " " << j << endl;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

struct UnionFind {
	vector<ll> data;
	UnionFind(ll size) : data(size, -1) {}
	bool unionset(ll x, ll y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[x] > data[y])swap(x, y);
			data[x] += data[y], data[y] = x;
		}
		return x != y;
	}
	bool findset(ll x, ll y) {
		return root(x) == root(y);
	}
	ll root(ll x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	ll size(ll x) {
		return -data[root(x)];
	}
};

int main() {
	ll n, m;
	cin >> n >> m;
	UnionFind uni(210000);
	REP(i, m) {
		ll a, b, c;
		cin >> a >> b >> c;
		if (a == 0) uni.unionset(b, c);
		else cout << uni.findset(b, c) << endl;
	}
}



Measured memory_bytes: 4428
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T>
using vec = std::vector<T>;

int main() {
    int A,B,K;
    cin >> A >> B >> K;
    set<int> st;
    for(int i=A;i<=min(A+K-1,B);++i){
        st.insert(i);
    }

    for(int i=max(B-(K-1),A);i<=B;++i){
        st.insert(i);
    }
    
    for(auto e:st){
        cout << e << endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int count[128] = {0};
  char ch;

  while (scanf("%c", &ch) != EOF)
  {
    count[ch]++;
  }
  
  for (char c = 'a'; c <= 'z'; c++)
  {
    printf("%c : %d\n", c, count[c] + count[c-32]);
  }  
  
  return 0;
}


Measured memory_bytes: 2052
///////////////////////////////////////////////
//		 ©Ahmad Haulian Yoga Pratama		 //
//          SMA TARUNA NUSANTARA		     //
//                MAGELANG					 //
//				   157503 					 //
// 		   	 All Right Reserved				 //
///////////////////////////////////////////////

#include<bits/stdc++.h>
using namespace std;
#define scanint(n) scanf("%d",&n)
#define scanll(n) scanf("%lld",&n)
#define mp make_pair
#define pb push_back
#define s second
#define f first
#define pii pair<int,int>
#define reset(a,b) memset(a,b,sizeof a)
#define ll long long
#define MAXAND 0x7fffffff
#define MOD 1000000007
#define lch(x) (2*x)
#define rch(x) (2*x+1)
#define MID (l+r)/2
#define ALL(x) x.begin(),x.end()
#define dalam fl<=l && r<=fr
#define kiwo lch(idx),l,MID
#define tengen rch(idx),MID+1,r
/*
template <class T> void inp(T &N){
    char ch;
    int sign = 1;
    while(ch = getchar_unlocked(), isspace(ch)) {

    };
    N = 0;
    if(ch == '-')
        sign = -1;
    else N = ch - '0';
    while(ch = getchar_unlocked(), isdigit(ch))
        N = (N << 3) + (N << 1) + ch - '0';
    N *= sign;
}
*/

int n,x,yy,z;
int main(){
	cin>>n>>yy;
	yy/=1000;
	for(int i=0;i<=n;i++){
		for(int x=0;x+i<=n;x++){
			int now=i*10+x*5;
			z=n-i-x;
			if(now+z==yy){
				cout<<i<<' '<<x<<' '<<z<<endl;
				return 0;
			}
		}
	}
	cout<<"-1 -1 -1\n";
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n)     for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n)    for (int i = 1; i <= (int)(n); ++i)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rrep(i, n)    for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n)   for (int i = (int)(n); i >= 1; --i)
#define allrep(V, v)  for (auto &&V : v)
#define all(x)        (x).begin(), (x).end()
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = 1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  string s, t;
  cin >> s >> t;
  int cnt = 0;
  rep (i, 3) {
    if (s[i] == t[i]) ++cnt;
  }
  cout << cnt << endl;
  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 NIL -1
typedef long long ll;
const ll INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll MOD = 1000000007;

void solve() {

    ll h, w, n;
    cin >> h >> w >> n;
    ll min = (h > w)? h : w;
    ll result;
    result = n / min;
    if (n % min != 0) ++result;
    cout << result << endl;
    return;
}

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

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int N, H, W;
    cin >> N >> H >> W;
    cout << ((N - H) + 1)*((N - W) + 1) << endl;
    return 0;
}

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

string t[] = {"dream", "dreamer", "erase", "eraser"};

void solve() {
    string s;
    cin >> s;
    int n = s.size();
    s = "#" + s;
    vector<int> dp(n + 1);
    dp[0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < 4; j++) {
            int sz = t[j].size();
            if (i + sz - 1 <= n) {
                string tm = s.substr(i, sz);
                if (tm == t[j])
                    dp[i + sz - 1] |= dp[i - 1];
            }
        }
    }
    if (dp[n])
        cout << "YES";
    else
        cout << "NO";
}

int main() {
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(20);
    solve();
    return 0;
}


Measured memory_bytes: 748
while True:
    v = raw_input()
    a = v.split(' ')
    if a[1] == "?":
        break
    if a[1] == "+":
        print int(a[0]) + int(a[2])
    elif a[1] == "-":
        print int(a[0]) - int(a[2])
    elif a[1] == "*":
        print int(a[0]) * int(a[2])
    elif a[1] == "/":
        print int(a[0]) / int(a[2])

Measured memory_bytes: 6448
#include<bits/stdc++.h>
namespace ZDY{
    #pragma GCC optimize(3)
    #define il __inline__ __attribute__ ((always_inline))
    #define rg register
    #define ll long long
    #define ull unsigned long long
    #define db double
    #define sht short
    #define MB template <class T>il
    #define Fur(i,x,y) for(int i=x;i<=y;++i)
    #define Fdr(i,x,y) for(int i=x;i>=y;--i)
    #define fl(i,x) for(int i=head[x],to;to=e[i].to,i;i=e[i].nxt)
    #define clr(x,y) memset(x,y,sizeof(x))
    #define cpy(x,y) memcpy(x,y,sizeof(x))
    #define fin(s) freopen(s".in","r",stdin)
    #define fout(s) freopen(s".out","w",stdout)
    #define fcin ios::sync_with_stdio(false)
    #define l2(n) (int(log2(n)))
    #define inf 0x3f3f3f3f
    MB T ABS(T x){return x>0?x:-x;}
    MB T MAX(T x,T y){return x>y?x:y;}
    MB T MIN(T x,T y){return x<y?x:y;}
    MB T GCD(T x,T y){return y?GCD(y,x%y):x;}
    MB void SWAP(T &x,T &y){T t=x;x=y;y=t;}
}using namespace ZDY;using namespace std;
namespace IO{const char* ln="\n";const int str=1<<20;struct IN{char buf[str],*s,*t;bool _;IN():s(buf),t(buf),_(0){}il char gc(){return s==t&&((t=(s=buf)+fread(buf,1,str,stdin))==s)?EOF:(*s++);}IN&operator>>(char&ch){if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)_=1;else ch=c;return *this;}IN& operator>>(char* ch){clr(ch,0);if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)return _=1,*this;*ch=c;ch++;while((c=gc())!=EOF&&!isspace(c))*ch=c,ch++;if(c==EOF)_=1;return *this;}IN& operator>>(string& ch){if(_)return *this;char c;while((c=gc())!=EOF&&isspace(c));if(c==EOF)return _=1,*this;ch+=c;while((c=gc())!=EOF&&!isspace(c))ch+=c;if(c==EOF)_=1;return *this;}template<typename T>IN&operator>>(T&x){if(_)return *this;char c=gc();bool ff=0;while(c!=EOF&&(c<'0'||c>'9'))ff^=(c=='-'),c=gc();if(c==EOF){_=1;return *this;}x=0;while(c!=EOF&&'0'<=c&&c<='9')x=(x<<3)+(x<<1)+c-48,c=gc();if(c==EOF)_=1;if(ff)x=-x;return *this;}}in;struct OUT{char buf[str],*s,*t;OUT():s(buf),t(buf+str){}~OUT(){fwrite(buf,1,s-buf,stdout);}void pt(char c){(s==t)?(fwrite(s=buf,1,str,stdout),*s++=c):(*s++=c);}OUT&operator<<(const char*s){while(*s)pt(*s++);return *this;}OUT&operator<<(char*s){while(*s)pt(*s++);return *this;}OUT&operator<<(string s){for(int i=0;s[i];i++)pt(s[i]);return *this;}template<typename T>OUT&operator<<(T x){if(!x)return pt('0'),*this;if(x<0)pt('-'),x=-x;char a[30],t=0;while(x)a[t++]=x%10,x/=10;while(t--)pt(a[t]+'0');return *this;}}out;}using namespace IO;
#define N 100011
int n,k,q,b[N];
int main(){
	fcin;
	cin>>n>>k>>q;
	int x;
	Fur(i,1,q){
		cin>>x;
		b[x]++;
	}
	Fur(i,1,n)if(q-b[i]>=k)cout<<"No\n";
	else cout<<"Yes\n";
}

Measured memory_bytes: 1024
S = input()
lS = len(S)
i=0
S=S[::-1]
while i<lS:
    if S[i:i+5] == 'esare' or S[i:i+5] == 'maerd':
        i = i+5
    elif S[i:i+6]=='resare':
        i = i+6
    elif S[i:i+7]=='remaerd':
        i = i+7
    else:
        print('NO')
        exit()
print('YES')

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

int main(){
    int s,w;
    cin >> s >> w;
    if(w>=s){
        cout << "unsafe"<< endl;
    }
    else {
        cout << "safe" << endl;
    }
}


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

int main(){
    int n;
    cin >> n;
    if(n%2 == 0){
        cout << n/2 << endl;
    }else{
        cout << n/2 + 1 << endl;
    }
}

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

/*
各要素は親の値を持っておけばいい

*/

int main(void){
    char s[4];
    scanf("%s",s);
    if(s[0] == s[2]){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    ll a, b, x;
    cin >> a >> b >> x;

    ll left = ( (a + x - 1) / x) * x;

    if(b - left >= 0){
        cout << (b - left ) / x + 1 << endl;  
    }
    else{
        cout << 0 << endl;
    }


}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") // wonderful

#include <bits/stdc++.h>
using namespace std;



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



    int a, b; cin >> a >> b;
    if (a == b) cout << "Yes";
    else cout << "No";




    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
int a,b,c,d;


scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&d);

while (a> 0 || c > 0)
{
c -= b;
if (c<= 0)
{
printf("Yes");
break;
}

a -= d;
if (a<= 0)
{
printf("No");
break;
}
}

return 0;}

Measured memory_bytes: 1720
#include <stdio.h>
int main(){
  int l,k,j,array1[100],array2[100][100];
  int num,i;  
scanf("%d",&num);
  for(i = 1;i <= num;i++){
    scanf("%d%d",&array1[i-1],&array1[i]);
  }
  for(i = 1; i <= num;i++){
    array2[i][i] = 0;
  }
  for(k = 2;k <= num;k++){
    for(i = 1;i <= num - k + 1;i++){
      j = i + k - 1;
      array2[i][j]=(1<<21);
      for(l = i;l <= j - 1;l++){
    if(array2[i][j] > array2[i][l] + array2[l+1][j] + array1[i-1] * array1[l] * array1[j]){
      array2[i][j] = array2[i][l] + array2[l+1][j] + array1[i-1] * array1[l] * array1[j];
    }
      }
    }
  }
  printf("%d",array2[1][num]);
  puts("");
  return 0;

}



Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define INF 1e15
struct edge{int from,to,cost;};
int n,m,a,b,c,d[1010];
bool neg[1010];
vector<edge>v;
void bell(){
	rep(i,n)d[i]=INF;
	d[0]=0;
	rep(i,n){
		bool update=false;
		for(edge e:v){
			if(d[e.from]!=INF&&d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				update=true;
			}
		}
		if(!update)break;
	}
}
void check(){
	rep(i,n+1){
		for(edge e:v){
			if(d[e.from]==INF)continue;
			if(d[e.to]>d[e.from]+e.cost){
				d[e.to]=d[e.from]+e.cost;
				neg[e.to]=true;
			}
		}
	}
}
signed main(){
	cin>>n>>m;
	while(m--){
		cin>>a>>b>>c;
		v.push_back({a-1,b-1,-c});
	}
	bell();
	check();
	if(neg[n-1])puts("inf");
	else cout<<-d[n-1]<<endl;
	return 0;
}


Measured memory_bytes: 384
use proconio::input;
use proconio::marker::Usize1;
use std::collections::VecDeque;

struct Node {
    edge: Vec<(usize, i64)>,
    parent: usize,
    depth: i64,
}

struct RootedTree {
    node: Vec<Node>,
    root: usize,
}

impl Node {
    fn new(parent: usize) -> Self {
        Node {
            edge: Vec::new(),
            parent: parent,
            depth: 0,
        }
    }
}

impl RootedTree {
    fn new(n: usize, r: usize) -> Self {
        RootedTree {
            node: (0..n).map(|i| Node::new(i)).collect(),
            root: r,
        }
    }

    fn add_edge(&mut self, v0: usize, v1: usize, weight: i64) {
        self.node[v0].edge.push((v1, weight));
        self.node[v1].edge.push((v0, weight));
    }

    fn build(&mut self) {
        let mut q: VecDeque<(usize, usize, i64)> = VecDeque::new();
        q.push_back((self.root, self.root, 0));

        while let Some((i, p, d)) = q.pop_back() {
            self.node[i].depth = d;
            self.node[i].parent = p;
            if let Some(idx) = self.node[i].edge.iter()
                .position(|&(i, _)| i == p) {
                self.node[i].edge.remove(idx);
            }

            for &(nxt, weight) in self.node[i].edge.iter() {
                let depth = weight + d;
                q.push_back((nxt, i, depth));
            }
        }
    }
}

fn main()
{
    input! {
    n:usize,
    k:i64,
    edge:[(Usize1,Usize1);n-1],
    }

    let _mod = 10_i64.pow(9) + 7;
    let mut tree = RootedTree::new(n,0);
    for (a, b) in edge
    {
        tree.add_edge(a, b, 1);
    }

    tree.build();
    let mut ans = k;
    let mut q = VecDeque::new();
    for (i, &(nxt, _)) in tree.node[0].edge.iter().enumerate()
    {
        let i = i as i64;
        ans = (ans * (k - i - 1)) % _mod;
        q.push_back(nxt);
    }

    while let Some(idx) = q.pop_front() {
        for (i, &(nxt, _)) in tree.node[idx].edge.iter().enumerate() {
            let i = i as i64;
            ans = (ans * (k - 2 - i)) % _mod;
            q.push_back(nxt);
        }
    }

    println!("{}", ans);
}

Measured memory_bytes: 15652
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  int b,c;
  int num;
  int ans = 0;
  rep(i,n){
    int mini = a.at(i);
    for(int j = i; j < n; j++){
      if(mini > a.at(j)){
        mini = a.at(j);
        num = j;
      }
    }
    if(mini < a.at(i)){
        swap(a.at(i),a.at(num));
        ans++;
    }
  }
  rep(i,n){
    cout << a.at(i);
    if(i == n-1) break;
    cout << " ";
  }
  cout << endl << ans << endl;
}


Measured memory_bytes: 3084
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import defaultdict
    h, w, n = map(int, readline().split())
    c = defaultdict(int)
    count = [0] * 10
    count[0] = (h - 2) * (w - 2)

    for _ in range(n):
        a, b = map(int, readline().split())
        a, b = a - 1, b - 1
        for row in range(max(2, a), min(h - 1, a + 2) + 1):
            for col in range(max(2, b), min(w - 1, b + 2) + 1):
                cur = c[(row, col)]
                count[cur] -= 1
                count[cur + 1] += 1
                c[(row, col)] += 1

    print(*count, sep="\n")


if __name__ == '__main__':
    main()


Measured memory_bytes: 213388