akhauriyash/Code-Regression huggingface dataset:
// Author -- Frame

#include<bits/stdc++.h>

#define lowbit(x) ((x)&(-x))
#define Finline __inline__ __attribute__ ((always_inline))
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
#define SZ(x) ((int)x.size())
#define mkpr std::make_pair
#define pb push_back

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef std::pair<int,int> pi;
typedef std::pair<ll,ll> pl;

const int inf=0x3f3f3f3f,Inf=0x7fffffff;
const ll INF=0x3f3f3f3f3f3f3f3f;

Finline uint rnd()
{
	static uint seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
template <typename _Tp>_Tp gcd(const _Tp &a,const _Tp &b){return (!b)?a:gcd(b,a%b);}
template <typename _Tp>Finline _Tp abs(const _Tp &a){return a>=0?a:-a;}
template <typename _Tp>Finline _Tp max(const _Tp &a,const _Tp &b){return a<b?b:a;}
template <typename _Tp>Finline _Tp min(const _Tp &a,const _Tp &b){return a<b?a:b;}
template <typename _Tp>Finline void chmax(_Tp &a,const _Tp &b){(a<b)&&(a=b);}
template <typename _Tp>Finline void chmin(_Tp &a,const _Tp &b){(b<a)&&(a=b);}
template <typename _Tp>Finline void read(_Tp &x)
{
	char ch(getchar());
	bool f(false);
	while(ch<48||ch>57) f|=ch==45,ch=getchar();
	x=ch&15,ch=getchar();
	while(ch>=48&&ch<=57) x=(((x<<2)+x)<<1)+(ch&15),ch=getchar();
	if(f) x=-x;
}
template <typename _Tp,typename... Args>Finline void read(_Tp &t,Args &...args){read(t);read(args...);}
Finline int read_str(char *s)
{
	char ch(getchar());
	while(ch==' '||ch=='\r'||ch=='\n') ch=getchar();
	char *tar=s;
	*tar=ch,ch=getchar();
	while(ch!=' '&&ch!='\r'&&ch!='\n'&&ch!=EOF) *(++tar)=ch,ch=getchar();
	return tar-s+1;
}

const int N=3005;
const int mod=998244353;
template<typename _Tp1,typename _Tp2>Finline void add(_Tp1 &a,_Tp2 b){(a+=b)>=mod&&(a-=mod);}
template<typename _Tp1,typename _Tp2>Finline void sub(_Tp1 &a,_Tp2 b){(a-=b)<0&&(a+=mod);}
int dp[N][N];
int main()
{
	int a,b,c,d;
	read(a,b,c,d);
	dp[a][b]=1;
	for(int i=a;i<=c;++i)
	{
		for(int j=b;j<=d;++j)
		{
			add(dp[i][j],1ll*dp[i][j-1]*i%mod);
			add(dp[i][j],1ll*dp[i-1][j]*j%mod);
			sub(dp[i][j],1ll*dp[i-1][j-1]*(i-1)*(j-1)%mod);
		}
	}
	printf("%d\n",dp[c][d]);
	return 0;
}


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

using namespace std;
using ll=long long;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, a, n) for(int i = (n); i < (a); i++)

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n,lim;cin>>n>>lim;
  int c,t,cost=1000;
  bool flag=false;
  rep(i,n){
    cin>>c>>t;
    if(t<=lim && c<=cost){
      flag=true;
      cost=c;
    }
  }
  flag? cout<<cost<<endl: cout<<"TLE"<<endl;
}


Measured memory_bytes: 256
from __future__ import division
from sys import stdin, maxint

def solve(n, m, ds):
    dp = [maxint] * (n + 1)
    dp[0] = 0
    for i in range(1, n + 1):
        for j in range(m):
            if i >= ds[j]:
                dp[i] = min(dp[i], dp[i - ds[j]] + 1)

    return dp[n]

if __name__ == '__main__':
    n, m = map(int, stdin.readline().strip().split())
    ds = map(int, stdin.readline().strip().split())
    print(solve(n, m, ds))

Measured memory_bytes: 9064
#include <iostream>

using namespace std;

class digit{
private:
	int len;
public:
	int scan(int num);
};

int digit::scan(int num){
	len = 0;
	while(num != 0){
		num /= 10;
		len++;
	}
	return len;
}

int main(void){

	int a,b;
	int data[200];
	int i,j;
	i=j=0;
	digit digit;


	while(cin>>a>>b){
		data[i] = digit.scan(a+b);
		i++;
	}

	while(j<i){
		cout << data[j] << endl;
		j++;
	}

	return 0;
}

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



namespace CSharpSample01
{

    
    class Program
    {
        
        static void Solve(int N, int[] a)
        {

            //b[i] := i番目の箱に入っているボールの数(1 or 0)(i:1～N)
            int[] b = new int[N + 1];
            //ボールが1つ入っている箱の数
            int M = 0;

            //各i番目の箱に対してb[i]を決める
            for(int i = N; i >= 1; i--)
            {
                //iの倍数のインデックスにおいて1をカウント
                int one_cnt = 0;
                for(int j = i; j <= N; j += i)
                {
                    if (b[j] == 1) one_cnt++;
                }

                //one_cntに基づいてb[i]を決める
                if (a[i] == 0)
                {
                    if (one_cnt % 2 == 0) b[i] = 0;
                    else b[i] = 1;
                }
                else
                {
                    if (one_cnt % 2 == 0) b[i] = 1;
                    else b[i] = 0;
                }

                if (b[i] == 1) M++;
            }

            //出力
            Console.WriteLine(M);
            if (M == 0) return;
            List<int> ans = new List<int>();
            for(int i = 1; i <= N; i++)
            {
                if (b[i] == 1) ans.Add(i);
            }

            Console.WriteLine(string.Join(" ", ans));
        }

        
        static void Main(string[] args)
        {
            //入力1(N)
            int N = int.Parse(Console.ReadLine());

            //入力2(a)
            string[] input = Console.ReadLine().Split(' ');
            int[] a = new int[N + 1];
            for(int i = 1; i <= N; i++)
            {
                a[i] = int.Parse(input[i - 1]);
            }

            Solve(N, a);
            
        }
    }

}

Measured memory_bytes: 31192
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    for(int i=0;i<s.size();i++){
        if(s[i]!=t[i]){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3624
import java.util.*;
import java.lang.*;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();
		StringBuilder sb = new StringBuilder();
		if (sx < tx && sy < ty) {
			for (int i = 0; i < tx - sx; i++) {
				sb.append('R');
			}
			for (int i = 0; i < ty - sy; i++) {
				sb.append('U');
			}
			for (int i = 0; i < tx - sx; i++) {
				sb.append('L');
			}
			for (int i = 0; i < ty - sy; i++) {
				sb.append('D');
			}
			sb.append('D');
			for (int i = 0; i < tx - sx + 1; i++) {
				sb.append('R');
			}
			for (int i = 0; i < ty - sy + 1; i++) {
				sb.append('U');
			}
			sb.append('L');
			sb.append('U');
			for (int i = 0; i < tx - sx + 1; i++) {
				sb.append('L');
			}
			for (int i = 0; i < ty - sy + 1; i++) {
				sb.append('D');
			}
			sb.append('R');
		} else if (sx < tx && sy > ty) {
			for (int i = 0; i < tx - sx; i++) {
				sb.append('R');
			}
			for (int i = 0; i < sy - ty; i++) {
				sb.append('D');
			}
			for (int i = 0; i < tx - sx; i++) {
				sb.append('L');
			}
			for (int i = 0; i < sy - ty; i++) {
				sb.append('U');
			}
			sb.append('U');
			for (int i = 0; i < tx - sx + 1; i++) {
				sb.append('R');
			}
			for (int i = 0; i < sy - ty + 1; i++) {
				sb.append('D');
			}
			sb.append('L');
			sb.append('D');
			for (int i = 0; i < tx - sx + 1; i++) {
				sb.append('L');
			}
			for (int i = 0; i < sy - ty + 1; i++) {
				sb.append('U');
			}
			sb.append('R');
		} else if (sx > tx && sy < ty) {
			for (int i = 0; i < sx - tx; i++) {
				sb.append('L');
			}
			for (int i = 0; i < ty - sy; i++) {
				sb.append('U');
			}
			for (int i = 0; i < sx - tx; i++) {
				sb.append('R');
			}
			for (int i = 0; i < ty - sy; i++) {
				sb.append('D');
			}
			sb.append('D');
			for (int i = 0; i < sx - tx + 1; i++) {
				sb.append('L');
			}
			for (int i = 0; i < ty - sy + 1; i++) {
				sb.append('U');
			}
			sb.append('R');
			sb.append('U');
			for (int i = 0; i < sx - tx + 1; i++) {
				sb.append('R');
			}
			for (int i = 0; i < ty - sy + 1; i++) {
				sb.append('D');
			}
			sb.append('L');
		} else {
			for (int i = 0; i < sx - tx; i++) {
				sb.append('L');
			}
			for (int i = 0; i < sy - ty; i++) {
				sb.append('D');
			}
			for (int i = 0; i < sx - tx; i++) {
				sb.append('R');
			}
			for (int i = 0; i < sy - ty; i++) {
				sb.append('U');
			}
			sb.append('U');
			for (int i = 0; i < sx - tx + 1; i++) {
				sb.append('L');
			}
			for (int i = 0; i < sy - ty + 1; i++) {
				sb.append('D');
			}
			sb.append('R');
			sb.append('D');
			for (int i = 0; i < sx - tx + 1; i++) {
				sb.append('R');
			}
			for (int i = 0; i < sy - ty + 1; i++) {
				sb.append('U');
			}
			sb.append('L');
		}
		System.out.println(sb);
	}
}

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


int main(){
    int N,M,K;
    cin >> N >> M >> K;
    for(int i=0;i<=N;i++){
        for(int j=0;j<=M;j++){
            if(K == i * (M - j) + j * (N - i)){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 1000000007
#define bitcnt(a) (ll) __builtin_popcount((a))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

ll leftEast = 0, rightWest = 0, rightEast = 0, leftWest = 0;
int main() {
  ll n;
  string s;
  cin >> n >> s;
  REP(i, n) {
    if (i && s[i] == 'E')
      rightEast++;
    if (i && s[i] == 'W')
      rightWest++;
  }
  ll mini = MOD;
  REP(i, n) {
    mini = min(rightEast + leftWest, mini);
    if (s[i] == 'E')
      leftEast++;
    else
      leftWest++;
    if (i != n - 1 && s[i + 1] == 'W')
      rightWest--;
    if (i != n - 1 && s[i + 1] == 'E')
      rightEast--;
  }
  cout << mini << endl;
}


Measured memory_bytes: 900
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, S, E) for (int(X) = (S); (X) < (E); ++(X))
#define rrep(X, S, E) for (int(X) = (E)-1; (X) >= (S); --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

const string YES = "Yes";
const string NO = "No";

void solve(long long N) {
  if (N == 1) {
    print(YES);
    print(2);
    print("1 1");
    print("1 1");
    return;
  }

  ll n = -1;
  rep(i, 1, N) {
    if (i * (i + 1) == 2 * N) {
      n = i;
      print(YES);
      break;
    }
  }

  if (n == -1) {
    print(NO);
  } else {
    ll k = n + 1;
    vector<vl> ans(k);
    ll rest = n;
    ll nown = 1;
    ll nowi = 0;
    while (rest > 0) {
      ll nowit = nowi + 1;
      rep(i, 0, rest) {
        ans[nowi].push_back(nown);
        ans[nowit++].push_back(nown);
        nown++;
      }
      nowi++;
      rest--;
    }

    print(k);
    rep(i, 0, k) {
      cout << n << " ";
      rep(j, 0, n) {
        cout << ans[i][j];
        if (j != n - 1) {
          cout << " ";
        }
      }
      cout << endl;
    }
  }
}

int main() {
  long long N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<tuple>
#include<cmath>
using namespace std;

int main(){
    int N,D;
    cin>>N>>D;
    vector<vector<int>> vec(N,vector<int>(D));
    for (auto &x : vec)
    {
        for (auto &hoge : x)
        {
            cin>>hoge;
        }
        
    }

    int ans=0;

    for (int i = 0; i < N; i++)
    {
        bool ok=true;
        for(int m=i+1;m<N;++m){ 

            int sum=0;
            for (int k = 0; k < D; k++)
            {
                sum+=abs(vec[i][k]-vec[m][k])*abs(vec[i][k]-vec[m][k]);
            }
            for (int p = 0; p < 1000; p++)
            {
                if (sqrt(sum)==p)
                {
                    ans++;
                }
            
            }
            

        }
        
    }
    
    cout<<ans<<endl;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')

typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
double calc(double sx, double sy, double nx, double ny)
{
    return sqrt((sx - nx) * (sx - nx) + (sy - ny) * (sy - ny));
}
int main()
{
    //检查有没有特判0,有没有越界限.
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    int n;
    cin >> n;
    vector<int> cnt(n);
    for (int i = 0; i < n; i++)
    {
        cnt[i] = i;
    }
    vector<double> x(n), y(n);
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
    }
    double sum = 0.0;
    do
    {
        for (int i = 0; i < n - 1; i++)
        {
            int pos1 = cnt[i], pos2 = cnt[i + 1];
            sum += calc(x[pos1], y[pos1], x[pos2], y[pos2]);
        }
    } while (next_permutation(cnt.begin(), cnt.end()));
    int num = 1;
    for (int i = n; i >= 2; i--)
    {
        num *= i;
    }
    cout << sum / num << "\n";
    return 0;
}

Measured memory_bytes: 3812
include Math 

loop do
    r, n = gets.split.map(&:to_i)
    break if r == 0 

    shadow = Hash.new(0)
    (1..n).each do 
        xl, xr, h = gets.split.map(&:to_i)
        (xl..xr-1).each do |x|
            shadow[x] = h if h > shadow[x]
        end
    end  

    t_min = Float::INFINITY

    (-r+1..0).each do |x|
        h = shadow[x-1]
        t = h + r - sqrt(r*r-x*x)
        t_min = t if t < t_min
    end  

    (0..r-1).each do |x|
        h = shadow[x]
        t = h + r - sqrt(r*r-x*x)
        t_min = t if t < t_min
    end  

    printf("%.4f\n", t_min)
end

Measured memory_bytes: 8904
#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue> 
using namespace std;
int main() 
{int x,a,b,c;
 cin>>x>>a>>b;
 c=(x-a)%b;
 cout<<c; 
 system("pause");
 return 0;
}        

Measured memory_bytes: 504
X=int(input())

a=X//100
b=X%100
c=b%10
b=b//10
d=c%5
c=c//5
if d>0:
  e=1
else:
  e=0

temp=2*b+c+e
if temp>a:
  print(0)
else:
  print(1)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int s;
    char c;
    double w,h,bmi;
    while (cin>>s>>c>>w>>c>>h) {
        bmi = w/(h*h);
        if (bmi>=25) {
            cout<<s<<endl;
        }
    }
}


Measured memory_bytes: 3056
#include <iostream>

using namespace std;

int main()
{
    string s;
    cin>>s;
    int n=s.length();
    int i,j,sum=0;
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {

            if(s[i]==s[j])
            {
                sum+=1;
            }
        }
    }
    if(sum!=0) cout<<"no\n";
    else if(sum==0) cout<<"yes\n";
    return 0;
}


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

const string YES = "YES";
const string NO = "NO";

auto solve(long long a, long long b, long long c){
    return ((b - a) == (c - b)) ? YES : NO;
}

int main(){
    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long c;
    scanf("%lld",&c);
    auto result = solve(a, b, c);
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

S = list(ST())
T = list(ST())
dp = FILL2(0,len(S)+1,len(T)+1)
for i in range(len(S)+1):
    for j in range(len(T)+1):
        if i+1<=len(S) and j+1<=len(T):
            if S[i]==T[j]:
                dp[i+1][j+1] = dp[i][j] + 1
        if i+1<=len(S):
            dp[i+1][j] = max(dp[i+1][j],dp[i][j])
        if j+1 <= len(T):
            dp[i][j+1] = max(dp[i][j+1],dp[i][j])

l = dp[len(S)][len(T)]
i = len(S)
j = len(T)
ans = ''
while l > 0:
    if S[i-1]==T[j-1]:
        i -= 1
        j -= 1
        l -= 1
        ans = S[i]+ans
    else:
        if dp[i][j-1]==dp[i][j]:
            j -= 1
        else:
            i -= 1
print(ans)


Measured memory_bytes: 125272
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10


int main() {
	ll r, D, base; cin >> r >> D >> base;
	ll x = base;
	REP(i, 10) {
		x = r * x - D;
		cout << x << endl;
	}


	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
	int N, K, x[110], sum = 0;
	scanf("%d%d", &N, &K);
	for (int i = 0; i < N; i++) {
		scanf("%d", &x[i]);
		if (x[i] <= K - x[i]) {
			sum += x[i] * 2;
		}
		else {
			sum += (K - x[i]) * 2;
		}
	}
	printf("%d", sum);
	return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ==========Union-Find============-
class UnionFind {
  // まとめる 親を調べる サイズを知る
 public:
  // Aから見た親の番号を格納する。rootだったら-1*その集合のサイズ。
  vector<int> Parent;

  // 初期化
  UnionFind(int N) { Parent = vector<int>(N, -1); }

  // Aのrootを調べる
  int root(int A) {
    if (Parent[A] < 0) return A;  // マイナスならそれはroot
    return Parent[A] = root(Parent[A]);
  }

  // rootの値をプラスに戻して返す(サイズ)
  int size(int A) { return -Parent[root(A)]; }

  // くっつける関数
  bool connect(int A, int B) {
    // AとBのroot同士をくっつける
    A = root(A);  // ここのAは、"rootの場所"の意味
    B = root(B);
    if (A == B) return false;  // 既にくっついている
    if (size(A) < size(B))
      swap(A, B);            // 大きい方にくっつけるために中身交換
    Parent[A] += Parent[B];  // 中身更新
    Parent[B] = A;
    return true;
  }
};

// ====================================================================

int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> fri[n];
  UnionFind uni(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    uni.connect(a, b);
    fri[a].push_back(b);
    fri[b].push_back(a);
  }
  vector<int> bro[n];
  for (int i = 0; i < k; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    bro[a].push_back(b);
    bro[b].push_back(a);
  }

  for (int i = 0; i < n; i++) {
    // cout << uni.size(i) << endl;
    int count = 0;
    for (auto b : bro[i])
      if (uni.root(i) == uni.root(b)) count++;
    cout << uni.size(i) - fri[i].size() - count - 1 << " ";
  }
  cout << endl;
}


Measured memory_bytes: 12152
N = int(input())
X = input()
MAX = 2 * (10 ** 5) + 1

base = [0] * (MAX+1)
for num in range(1, MAX+1):
  cnt = 0
  bin_num = bin(num)[2:]
  for j in bin_num:
    cnt += int(j)
  p = num % cnt
  base[num] = base[p]+1

xcnt = 0
for i in range(N):
  xcnt += int(X[i])

#mod xnt+1  
X0to1 = [1] * N
X0to1sum = 0
k = 1
for i in range(N-1, -1, -1):
  X0to1[i] = k % (xcnt+1)
  X0to1sum += X0to1[i] * int(X[i])
  k = (k*2)%(xcnt+1)


  
#mod xnt-1
X1to0 = [0] * N
X1to0sum = 0
if(xcnt >= 2):
  k = 1
  for i in range(N-1, -1, -1):
    X1to0[i] = k % (xcnt-1)
    X1to0sum += X1to0[i] * int(X[i])
    k = (k*2)%(xcnt-1)


for i in range(N):
  if(X[i] == '0'):
    print(base[(X0to1sum + X0to1[i])%(xcnt+1)]+1)
  else:
    if(xcnt >= 2):
      print(base[(X1to0sum - X1to0[i])%(xcnt-1)]+1)
    else:
      print(0)

Measured memory_bytes: 79208
import itertools
N, M, Q = map(int, input().split())
A = [0] * Q
B = [0] * Q
C = [0] * Q
D = [0] * Q

for i in range(Q):
    a, b, c, d = map(int, input().split())
    A[i] = a
    B[i] = b
    C[i] = c
    D[i] = d
X = list(itertools.combinations_with_replacement([a for a in range(1,M+1)],N))

cnt = [0] * (len(X))
for k in range(len(X)):
    for l in range(Q):
        if X[k][B[l] - 1] - X[k][A[l] - 1] == C[l]:
            cnt[k] += D[l]

print(max(cnt))

Measured memory_bytes: 25048
X = int(input())

dp = [0] * 100001
dp[0] = 1
dp[100] = 1
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1

for i in range(106,X+1):
    dp[i] = dp[i-100] + dp[i-101] + dp[i-102] + dp[i-103] + dp[i-104] + dp[i-105]
    if dp[i] != 0:
        dp[i] = 1

print(dp[X])


Measured memory_bytes: 3828
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b;
  cin >> a >> b;
  if (a > b) cout << "a > b" << endl;
  else if (a < b) cout << "a < b" << endl;
  else cout << "a == b" << endl;
  return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define FOR(i,b,e) for (common_type_t<decltype(b),decltype(e)> i = (b), i ## __end = (e); i < i ## __end; ++ i)
#define rep(i,n)   FOR (i, size_t{}, n)
#define ALL(x)     begin (x), end (x)
using namespace std;
using ll = int64_t;
constexpr ll inf = 2e18;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  ll n;
  cin >> n;
  cout << n * (n - 1) / 2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a,b,n;
ll fl(double x){
	return (ll)x;
}
int main()
{
	scanf("%lld %lld %lld",&a,&b,&n);
	if(n>=b-1) printf("%lld\n",fl((double)a*(b-1)/b));
	else printf("%lld\n",fl((double)a*n/b));
	return 0;
}

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

const int N = 1e7 + 10;

long long n, W, w, v, sum, mx = -N;
long long d[N], use[N];
int main ()
{
    cin >>n >>W;
    use[0] = 1;
    for (int i = 1; i<=n; i++)
    {
        cin >>w >>v;
        for (int u = 1e7 + 10; u >= 0; u --)
        {
            if (use[u] == 1)
            {
                d[u + w] = max(d[u + w], d[u] + v);
                use[u + w] = 1;
            }
        }
        sum += w;
    }
    for (int i = W; i >= 0; i --)
    {
        if (use[i] == 1)
        {
            mx = max(mx, d[i]);
        }
    }
    cout <<mx;
    return 0;
}


Measured memory_bytes: 78080
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vv vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define INF 100000000000
#define eps 1e-7
#define mod 1000000007
#define int ll
using namespace std;
int N;
int B[100];
int total = 0;

signed main(void) {
    cin >> N;
    rep(i,N-1){
        cin >> B[i];
    }

    if(N==2){
        cout << B[0]+B[0] << endl;
    }else{
        total += B[0]+B[N-2];

        rep(i,N-2){
            total += min(B[i],B[i+1]);
//            cout << min(B[i],B[i+1]) << endl;
        }

        cout << total << endl;
    }

    return 0;
}


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

using namespace std;

template <typename A, typename B>string to_string(pair<A, B> p);

template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {return '"' + s + '"';}

string to_string(const char* s) {return to_string((string) s);}

string to_string(bool b) {return (b ? "true" : "false");}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

template <typename A, typename B, typename C>string to_string(tuple<A, B, C> p) {return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";}

template <typename A, typename B, typename C, typename D>string to_string(tuple<A, B, C, D> p) {return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

typedef unsigned long long ull;
typedef long long int lli;
typedef pair <int,int> ii;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x;
	cin >> x;
	cout << (x == 0? 1:0);
    return 0;
}

Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{

    public static void main(String[] args)throws IOException{
        BufferedReader  br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int count = 0;
        int x;
        for(int i = 0; i < n; i++){
            x = Integer.parseInt(br.readLine());
            if(isPrime(x)) count++;
        }
        System.out.println(count);
    }

    public static boolean isPrime(int x){
        if(x < 2) return false;
        else if(x == 2) return true;
        if(x % 2 == 0) return false;
        int i;
        for(i = 3; i * i <= x; i += 2){
            if(x % i == 0) return false;
        }
        return true;
    }

}

Measured memory_bytes: 30292
#include<bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
 
 
void solve(){
    int n;
  	cin>>n;
    if(n/100==n%10){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}
 
signed main(){
    //while(1)
    solve();
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
int MOD=1000000007;
signed main(){
    int n,k;cin>>n>>k;
    vector<bool> dp(k*2+10,false);
    vector<int> a(n);
    rep(i,n)cin>>a[i];
    rep1(i,k){
        rep(j,n){
            if(a[j]>i)break;
            dp[i]=dp[i]||!dp[i-a[j]];
        }
    }
    if(dp[k]){
        cout<<"First"<<endl;
    }
    else{
        cout<<"Second"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.diverta2019_2
{
    class D
    {
        static void Main(string[] args)
        {
            Method(args);
        }

        static void Method(string[] args)
        {
            long n = ReadLong();
            long[] valA = ReadLongs();
            long[] valB = ReadLongs();
            long[][] vals = new long[3][];
            for (int i = 0; i < 3; i++)
            {
                vals[i] = new long[2] { valA[i], valB[i] };
            }

            long tmp = n;
            long[] dp = new long[tmp + 1];
            long maxI = 0;
            for(int i = 0; i <= tmp; i++)
            {
                for(int j = 0; j < 3; j++)
                {
                    if (i + vals[j][0] <= tmp)
                    {
                        dp[i + vals[j][0]]
                            = Max(dp[i + vals[j][0]], dp[i] + vals[j][1]);
                        if (dp[maxI] < dp[i + vals[j][0]])
                        {
                            maxI = i + vals[j][0];
                        }
                    }
                }
            }

            tmp = Max(tmp, dp[maxI] + tmp - maxI);
            maxI = 0;
            dp = new long[tmp + 1];
            for (int i = 0; i <= tmp; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    if (i + vals[j][1] <= tmp)
                    {
                        dp[i + vals[j][1]]
                            = Max(dp[i + vals[j][1]], dp[i] + vals[j][0]);
                        if (dp[maxI] < dp[i + vals[j][1]])
                        {
                            maxI = i + vals[j][1];
                        }
                    }
                }
            }
            tmp = Max(tmp, dp[maxI] + tmp - maxI);

            WriteLine(tmp);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 206304
#include<cstdio>
using namespace std;
int main(){
  int i=0,s0=0,s1=0;
  char t;
  t=getchar();
  for(int i=0;t=='0'||t=='1';i++){
   	if(t==(i%2+'0'))s0++;
    else s1++;
    t=getchar();
  }
  printf("%d\n",(s0>s1)?s1:s0);
  return 0;
}

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

int main() {
  int n;
  cin>>n;
  int a[n+1];
  a[0] = 0;
  vector<int> b;
  int cnt = 0;
  for (int i=1; i<=n; i++) {
    cin>>a[i];
    if (a[i] != a[i-1]) {
      if (cnt > 0) {
        b.push_back(cnt+1);
        cnt = 0;
      }
      continue;
    }
    ++cnt;
  }
  if (cnt > 0) {
    b.push_back(cnt+1);
  }
  int ans = 0;
  for (int i: b) {
    ans += i / 2;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pb push_back
#define MOD 1000000007
char a[11][1010];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int h=0,w=0,k=0,res=INT_MAX;
    cin>>h>>w>>k;
    for(int i=0;i<h;++i)
        for(int j=0;j<w;++j)
            cin>>a[i][j];
    for(int i=0;i<(1<<(h-1));++i)
    {
        int c=__builtin_popcount(i);
        vector<int> curr(h);
        int flag=0;
        for(int j=0;j<w&&(!flag);++j)
        {
            int pos=0;
            vector<int> v(h);
            for(int l=0;l<h;++l)
            {
                v[pos]+=(a[l][j]-'0');
                if(i>>l&1)
                    ++pos;
            }
            for(int j=0;j<h;++j)
            {
                if(v[j]>k)
                {
                    flag=1;
                    break;
                }
            }
            bool mark=0;
            for(int j=0;j<h;++j)
            {
                if(curr[j]+v[j]>k)
                    mark=1;
            }
            c+=mark;
            if(mark)
            {
                for(int j=0;j<h;++j)
                    curr[j]=v[j];
            }
            else
            {
                for(int j=0;j<h;++j)
                    curr[j]+=v[j];
            }
        }
        if(!flag)
            res=min(res,c);
    }
    cout<<res<<endl;
}


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

using namespace std;

typedef long long ll;

ll dp[3000050];
vector<int> G[25];
vector<int> G2[25];

int mod = (int)1e9 + 7;

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

    for(int i = 0 ; i < n ; i++){
        for(int j = 0 ; j < n ;j++){
            int num;
            scanf("%d",&num);
            if(num) G[i].push_back(j);
        }
    }

    int N = 1<<n;

    for(int i = 0 ; i < N ; i++){
        int num = i;
        int cnt = 0;
        while(num){
            if(num&1){
                cnt++;
            }
            num >>= 1;
        }
        G2[cnt].push_back(i);
    }


    //cout << N ;

    dp[0] = 1;
    for(int j = 0 ; j < n ; j++){
        for(int i : G2[j]){
            if(!dp[i])  continue;


            for(int k : G[j]){
                if(((1<<k) | i) == i) continue;

                dp[(1<<k) | i] += dp[i];
                if(dp[(1<<k) | i] >= mod)   dp[(1<<k) | i] -= mod;
            }

        }
    }

    cout << dp[N - 1];

    return 0;
}


Measured memory_bytes: 28092
def main():
    import sys
    input = sys.stdin.readline
    from heapq import heappush
    N, C = map(int, input().split())
    table = [[0]*10**5 for _ in range(C)]
    for _ in range(N):
        s, t, c = map(int, input().split())
        s -= 1
        t -= 1
        c -= 1
        for i in range(s, t + 1):
            table[c][i] = 1
            
    ans = 0
    for i in range(10**5):
        tmp = sum(table[j][i] for j in range(C))
        ans = max(ans, tmp)
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 26612
from bisect import bisect_left

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


a.sort()
count = 0

for i in range(n-2):
    for j in range(i+1, n-1):
        x = bisect_left(a, a[i] + a[j])
        count += x - (j+1)

print(count)




Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define y_n(ans) cout<<(ans?"Yes":"No")<<endl;

int main() {
    int a, b; cin >> a >> b;
    cout << a*b << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int main()
{
    //freopen("in.txt","r",stdin);
    int n,m;
    cin >> n >> m;
    vector< vector<int> > A(n,vector<int>(m));
    vector<int> b(m,0);

    for(int i=0;i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            cin >> A[i][j];
        }
    }
    for(int i=0;i<m;i++)
    {
        cin >> b[i];
    }
    for(int i=0;i<n;i++){
        int sum = 0;
        for(int j=0;j<m;j++)
        {
            sum+=A[i][j] * b[j];
        }
        cout << sum << endl;
    }
    return 0;
























    return 0;
}

Measured memory_bytes: 1256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>

int main(int argc, char *argv[]) {
	int n;
	scanf("%d",&n);
	int a[4];
	for(int i=3;i>=0;i--){
		a[i]=n%10;
		n/=10;
	}
	int ans[20]={0};
	ans[1]=a[0];
	for(int i=1;i<8;i++){
		int b;
		if(i==1) b=a[1];
		else if(i>=2&&i<=3) b=a[2];
		else if(i>=4&&i<=7) b=a[3];
		ans[2*i]=ans[i]+b;
		ans[2*i+1]=ans[i]-b;
	}
	
	for(int i=8;i<=15;i++){
		if(ans[i]==7){
			for(int j=0;j<3;j++){
				printf("%d",a[j]);
				int c=i;
				for(int k=2-j;k>0;k--){
					c/=2;
				}
				if(c%2) printf("-");
				else printf("+");
			}
			printf("%d=7",a[3]);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int a,b;
  scanf("%d %d",&a,&b);
  if(a>=0 && a<=5)
    printf("0");
  else if(a>=6 && a<=12)
    printf("%d",b/2);
  else
    printf("%d",b);
 return 0;
}

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

int main() {
    int A, B;
    cin >> A >> B;
    if(A + B == 3){
        cout << 3 << endl;
    }
    else if(A + B == 5){
        cout << 1 << endl;
    }
    else cout << 2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <functional>

using namespace std;
int main()
{

	long long A, B, C, K;
	long long Ans = 0;
	cin >> A >> B >> C >> K;

	if (K % 2 == 0) {
		Ans = A - B;
	}
	else {
		Ans = B - A;
	}

	long long ABS = abs(Ans);

	if (ABS > 1000000000000000000) {
		cout << "Unfair";
	}
	else {
		cout << Ans;
	}

	return 0;
}

Measured memory_bytes: 256
import math
 
N = 1000001
 
spf = [*range(N)]
i = 2
while i * i < N:
  if spf[i] == i:
    for j in range(i * i, N, i):
      if spf[j] == j:
        spf[j] = i
  i += 1
  
r = 'pairwise'
 
input()
d = None
u = set()
for x in map(int, input().split()):
  d = math.gcd(d or x, x);
  s = set()
  while x > 1:
    p = spf[x]
    if p in u:
      r = 'setwise'
    s.add(p)
    x //= p
  u |= s
print(d > 1 and 'not' or r, 'coprime')


Measured memory_bytes: 179188
import itertools
from math import ceil
t = []
for i in range(5):
    t.append(int(input()))
ans = 10**9

for values in list(itertools.permutations(t)):
    tmp = 0
    for i, v in enumerate(values):
        if i == 4:
            tmp += v
        else:
            tmp += (ceil(v / 10) * 10)
    ans = min(ans, tmp)
print(ans)


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define _USE_MATH_DEFINES
#include <math.h>
#define rep(i,n) for(int i = 0;i < n;i++)
#define NIL = -1;
#define all(x) x.begin(),x.end()
const ll INF = 1e9;
const ll mod = 1e9 + 7;

int digit(ll x) {
    if (x / 10 == 0) return 1;
    return digit(x / 10) + 1;
}

ll gcd(long long a,long long b) {
    if (a < b) swap(a,b);
    if (b == 0) return a;
    
    return gcd(b,a%b);
}

ll lcm(ll a,ll b){
    return ((a * b == 0)) ? 0 : (a / gcd(a,b) * b);
}

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


//////////////////////////////////////////////////////////////////////////////////////

int main(){
    string s,t;
    cin >> s >> t;
    int ans = 0, rep = 0;
    bool con = true;
    for (int i = 0;i < s.size();i++){
        for (int j = 0;j< t.size();j++){
            if (i + j >= s.size()){
                con = false;
                break;
            }
            if (s[i + j] == t[j]){
                rep++;
            }
        }
        if (con == false){
            break;
        }
        ans = max(ans, rep);
        rep = 0;
    }

    cout << t.size() - ans << endl;
}



Measured memory_bytes: 3584
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<numeric>
#include<vector>
#include<iostream>
#include<map>

using namespace::std;

int main(void)
{

  int a,b;

  while(cin >> a >> b)
    {
      int ab = a + b;

      char c_num[64];

      sprintf(c_num , "%d" , ab);
      string s_num = (string)c_num;
      cout << s_num.size() << endl;
    }

  return 0;
}

Measured memory_bytes: 1228
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pii;
typedef pair<pii, ll>pi3;
ll mod = 1000000007;
ll gcd(ll a, ll b)
{
	for (;;)
	{
		if (a < b)swap(a, b);
		a %= b;
		if (a == 0)return b;
	}
}
int main()
{
	int a, b;
	scanf("%d%d", &a, &b);
	int x = -1, y = -1, z = -1;
	for (int i = 0; i <= a; i++)
	{
		for (int j = 0; j <= a - i; j++)
		{
			if (b == i * 10000 + j * 5000 + (a - i - j) * 1000)x = i, y = j, z = a - i - j;
		}
	}
	printf("%d %d %d\n", x, y, z);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
const ll ddx[8]={ 0, 1, 0,-1, 1, 1,-1,-1};
const ll ddy[8]={ 1, 0,-1, 0, 1,-1, 1,-1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    string s;cin >> s;
    ll n=s.size();
    ll d=n/2;
    string f,l;
    rep(i,d){
        f+=s[i];
    }
    for(int i=n-1;i>=n-d;i--)l+=s[i];
    if(f!=l){
        cout << "No" <<endl;
        return 0;
    }
    string f2,l2;
    per(i,d){
        f2+=f[i];
    }
    per(i,d){
        l2+=l[i];
    }
    if(f!=f2||l!=l2){
        cout << "No" <<endl;
        return 0;
    }
    cout << "Yes" <<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	char s[5];
	int count = 0;
	scanf("%s", s);
	if (s[0] == '1') count++;
	if (s[1] == '1') count++;
	if (s[2] == '1') count++;
	printf("%d\n", count);
	return 0;
}

Measured memory_bytes: 128
N,M,Q = map(int,input().split())

train = [[0 for i in range(N)] for j in range(N)]
for m in range(M):
    L,R = map(int,input().split())
    train[L-1][R-1] += 1

c = [[0 for i in range(N)] for j in range(N)]
for i in range(N):
    cnt = 0
    for j in range(N):
        cnt += train[i][j]
        c[i][j] = cnt

for x in range(Q):
    p,q = map(int,input().split())
    p -= 1
    q -= 1
    cnt2 = 0
    for i in range(p,q+1):
        if p == 0:
            cnt2 += c[i][q]
        else:
            cnt2 += c[i][q] - c[i][p-1]
    print(cnt2)



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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define dump(x)
#define debug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, std::vector<std::string> S){
    unordered_set<string> variation;
    rep(i,0,N) variation.insert(S[i]);
    cout << variation.size() << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
    }
    solve(N, std::move(S));
    return 0;
}


Measured memory_bytes: 24108
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
#define INF (long long)998244353
using namespace std;

int main(void){
    int n,m;
    cin >> n >> m;
    vector<long long> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    int maxi=0;
    int count=0;
    while(m>0){
        long long temp=a[maxi]/2;
        if(a[maxi]==0)break;
        count=0;
        for(int i=0; i<n; i++){
            if(temp<a[i])count++;
        }
        if(count>m){
            sort(a.begin(),a.end());
            reverse(a.begin(),a.end());
        }
        for(int i=0; i<n; i++){
            if(m==0)break;
            if(temp<a[i]){
                a[i]/=2;
                m--;
            }else {
                if(a[maxi]<a[i])maxi=i;
            }
        }
    }
    long long ans=0;
    for(int i=0; i<n; i++){
        //cerr << a[i] << endl;
        ans+=a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
N, M = map(int, input().split())
pyi = list()

for i in range(M):
  pyi.append(list(map(int, input().split())))
  pyi[i].append(i)
  
N_cnt = [0] * N

pyi = sorted(pyi, key=lambda x:x[1])

for i in range(M):
  p = pyi[i][0]
  N_cnt[p-1] += 1
  pyi[i][0] = str(p).zfill(6)
  pyi[i][1] = str(N_cnt[p-1]).zfill(6)
  
pyi = sorted(pyi, key=lambda x:x[2])

for i in range(M):
  print(pyi[i][0] + pyi[i][1])

Measured memory_bytes: 44780