akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <chrono>
#include <math.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono; 
#define fo(i,z,n) for(int i = z;i<n;i++)
#define Fo(i,z,n) for(ll i = z;i<n;i++)
#define INT_BITS 32
#define mod 1000000007
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> > 
#define pb push_back
#define f first
// #define s second
#define int long long
#define float long double
#define all(c) (c).begin(), (c).end()
#define endl '\n'
#define pi 3.14159265358979323846

ll power(ll a,ll p,ll m=mod)
{ll res=1;while(p>0){if(p&1)res=(res*a)%m;a=(a*a)%m;p>>=1;}
return res;}

int pow(int a,int b){
	if(b == 0)return 1;
	int res = pow(a,b/2);
	res = res*res;
	if(b&1)res *= a;
	return res;
}



int32_t main()
{
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
     cout.tie(0);
   	
 //    int t;
 //     cin >> t;

 //     while(t--){

     
 // }

int a = 100;
int x;
cin >> x;
int interest = 0;
int count = 0;
while(a < x){
	int in = a/100;
	a += in;
	count++;
}
cout << count << endl;




return 0;
	
	}




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

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int n;
    cin >> n;
    vector<vector<int>> v(n);
    vector<int> visited(n, 0), d(n, INF<int>), d2(n, INF<int>);
    visited[0] = 1;
    for (int i = 0; i < n-1; ++i) {
        int a, b;
        cin >> a >> b;
        v[a-1].emplace_back(b-1);
        v[b-1].emplace_back(a-1);
    }
    stack<pair<int, int>> S;
    S.emplace(0, 0);
    d[0] = 0;
    while(!S.empty()){
        auto p = S.top(); S.pop();
        for (auto &&i : v[p.first]) {
            if(!visited[i]){
                visited[i] = 1;
                d[i] = p.second+1;
                S.emplace(i, p.second+1);
            }
        }
    }
    S.emplace(n-1, 0);
    visited[n-1] = 1;
    d2[n-1] = 0;
    fill(visited.begin(), visited.end(), 0);
    while(!S.empty()){
        auto p = S.top(); S.pop();
        for (auto &&i : v[p.first]) {
            if(!visited[i]){
                visited[i] = 1;
                d2[i] = p.second+1;
                S.emplace(i, p.second+1);
            }
        }
    }
    int p = 0, q = 0;
    for (int j = 1; j < n-1; ++j) {
        if(d[j] <= d2[j]) p++;
        else q++;
    }
    cout << (p <= q ? "Snuke" : "Fennec") << "\n";
    return 0;
}


Measured memory_bytes: 6912
#include <stdio.h>
#include <stdlib.h>
int sl(const void *a,const void *b){
    if(*(int*)a>*(int*)b)return 1;
    return -1;
}
int ls(const void *a,const void *b){
    if(*(int*)a<*(int*)b)return 1;
    return -1;
}
int main()
{   int n;
    scanf("%d",&n);
    int a[n],b[n],c[n];
    long long ans=0;
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    for(int i=0;i<n;i++)scanf("%d",&b[i]);
    for(int i=0;i<n;i++)scanf("%d",&c[i]);
    qsort(a,n,sizeof(int),sl);
    qsort(b,n,sizeof(int),sl);
    qsort(c,n,sizeof(int),ls);
    
    long long ac=0,cc=0,j=0,k=0;
    while(c[k]>b[0]&&k<n){
        k++;
        cc++;
    }k--;
    for(int i=0;i<n;i++){
        for(;a[j]<b[i]&&j<n;j++)ac++;
        for(;c[k]<=b[i]&&k>=0;k--)cc--;
        //printf("i=%d,ac=%d,cc=%d\n",i,ac,cc);
        ans+=ac*cc;
    }
    printf("%lld",ans);

    return 0;
}


Measured memory_bytes: 1788
import numpy as np
import math

n , k = list(map(int, input().split()))
def combi(a,b):
    return  math.factorial(a) // (math.factorial(b) * math.factorial(a-b))
i = 2
mod = 10 ** 9 + 7
for i in range(1, k + 1):
    if n - k + 1 >= i and k - 1 >= i - 1:
        print(int(combi(n - k + 1,i) * combi(k - 1, i - 1) % mod))
    else:
        print(0)

Measured memory_bytes: 12740
n=int(input())
a=list(map(int,input().split()))

x=[]
s=sum(a)
x.append(s-2*sum(a[1::2]))
for i in range(1,n-1):
    x.append(2*a[i-1]-x[i-1])
x.append(2*a[n-1]-x[0])
print(*x)


Measured memory_bytes: 14092
n=input()
n='0'+n
l=len(n)
flag=0
if n!=n[::-1]:
    flag=1
if n[1]=='0':
    flag=1
if flag==0:
    print(1,2)
    c=1
    for i in range(1,l-2):
        if n[i]=='1':
            print(i+1,i+2)
            c=i+1
        else:
            print(c,i+2)
else:
    print(-1)

Measured memory_bytes: 4652
N, M = map(int,input().split())
H = list(map(int,input().split()))
AB = [0]*M
for i in range(M):
    AB[i] = list(map(int,input().split()))

GD = [0]*N

for A ,B in AB:
    HA = H[A-1]
    HB = H[B-1]
    if HA < HB:
        GD[A-1] -= 1
    elif HA > HB:
        GD[B-1] -= 1
    else:
        GD[A-1] -= 1
        GD[B-1] -= 1

ans = 0
for i in GD:
    if i == 0:
        ans += 1
print(ans)


    

Measured memory_bytes: 89592
#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <string>

using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

/*template*/
int main() {
	ll c[4][4] = {};
	repe(i, 1, 3)repe(j, 1, 3)cin >> c[i][j];

	ll a1, a2, a3, b1, b2, b3;
	a1 = 0;
	b1 = c[1][1];
	b2 = c[1][2];
	b3 = c[1][3];
	a2 = c[2][1] - b1;
	a3 = c[3][1] - b1;

	if (a2 + b2 == c[2][2] &&
		a2 + b3 == c[2][3] &&
		a3 + b2 == c[3][2] &&
		a3 + b3 == c[3][3]) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
	return 0;
}

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

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

Node *root, *NIL;

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);
}
    
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;
}

int main(void) {
    int n, i, x;
    char com[16];
    scanf("%d",&n);
    
    for(i=0;i<n;i++) {
        scanf("%s",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(!strcmp(com,"insert")) {
            scanf("%d",&x);
            insert(x);
        } else if(!strcmp(com,"print")) {
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }

    return 0;
}



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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cout << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n;cin >> n;
	string s; cin >> s;
	int ans = 1;
	FOR(i, 1, n) ans += s[i] != s[i - 1];
	cout << ans;
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 512
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for ( auto blockTime = make_pair(chrono::high_resolution_clock::now(), true);blockTime.second;\
debug("%s: %lld ms\n", d, chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - blockTime.first).count()), blockTime.second = false)
#define li long long int
#define ld long double
#define eb push_back
#define pb pop_back
#define INF 1e18+10
#define MINF -1e18-10
#define rep(i,a,b) for(li i=a;i<b;i++)
#define size(a) a.size()
#define rev(a) reverse(a.begin(),a.end())
#define len(a) a.length()
#define f first
#define s second
#define sort(a) sort(a.begin(),a.end())
#define vli vector<li>
#define vvli vector<vli >
#define pli pair<li,li>199
#define vpli vector<pli>
#define inp(t) li t;cin>>t; while(t--)
using namespace std;
const li mod = 1e9+7;
const long int MAXN = 2e5+100;
#define PI 3.14159265358979323846264338327950

li power(li a, li b) { a%=mod; li ret=1;while(b) {if(b&1) ret*=a;a*=a;if(ret>=mod) ret%=mod;if(a>=mod) a%=mod;b>>=1;}return ret;}
li add(li a,li b) { return (((a%mod)+(b%mod))%mod);}
li sub(li a,li b) { return (((a%mod)-(b%mod))%mod);}
li mul(li a,li b) { return (((a%mod)*(b%mod))%mod);}

vector<li> v[MAXN];
li ances[MAXN];
bool visited[MAXN];
li n,m;

void bfs(li node)
{ 
   queue <li> q;
   q.push(node);

   visited[node] = true;
   n-=1;
   
   while (!q.empty()) 
   {
      li u = q.front(); 
      q.pop();
      for(li j = 0;j < (li)size(v[u]);j++) 
      {
         li nodes = v[u][j];
         
         if (!visited[nodes]) 
         {
            n-=1;
            ances[nodes] = u;
            q.push(nodes);
            visited[nodes] = true;
         }
      }
   }
}

void solve()
{
  cin>>n>>m;

  li vert = n;

  rep(i,0,m)
  {
    li a,b;
    cin>>a>>b;
    v[a].eb(b);
    v[b].eb(a);
  }

  bfs(1);

  if(n==0)
  {
    cout<<"Yes\n";
    for(li i=2;i<=vert;i++)
    {
      cout<<ances[i]<<endl;
    }
    cout<<'\n';
  }
  else
  {
    cout<<"No\n";
  }
}
int main()
{
    IOS;
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    solve();
    
    return 0;
}

Measured memory_bytes: 15460
#include <bits/stdc++.h>
#define N 100005

using namespace std;

inline int input() {
	int x; char ch; while (!isdigit(ch = getchar()));
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return x;
}

template <class T> void chkmax(T &x, T y) { x = x > y ? x : y; }
template <class T> void chkmin(T &x, T y) { x = x < y ? x : y; }

int n;
int du[N], dp[N];
int val[N], res, cnt, tot;
bool c[N], del[N];
vector<int> G[N];
char s[N];

inline void AddEdge(int x, int y) {
	G[x].push_back(y), ++du[x];
	G[y].push_back(x), ++du[y];
}

void dfs(int u, int fa) {
	dp[u] = val[u];
	for (int v : G[u])
		if (v != fa && !del[v]) {
			dfs(v, u);
			chkmax(res, dp[u] + dp[v]);
			chkmax(dp[u], dp[v] + val[u]);
		}
}

int main() {
	n = input();
	for (int i = 1, u, v; i < n; ++i) {
		u = input(), v = input();
		AddEdge(u, v);
	}
	scanf("%s", s + 1);
	for (int i = 1; i <= n; ++i)
		c[i] = s[i] == 'B';
		
	queue<int> que;
	for (int i = 1; i <= n; ++i)
		if (c[i] && du[i] == 1) que.push(i);
	while (!que.empty()) {
		int u = que.front(); que.pop();
		del[u] = true, ++tot;
		for (int v : G[u])
			if ((--du[v]) == 1 && c[v]) que.push(v);
	}
	
	if (tot == n) return puts("0"), 0;

	for (int u = 1; u <= n; ++u) {
		if (del[u]) continue;
		if (c[u] ^ (du[u] & 1)) val[u] = 0;
		else val[u] = 2, ++cnt;
	}

	for (int i = 1; i <= n; ++i)
		if (!del[i]) {
			dfs(i, 0);
			break;
		}
	printf("%d\n", (n - tot) * 2 - 2 + cnt - res);
	return 0;
}

Measured memory_bytes: 12672
#include <cstdio>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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 r, g, b;

int main()
{
  scanf( "%d%d%d", &r, &g, &b );

  puts( (100*r+10*g+b)%4 ? "NO" : "YES" );

  return 0;
}

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

using namespace std;

int main(void){
	int h,w;
	string a[100];
	int flagh[100] = {0};
	int flagw[100] = {0};
	int dh=0,dw=0;
	cin >> h >> w;
	int i,j;
	for(i=0;i<h;i++) cin >> a[i];
	//行ごとに見ていく
	int count;
	for(i=0;i<h;i++){
		count = 0;
		for(j=0;j<w;j++){
			if(a[i][j]=='#'){
				count = 1;
				break;
			}
		}
		if(count == 0){
			flagh[i] = 1; //i行目は全部白
			dh++;
		}
	}
	//列ごとに見ていく
	for(j=0;j<w;j++){
		count = 0;
		for(i=0;i<h;i++){
			if(a[i][j]=='#'){
				count = 1;
				break;
			}
		}
		if(count == 0){
			flagw[j] = 1; //i行目は全部白
			dw++;
		}
	}
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(flagh[i] == 0 && flagw[j] == 0) cout << a[i][j];
		}
		cout << endl;
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll int64_t
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define s second

using namespace std;

ll X,K,D;


void solve()
{
	cin >> X >> K >> D;
    if (X == 0){
        if (K % 2 == 0) cout << 0 << endl;
        else cout << D << endl;
        return ;
    } else {
        if (X < 0) X = -X;
        ll pl = X % D, mi = D - pl;
        ll to_pl = X / D;
        if (to_pl > K){
            cout << X - K * D << endl;
        } else {
            if ((K - to_pl) % 2 == 0) cout << pl << endl;
            else cout << mi << endl;
        }
    }
}

int main()
{
	std::ios::sync_with_stdio(false);
	solve();
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <cstring>

#define INF 1e+9
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define int long long

using namespace std;

main(){
    int n,m,s,g1,g2;

    while(cin >> n >> m >> s >> g1 >> g2){
        if((n|m|s|g1|g2) == 0) break;
        int cost[n][n];
        int ret = 1e+18;
        int src,dst,c;

        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                cost[i][j] = INF;
            }
        }

        for(int i=0;i<n;i++) cost[i][i] = 0;

        //load roads lol
        for(int i=0;i<m;i++){
            cin >> src >> dst >> c;
            cost[src-1][dst-1] = c;
        }

        //WF
        for(int r=0;r<n;r++){
            for(int p=0;p<n;p++){
                for(int q=0;q<n;q++){
                    cost[p][q] = min(cost[p][q], cost[p][r] + cost[r][q]);
                }
            }
        }

        for(int i=0;i<n;i++){
            ret = min(ret, cost[s-1][i] + cost[i][g1-1] + cost[i][g2-1]);
        }
        cout << ret << endl;
    }
}

Measured memory_bytes: 936
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
#define mod 1000000007
#define mem(a,val) memset(a,val,sizeof(a))
#define ps(x,noOfDecimal) fixed<<setprecision(noOfDecimal)<<x

using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	std::ios::sync_with_stdio(false);
	int t = 1;
	// cin>>t;
	while (t--) {
		int n;
		cin >> n;
		vector<int> arr(n);
		vector<pair<int, int>> v;
		for (int i = 0; i < n; i++) {
			cin >> arr[i];
			v.push_back(make_pair(arr[i], i + 1));
		}
		sort(v.begin(), v.end());
		for (auto x : v) {
			// cout<<x.first<<" "<<x.second;
			cout << x.second << " ";
		}
	}
	return 0;
}

Measured memory_bytes: 4708
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
char c;string s,t;
int a,b;
void f(){
	while(1){
		if(a==s.size()&&b==t.size())break;
		if(s[a]==t[b]){
			cout<<s[a];
			a++;b++;
		}else if(s[a]=='('){
			int co=0;
			while(1){
				if(s[a]=='(')co++;
				else if(s[a]==')')co--;
				if(c=='u')cout<<s[a];
				a++;
				if(co==0)break;
			}
		}else{
			int co=0;
			while(1){
				if(t[b]=='(')co++;
				else if(t[b]==')')co--;
				if(c=='u')cout<<t[b];
				b++;
				if(co==0)break;
			}
		}
	}
}
int main(){
	while(cin>>c>>s>>t){
		a=b=0;
		f();
		cout<<endl;
	}
}

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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int T;
int A[330], B[330], C[330], D[330];

int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

signed main() {
    cin >> T;
    for (int i = 0; i < T; i++) {
        cin >> A[i] >> B[i] >> C[i] >> D[i];
    }
    for (int i = 0; i < T; i++) {
        if (B[i] > A[i] || B[i] > D[i]) {
            cout << "No" << endl;
            continue;
        }
        if (B[i] < C[i]) {
            cout << "Yes" << endl;
            continue;
        }
        int x = gcd(B[i], D[i]);
        if ((A[i] - (C[i] + 1) + x) % x + C[i] + 1 - B[i] >= 0)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	int n,m,sum=0;
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		int a,b;
		cin>>a>>b;
		if(sqrt(a*a+b*b)<=m){
			sum++;
		}
	}
	cout<<sum;
	return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <string>
#include <cfenv>
#include <cmath>

using namespace std;

int main(){
  int H, A;
  cin >> H >> A;

  double x = H/(double)A;
  x = ceil(x);
  int p = static_cast<int>(x);

  cout << x << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
ll MOD=1000000007;
int inf=1000000000;
ll INF=10000000000000000;
 
int main(){
    int n;
    cin >> n;
    map<int,int> s;
    rep(i,n){
        int a;
        cin >> a;
        s[a]++;
    }
    int m;
    cin >> m;
    rep(i,m){
        int t;
        cin >> t;
        auto it=s.find(t);
        if (it!=s.end()){
            if (s[t]==0) {cout << "NO" << endl;return 0;}
            s[t]--;
        }
        else {cout << "NO" << endl;return 0;}
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 9600
d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
    si=list(map(int,input().split()))
    s.append(si)
last_d=[-1]
last_d*=26
ans=0
for i in range(d):
    ti=int(input())
    ans+=s[i][ti-1]
    last_d[ti-1]=i
    for j in range(26):
        ans-=c[j]*(i-last_d[j])

    print(ans)

Measured memory_bytes: 9388
#include<iostream>
#include<string>
#include<cstring>
#include<cctype>
using namespace std;

int main(){
    string w,t;
    int i=0,l,k;
    cin>>t;
    while(true){
        cin>>w;
        if(w=="END_OF_TEXT")break;
        for(k=0;k<50;k++){
            if(isupper(w[k])){
                w[k]=tolower(w[k]);
            }
        }
        if(w==t){
            i+=1;
        }
    }
    cout<<i<<endl;
    return 0;
}


Measured memory_bytes: 3144
while input = gets;
	break if input == nil
	weight = input.to_f

	if weight <= 48.0 then
		print "light fly\n"
	elsif weight > 48.0 && weight <= 51.0 then
		print "fly\n"
	elsif weight > 51.0 && weight <= 54.0 then
		print "bantam\n"
	elsif weight > 54.0 && weight <= 57.0 then 
		print "feather\n"
	elsif weight > 57.0 && weight <= 60.0 then
		print "light\n"
	elsif weight > 60.0 && weight <= 64.0 then
		print "light welter\n"
	elsif weight > 64.0 && weight <= 69.0 then
		print "welter\n"
	elsif weight > 69.0 && weight <= 75.0 then
		print "light middle\n"
	elsif weight > 75.0 && weight <= 81.0 then
		print "middle\n"
	elsif weight > 81.0 && weight <= 91.0 then
		print "light heavy\n"
	else
		print "heavy\n"
	end
end

Measured memory_bytes: 2232
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define mod 1e9+7
using namespace std;
ll dp[105][100010];
ll weight[110], val[110];
ll DP(int pos, ll rem, ll last)
{
    if(pos>=last || rem<=0) return 0;
    if(dp[pos][rem]!=-1)
        return dp[pos][rem];
    ll t1=0;
    if(rem-weight[pos]>=0)
        t1=DP(pos+1, rem-weight[pos], last)+val[pos];
    ll t2=DP(pos+1, rem, last);
    return dp[pos][rem]=max(t1, t2);
}
int main()
{
    memset(dp, -1, sizeof dp);
    ll N, W;
    scanf("%lld%lld", &N, &W);
    for(int i=0; i<N; i++)
    {
        scanf("%lld%lld", &weight[i], &val[i]);
    }
    cout<<DP(0, W, N)<<endl;;
    return 0;
}


Measured memory_bytes: 82304
int main()
{
  char s[101];
  scanf("%s", &s);
  int i, digit = 0;
  for (i = 0; s[i] != '\0'; i++)
    digit++;
  int cnt = 0;
  for (i = 0; i < digit / 2; i++)
  {
    if (s[i] != s[digit - 1 - i])
      cnt++;
  }
  printf("%d", cnt);
}

Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)

func main() {
	log.SetFlags(log.Lshortfile)
	scn := newScanner()
	H := scn.nextInt()
	W := scn.nextInt()
	a := make([]string, 0)
	red := make([][]byte, 0)
	blue := make([][]byte, 0)
	for i := 0; i < H; i++ {
		s := scn.nextLine()
		a = append(a, s)
		red = append(red, []byte(s))
		blue = append(blue, []byte(s))
	}
	for j := 0; j < H; j++ {
		for k := 0; k < W; k++ {
			if j%2 == 0 {
				// red
				red[j][k] = '#'
			} else {
				// blue
				blue[j][k] = '#'
			}
		}
		red[j][0] = '#'
		red[j][W-1] = '.'
		blue[j][0] = '.'
		blue[j][W-1] = '#'
	}
	for i := 0; i < H; i++ {
		fmt.Println(string(red[i]))
	}
	fmt.Println("")
	for i := 0; i < H; i++ {
		fmt.Println(string(blue[i]))
	}
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

type scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func newScanner() *scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &scanner{r: rdr}
}
func (s *scanner) next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *scanner) nextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *scanner) nextInt() int {
	v, _ := strconv.Atoi(s.next())
	return v
}

func (s *scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

int main()
{
    int n, d, sum;
    cin >> n;
    sum = 0;
    d = n;
    while(d !=0){
        sum += d%10;
        d /= 10;
    }
    if(n %sum == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solveA();
	}

	private void solveA() {
		Scanner sc = new Scanner(System.in);
		String X = sc.nextLine();
		String[] TEST = X.split(" ", 0);
		int N = Integer.parseInt(TEST[0]);
		int A = Integer.parseInt(TEST[1]);
		int B = Integer.parseInt(TEST[2]);

		// 7 * 10  120
		
        if (N * A <= B) {
        	System.out.println(A * N);
        } else {
        	System.out.println(B);
        }
	}

	private void solveB() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveC() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveD() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveE() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveF() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

}

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

int main() {
	int W, a, b;
	cin >> W >> a >> b;
	if (a <= b){
		if (b <= a + W){
			cout << 0 << endl;
		}
		else {
			cout << b - a - W << endl;
		}
	}
	else {
		if (b + W < a) {
			cout << a - b - W << endl;
		}
		else {
			cout << 0 << endl;
		}
	}
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
from fractions import Fraction
from collections import Counter
import math

import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


def fract(a, b):
    if a == 0 and b == 0:
        return (0, 0)
    if b == 0:
        return (1, 0)
    f = Fraction(a, b)
    return f.numerator, f.denominator


@mt
def slv(N, AB):
    adb = Counter()
    for a, b in AB:
        k = fract(a, b)
        adb[k] += 1
    M = Mod(1000000007)
    ans = 1
    done = {(0, 0)}
    for k, v in adb.items():
        if k in done:
            continue
        a, b = k
        kk = fract(-b, a)
        done.add(k)
        done.add(kk)

        n = adb[kk]
        t = M.sub(M.pow(2, v) + M.pow(2, n), 1)
        ans = M.mul(ans, t)
    ans = M.add(ans, adb[(0, 0)])
    return M.sub(ans, 1)


def main():
    N = read_int()
    AB = [read_int_n() for _ in range(N)]
    print(slv(N, AB))


if __name__ == '__main__':
    main()


Measured memory_bytes: 172908
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

bool done[101];

vector<double> p;
vector<vector<int>> E, rE;

vector<int> vs;
int cmp[101];

void dfs(int pos) {
    done[pos] = true;

    for (auto to : E[pos]) {
        if (!done[to]) {
            dfs(to);
        }
    }
    vs.push_back(pos);
}

void rdfs(int pos, int k) {
    done[pos] = true;
    cmp[pos] = k;

    for (auto e : rE[pos]) {
        if (!done[e]) {
            rdfs(e, k);
        }
    }
}

int main() {
    int n;
    while(cin >> n, n) {
        p = vector<double>(n);
        E = vector<vector<int>>(n);
        rE = vector<vector<int>>(n);

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

            for (int j = 0; j < m; j++) {
                int x; cin >> x;
                x--;
                E[i].push_back(x);
                rE[x].push_back(i);
            }
        }

        vs.clear();
        memset(done, false, sizeof(done));
        for (int i = 0; i < n; i++) {
            if (!done[i]) {
                dfs(i);
            }
        }

        int k = 0;
        memset(done, false, sizeof(done));
        for (int i = vs.size() - 1; i >= 0; i--) {
            if (!done[vs[i]]) {
                rdfs(vs[i], k++);
            }
        }

        vector<double> pscc(k, 1.0);
        for (int i = 0; i < n; i++) {
            pscc[cmp[i]] *= p[i];
        }

        double ans = 1.0;
        memset(done, false, sizeof(done));
        for (int i = vs.size() - 1; i >= 0; i--) {
            if (!done[vs[i]]) {
                dfs(vs[i]);
                ans *= (1 - pscc[cmp[vs[i]]]);
            }
        }
        printf("%.09lf\n", ans);
    }
}



Measured memory_bytes: 3276
#include <bits/stdc++.h>
#define MEM 100006
#define sanic ios_base::sync_with_stdio(0)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
const ll MOD = 1e9+7;
char c;
int main()
{
    sanic; cin.tie(0);
    cin >> c;
    //cout << (int)c;
    if(97<=c) cout << 'a';
    else cout << 'A';
}


Measured memory_bytes: 3572
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        x: i128,
    }

    let mut n:i128 = 100;
    // let interest:f64 = 1.01;
    let mut years:i64 = 0;
    while n < x {
        // n = format!("{:.*}", 0, n*interest).parse().unwrap();
        // n = (n*interest).round();
        n = (n * 101) / 100;
        years += 1;
    }

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

Measured memory_bytes: 2108
package main

import (
	"fmt"
	"math/big"
)

var max int64 = 120
var min int64 = -119
var arr = func() []int64 {
	a := make([]int64, 0, max-min+1)
	for i := min; i <= max; i++ {
		a = append(a, i)
	}
	return a
}()

func main() {
	var five = big.NewInt(5)
	var x int64
	fmt.Scan(&x)
	for _, a := range arr {
		for _, b := range arr {
			bigA := new(big.Int).Exp(big.NewInt(a), five, nil)
			bigB := new(big.Int).Exp(big.NewInt(b), five, nil)
			if new(big.Int).Sub(bigA, bigB).Int64() == x {
				fmt.Println(a, b)
				return
			}
		}
	}
}


Measured memory_bytes: 6464
def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    nab = [int(x) for x in input().rstrip().split(" ")]
    n = nab[0]
    a = nab[1]
    b = nab[2]

    kurikaesi = n // (a + b)
    amari = n % (a + b)

    ans = kurikaesi * a
    ans += amari if amari < a else a
    print(ans)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 61876
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}

int gcd(int a, int b){
    if(a<b){
        int tmp=a;
        a=b;
        b=tmp;
    }
    if(b==0) return a;            
    return gcd(b, a%b);
}

int main(){
    int N, X;
    cin >> N >> X;
    vi x(N);
    rep(i, N){
        cin >> x[i];
        x[i] = abs(x[i]-X);
    }
    int ans = x[0];
    rep(i, N-1) ans = gcd(ans, x[i+1]);

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(void) {

	int r, g, b, rgb;

	cin >> r >> g >> b;

	rgb = r * 100 + g * 10 + b;

	if (rgb % 4 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

// ans[i] = (i番目の頂点v, swapできる頂点をまとめたときにvが何番目か)
vector<PII> tsort(vector<vector<ll>> g) {
    const int n = g.size();
    vector<ll> h(n);
    REP(i, n) for(int j: g[i]) h[j]++;

    stack<PII> st;
    REP(i, n) if(h[i] == 0) st.push({i, 0});

    vector<PII> ans;
    while(st.size()) {
        PII p = st.top(); st.pop();
        ans.push_back(p);
        for(auto& j: g[p.first]) {
            h[j]--;
            if(h[j] == 0) st.push({j, p.second+1});
        }
    }

    return ans;
}

signed main(void) {
    ll n, m;
    cin >> n >> m;
    vector<vector<ll>> g(n);
    REP(i, m) {
        ll u, v;
        cin >> u >> v;
        g[u].push_back(v);
    }

    auto ans = tsort(g);
    for(auto p: ans) cout << p.first << endl;

    return 0;
}


Measured memory_bytes: 4832
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int n = rint;
	string s = readln.chomp;

	bool[string] xz, yz, zz;
	foreach(c; s){
		foreach(y; yz.keys) zz[y ~ c] = 1;
		foreach(x; xz.keys) yz[x ~ c] = 1;
		xz["" ~ c] = 1;
	}
zz.keys.length.writeln;
}

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

using namespace std;
typedef long long ll;
const int N=5005;
ll p[N],c[N];
ll cnt[N];
int n,k;
int main()
{
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%lld",&p[i]);
    for(int i=1;i<=n;i++) scanf("%lld",&c[i]);
    ll ans=-1e18;
    for(int i=1;i<=n;i++)
    {
        ll s=0;
        int tot=0;
        s+=c[i];
        cnt[++tot]=s;
        for(int j=p[i];j!=i;j=p[j])
        {
            s+=c[j];
            cnt[++tot]=s;
        }

        for(int j=1;j<=tot;j++)
        {
          //  cout<<cnt[j]<<endl;
            ll ret=k-j;
            if(ret<0) break;
            ans=max(ans,cnt[j]+(ret/tot)*max(s,0ll));
           // cout<<ans<<endl;
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3940
#include <stdio.h>

int main()
{
  int N;
  scanf("%d",&N);
  int a[N];
  int i;
  i = 0;
  while (i < N)
  {
    scanf("%d",&a[i]);
    i++;
  }
  qsort(N, a, 0, N-1);
  i = 0;
  int A,B;
  A = 0;
  B = 0;
  while (i < N)
  {
    A += a[i];
    if (i + 1 < N)
    {
      B += a[i+1];
    }
    i += 2;
  }
  printf("%d",A-B);
}

void qsort(int len, int a[len], int f, int l)
{
  int x;
  x = a[(f+l)/2];
  int i,j;
  i = f;
  j = l;
  int t;
  while (1)
  {
    while (x < a[i])
    {
      i++;
    }
    while (x > a[j])
    {
      j--;
    }
    if (i >= j)
    {
      break;
    }
    t = a[i];
    a[i] = a[j];
    a[j] = t;
    i++;
    j--;
  }
  if (f < i - 1)
  {
    qsort(len, a, f, i-1);
  }
  if (l > j + 1)
  {
    qsort(len, a, j + 1, l);
  }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};


  
int main(){
  
  long long a,b;
  cin>>a>>b;
  
  long long sa,sb;
  long long cnt;
  if(a==0){
    sa=0;
  }else if((a-1)%2==1){
    cnt = (a-2)/2+1;
    if(cnt%2==0){
      sa = 0;
    }else{
      sa = 1;
    }
  }else{
    cnt = (a-3)/2+1;
    if(cnt%2==0){
      sa = a-1;
    }else{
      sa = 1^(a-1);
    }
  }
  
  if(b==0){
    sb=0;
  }else if(b%2==1){
    cnt = (b-1)/2+1;
    if(cnt%2==0){
      sb = 0;
    }else{
      sb = 1;
    }
  }else{
    cnt = (b-2)/2+1;
    if(cnt%2==0){
      sb = b;
    }else{
      sb = 1^b;
    }
  }
  
  long long ans;
  ans = sa^sb;
  cout<<ans<<endl;
  return 0;
}


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

int main(void){
    
    ll k, a, b;
    
    cin >> k;
    cin >> a >> b;
    
    for(ll i=a; i<=b; i++){
        
        if(i%k==0){
            
            cout << "OK" << endl;
            return 0;
            
        }
        
    }
    
    cout << "NG" << endl;
    return 0;
    
}

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

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

    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
        cout << "vowel" << endl;
    }
    else{
        cout << "consonant" << endl;
    }
}


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

using namespace std ;

#define sz(v) (int)v.size()
#define ll long long
#define all(v)  v.begin() , v.end()
#define rall(v)  v.rbegin() , v.rend()
#define pf push_front
#define pb push_back
#define fast FastInputOutput() ;
#define Clear( container , value ) memset( container , value , sizeof container )
#define PI acos( -1.0 )
#define forn( t , v , be , n ) for( t v = be ; v < n ; v++ )
#define fore( x , j ) for( auto x : j )
#define se second
#define fr first
//#define c_b fflush(stdin);

const ll Long_max = numeric_limits < ll > :: max() ;
const int Int_max = numeric_limits < int > :: max() ;

void File_input( string pathIn ) {
    freopen( pathIn.c_str(), "r", stdin ) ;
}

void File_output( string pathOut ) {
    freopen( pathOut.c_str(), "w", stdout ) ;
}

int msg() {
    srand( time( 0 ) ) ;
    vector < string > st = {
        "Wish everyone high ratings!",
        "Good luck!",
        "Have fun!",
        "Please, read all the problems!",
        "Go Go fight!"
    } ;
    cerr << st[ rand() % sz( st ) ] ;
    return 0 ;
}

void FastInputOutput() {
    ios_base :: sync_with_stdio( 0 ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;
}

deque < char > a , b ;

int main() {

    string s1 , s2 ;
    cin >> s1 >> s2 ;

    fore( i , s1 ) a.pb( i ) ;
    fore( i , s2 ) b.pb( i ) ;

    int cnt = 0 ;

    while( a != b ){
      char x = a.back() ;
      a.pop_back() ;
      a.push_front( x ) ;
      if( cnt >= sz( a ) + 1 ) break ;
      cnt++ ;
    }

    if( a == b ){
        cout << "Yes\n" ;
    } else cout << "No\n" ;

    return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
const ll INF = 1LL << 60;

int n;
vector<int> h(110);
int cnt = 0;

void gardening(int l, int r) {
    if (l > r) {
        return;
    }
    int mel = 100; int idx = 0;
    for (int i = l; i <= r; i++) {
        if (chmin(mel, h[i])) idx = i;
    }
    for (int i = l; i <= r; i++) {
        h[i] -= mel;
    }
    cnt += mel;
    gardening(l, idx - 1);
    gardening(idx + 1, r);
}

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

    gardening(0, n - 1);
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <map>
#include <utility>
#define ll long long
#define REP(i, x) for(int (i) = 0; (i) < (x); (i) ++)
#define pi 3.1415926535
const int MOD = 1000000007;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<tuple<string, int, int>>a;
	REP(i, n) {
		string s;
		int p;
		cin >> s >> p;
		p = -p;
		a.push_back(tie(s, p, i));
	}
	sort(a.begin(), a.end());
	REP(i, n) {
		cout << get<2>(a[i]) + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;

int n;

bool judge( vector<int>& a )
{
    int i;
    for(i=0; i<n-1; i++) {
        if(a[i] > a[i+1]) return false;
    }
    return true;
}
int main(int argc, char* argv[])
{
    scanf("%d", &n);
    vector<int> a(n);
    int i,j;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }

    if( judge( a ) ) {
        printf("YES\n"); return 0;
    }
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            vector<int> b=a;
            swap(b[i], b[j]);
            if( judge( b )  ) {
                printf("YES\n"); return 0;
            }
        }
    }
    printf("NO\n");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...) 0
#endif

int n;
vector<ll> a(5100);
vector<vector<int>> g(5100);
// vector<vector<vector<ll>>> dp(5100, vector<vector<ll>>(5100, vector<ll>(2, 1e18)));
ll dp[5100][5100][2];
vector<vector<ll>> tmp(5100, vector<ll>(2, 1e18));
vector<int> sz(5100, 1);

void dfs(int v, int p) {
    if (g[v].size() == 0) {
        if (a[v] > 0)
            dp[v][0][0] = a[v];
        else
            dp[v][0][1] = a[v];
        return;
    }
    for (int u : g[v]) {
        if (u == p) continue;
        dfs(u, v);
        sz[v] += sz[u];
    }
    int cur = 0;
    rep(i, 0, n + 1) tmp[i][0] = tmp[i][1] = 1e18;
    tmp[0][0] = a[v];
    if (a[v] > 0) tmp[0][1] = a[v];
    for (int u : g[v]) {
        if (u == p) continue;
        for (int i = cur; i >= 0; i--) {
            ll x = tmp[i][0], y = tmp[i][1];
            tmp[i][0] = tmp[i][1] = 1e18;
            rep(k, 0, sz[u] + 1) {
                tmp[i + k][0] = min(tmp[i + k][0], x + dp[u][k][0]);
                if (dp[u][k][0] < 0 || dp[u][k][1] < 1e18)
                    tmp[i + k + 1][0] = min(tmp[i + k + 1][0], x);
                if (a[v] > 0) {
                    tmp[i + k][1] = min(tmp[i + k][1], y + dp[u][k][1]);
                    if (dp[u][k][0] < 0 || dp[u][k][1] < 1e18)
                        tmp[i + k + 1][1] = min(tmp[i + k + 1][1], y);
                }
            }
        }
        cur += sz[u];
    }
    rep(i, 0, sz[v] + 1) {
        dp[v][i][0] = tmp[i][0];
        dp[v][i][1] = tmp[i][1];
    }
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    rep(i, 0, n) cin >> a[i];
    rep(i, 0, 5100) rep(j, 0, 5100) dp[i][j][0] = dp[i][j][1] = 1e18;
    rep(i, 0, n - 1) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        g[u].emplace_back(v);
        g[v].emplace_back(u);
    }
    dfs(0, -1);
    rep(i, 0, n) {
        if (dp[0][i][0] < 0 || dp[0][i][1] < 1e18) {
            cout << i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 407808
<?php
$N = trim(fgets(STDIN));
$s = trim(fgets(STDIN));
$t = trim(fgets(STDIN));
$index = 200;
for($i = 0; $i < $N; $i++) {
  $s1 = substr($s, $i, $N - $i);
  $s2 = substr($t, 0, $N - $i);
  if($s1 == $s2) {
    $index = $i;
    break;
  }
}
if($index == 200) $index = $N;
print($N + $index);
?>

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

const int N  = 100;
int prime[N], cnt[N], dp[N][76];

void solve(int n){
    memset(dp, 0, sizeof(dp));
    memset(prime, 0, sizeof(prime));
    int m = sqrt(n + 0.5);
    prime[1] = 1;
    for(int i = 2; i <= m; i++)
        if(!prime[i])
            for(int j= i*i; j<= n; j+=i)
                prime[j] = 1;
    
    for (int i = 2; i<=n; i++) {
        int num = i;
        for(int j = 2; num != 1 ;j++ ){
            if (prime[j]) continue;
            while (num%j ==0) {
                cnt[j] ++;
                num /= j;
            }
        }
    }
    
    dp[1][1] = 1;
    for(int i = 1; i< n; i++){
        int k,j, m = cnt[i];
        for( k= 1; k<=75; k++)
            for(j=0; j < m+1; j++){
                if((j+1)*k<=75){
                    dp[i+1][(j+1)*k] += dp[i][k];
                }
            }
    }
    
    printf("%d\n",dp[n][75]);
        
    
}

int main(){
//    freopen("input.txt", "r", stdin);
    int n;
    scanf("%d", &n);
    solve(n);
    return 0;
}


Measured memory_bytes: 256