akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define int long long

#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define fi first
#define se second

using vint = vector<int>;
using pint = pair<int, int>;
using vpint = vector<pint>;

template <typename A, typename B>
inline void chmin(A& a, B b) {
    if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A& a, B b) {
    if (a < b) a = b;
}

template <class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>& p) {
    ost << "{" << p.first << "," << p.second << "}";
    return ost;
}

template <class T>
ostream& operator<<(ostream& ost, const vector<T>& v) {
    ost << "{";
    for (int i = 0; i < v.size(); i++) {
        if (i) ost << ",";
        ost << v[i];
    }
    ost << "}";
    return ost;
}

inline int topbit(unsigned long long x) {
    return x ? 63 - __builtin_clzll(x) : -1;
}

inline int popcount(unsigned long long x) {
    return __builtin_popcountll(x);
}

inline int parity(unsigned long long x) {
    return __builtin_parity(x);
}

const int INF = 1001001001;

signed main() {
    int H, W;
    cin >> H >> W;

    vint dp(W, 0);
    set<int> idx;
    multiset<int> val;
    rep(i, W) {
        idx.insert(i);
        val.insert(0);
    }

    rep(i, H) {
        int a, b;
        cin >> a >> b;
        a--;
        int mi = INF;
        while (true) {
            auto it = idx.lower_bound(a);
            if (it == idx.end() || *it >= b) break;
            int k = *it;
            idx.erase(it);
            chmin(mi, b - k + dp[k]);
            val.erase(val.find(dp[k]));
            dp[k] = INF;
        }
        if (b < W && mi != INF) {
            if (idx.find(b) != idx.end()) {
                val.erase(val.find(dp[b]));
            }
            chmin(dp[b], mi);
            val.insert(dp[b]);
            idx.insert(b);
        }
        if (val.size() == 0)
            puts("-1");
        else
            printf("%lld\n", *val.begin() + i + 1);
    }
    return 0;
}

Measured memory_bytes: 23524
#include <stdio.h>
#include <string.h>

const char word[9][6] = {{".,!? "},{"abc"},{"def"},{"ghi"},{"jkl"},{"mno"},{"pqrs"},{"tuv"},{"wxyz"}};
const char len[9] = {5,3,3,3,3,3,4,3,4};
int main(void){
	char str[1025], tmp;
	int n, i, j, count;
	scanf("%d%*c",&n);
	for(i = 0;i < n;i++){
		gets(str);
		str[strlen(str)] = '\0';
		j = 0;
		while(str[j] != '\0'){
			tmp = str[j];
			if(tmp != '0'){
				count = 1;
				while(str[++j] == tmp)
					count++;
				putchar(word[tmp - '1'][(count - 1) % len[tmp - '1']]);
			}
			else
				j++;
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 1004
(let* ((n (read))
       (ans 0)
       (m 0))
  (loop :for i :from 1 :to n
        :for a := (read)        
        :do (let ((f 0))
              (if (> m a)
                  (setf f (- m a)))
              (incf ans f)
              (setf m (max m (+ a f)))))
  (format t "~A~%" ans))


Measured memory_bytes: 77128
#include <bits/stdc++.h>
using namespace std;
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; }
using ll = long long;
using P = pair<int, int>;
ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; }
ll LCM(ll a, ll b) { return a/GCD(a, b)*b; }

int n, m;

int main() {
    cin >> n >> m;
    vector< vector<int> > graphlist(n, vector<int>());
    for(int i = 0; i < m; ++i) {
        int aa, bb;
        cin >> aa >> bb;
        aa--; bb--;
        graphlist.at(aa).emplace_back(bb);
        graphlist.at(bb).emplace_back(aa);
    }

    vector<int> visit(n, -1);
    queue<int> que;
    que.push(0);
    while(!que.empty()) {
        int now = que.front();
        que.pop();
        for(int i = 0; i < (int)graphlist.at(now).size(); ++i) {
            int next = graphlist.at(now).at(i);
            if(visit.at(next) == -1) {
                visit.at(next) = now+1;
                que.push(next);
            }
        }
    }

    bool flg = true;
    for(int i = 0; i < n; ++i) {
        if(visit.at(i) == -1) {
            flg = false;
            break;
        }
    }

    if(flg) {
        cout << "Yes" << endl;
        for(int i = 1; i < n; ++i) {
            cout << visit.at(i) << endl;
        }
    }else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 10040
/******************************************
* AUTHOR : SHUBHAM KUMAR *
* NICK : { "CODECHEF" : "SCHELEON",
		   "CODEFORCES" : "SCH3130N" } * 	
* INSTITUTION : BIT MESRA *
******************************************/

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define sd(x) scanf("%lld",&x)
#define ll long long int
#define large 100005
#define MOD 1000000007
#define dd double
#define pb push_back
#define mk make_pair
#define rep0(i,b) for(int i=0;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define pll pair<ll, ll>
#define ld long double
#define vll vector<ll>
#define vpll vector<pll>
#define sortv(v) sort(v.begin(),v.end())  

ll ModE(ll x, unsigned ll y, ll p = MOD) 
{ 
    ll res = 1;
    x = x % p;    
    while (y > 0) 
    {   if (y & 1) 
            res = (res*x) % p; 
        y = y>>1;
        x = (x*x) % p;   
    } 
    return res; 
}

using namespace std;

ll dp[100][large],a[large][3];
ll n;
ll v[100],w[100];
ll solve(ll i, ll weight){
	if(i<0)
		return 0;
	if(dp[i][weight] != -1)
		return dp[i][weight];

	if(weight-w[i]>=0)
		dp[i][weight] = max(v[i]+solve(i-1, weight-w[i]), solve(i-1, weight));
	else
		dp[i][weight] = solve(i-1, weight);
	return dp[i][weight];

	// if(weight-w[i]>=0)
	// 	return max(v[i]+solve(i-1, weight-w[i]), solve(i-1, weight));
	// else
	// 	return solve(i-1, weight);
	//return dp[i][weight];
}

int main() {
	#ifdef M_DEBUG
    //#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

	fastio
	//ios_base& scientific (ios_base& str);

	//ll T; cin>>T; while(T--){}
	ll W;
	cin>>n>>W;
	rep0(i,n){
		cin>>w[i]>>v[i];
	}
	rep0(i,large)
		rep0(j,n)
			dp[j][i] = -1;
	
	// rep0(i,10){
	// 	rep0(j,10)
	// 		cout<<dp[i][j]<<" ";
	// 		cout<<endl;}
	//cout<<"hello"<<endl;
	cout<<solve(n-1, W);

	return 0;
}

Measured memory_bytes: 78720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll x,y;
    cin>>x>>y;
    //ll t=1;
    //ll ans=x*t;
    ll steps=0;
    while(x<=y)
    {
        steps++;
        x=x*2;
    }
    cout<<steps;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力
		int b = sc.nextInt();
		int c = sc.nextInt();
		int m = a*b;
		if(m >= c) {
			System.out.println(c);
		}else {
			System.out.println(m);
		}
		
	}
}

Measured memory_bytes: 23380
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

typedef long long ll;

int main(){

	string S;
	cin >> S;
	int i = 0;

	while( i < S.length()){
		string test = S.substr(i,5);
		if(test == "dream"){
			if(S[i+5] == 'e'){
				if (S[i+6] == 'r'){
					if(S[i+7] == 'a'){
						i = i+5;
						//cout << "dream era" << endl; 
					}
					else{
						i = i+7;
						//cout << "dreamer not a" << endl;
					}
				}
				else{ 
					//cout << "break r" << endl;
					break;
				}
			}
			else{
				i = i+5;
				//cout << "dream not e" << endl;
			}	
		}
		else if(test == "erase"){
			if (S[i+5] == 'r'){
				i = i+6;
				//cout << "eraser" << endl;
			}
			else{
				i = i+5;
				//cout << "erase not r" << endl;
			}
		}
		else{
			//cout << "not correspond" << endl; 
			break;
		}
	}


	string ans ;
	if (i == S.length())
		ans = "YES";
	else ans = "NO";

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

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<cmath>
#include<stack>
#include<algorithm>
#define rg register
#define ll long long
#define LDB long double
#define ull unsigned long long
#define view(i,x) for(rg int i=hd[x];i!=-1;i=e[i].nt)
#define go(i,x,a) for(rg int i=a;i<x;i++)
#define inf 0x3f3f3f3f
#define INF 0x7fffffff
using namespace std;

const int maxn=105;
int n;

inline int rd(){
	int ret=0,af=1; char gc=getchar();
	while(gc < '0' || gc > '9'){ if(gc=='-') af=-af; gc=getchar(); }
	while(gc >= '0' && gc <= '9') ret=ret*10+gc-'0',gc=getchar();
	return ret*af;
}

int main(){
	#ifndef ONLINE_JUDGE
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	#endif
	n=rd();
	if(n%2 == 0){
		if(n == 4){
			printf("%d\n",4);
			printf("%d %d\n",1,2); printf("%d %d\n",4,2);
			printf("%d %d\n",1,3); printf("%d %d\n",4,3);
		}else{
			printf("%d\n",n*2);
			go(i,n/2,1){
				printf("%d %d\n",i,i+1); printf("%d %d\n",n-i+1,n-i);
				printf("%d %d\n",i,n-i); printf("%d %d\n",n-i+1,i+1);
			}
			printf("%d %d\n",1,n/2); printf("%d %d\n",n,n/2+1);
			printf("%d %d\n",1,n/2+1); printf("%d %d\n",n,n/2);
		}
	}else{
		if(n == 3){
			printf("%d\n",2);
			printf("%d %d\n",1,3); printf("%d %d\n",2,3);
		}else{
			printf("%d\n",2*(n/2)*(n/2-1)+n-1);
			go(i,n/2+1,1)
				go(j,n/2+1,i+1){
					printf("%d %d\n",i,j); printf("%d %d\n",n-i,n-j);
					printf("%d %d\n",i,n-j); printf("%d %d\n",n-i,j);	
				}
			go(i,n,1) printf("%d %d\n",i,n);
		}
	}
	return 0;
}//Faze


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    X = int(input())

    kyu = int()
    if X <= 599:
        kyu = 8
    elif X <= 799:
        kyu = 7
    elif X <= 999:
        kyu = 6
    elif X <= 1199:
        kyu = 5
    elif X <= 1399:
        kyu = 4
    elif X <= 1599:
        kyu = 3
    elif X <= 1799:
        kyu = 2
    else:
        kyu = 1
    print(kyu)

if __name__ == "__main__":
    main()



Measured memory_bytes: 61728
#include <iostream>

using namespace std;

#define MAX_H 100000
#define MAX_W 100000
#define MOD 1000000007

typedef long long ll;

ll inv_(ll a, ll m){
	// assert(0 < a < m && gcd(a,m) == 1 && 0 < ret < m)
	if(a == 1) return 1;
	return m+(1 - m * inv_(m % a, a)) / a;
}

ll inv(ll a, ll m){
	if(m < 0) m = -m;
	a %= m;
	return inv_((a < 0 ? a+m : a), m);
}


/*
(b-1)C0 * (h+p-2)C(p-1) + (b-1+1)C1 * (h+p-3)C(p-1) + … + (b-1+q-1)C(q-1) * (h+p-2+q-1)C(p-1)
*/
int main(){
	int h,w,a,b,h2;
	cin >> h >> w >> a >> b;
	int p = w-b;
	int q = h-a;
	
	ll l = 1,r=1,ans = 0;
	
	// r = (h+p-1)C(p-1)
	for(int i = 1;i < p;i++){
		r = r*(h+i)%MOD*inv(i, MOD)%MOD;
	}
	
	for(int i = 0;i < q;i++){
		if(i) l = l*(b-1+i)%MOD*inv(i, MOD)%MOD;
		r = r*inv(h+p-1-i, MOD)%MOD*(h-i)%MOD;
		ans = (ans + l*r%MOD) % MOD;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import sys


def slove():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    ls = [10 ** 10] * n
    t = 0
    for i in range(n):
        t += a[i]
    t /= n
    mt = 10 ** 10
    for i in range(n):
        ls[i] = abs(a[i] - t)
        mt = min(mt, ls[i])
    for i in range(n):
        if ls[i] == mt:
            print(i)
            exit()


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38512
def SieveOfEratosthenes(n):
    sn = int(n ** 0.5)
    res = []
    check = [False] * (sn + 1)
    for i in range(2, sn+1):
        if check[i]:
            continue
        res.append(i)
        for j in range(2 * i, sn+1, i):
            check[j] = True
    return res

def trialDivision(n):
    res = dict()
    pn = SieveOfEratosthenes(n)
    for p in pn:
        while n % p == 0:
            res[p] = res.get(p, 0) + 1
            n //= p
    if n > 1:
        res[n] = 1
    return res

N = int(input())
fn = trialDivision(N)
ans = 0
for n in fn.values():
    res = 0
    s = 0
    for i in range(1, n+1):
        if s + i > n:
            break
        s += i
        res += 1
    ans += res

print(ans)



Measured memory_bytes: 80992
// writer: w33z8kqrqk8zzzx33
#include <bits/stdc++.h>
using namespace std;
 
#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

int dp[100005];

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, w; cin >> n >> w;
    memset(dp, 0x3f, sizeof dp); dp[0] = 0;
    rep(i, n) {
        int s, v; cin >> s >> v;
        for(int i=100000; i>=v; i--) dp[i] = min(dp[i], dp[i-v]+s);
    }
    int bes = 0;
    rep(i, 100001) if(dp[i] <= w) bes = i;
    cout << bes << endl;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define x1 ahdhasd
#define x2 isdhfisdf
#define y1 osafoijsdgd
#define y2 sjbfdd
#define MAX 100000000

int x1, y1, x2, y2;
int n;
int ax[200005], ay[200005];
double pi;

double ct(int asli, int num){
	double res = (double)asli*100.0;
	res -= (double)num*20;
	res += (double)num*pi*5;
	return res;
}

int bit[400005];
int dp[400005];

void update(int x, int v){
	for(++x; x < 400005; x += x&-x) bit[x] = max(bit[x], v);
}

int query(int x){
	int res = 0;
	for(++x; x > 0; x -= x&-x) res = max(res,bit[x]);
		return res;
}

int get(vector<int> &arr){
	vector<int> v = arr;
	sort(v.begin(),v.end());
	int a = v.size();
	v.erase(unique(v.begin(),v.end()),v.end());
	int b = v.size();
	assert(a==b);
	for(int i = 0; i < arr.size(); i++ ){
		arr[i] = lower_bound(v.begin(),v.end(),arr[i])-v.begin();
	}
	int res = 0;
	for(int i = 0; i < arr.size(); i++ ){
		dp[i] = query(arr[i])+1;
		res = max(res, dp[i]);
		update(arr[i],dp[i]);
	}
	return res;
}

int main(){
	pi = acos((double)-1.0);

	scanf("%d%d%d%d%d",&x1,&y1,&x2,&y2,&n);
	for(int i = 0; i < n; i++ ){
		scanf("%d%d",&ax[i],&ay[i]);
	}

	if(x1 > x2){
		// mirror h
		x1 = MAX-x1;
		x2 = MAX-x2;
		for(int i = 0; i < n; i++ ){
			ax[i] = MAX-ax[i];
		}
	}
	if(y1 > y2){
		// mirror v
		y1 = MAX-y1;
		y2 = MAX-y2;
		for(int i = 0; i < n; i++ ){
			ay[i] = MAX-ay[i];
		}
	}
	assert(x1<=x2 && y1<=y2);
	vector<pair<int,int> > v;
	for(int i = 0; i < n; i++ ){
		if(ax[i]<x1||ax[i]>x2||ay[i]<y1||ay[i]>y2) continue;
		v.emplace_back(ax[i],ay[i]);
	}

	if(x1==x2){
		// vertikal
		if(!v.empty()){
			double res = y2-y1;
			res *= 100.0;
			res -= 20.0;
			res += pi*10;
			printf("%.20lf\n",res);
		}
		else{
			printf("%.20lf\n",(double)((double)y2-y1)*100.0);

		}
		return 0;
	}

	if(y1==y2){
		// horizontal
		if(!v.empty()){
			double res = x2-x1;
			res *= 100.0;
			res -= 20.0;
			res += pi*10;
			printf("%.20lf\n",res);
		}
		else{
			printf("%.20lf\n",(double)((double)x2-x1)*100.0);
		}
		return 0;
	}


	sort(v.begin(),v.end());
	vector<int> arr;
	for(auto i : v){
		arr.push_back(i.second);
	}
	int aa = get(arr);
	if(aa==x2-x1+1 || aa==y2-y1+1){
		aa--;
		double aaa = ct(y2-y1 + x2-x1, aa);
		aaa -= 20.0;
		aaa += pi*10;
		printf("%.20lf\n",aaa);
		return 0;
	}
	printf("%.20lf\n",ct(y2-y1 + x2-x1, aa));

	return 0;
}


Measured memory_bytes: 7536
#include <iostream>
#include <string>

using namespace std;

string s;
int n, k;
int flag[20];
long long ans = 0;

long long cal (string str) {
    long long subans = 0;
    string w;
    for(int i = 0; i < str.size(); i++) {
        if(str.at(i) == '+') {
            subans += stoll(w);     // s to ll 文字列strを数値として読み取って、long long型の値に変換する。(stoi, sto l, stod)
            w.clear();
        } else {
            w += str.at(i);
        }
    }
    subans += stoll(w);
    return subans;
} 

void dfs(int i) {
    if(i == s.size()-1) {
        string str;
        str += s.at(0);
        for(int j = 1; j < s.size(); j++) {
            if(flag[j-1] == 1) str.push_back('+');
            str.push_back(s.at(j));
        }
        ans += cal(str);
        return;
    }
    flag[i] = 1;
    dfs(i+1);
    flag[i] = 0;
    dfs(i+1);
}

void solve() {
    dfs(0);
    cout << ans << endl;
}

int main() {
    cin >> s;
    solve();
    return 0;
}

Measured memory_bytes: 256
def gcd(x, y):
    if y == 0:
        return x
    else:
        r = x % y
        return  gcd(y, r)

a, b = map(int, input().split())

if a <  b:
    c = a
    a = b
    b = c
    
print(int(gcd(a, b)))
   


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

int main(){
  int N,M;
  cin >>N>>M;
  if (N==M){
    cout<<0<<endl;
    return 0;
  }
  int P[M];
  int D[M-1];
  
  //vector <int> P;
  //vector <int> D;
  for (int i=0;i<M;i++){
    cin>>P[i];
  }
  sort(P,P+M);
  for(int i=0;i<M-1;i++){
    D[i]=P[i+1]-P[i];
  }
  sort(D,D+M-1);
  int ans=0;
  for(int i=0;i<M-N;i++){
    ans=ans+D[i];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void){

  int n;
  scanf("%d", &n);
  char s[10001];
  scanf("%s", s);

  for (int i = 0; i < 10001; i++) {
    if (s[i] < 'A' || s[i] > 'Z') {
      break;
    }
    s[i] += n;
    if (s[i] > 'Z') {
      s[i] += 'A'-'Z'-1;
    }
    printf("%c", s[i]);
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define mem(a,b) memset(a,b,sizeof(a))
#define ll long long
#define ull unsigned long long
#define EPS 1e-8
using namespace std;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
const double pi = acos(-1.0);
int read()
{
	int ret=0;char ch=getchar();
	while(ch<'0'||ch>'9') ch=getchar();
	for(;ch>='0'&&ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret;
}
const int MAX_N=1e5+7;
const int INF=0x3f3f3f3f;
bool vis[MAX_N];
int dis1[MAX_N],dis2[MAX_N];
int n,a,b;
vector <int> G[MAX_N];
void dfs1(int k,int num)
{
	 for(int i=0;i<G[k].size();i++)
	 {
	 	if(!vis[G[k][i]]&&G[k][i]!=n)
	 	{
	 		dis1[G[k][i]]=min(dis1[G[k][i]],num);
	 		vis[G[k][i]]=true;
	 		dfs1(G[k][i],num+1);
	 		vis[G[k][i]]=false;
		}
	 }
}
void dfs2(int k,int num)
{
	 for(int i=0;i<G[k].size();i++)
	 {
	 	if(!vis[G[k][i]]&&G[k][i]!=1)
	 	{
	 		dis2[G[k][i]]=min(dis2[G[k][i]],num);
	 		vis[G[k][i]]=true;
	 		dfs2(G[k][i],num+1);
	 		vis[G[k][i]]=false;
		}
	 }
}
int main()
{
 	#ifdef TEST
	 	freopen("input.txt","r",stdin);
	#endif
	mem(vis,0);
	fill(dis1,dis1+MAX_N,INF);
	fill(dis2,dis2+MAX_N,INF);
	scanf("%d",&n);
	for(int i=0;i<n-1;i++)
	{
		scanf("%d%d",&a,&b);
		G[a].push_back(b);
		G[b].push_back(a);
	}
	vis[1]=true;
	dfs1(1,1);
	mem(vis,0);
	vis[n]=true;
	dfs2(n,1);
	int cnt1=0,cnt2=0;
	for(int i=2;i<n;i++)
	{
		if(dis1[i]<=dis2[i])
		{
			cnt1++;
		}
		else
		{
			cnt2++;
		}
	}
	if(cnt1<=cnt2)
	{
		puts("Snuke");
	}
	else
	{
		puts("Fennec");
	}
	return 0;
}



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

using ll=long long;
const ll MOD=1e9+7;
int main(){
    int n,m;
    cin>>n>>m;
    vector<ll> x(n),y(m);
    for(int i=0;i<n;i++) cin>>x[i];
    for(int i=0;i<m;i++) cin>>y[i];

    auto calc=[](vector<ll> v){
        int n=v.size();
        ll res=0;
        for(int i=0;i+1<n;i++){
            res+=ll(i+1)*(n-1-i)%MOD*(v[i+1]-v[i])%MOD;
        }
        return res%MOD;
    };
    cout<<(calc(x)*calc(y))%MOD<<endl;
    return 0;
}

Measured memory_bytes: 3328
import collections

n = input()
al = tuple(x for x in input().split())
aset = set(al)

# {number: count}
ccc = collections.Counter
counts_d = ccc(al)

# Count of count
v_counts = ccc(v for v in counts_d.values())

whole_patterns = sum(
    (int(k * (k - 1) / 2)) * v for k, v in v_counts.items() if k > 1
)

[print(whole_patterns - counts_d[a] + 1) for a in al]


Measured memory_bytes: 32408
main = getLine >>= putStrLn . solve . read

solve :: Int -> String
solve x = let h = x `div` 3600
              m = (x - h * 3600) `div` 60
              s = x - (h * 3600) - (m * 60)
           in (show h) ++ ":" ++ (show m) ++ ":" ++ (show s)


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

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''


n=int(input())
ans=0
for i in range(1,n+1):
    ans+=i*(n//i)*(1+n//i)//2
print(ans)

Measured memory_bytes: 9092
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
//#include <intrin.h>

using namespace std;

typedef long long ll;

inline void solve() {
	int k;
	cin >> k;
	string s;
	cin >> s;
	if (s.size() <= k)
		cout << s;
	else
		cout << s.substr(0, k) + "...";
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		cout << '\n';
	}
}

Measured memory_bytes: 3656
#define _CRT_SECURE_NO_WARNINGS
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(c) begin(c), end(c)
#define range(i,a,b) for(int i = a; i < (int)(b); i++)
#define rep(i,b) range(i,0,b)
#define eb emplace_back
typedef long long ll;
// #define int ll
auto const inf = numeric_limits<int>::max()/4;

using Weight = int;
using Capacity = int;
struct Edge {
    int src, dst; Weight weight;
    Edge(int s, int d, int w) : src(s), dst(d), weight(w) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

pair<vector<Weight>, bool> spfa(const Graph &g, int s){
    const Weight inf = numeric_limits<Weight>::max()/4;
    const int n = g.size(); queue<int> q;
    vector<Weight> dist(n, inf); vector<int> inQ(n);
    vector<int> count(n);
    dist[s] = 0; q.emplace(s); inQ[s] = true; ++count[s];
    bool negCycle = false;
    for(int i = 0; q.size(); i++){
        int v = q.front(); q.pop(); inQ[v] = false;
        for(auto &e : g[v]){
            if(dist[v] != inf && dist[e.dst] > dist[v] + e.weight){
                dist[e.dst] = dist[v] + e.weight;
                if(!inQ[e.dst]){
                    q.emplace(e.dst); inQ[e.dst] = true; ++count[e.dst];
                    if(count[e.dst] >= n){ negCycle = true; goto END; }
                }
            }
        }
    }
 END:;
    return make_pair(dist, !negCycle);
}

int main(){
    int V,E,r;
    while(cin >> V >> E >> r){
        Graph g(V);
        rep(i,E){
            int a,b,c;
            cin >> a >> b >> c;
            g[a].eb(a,b,c);
        }
        bool ok;
        vector<Weight> dist;
        tie(dist, ok) = spfa(g,r);
        if(ok){
            for(int i = 0; i < (int)dist.size(); i++){
                if(dist[i] == inf) cout << "INF";
                else cout << dist[i];
                cout << endl;
            }
        } else {
            cout << "NEGATIVE CYCLE" << endl;
        }
    }
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, m;
ll a[100005];
ll sig[2 * 100005];
ll ct[2 * 100005];
ll neg[2 * 100005];

int main () {
    ios::sync_with_stdio(false);
    cin >> n >> m;
    ll all = 0;
    
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
        a[i]--;
    }
 
    for(int i = 1; i < n; ++i) {
        // calc operations without favorite
        ll d = a[i] - a[i - 1];
        if (d < 0) d += m;
        all += d;
 
        // add range
        ll l = a[i - 1];
        ll r = a[i];
        if (l > r) r += m;
        if (l + 1 >= r) continue;
        sig[l + 2]++;
        sig[r + 1]--;
        neg[r + 1] += r - l - 1;
    }
 
    ll pct = 0;
    ll cur = 0;

    for(int i = 0; i < 2 * m - 1; ++i) {
        pct += sig[i];
        cur += pct;
        cur -= neg[i];
        ct[i] = cur;
    }

    ll mmax = 0;
    for(int i = 0; i < m; ++i) {
        mmax = max(mmax, ct[i] + ct[i + m]);
    }
 
    cout << all - mmax << endl;
    
}

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

int main() {
    int a,b,c,d;
    cin>>a;
    if(a==1){
    	cout<<"Hello World"<<endl;
    }
    else{
    	
    	cin>>b>>c;
    	d=c+b;
    	cout<<d<<endl;
    }
    
  
	return 0;
}

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

#define ll long long int
#define pf push_front
#define mod  1000000007
#define inf  1000000000000000000
#define pi  acos(-1.0)
#define maxn  1000009
#define endl '\n'
#define sorted(s)  sort(s.begin(),s.end())
#define reversed(s) reverse(s.begin(),s.end())
#define sortarr(a) sort(a,a+n)
#define slc(n) scanf("%I64d", &n)
#define sl(n)  scanf("%lld", &n)
#define sf(n)  scanf("%lf", &n)
#define si(n)  scanf("%d", &n)
#define sch(n)  scanf(" %c", &n)
#define ss(n)  scanf("%s", n)
#define prf printf
#define pb  push_back
#define fr first
#define sc second
#define all(a)  a.begin(),a.end()
#define forl(n) for(i=0;i<n;i++)
#define ison(n,j) (n&(1LL<<j))
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

int main()
{
   ll a,b,x,y,res;
   cin>>a>>b;
   if(a%2)
    x=a+1;
   else
    x=a;
   if(b%2)
    y=b;
   else
    y=b-1;
   if(((y-x+1)/2)%2)
    res=1;
   else
    res=0;
   if(a%2)
    res=res^a;
   if(b%2==0)
    res=res^b;
   cout<<res<<endl;

    return 0;
}


Measured memory_bytes: 3612
N,M,X,Y=map(int,input().split())
xs=list(map(int,input().split()))
ys=list(map(int,input().split()))
def check(xs,ys,z):
    for x in xs:
        if z<=x:
            return
    for y in ys:
        if z>y:
            return 0
    return 1
if min(ys)<=max(xs):
    print("War")
else:
    f=1
    for z in range(max(xs)+1, min(ys)+1):
        if X<z and Y>=z:
            f=0
            print("No War")
            break
    if f:
        print("War")


Measured memory_bytes: 3064
#-*- using:utf-8 -*-

def count_negative(n,a):
    count = 0
    for i in range(n):
        if a[i] == 0:
            return 0
        elif a[i] < 0:
            count += 1
    return count

def num_of_min(n,a):
    minimum = sum(map(abs,a))
    
    count = 0    
    tmp = 0
    for i in range(n):
        tmp = abs(a[i])
        if tmp < minimum:
            minimum = tmp
            count = i
        else:
            pass
    return count

def flipping(n,a):
    nc = count_negative(n,a)
    total = 0
    count = 0
    if nc % 2 == 0:
        total = sum(map(abs,a))
    else:
        count = num_of_min(n,a)
        target = a.pop(count)
        
        total = sum(map(abs,a))
        if target > 0:
            total += target*(-1)
        else:
            total += target

    return total

if __name__ == '__main__':
    n = int(raw_input())
    a = map(int,raw_input().split())
    gt = flipping(n,a)
    print("%d" %gt)


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  ll a,b;
  cin>>a>>b;
  if((a*b)%2==0) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List
import Text.Printf

readInts :: IO [Int]
readInts = map read . words <$> getLine

main :: IO ()
main = do
  [x, y] <- sort <$> readInts
  when (y > 0) $ do
    printf "%d %d\n" x y
    main



Measured memory_bytes: 4180
using System;
using System.Collections.Generic;
using System.Linq;

class Class1
{
    static void Main(string[] args)
    {
        List<int> inputs = Console.ReadLine().Split(' ').Select(_ => int.Parse(_)).ToList();
        int L = inputs[0];
        int R = inputs[1];
        int d = inputs[2];

        int result = 0;
        for (int i = L; i <= R; i++)
        {
            if (i % d == 0)
            {
                result++;
            }
        }

        Console.WriteLine(result);
    }
}

Measured memory_bytes: 28304
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
#define PI 3.1415926535897932384626433832795028
#define INF (1<<29)
#define LINF (1LL<<60)
using namespace std;
using INT = long long;
using P = pair<int,int> ;

int main(){
    int n;
    cin >> n;
    int d1[n];
    int d2[n];
    rep(i,n){
        cin >> d1[i];
        cin >> d2[i];
    }
    int cnt=0;
    rep(i, n){
        if(d1[i]==d2[i])cnt++;
        else cnt=0;
        if(cnt==3){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";

	return 0;
}



Measured memory_bytes: 3632
#include <iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#define pb push_back
#define ll long long
#define ld long double
#define f first
#define s second

using namespace std;
const int N = 1e5 + 5;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int x, y; cin >> x >> y;
    int fl = 0;
    for(int i = 0; i <= x; i++)
    {
        if(i * 2 + (x - i) * 4 == y)fl = 1;
    }
    if(fl)cout << "Yes";
    else cout << "No";
    return 0;
}




Measured memory_bytes: 3632
n, m = map(int, input().split())
a = []
b = []
c = n - m + 1
for i in range(n):
    a.append(input())
for i in range(m):
    b.append(input())
ans = 'No'
for i in range(c):
    for j in range(c):
        flag = 0
        for k in range(m):
            if b[k] == a[i + k][j:j + m]:
                flag += 1
        if flag == m:
            ans = 'Yes'
            break
print(ans)



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

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

    for (int a = 0; a <= N; a++) {
        for (int b = 0; a + b <= N; b++) {
            int c = N - (a + b);
            if (Y - 10000 * a - 5000 * b == 1000 * c) {
                cout << a << " " << b << " " << c << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define N 1005
using namespace std;
int x, y, z, k;
ll a[N], b[N], c[N];
bool cmp(ll A, ll B) { return A > B; }
class Node {
  public:
    int id1, id2, id3;
    ll sum;
    bool operator < (Node a) const {
      if (a.sum == sum) {
        if (a.id1 == id1) {
          if (a.id2 == id2) {
            return a.id3 < id3;
          }
          return a.id2 < id2;
        }
        return a.id1 < id1;
      }
      return a.sum > sum;
    }
    Node(ll _sum, int _id1, int _id2, int _id3) {
      sum = _sum, id1 = _id1, id2 = _id2, id3 = _id3;
    }
    Node() {}
};

priority_queue<Node>q;
map<Node, int> mp;

int main() {
  scanf("%d%d%d%d", &x, &y, &z, &k);
  for (int i = 1; i <= x; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= y; i++) scanf("%lld", &b[i]);
  for (int i = 1; i <= z; i++) scanf("%lld", &c[i]);
  sort(a + 1, a + x + 1, cmp);
  sort(b + 1, b + y + 1, cmp);
  sort(c + 1, c + z + 1, cmp);
  q.push(Node(a[1] + b[1] + c[1], 1, 1 + x, 1 + x + y));
  
  while (k--) {
    Node now = q.top(), tmp;
    q.pop();
    mp[now] = 0;
    printf("%lld\n", now.sum);
    if (now.id1 < x) tmp = Node(a[now.id1 + 1] + b[now.id2 - x] + c[now.id3 - x - y], now.id1 + 1, now.id2, now.id3);
    if (!mp[tmp]) mp[tmp] = 1, q.push(tmp);

    if (now.id2 - x < y) tmp = Node(a[now.id1] + b[now.id2 + 1 - x] + c[now.id3 - x - y], now.id1, now.id2 + 1, now.id3);
    if (!mp[tmp]) mp[tmp] = 1, q.push(tmp);

    if (now.id3 - x - y < z) tmp = Node(a[now.id1] + b[now.id2 - x] + c[now.id3 + 1 - x - y], now.id1, now.id2, now.id3 + 1);
    if (!mp[tmp]) mp[tmp] = 1, q.push(tmp);
  }
  return 0;
}

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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

ll num[252521];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n, a[252521];
  cin>>n;
  REP(i, n){
    cin>>a[i];
    ++num[a[i]];
  }
  ll ans=0;
  REP(i, n+1){
    if(num[i]){
      ans+=num[i]*(num[i]-1)/2;
    }
  }
  REP(i, n){
    if(num[a[i]]>1){
      ll tmp=ans-num[a[i]]*(num[a[i]]-1)/2+(num[a[i]]-1)*(num[a[i]]-2)/2;
      cout<<tmp<<'\n';
    }
    else{
      cout<<ans<<'\n';
    }
  }
  return 0;
}


Measured memory_bytes: 3968
N = int(input())
*A, = map(int, input().split())
min_v = 1
cnt = 0
l = len(A)
for a in A:
    if min_v == a:
       cnt += 1
       min_v += 1
if cnt == 0:
    print(-1)
else:
    print(l - cnt)

Measured memory_bytes: 24744
/*input
1999
*/

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

#define Fi              first
#define Se              second
#define S(n)            cin >> n
#define P(n)            cout << n
#define pb              push_back
#define pp              pop_back
#define pf              pop_front
#define sp              cout << " "
#define nl              cout << "\n"
#define MIN(con)        (*min_element(ALL(con))) 
#define MAX(con)        (*max_element(ALL(con)))
#define mem(n, a)       memset((n), (a), sizeof(n))
#define ALL(cont)       (cont).begin(),(cont).end()
#define NX(cont)        next_permutation(ALL(cont))
#define PX(cont)        prev_permutation(ALL(cont))
#define F(i, n, r)      for(int i = (n); i < (r); i ++)
#define prec(n)         cout << fixed << setprecision(n)
#define PI              3.14159265358979323846264338327951
#define fast            ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FH(it,c)   for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)
 
using ll = long long;
using ss = stringstream;
using ul = unsigned long long;
 
template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c)      { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c)      { return min( min( a, b ), c ); }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { ss str(s); str >> x;}  // Convert string to int

inline void lower(string &s) { 
  FH(it,s) 
    *it = tolower(*it); 
} 
 
inline void upper(string &s) { 
  FH(it,s) 
    *it = toupper(*it); 
}

const ll inf    =  999999999999999999;

bool palin(string s)
{
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
} 

ll triangle(ll n)
{
    return (n * (n + 1)) / 2;
}

bool check(ll n) 
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}


int main ()
{
    fast;
    ll a;
    cin >> a;
    string s = toString(a);
    
    auto calc = [](ll a) -> int {
        int cnt = 0;
        while(a > 0) {
            cnt += (a % 10);
            a /= 10;
        }
        return cnt;
    };

    int ans = calc(a);
    
    for(int i = 1; i < s.length(); ++ i) {
        s[i] = '9';
    }
    
    int b = s[0] - '0';
    b --;
    s[0] = (b + '0');
    ll u = 0;
    toInt(s, u);

    ans = max(ans, calc(u));
    cout << ans;
    nl;
    return 0;
}


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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
//const ll mod = 1777777777ll;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  string o, e;
  cin >> o >> e;
  reverse(ALL(o));
  reverse(ALL(e));

  int n = o.size()+e.size();
  string ans = "";
  rep(i, n) {
    if(i%2==0) {
      ans += o.back();
      o.pop_back();
    }
    else {
      ans += e.back();
      e.pop_back();
    }
  }
  cout << ans << endl;
}

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

    
    if(k <= a) cout << a-k << " " << b << endl;
    else if(k <= a+b) cout << 0 << " " << b-(k-a) << endl;
    else cout << 0 << " " << 0 << endl;
}

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

using namespace std;

int main(void){
  string s, d;
  string a[4] = {"dream","dreamer","erase","eraser"};
  int b[4] = {5, 7, 5, 6};
  cin >> s;
  reverse(s.begin(), s.end());
  for(int i = 0; i < 4; i++)	reverse(a[i].begin(), a[i].end());
  
  bool f = false;
  for(int i = 0; i < s.size();){
    f = false;
    for(int j = 0; j < 4; j++){
      d = a[j];
      if(s[i] == d[0]){
        for(int k = 0; k < b[j]; k++){
          if(s.size()-1 < i+k)
            break;
          else if(s[i+k] != d[k])
            break;
          else if(k == b[j]-1){
            f = true;
            i += b[j];
            break;
          }
        }
      }
      if(f){
        break;
      }
    }
    if(!f)
      break;
  }
  if(f)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 512
// In god we trust
 
#include <bits/stdc++.h>
#include <chrono>
#include <algorithm>
#include <signal.h>
#include <thread>
#include <pthread.h>
#include <omp.h>
 
#define pb push_back
#define fi first
#define se second
#define Vi vector<int>
#define Vb vector<bool>
#define Pi pair<int, int>
#define MP make_pair
#define MT make_tuple
#define Q queue
#define Qi Q<int>
#define INF 1000000000 
#define LINF 1000000000000000000
#define int long long
using namespace std;
using namespace std::chrono;

unordered_map<int, int> factor(int n){
  int cnt = 0;
  unordered_map<int, int> m;
  int nn = n;
  while (!(nn & 1))
    cnt++, nn /= 2;
  if(cnt)
    m[2] = cnt;
  for (int i = 3; i <= sqrt(n); i++){
    cnt = 0;
    while(nn % i == 0)
      nn /= i, cnt++;
    if (cnt)
      m[i] = cnt;
  }
  if (nn > 2)
    m[nn] = 1;
  
  return m;
}



Vi g[200100];
bool visited[200100];

int dfs(int v, int par = -1){
  visited[v] = true;
  int cnt = 1;
  for (auto item: g[v])
    if (item != par and not visited[item])
      cnt += dfs(item, v);
  return cnt;
}

signed main(){
  ios_base::sync_with_stdio(false); 
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  set<int> s;
  int base = 200100;
  for (int i = 0; i < m; i++){
    int u, v;
    cin >> u >> v;
    u--, v--;
    int value = base * min(u, v) + max(u, v);
    if (s.find(value) == s.end())
      g[u].pb(v), g[v].pb(u);
    s.insert(value);
  }
  int ans = 0;
  for (int i = 0; i < n; i++){
    if (not visited[i])
      ans = max(ans, dfs(i, -1));
  }
  cout << ans << endl;
}


Measured memory_bytes: 36604
<?php

//$_input = explode(
//    "\n",
//    '6
//382253568 723152896 37802240 379425024 404894720 471526144'
//);

function getNext() {
    return trim(
        isset($GLOBALS['_input'])
            ? array_shift($GLOBALS['_input'])
            : fgets(STDIN)
    );
}

$n = (int) getNext();
$a = array_map(function ($i) {
    $i = (int) $i;
    // 何回割り切れるか

    $count = 0;
    while ($i % 2 === 0) {
        $i = $i / 2;
        ++$count;
    }
    return $count;
}, explode(' ', getNext()));

printf("%d\n", min($a));



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

using namespace std;
int main(void){
    int K;
    string S;
    cin >> K >> S;
    if(S.size()  > K){
        for(int i = 0; i < K; i++){
            cout << S.at(i);
        }
        cout << "...";
    }else{
        cout << S << endl;
    }
    
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N, M;
		N = sc.nextInt();
		M = sc.nextInt();
		int[] broken = new int[N + 1];
		for (int i = 0; i < M; i++) {
			int a = sc.nextInt();
			broken[a] = 1;
		}

		int[] dp = new int[N + 2];
		dp[N] = 1;
		for(int i = N - 1; i >= 0; i--) {
			if (broken[i] == 1) {
				dp[i] = 0;
				continue;
			}
			dp[i] = (dp[i + 1] + dp[i + 2]) % 1000000007;
		}

		System.out.println(dp[0]);
	}
}

Measured memory_bytes: 51148
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N; cin>>N;
    int t[110000], x[110000], y[110000];
    t[0] = x[0] = y[0] = 0;
    for(int i=0; i<N; i++)cin >> t[i+1] >> x[i+1] >> y[i+1];
    bool can = true;
    for(int i=0; i<N; i++){
        int dt = t[i+1]-t[i];
        int dist = abs(x[i+1]-x[i])+abs(y[i+1]-y[i]);
        if(dt<dist) can =false;
        if(dist %2 != dt%2) can =false;
    }
    if(can) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

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

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        while(true){
            int h = Integer.parseInt(sc.next());
            int w = Integer.parseInt(sc.next());
            
            if(h==0 && w==0) break;
            
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    /*
                    //偶数行の場合
                    if(i%2 == 0){
                        //偶数番目の文字は「#」、奇数番目の文字は「.」
                        if(j%2 == 0) System.out.print("#");
                        else System.out.print(".");
                    }
                    //奇数行の場合
                    else{
                        //偶数番目の文字は「.」、奇数番目の文字は「#」
                        if(j%2 == 0) System.out.print(".");
                        else System.out.print("#");
                    }
                    */
                    //i+jが偶数の場合「#」、奇数の場合「.」
                    if((i+j)%2 == 0) System.out.print("#");
                    else System.out.print(".");
                    
                }
                System.out.println("");
            }
            System.out.println("");
        }
    }
}



Measured memory_bytes: 34960
using System;
using System.Collections.Generic;

public class Program111 // ←Class名変更！！
{
    public static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        if (n==1)
        {
            Console.WriteLine("Hello World");
            return;
        }
        else
        {
            var a = int.Parse(Console.ReadLine());
            var b = int.Parse(Console.ReadLine());
            Console.WriteLine(a+b);
            return;

        }


    } // Main
}     // Class






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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int t , n;
int a[MAXX];

int main()
{
    _FastIO;
    char c;
    cin >> c;
    cout << char(int(c) + 1) << endl;
    return 0;
}


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

int main() {
    int N; cin >> N;
    vector<int> Ws(N);
    for (int i = 0; i < N; i++) cin >> Ws[i];
    int a, b;
    int m = 1e7;
    for (int i = 0; i < N; i++) {
        a = 0;
        b = 0;
        for (int j = 0; j < N; j++) {
            if (j <= i) {
                a += Ws[j];
            } else {
                b += Ws[j];
            }
        }
      	m = min(m, abs(a - b));
    }
    cout << m << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import deque
def main():
    n,q = map(int,input().split())
    node = [[]for _ in range(n)]
    looked = [1]*n
    for i in range(n-1):
        a,b = map(int,input().split())
        node[b-1].append(a-1)
        node[a-1].append(b-1)
    counter = [0]*n
    for i in range(q):
        p,x = map(int,input().split())
        counter[p-1] += x
    queue = deque([0])
    looked[0] = 0
    while queue:
        now = queue.pop()
        for i in node[now]:
            if looked[i]:
                queue.append(i)
                counter[i] += counter[now]
                looked[i] = 0
    print(*counter)
main()

Measured memory_bytes: 56216
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
 
typedef pair<int,string> P;
 
int main(){
    int N, M[31];
 
    while(cin >> N, N){
	string name[N];
	int cnt[31] = {0};
	int d[N][31];
 
	for(int i = 0 ; i < N ; i++){
	    cin >> name[i] >> M[i];
	    for(int j = 0 ; j < M[i] ; j++){
		cin >> d[i][j];
		cnt[d[i][j]]++;
	    }
	}
    
	vector<P> vec;
	for(int i = 0 ; i < N ; i++){
	    int sum = 0;
	    for(int j = 0 ; j < M[i] ; j++){
		sum += N-cnt[d[i][j]]+1;
	    }
	    vec.push_back(P(sum,name[i]));
	}
	sort(vec.begin(), vec.end());
	cout << vec[0].first << " " << vec[0].second << endl;
    }
    return 0;
}

Measured memory_bytes: 3152
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int a,b,c,sum=0;
		a=sc.nextInt();
		b=sc.nextInt();
		c=sc.nextInt();
		for(int x=a;x<=b;x++){
			if(c%x==0){
				sum+=1;
			}
		}
		System.out.println(sum);
		sc.close();
	}

}



Measured memory_bytes: 26396