akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x) (int)((x).size())
#define debug(x) cout << #x << ":" << x << ' ';
#define debugg(x) cout << #x << ":" << x << ' ' << "\n";
#define endl "\n"
#define L(X) ((X)<<1)
#define R(X) (((X)<<1)|1)
#define M(X,Y) (((X)+(Y))>>1)

using namespace std;

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

const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const double PI = acos(-1);

int add(int x, int y) { return ((x % MOD)  + (y % MOD)) % MOD;             }
int mul(int x, int y) { return ((x % MOD) * (long long)(y % MOD)) % MOD;   }
int sub(int x, int y) { return add(x, -y + MOD);                           }


ll n, k, h[MAXN], dp[MAXN];

ll solve(ll x) {
   if (dp[x] != -1) return dp[x];
   if (x > n) return INF;
   if (x == n) {
      return 0;
   }

   ll cost = INF;

   for (int i = 1; i <= k && x + i <= n; ++i) {
      ll val = abs(h[x + i] - h[x]) + solve(x + i);
      cost = min(cost, val);
   }

 	return dp[x] = cost;
}

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

   cin >> n >> k;

   memset(dp, -1, sizeof dp);

   for (int i = 1; i <= n ;  ++i) {
      cin >> h[i];
   }

   cout << solve(1) << endl;

   return 0;
}

Measured memory_bytes: 6528
import java.util.Scanner;

public class Main {

	
	public static void main(String args[]){
		
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int c = Integer.parseInt(sc.next());
		int answer = 0;
		for(;a <=b; a++){
			
			if(c % a == 0){
				answer++;
			}
		}
		System.out.println(answer);
		
		sc.close();
	}
	

}



Measured memory_bytes: 26172
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

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

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define sz(x) int(x.size())
double pi = 3.141592653589793;
ll mod = 1000000007;
ll INF = 1000000001;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

vi to[200005];
vi ans;
void dfs(int v, int p=-1){
	for(int u: to[v]){
		if(u==p) continue;
		ans[u]+=ans[v];
		dfs(u,v);
	}
}

int main(){
	int n,q;
	cin>>n>>q;
	rep(i,n-1){
		int a, b;
		cin>>a>>b;
		--a; --b;
		to[a].pb(b);
		to[b].pb(a);
	}
	ans.resize(n);
	rep(i,q){
		int p,x;
		cin>>p>>x;
		--p;
		ans[p]+=x;
	}
	dfs(0);
	rep(i,n){
		cout<<ans[i]<<endl;
	}
    return 0;
}


Measured memory_bytes: 23552
#include <bits/stdc++.h>
using namespace std;
int main(){
    int x, y;
    cin >> x >> y;
    vector<int> vec = {0, 2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0};
    if(vec[x-1] == vec[y-1]) cout << "Yes";
    else cout << "No";
    return 0;
}

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

int main() {
	std::cout << std::setprecision(std::numeric_limits<double>::max_digits10);

	int N;
	std::cin >> N;

	std::vector<int> A(N);
	for(auto &a : A) {
		std::cin >> a;
	}

	double result = 0;
	for(const auto &a : A) {
		result += 1.0 / a;
	}
	result = 1.0 / result;

	std::cout << result << std::endl;

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define IOS ios::sync_with_stdio(false); cin.tie(NULL);
#ifndef LOCAL
#define dbg(...) ;
#define endl '\n'
#endif

const int inf = 1e15;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;



signed main(){
    IOS;
    int n;
    cin >> n;
    vector<int> v, v2;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        v.push_back(a);
        v2.push_back(b);
    }
    sort(v.begin(), v.end());
    sort(v2.begin(), v2.end());
    double mn, mx;
    double ans;
    if (n % 2 == 1) {
        mn = v[n/2]; mx = v2[n/2];
        ans = mx - mn + 1;
    }
    else {
        mn = (v[n/2-1] + v[n/2]) / 2.0;
        mx = (v2[n/2-1] + v2[n/2]) / 2.0;
        mx *= 2;
        mn *= 2;
        ans = mx - mn + 1;
    }
    cout << (int)ans << endl;
    return 0;
}


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

using namespace std;
using ll = long long;

int main() {
    ll A, B, C;
    cin >> A >> B >> C;
    if(A%2 && B%2 && C%2) {
        cout << min(A*B, min(B*C, C*A)) << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}

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

int knapsack(vector<int> &v, vector<int> &w, int W) {
    vector<int> dp(W + 1, 0);
    for (int i = 0; i < (int)v.size(); ++i) for (int j = W; j >= w[i]; --j) {
        dp[j] = max(dp[j], dp[j - w[i]] + v[i]);
    }
    return dp[W];
}

int main() {
    int N, W;
    cin >> N >> W;
    vector<int> v(N), w(N);
    for (int i = 0; i < N; ++i) {
        cin >> v[i] >> w[i];
    }
    cout << knapsack(v, w, W) << endl;
}


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

int main(){
  int a,b,c,tmpa,tmpb;
  cin >> a >> b >> c;

  int ans=0;
  bool flag=true;
  while(flag){
    if(a%2!=0 || b%2!=0 || c%2!=0)break;
    if(a==b && b==c){
      cout << -1 << endl;
      return 0;
    }
    tmpa=a;
    tmpb=b;
    a=b/2+c/2;
    b=tmpa/2+c/2;
    c=tmpa/2+tmpb/2;
    ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int power(int a){
    int rev=1;
    for(int i=0;i<a;i++){
        rev*=2;
    }
    return rev;
}
int main(void){
    int n,ans;
    cin >>n;
    for(int i=1;i<=21;i++){
        if(n<power(i)){
            ans=power(i-1);
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3096
def gusaku():
    n = int(input())
    List = list(map(int, input().split()))
    # 昇順ソートなので，前のsumnが小さくなる
    List_sorted = sorted(List, reverse=True)
    print(sum(List_sorted[::2]) - sum(List_sorted[1::2]))

gusaku()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2e5+1;
const int md=1e9+7;

int read(){
	int x=0,flag=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-') ch=getchar();
	if (ch=='-') flag=-1,ch=getchar();
	while(isdigit(ch)) x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x*flag;
}

struct node{
	int k,b,id;
}p[maxn];

struct range{
	int l,r;
	bool operator < (const range &x) const{
		return r!=x.r?r<x.r:l<x.l;
	}
}q[maxn];

bool cmpk(const node &x,const node &y){return x.k==y.k?x.b<y.b:x.k<y.k;}
bool cmpb(const node &x,const node &y){return x.b<y.b;}

int n;ll f[maxn],s[maxn];

int main(){
	n=read();
	for (int i=1;i<=n;++i)
	p[i].b=read(),p[i].k=read();
	sort(p+1,p+1+n,cmpk);
	for (int i=1;i<=n;++i)
	p[i].id=i;
	sort(p+1,p+1+n,cmpb);
	int in=n;
	for (int i=n;i>=1;--i)
	in=min(in,p[i].id),
	q[p[i].id].l=in;
	int ax=0;
	for (int i=1;i<=n;++i)
	ax=max(ax,p[i].id),
	q[p[i].id].r=ax;
	sort(q+1,q+1+n);
	int pos=0;
	for (int i=1;i<=n;++i){
		while(pos<q[i].r-1){
			pos++;s[pos]=(s[pos-1]+f[pos])%md;
		}
		(f[q[i].r]+=f[q[i].r]+s[q[i].r-1]-(q[i].l>=2?s[q[i].l-2]:0)+md)%=md;
		if (q[i].l==1) (f[q[i].r]+=1)%=md; 
	}
	printf("%lld\n",f[n]);
	return 0;
}

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

int main(){
    long long int Q, H, S, D, N;
    cin >> Q >> H >> S >> D >> N;
    
    H = min(H,Q*2);
    S = min(S,H*2);
    
    if (S * 2 <= D)
        cout << N * S << endl;
    else
        cout << (N / 2) * D + (N % 2) * S << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline


# 解説AC
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)


def check(mid):
    k = K
    # 全員が目標値 mid を下回るまで修行できるか？
    for i in range(N):
        if A[i] * F[i] > mid:
            # x: 必要な修行回数
            x = A[i] - mid // F[i]
            k -= x
            # 誰かが修行できなかった ⇒ その目標値は達成不可能
            if k < 0:
                return False
    return True


def main():
    H = []
    for i in range(N):
        H.append(A[i]*F[i])
    # lb := 条件を満たさない最大, ub := 条件を満たす最小
    lb, ub = -1, max(H)
    while ub - lb > 1:
        mid = (lb + ub)//2
        if check(mid):
            ub = mid
        else:
            lb = mid
    print(ub)


if __name__ == '__main__':
    main()


Measured memory_bytes: 115276
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt(),m=nxt();
    int x=m*1900+(n-m)*100;
    int y=pow(2,m);
    cout<<x*y<<endl;
    
    
    return 0;   
}




 
 


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

#define REP(i,a) for(long i=0;i<(a);++i)

typedef long long LL;

LL solve(const int n) {
    LL cnt = 0;
    
    LL val = n;
    std::string str = std::to_string(n);

    std::set<LL> set;
    while(str.length() > 1) {
        if(set.count(val) > 0) {
            return -1;
        }
        set.insert(val);

        int len = str.length();

        LL left = 0;
        LL right = std::atoll(str.c_str());
        LL max = 0;
        REP(i, len-1) {

            int x = str[i] - '0';
            left  = left*10 + x;
            right = right - x * std::pow(10, len-i-1);

            max = std::max(max, left*right);
        }
        val = max;
        str = std::to_string(max);

        ++cnt;
    }
    return cnt;   
}

int Q;
int main() {
    std::cin >> Q;
    REP(i, Q) {
        int N;
        std::cin >> N;
        LL res = solve(N);
        std::cout << res << std::endl;
    }
}


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

int main() {
    int h, w;
    while(true) {
        cin >> h >> w;
        if(h == 0 && w == 0) {
            break;
        }
        for(int i = 0; i < h; ++i) {
            for(int j = 0; j < w; ++j) {
                if(i==0 || i==h-1 || j==0 || j==w-1) {
                    cout << "#";
                }
                else {
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;

}


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

int main(){
	ios::sync_with_stdio(0); 
	cin.tie(0);
	ll n,m;
	cin>>n>>m;
	ll ht[n+1];
	for(int i=1;i<=n;i++){
		cin>>ht[i];
    }
  
	vector<ll>V(n+1,0);
	ll u,v;
	while(m--){
		cin>>u>>v;
		V[u]=max(V[u],ht[v]);
		V[v]=max(V[v],ht[u]);
	}
	ll ans = 0;
	for(int i=1;i<=n;i++){
		if(ht[i]>V[i])
			ans++;
	}
	cout<<ans<<endl;
	return 0;
	
	
   
}



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

using int64 = long long;
const int64 kMax = 1e+17;
using Data = pair<double, int64>;

double ndivs(int64 n) {
  double s = 0;
  for (int64 k = n; k; k /= 10)
    s += k % 10;
  return n / s;
}

int main() {
  int64 k;
  cin >> k;

  set<Data> data;
  for (int64 base = 1; base < kMax; base *= 10) {
    for (int64 d = 1; d < 1000 && d < (kMax / base); ++d) {
      int64 n = (d + 1) * base - 1;
      data.insert(Data(ndivs(n), n));
    }
  }

  int64 v = 0;
  for (auto itr = data.begin(); k; ++itr) {
    int64 n = itr->second;
    if (v < n) {
      v = n;
      cout << n << "\n";
      --k;
    }
  }

  return 0;
}


Measured memory_bytes: 1152
from operator import itemgetter

N,M = map(int,input().split())

a = []
b = []

for i in range(M):
    ao,bo = map(int,input().split())
    a.append(ao)
    b.append(bo)

ab = sorted([(a[i],b[i]) for i in range(M)], key = itemgetter(1))

ans = 0
last = 0

for i in range(M):
    if last <= ab[i][0]:
        ans += 1
        last = ab[i][1]

print(ans)


Measured memory_bytes: 20636
import bisect

S = input()
N = len(S)

ans = [0] * N
R = []

for i in range(1, N):
    if S[i-1] == "R" and S[i] == "L":
        R.append(i-1)

for i in range(N):
    idx = bisect.bisect_left(R, i)
    if S[i] == "R":
        if (R[idx] - i) % 2 == 0:
            ans[R[idx]] += 1
        else:
            ans[R[idx]+1] += 1
    else:
        if (i - R[idx-1]) % 2 == 0:
            ans[R[idx-1]] += 1
        else:
            ans[R[idx-1]+1] += 1

print(*ans)

Measured memory_bytes: 8264
#include<cstdio>
#include<cstdlib>
#include<string>
#include<iostream>
using namespace std;

struct Node{
	int key;
	Node *right, *left, *parent;
};

Node *root, *NIL;

Node * treeMinimum(Node *x){
	while(x->left != NIL) x = x->left;
	return x;
}

Node * find(Node *u, int k){
	while(u != NIL && k != u->key){
		if(k < u->key) u = u->left;
		else u = u->right;
	}
	return u;
}

Node * treeSuccessor(Node *x){
	if(x->right != NIL) return treeMinimum(x->right);
	Node *y = x->parent;
	while(y != NIL && x == y->right){
		x = y;
		y = y->parent;
	}
	return y;
}

void treeDelete(Node *z){
	Node *y;
	Node *x;

	if(z->left == NIL || z->right == NIL) y = z;
	else y = treeSuccessor(z);
	if(y->left != NIL){
		x = y->left;
	}else{
		x = y->right;
	}

	if(x != NIL){
		x->parent = y->parent;
	}

	if(y->parent == NIL){
		root = x;
	}else{
		if(y == y->parent->left){
			y->parent->left = x;
		}else{
			y->parent->right = x;
		}
	}

	if(y!=z){
		z->key=y->key;
	}

	free(y);
}

void insert(int k){
	Node *y = NIL;
	Node *x = root;
	Node *z;

	z = (Node *) malloc(sizeof(Node));
	z->key = k;
	z->left = NIL;
	z->right = NIL;

	while(x != NIL){
		y = x;
		if(z->key < x->key){
			x = x->left;
		}else{
			x = x->right;
		}
	}

	z->parent = y;
	if(y == NIL){
		root = z;
	}else{
		if(z->key < y->key){
			y->left = z;
		}else{
			y->right = z;
		}
	}
}

void inorder(Node *u){
	if(u == NIL) return;
	inorder(u->left);
	printf(" %d",u->key);
	inorder(u->right);
}
void preorder(Node *u){
	if(u == NIL) return;
	printf(" %d",u->key);
	preorder(u->left);
	preorder(u->right);
}

int main(){
	int n, i, x;
	string com;

	scanf("%d",&n);

	for(i=0;i<n;i++){
		cin >> com;
		if(com[0] == 'f'){
			scanf("%d",&x);
			Node *t = find(root,x);
			if(t != NIL) printf("yes\n");
			else printf("no\n");
		}else if(com == "insert"){
			scanf("%d",&x);
			insert(x);
		}else if(com == "print"){
			inorder(root);
			printf("\n");
			preorder(root);
			printf("\n");
		}else if(com == "delete"){
			scanf("%d",&x);
			treeDelete(find(root,x));
		}
	}

	return 0;
}



Measured memory_bytes: 22032
<?php
fscanf(STDIN, "%d", $n);
fscanf(STDIN, "%s", $s);
$ss = str_split($s);
$a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$res = "";
foreach ($ss as $s) {
  $res .= substr($a, (strpos($a, $s)+$n)%26, 1);
}
echo $res;

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int N;
  cin >> N;
  vint A(N);
  map<int, int> mp;
  rep(i, N) cin >> A[i], mp[A[i]]++;
  vector<int> vec;
  for(auto &p : mp) {
    if(p.second >= 2) {
      vec.push_back(p.first);
      if(p.second >= 4) vec.push_back(p.first);
    }
  }
  sort(all(vec));
  reverse(all(vec));
  if(vec.size() < 2) cout << 0 << endl;
  else cout << vec[0]*vec[1] << endl;

  return 0;
}


Measured memory_bytes: 7296
lis=[]
n=int(input())
lis += input()
count=0
for i in range(1,n):
    if lis[i]=="E":
        count += 1
saidai = count
for i in range(n-1):
    if lis[i] == "W":
        count += 1
    if lis[i+1] == "E":
        count -= 1
        if saidai > count:
            saidai = count
print(saidai)

Measured memory_bytes: 5920
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    int a, b;
    cin >> a >> b;
    int p1 = 0, p2 = 0, p3 = 0;
    for(int i = 0; i < n; i++){
        int p; cin >> p;
        (p <= a ? p1 : p <= b ? p2 : p3)++;
    }
    cout << min({p1, p2, p3}) << '\n';
}


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

/*int main()
{
    float a, b, x;
    cin >> a >> b;

    x = ceil((a + b) / 2.0f);
    cout << x << endl;
}*/

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

    cout << (a + b + 1) / 2 << endl;
}

Measured memory_bytes: 256
n,m= map(int,input().split())
henl = []
usehen = [False] * m
brdic = {}
for _ in range(m):
    a,b= map(int,input().split())
    brdic[a] = brdic.get(a,[]) + [b]
    brdic[b] = brdic.get(b,[]) + [a]
    henl.append((a,b))

ordin = [-1]*(n+1)
lowlink = [-1]*(n+1)
k=[1]
bn=[0]
def dfs(node):
    ordin[node]=k[0]
    k[0]+=1
    lowlink[node]=ordin[node]
    for br in brdic[node]:
        temp = (min(node,br),max(node,br))
        if ordin[br]==-1:
            usehen[henl.index(temp)]=True
            dfs(br)
            lowlink[node] = min(lowlink[br],lowlink[node])
        else:
            if usehen[henl.index(temp)]==False:lowlink[node] = min(ordin[br],lowlink[node])
        if ordin[node] < lowlink[br]:bn[0]+=1
dfs(1)
print(bn[0])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

int main(){
    int n;
    string s;
    cin >> n >> s;
    rep(i,s.size()){
        rep(j,n){
            if(s[i]=='Z') s[i]='A';
            else s[i]++;
        }
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n,a[20],q,m,h[2222]={};

void s(int i=0,int sum=0){
  if(i==n){
    h[sum]=1;
    return;
  }
  s(i+1,sum+a[i]),s(i+1,sum);
}

int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  cin>>q,s();
  for(int i=0;i<q;i++){
    cin>>m;
    cout<<(h[m]?"yes\n":"no\n");
  }
  return 0;
}


Measured memory_bytes: 3104
// finish date: 2018/02/24

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000
#define pii pair<int,int>


int main() {
    string S;
    cin>>S;
    map<char,int> mp;
    rep(i,S.length()) mp[S[i]]++;
    bool con1 = (mp['E']*mp['W']==0)&&(mp['E']!=0||mp['W']!=0);
    bool con2 = (mp['N']*mp['S']==0)&&(mp['N']!=0||mp['S']!=0);
    if(con1||con2) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

    return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int inf=LONG_LONG_MAX-1;
int gcd(int x,int y){return (y==0)?x:gcd(y,x%y);}
bool cmp(pair<int,int>a,pair<int,int>b){return (a.first!=b.first)?a.first<b.first:a.second>b.second;}
map<int,int>mp;
vector<pair<int,int> >v[600001];
signed main()
{
	int n,x,d;
	scanf("%lld%lld%lld",&n,&x,&d);
	if(d==0)
	{
        if(x==0) cout<<1;
        else cout<<(n+1);
        return 0;
    }
	int g=gcd(abs(x),abs(d));
	x/=g,d/=g;
	if(d<0)x=-x,d=-d;
	int num=0;
	for(int i=0;i<=n;i++)
	{
		int l=i*(i-1)-n*(n-1)/2;
		int r=n*(n-1)/2-(n-i-1)*(n-i);
		int cl=l*d+(i-(n-i))*x;
		int cr=r*d+(i-(n-i))*x;
		int to=(cl%(2*d)+(2*d))%(2*d);
		if(!mp[to]) mp[to]=++num;
		v[mp[to]].push_back(make_pair(min(cl,cr),max(cl,cr)));
	}
	long long ans=0;
	
	for(int t=1;t<=num;t++)
		if(v[t].size())
		{	
			sort(v[t].begin(),v[t].end(),cmp);
			int l=v[t][0].first,r=v[t][0].second;
			for(int i=1;i<v[t].size();i++)
			{
				if(v[t][i].first>r)
				{
					ans+=(r-l)/2/d+1;
					l=v[t][i].first;
					r=v[t][i].second;
				}
				else
					r=max(r,v[t][i].second);
			}
			ans+=(r-l)/2/d+1;
		}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 33024
let () =
  let s = read_line () in
  let dp = Array.init (String.length s) (( + ) 0) in
  for i = 1 to String.length s - 1 do
    if s.[i] = 'L' then
      dp.(i) <- dp.(i - 1)
  done;
  for i = String.length s - 2 downto 0 do
    if s.[i] = 'R' then
      dp.(i) <- dp.(i + 1)
  done;
  let acc = Array.make (String.length s) 0 in
  for i = 0 to String.length s - 1 do
    let j = dp.(i) + abs (i - dp.(i)) mod 2 in
    acc.(j) <- acc.(j) + 1
  done;
  Array.iter (Printf.printf "%d ") acc;
  print_newline ()


Measured memory_bytes: 6656
N,C = map(int,input().split())
d,c = [list(map(int,input().split())) for i in range(C)], [list(map(lambda x:int(x)-1,input().split())) for i in range(N)]
cnt,t,ans = [[0 for j in range(C)] for i in range(3)],[[0 for j in range(C)] for i in range(3)],float("inf")
for i in range(N):
	for j in range(N):
		cnt[(i+j)%3][c[i][j]] += 1
for i in range(3):
	for j in range(C):
		t[i][j] = 0
		for k in range(C):
			t[i][j] += d[k][j] * cnt[i][k]; 
for i in range(C):
	for j in range(C):
		for k in range(C):
			if i == j or j == k or k == i:
				continue
			ans = min(ans,t[0][i]+t[1][j]+t[2][k])
print(ans)


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

using namespace std;
using ll = long long;


int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int,int>> a(n), b(m);
    for(int i = 0; i < n; i++)cin >> a[i].first >> a[i].second;
    for(int i = 0; i < m; i++)cin >> b[i].first >> b[i].second;


    for(int i = 0; i < n; i++) {
        int ind = -1; int dist = 1e9;
        int x = a[i].first, y = a[i].second;
        for(int j = 0; j < m; j++) {
            if(dist > abs(x - b[j].first) + abs(y - b[j].second)) {
                ind = j;
                dist = abs(x - b[j].first) + abs(y - b[j].second);
            }
        }
        cout << ind + 1 << endl;
    }
}

Measured memory_bytes: 3656
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,p = LI()
    if n == 1:
        return p
    if math.log(p) / math.log(2) < n - 1:
        return 1
    r = 1
    i = 2
    while 1:
        t = i**n
        if p < t:
            break
        if p % t == 0:
            r *= i
            p //= t
        elif i == 2:
            i += 1
        else:
            i += 2
    return r


print(main())


Measured memory_bytes: 5460
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int x;
    cin>>x;
    if(x==0)
    {
        cout<<"1"<<endl;
    }
    else
    {
        cout<<"0"<<endl;
    }

    return 0;
}


Measured memory_bytes: 3648
#include <iostream>

int main() {
  unsigned N;
  std::cin >> N;
  unsigned long long TT = 0, AA = 0;
  for (unsigned i = 0; i < N; ++i) {
    unsigned long long T, A;
    std::cin >> T >> A;
    if (i == 0) {
      TT = T;
      AA = A;
    }
    auto x = std::max({(TT - 1) / T, (AA - 1) / A}) + 1ull;
    TT = x * T;
    AA = x * A;
  }
  std::cout << TT + AA << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.20f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

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

	string ans = t;

	int n = t.size();

	//t += '3';
	rep (i, n) {
		if (t[i] == '?') t[i] = 'D';
	}
	cout << t << endl;
	return 0;
}


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


int main() {
    int n, k;
    scanf("%d %d", &n, &k);
    vector<int> h(n);
    for(int& x : h) {
        scanf("%d", &x);
    }
    vector<int> dp(n, INT_MAX);
    dp[0] = 0;

    for(int i=1;i<n;i++) {
        for(int j=i-1; j>=i-k && j>=0; j--) {
            dp[i] = min((dp[j] + abs(h[i] - h[j])), dp[i]);
        }
    }
    printf("%d\n", dp[n-1]);
}

Measured memory_bytes: 4040
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int a[200000]={0};
int main()
{
	int n,m,i;
	cin>>n>>m;
	long long int sum=0;
	int l=0;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	double j=sum*1.0/(4*m);
	for(i=0;i<n;i++)
	{
		if(a[i]>=j) l++;
	}
	if(l>=m) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
from heapq import heappush, heappop


def input():
    return sys.stdin.readline().strip()


def dijkstra(adj_list, start):
    n = len(adj_list)
    dist = [float("inf")] * n
    dist[start] = 0

    pq = []
    heappush(pq, (0, start))
    visited = set()
    while pq:
        w, v = heappop(pq)
        if dist[v] < w:
            continue
        visited.add(v)
        for nv, nw in adj_list[v]:
            if nv in visited:
                continue
            if dist[nv] > dist[v] + nw:
                dist[nv] = dist[v] + nw
                heappush(pq, (dist[nv], nv))
    return dist


N = int(input())
g = defaultdict(list)
for _ in range(N - 1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    g[a].append((b, c))
    g[b].append((a, c))
Q, K = map(int, input().split())
K -= 1
d = dijkstra(g, K)
ans = []
for _ in range(Q):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(d[x] + d[y])


Measured memory_bytes: 61348
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using P = pair<ll,ll>;
using um = unordered_map<ll,ll>;
#define fl cout<<flush;
#define endl '\n'
template <typename T> inline void prt(T v){cout<<v<<'\n';}
template <typename T> inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template <typename T> inline bool chmin(T &a, const T &b){if (a>b){a=b;return 1;}return 0;}
const ll INF=1LL<<60;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ld pi=3.14159265358979323846;
const ld eps=1e-10;

signed main(void){
    cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
    ll D;
    cin >> D;
    vector<ll> c(27,0);
    for(ll i=0;i<26;++i)cin>>c[i+1];
    vector<vector<ll>> S(D+1, vector<ll>(27, 0));
    for(ll i=0;i<D;++i)
        for(ll j=0;j<26;++j)cin>>S[i+1][j+1];
    vector<ll> last(27,0);
    for(ll i=1;i<=D;++i){
        set<P> hoge;
        for(ll j=1;j<=26;++j){
            hoge.insert(P(S[i][j]+c[j],j));
        }
        prt((*--hoge.end()).second);
    }fl

    return 0;
}



Measured memory_bytes: 3772
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include <sstream>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include <iomanip>
#include <numeric>
#include <iterator>
#include <math.h>
#include <list>
#include <bits/stdc++.h>

using namespace std;

int main(void){
  int64_t N,K;
  cin >> N >> K;
  map<long,int64_t> neko;
  for(int i =0; i < N; i++){
    long a,b;
    cin >> a >> b;
    neko[a] += b;
  }

  long sum = 0;
  for(auto it = neko.begin(); it != neko.end(); ++it){
    //cout << it->first <<":"<<sum+1 << "-" << sum + it->second << endl;
    sum += it->second;
    if( K<= sum){
      cout << it->first << endl;
      break;
    }
    

  
  }
  return 0;
}

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

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

	
	int N,R;

	cin>>N>>R;

	if(N>=10)
		cout<<R<<endl;

	else
		cout<<100*(10-N) + R<<endl;
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
    int n,k;
    cin>>n>>k;
    vector<int>A(n);
    for (int i = 0;i<n;i++)cin>>A[i];
    vector<int>dp(k+1,0);
    for (int i = 1;i<=k;i++){
        for (auto val:A){
            if (val<=i && dp[i-val]==0){dp[i] = 1;break;}
        }
    }
    if (dp[k])cout<<"First";
    else cout<<"Second";
    return 0;
}

Measured memory_bytes: 4000
#include<bits/stdc++.h>
#define endl "\n"
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  char c1,c2;
  string s,t;

  cin >> s >> t;

  for(int i = 0;i < s.size();i++){
	if(s[i] != t[i]){
	  c1 = s[i];
	  c2 = t[i];
	  for(int j = 0;j < s.size();j++){
		if(s[j] == c1){
		  if(i > j){
			s = '\0';
			break;
		  }else{
			s[j] = c2;
		  }
		  
		}else if(s[j] == c2){
		  if(i > j){
			s = '\0';
			break;
		  }else{
			s[j] = c1;
		  }
		  
		}
	  }
	}
  }
  
  if(s == t) cout << "Yes" << endl;
  else       cout << "No" << endl;
	  
  return 0;
}


Measured memory_bytes: 916
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    rep(i,n-1){
        if(s[i] == s[i+1]){
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
        if(i+2 < n && s[i] == s[i+2]){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    cout << -1 << " " << -1 << endl;
    return 0;
}

Measured memory_bytes: 512
use io::*;
use std::*;

const YES: &'static str = "Yes";
const NO: &'static str = "No";
fn solve(A: i64, B: i64, C: i64, D: i64) {
    let mut ahp = A;
    let mut chp = C;

    loop {
        chp = chp - B;
        if chp <= 0 {
            println!("{}", YES);
            return;
        }
        ahp = ahp - D;
        if ahp <= 0 {
            println!("{}", NO);
            return;
        }
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
fn main() {
    let con = read_string();
    let mut scanner = Scanner::new(&con);
    let mut A: i64;
    A = scanner.next();
    let mut B: i64;
    B = scanner.next();
    let mut C: i64;
    C = scanner.next();
    let mut D: i64;
    D = scanner.next();
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(move || solve(A, B, C, D))
        .unwrap()
        .join()
        .unwrap();
}

pub mod io {
    use std;
    use std::str::FromStr;

    pub struct Scanner<'a> {
        iter: std::str::SplitWhitespace<'a>,
    }

    impl<'a> Scanner<'a> {
        pub fn new(s: &'a str) -> Scanner<'a> {
            Scanner {
                iter: s.split_whitespace(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T {
            let s = self.iter.next().unwrap();
            if let Ok(v) = s.parse::<T>() {
                v
            } else {
                panic!("Parse error")
            }
        }

        pub fn next_vec_len<T: FromStr>(&mut self) -> Vec<T> {
            let n: usize = self.next();
            self.next_vec(n)
        }

        pub fn next_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
    }

    pub fn read_string() -> String {
        use std::io::Read;

        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }

    pub fn read_line() -> String {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    }
}


Measured memory_bytes: 2200
//#include<bits/stdc++.h> using namespace std;
#include<iostream>
using namespace std;
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<stack>
#include<queue> //priority_queue inside queue
#include<deque>
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl '\n'
typedef long long ll;
typedef unsigned long long ull;
#define f(i,start,end) for(i=start;i<=end;i++)
#define min_heap priority_queue<int, vector<int>, greater<int> >
#define max_heap priority_queue<int>

bool isPrime(int n)
{
    for(int i=2; i*i<=n; i++)
    {
        if(n%i==0) return false;
    }
    return true;
} //returns true if prime!

bool bl[200001];

int main()
{
    fast;
//int t=0,tc=0; cin >> tc; f(t,1,tc) //testcases
    {
        ll n, m; cin >> n >> m;
        ll h[n+1]; int i=0,a=0,b=0; f(i, 1, n) cin >> h[i];
        f(i, 0, m-1)
        {
          cin >> a >> b;
          if(h[a]<h[b]){
            if(!bl[a]){
              bl[a]=1; n--;
            }
          }
          else if(h[a]>h[b]){
            if(!bl[b]){
              bl[b]=1; n--;
            }
          }
          else if(h[a]==h[b]){
            if(!bl[b]){
              bl[b]=1; n--;
            }
            if(!bl[a]){
              bl[a]=1; n--;
            }
          }
        }
        cout << n << nl;
    }
    return 0;
}
    

Measured memory_bytes: 4516
#include<iostream>
#include<math.h>
#include<string>

using namespace std;

int main()
{
    int a,b,c;

    cin>>a>>b>>c;

    if(a<b && b<c)
    {
        cout<<"Yes";
    }

    else
    {
        cout<<"No";
    }


    cout<<endl;
}


Measured memory_bytes: 3048
/*
  code by RyeCatcher
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cctype>
#include <utility>
#include <queue>
#include <vector>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iostream>
#define DEBUG freopen("dat.in","r",stdin);freopen("wa.out","w",stdout);
#define FO(x) {freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);}
#define ri register int
#define ll long long
#define ull unsigned long long
#define SIZE 1<<22
using std::min;
using std::max;
using std::deque;
using std::vector;
using std::pair;
using namespace __gnu_pbds;
inline char gc(){
    static char buf[SIZE],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,SIZE,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
template <class T>inline void read(T &x){
    x=0;int ne=0;char c;
    while((c=gc())>'9'||c<'0')ne=c=='-';x=c-48;
    while((c=gc())>='0'&&c<='9')x=(x<<3)+(x<<1)+c-48;x=ne?-x:x;return ;
}
const int maxn = 10000005;
const int inf=0x7fffffff;
typedef pair<int,int> pii;
bool vis[maxn];
deque<pii>q;
int k;
int main(){
	int x,y;
	read(k);
	q.push_back(pii(1,1));
	while(q.size()){
		x=q.front().first,y=q.front().second;q.pop_front();
		if(vis[x])continue;vis[x]=1;
		if(x==0){
			printf("%d\n",y);
			break;
		}
		q.push_front(pii(x*10%k,y));
		q.push_back(pii((x+1)%k,y+1));
	}
	return 0;
}


Measured memory_bytes: 1152
/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vll vector<ll>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define NMAX 1000000

void solve()
{
	ll x, y;
	cin >> x >> y;
	//if ()
	if ((y - 2 * x) >= 0 and (y - 2 * x) % 2 == 0 and (4 * x - y) >= 0 and  (4 * x - y) % 2 == 0)
	{
		cout << "Yes\n";
		return;
	}
	cout << "No\n";
	// for (ll i = 1; i <= 5; i++)
	// {
	// 	cin >> x;
	// 	if (x == 0)
	// 	{
	// 		cout << i << "\n";
	// 		return;
	// 	}
	// }
}


int main()
{

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	// ll t;
	// cin >> t;
	// while (t--)
	// {
	solve();
	// }

	return 0;
}

Measured memory_bytes: 3652
input = gets
a,b,k = input.split.map(&:to_i)
gcd = a.gcd(b)
ans = 0
gcd.downto(1) do |i|
	if a % i == 0 && b % i == 0 then
		ans = i
		k = k - 1
	end
	if k <= 0
		break
	end
end
puts ans

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define se second
typedef long long ll;
const int maxn = 100005;
typedef pair<int, int>par;
const ll mod = 1e9+7;

char s[maxn], t[maxn];
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    #ifdef acm
    freopen("a.in", "r",stdin);
    #endif // acm

    cin >> s >> t;
    int ls = strlen(s), lt = strlen(t);

    if( lt != ls+1 )
        cout << "No\n";
    else{
        t[ls] = '\0';
        if( !strcmp(s, t) )cout << "Yes\n";
        else cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#define l int64_t
#define c continue
using namespace std;
int main(){l m=1e9+7,x,y,z,w,o,p,q,v[93],t[91][91][2],a,b;v[0]=1,v[1]=1;for(l i=2;i<93;i++)v[i]=v[i-1]+v[i-2];for(l i=2;i<91;i++){for(l j=1;j<i;j++){a=v[i],b=v[i+1];if(j<2){t[i][0][0]=a,t[i][0][1]=b,t[i][j][0]=b,t[i][j][1]=2*b-a;c;}t[i][j][0]=t[i-1][j-1][1],t[i][j][1]=t[i-1][j-1][1]+t[i-1][j-1][0];}}cin>>q;while(q--){cin>>x>>y;if(x>y)swap(x,y);if(y<2){cout<<"1 1\n";c;}for(l i=0;i<93;i++){if(v[i]>x||v[i+1]>y){z=i-1;break;}}cout<<z<<" ";if(z<2){cout<<x*y%m<<" ";c;}w=0;for(l j=0;j<z;j++){o=t[z][j][0],p=t[z][j][1];if(o>x||p>y)c;w+=(y-p)/o+1;if(x>=p)w+=(x-p)/o+1;}cout<<w%m<<" ";}}

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

int main() {
  int N ;
  cin >> N;
  vector<int> A(N);
  for(int i=0; i<N-1; i++){
    int a;
    cin >> a;
    A.at(a-1)++;
  }
  for(int i=0; i<N; i++){
    cout << A.at(i) << endl;
  }
}

Measured memory_bytes: 4052
#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve(){
	int x;
	cin>>x;
	unordered_set<LL> t;
	t.insert(0);
	LL dis = 1;
	LL pre = 0;
	while(dis<=1ll*x){
		LL temp = pre+1;
		temp = pow(temp,5);
		LL pretemp = temp;
		t.insert(temp);
		t.insert(-temp);
		pre++;
		temp = pow(pre+1,5);
		dis = temp-pretemp;
	}
	// cout<<pre<<endl;
	int ra=0,rb=0;
	for(int i=0;i<=(pre);i++){
		LL temp = i;
		temp = pow(temp,5);
		temp-=x;
		if(t.count(temp)){
			ra = i;
			LL sign = 1;
			if(temp<0) sign = -1;
			temp = abs(temp);
			rb = int(pow(temp,1.0/5)) * sign;
			break;
		}
	}
	cout<<ra<<' '<<rb<<endl;

}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3956
#include<iostream>
using namespace std;
int main()
{
	int m, n;
	int a[1001];
	int i, j;

	cin >> n >> m;
	int total = 0;
	for (i = 0; i < n; i++) {
		cin >> a[i];
		total += a[i];
	}

	int enable = total / 4 / m;
	if (total % (4 * m) == 0) {
		enable--;
	}
	//cout << enable << endl;

	int ans = 0;
	for (i = 0; i < n; i++) {
		if (a[i] > enable) {
			ans++;
		}
	}
	if (ans >= m) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#define mod 1000000007
#define MAX 100050
typedef long long ll;
using namespace std;
// 累積和
int v[MAX]; // v[i]:i番目で"AC"ができるかどうか
int cnt[MAX]; // cnt[i]:i番目までにある"AC"の数

int main(){
  int N,Q; cin >> N >> Q; 
  string s; cin >> s;
  
  for(int i=0;i<N;i++){
    if(s[i]=='A' && s[i+1]=='C' && i+1<N) v[i+1]++;
  }
  cnt[1] = 0;
  for(int i=1;i<N;i++) cnt[i+1] = cnt[i] + v[i];
  for(int i=0;i<Q;i++){
    int l,r; cin >> l >> r;
    cout << cnt[r] - cnt[l] << endl;
  }
  return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

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

		// 入力値の取得
		int N = sc.nextInt();
		
		// 結果の出力
		System.out.println(N % 1000 == 0? 0 : 1000 - N % 1000);
		
		sc.close();
	}
}


Measured memory_bytes: 27104
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
#define all(a) a.begin(),a.end()
using namespace std;
const ll M=1e9+7;
int n;
ll a[200005];
ll ans=0;
ll cnt[200005]={0};

int main(void){
	cin>>n;
	REP(i,n){
		cin>>a[i];
	}
	sort(a,a+n);
	FORN(i,1,n+1)cnt[i]=(cnt[i-1]+a[i-1])%M;
	REP(i,n){
		ans=(ans+(a[i]%M*cnt[i]%M+M)%M)%M;
//		cout<<i<<':'<<a[i]*(cnt[n]-cnt[i+1])<<endl;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6712
s = input()
ans = 10**5
def f(s,w):
    cnt = 0
    k = s.count(w)
    length = len(s)
    while True:
        if k==length:
            break
        s_=''
        for i in range(len(s)-1):
            if s[i+1]==w:
                s_+=w
            else:
                s_+=s[i]
        length-=1
        k = s_.count(w)
        s = s_
        cnt+=1
    return cnt
for s_ in s:
    ans = min(ans,f(s,s_))
print(ans)

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

int main() {
  int a, b;
  cin >> a >> b;
  
  int c = a * b;
 
  if (c % 2 == 0) {
    cout << "Even" << endl;
  }
  
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int number(char c) {
  int num = 0;
  num = (int)(c - '0');
  return num;
}
int main() {
  int n;
  string s;
  cin >> n >> s;
  vector<int> a(n);
  for(int i = 0; i < n; i++) {
    a[i] = number(s[i]);
  }
  int ans = 0;
  for(int i = 0; i <= 999; i++) {
    int tmp[3] = {i / 100, (i % 100) / 10, i % 10};
    int j = 0;
    for(int k = 0; k < 3; k++) {
      while(j < n && tmp[k] != a[j]) {
        j++;
      }
      if(k < 2) {
        j++;
      }
    }
    if(j < n) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3688