akhauriyash/Code-Regression huggingface dataset:
#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 rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  ll s;
  cin >> s;
  ll x2,y2,x3,y3;
  x2 = 1e9;
  y2 = 1L;
  y3 = ceil((long double)s/(double)x2);
  x3 = x2*y3-s;
  cout<<"0 0 "<<x2 <<" " <<y2 <<" " <<x3 <<" "<<y3<<endl;
  return 0; 
}


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


public class my
{
	
	private static StringBuilder sb = new StringBuilder();
	
	public static void Main()
	{
		var n = my.GetInt();
		var dict = new Dictionary<string, int>();
		
		for(int i = 0; i < n; i++) {
			var s = Console.ReadLine();
			
			if(s.StartsWith("insert")) {
				dict[s.Split(' ')[1]] = 1;
			}
			
			if(s.StartsWith("find")) {
				sb.AppendLine( dict.ContainsKey(s.Split(' ')[1])? "yes" : "no");
			}
		}
		
		my.Flush();
	}
	
	private static int CountChar(string s, char c)
	{
		return s.Length - s.Replace(c.ToString(), "").Length;
	}
	
	private static void Flush()
	{
		Console.Write(sb);
		sb.Length = 0;
	}
	
	private static void AppendLine(int v)
	{
		sb.AppendLine(v.ToString());
	}
	
	private static void AppendLine(long v)
	{
		sb.AppendLine(v.ToString());
	}
	
	private static void AppendLine(string[] v)
	{
		sb.AppendLine(string.Join(" ", v));
	}

	private static void Swap(ref string a, ref string b) 
	{
		string tmp = a;
		a = b;
		b = tmp;
	}
	
	private static void Swap(ref int a, ref int b) 
	{
		int tmp = a;
		a = b;
		b = tmp;
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static void WriteArray(long[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
	
	private static long GetLong()
	{
		return long.Parse(Console.ReadLine());
	}
}

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

int main() {
  ll x, y; cin >> x >> y;
  
  int ans = 1;
  while (x * 2 <= y) {
    x *= 2; ++ans;
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
import numpy as np

n = int(input())
ab = []

for _ in range(n):
    ab.append(list(map(int, input().split())))

a = np.array([x[0] for x in ab])
b = np.array([x[1] for x in ab])


ans = 0
for x, y in zip(a[::-1], b[::-1]):
    mod = (x + ans) % y
    if mod == 0:
        continue
    else:
        add = y - mod
        ans += add

print(ans)

Measured memory_bytes: 38656
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
map <ll, int> mp;
int main() {
	int n; read(n);
	ll s = 0, ans = 0; mp[s]++;
	for (int i = 1; i <= n; i++) {
		int x; read(x); s += x;
		ans += mp[s], mp[s]++;
	}
	writeln(ans);
	return 0;
}

Measured memory_bytes: 12800
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long ll;

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

    vector<ll> v[100010];
    for (int i = 0; i < n; i++) {
        ll t, d;
        cin >> t >> d;
        v[t - 1].push_back(d);
    }
    
    vector<ll> mx, ex_mx;
    for (int i = 0; i < n; i++) {
        sort(v[i].begin(), v[i].end(), greater<ll>());
        if (v[i].size() != 0) {
            mx.push_back(v[i][0]);
            for (int j = 1; j < v[i].size(); j++) {
                ex_mx.push_back(v[i][j]);
            }
        }
    }
  sort(mx.begin(), mx.end(), greater<ll>());
  sort(ex_mx.begin(), ex_mx.end(), greater<ll>());

    ll mx_s[100010], ex_mx_s[100010];
    for (int i = 0; i <= mx.size(); i++) {
        if (i == 0) mx_s[0] = 0;
        else mx_s[i] = mx_s[i - 1] + mx[i - 1];
    }
    for (int i = 0; i <= ex_mx.size(); i++) {
        if (i == 0) ex_mx_s[0] = 0;
        else ex_mx_s[i] = ex_mx_s[i - 1] + ex_mx[i - 1];
    }

    ll ans = 0;
    for (ll i = 1; i <= mx.size(); i++) {
        ll tmp = 0;
        tmp += mx_s[i] + i * i;
        if (k - i >= 0) {
            tmp += ex_mx_s[k - i];
            ans = max(ans, tmp);
        }
      //cout << tmp << endl;
    }

    cout << ans << endl;



}


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

int main() {
    int H, W, i, j;
    while(1){
        cin >> H >> W;
        if(H == 0 && W == 0) break;
        for(i=0; i < H; i++){
            for(j=0; j < W; j++){
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;

    }
    return 0;

    
}


Measured memory_bytes: 3088
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){

   int n,k,x,y;
   cin >> n >> k >> x >> y;

   int ans = 0;
   if(n<=k) ans = n*x;
   else ans = k*x + (n-k)*y;

   cout << ans << endl;


   return 0;
}

Measured memory_bytes: 256
my $s = <STDIN>;
my ($a,$b,$k) = split(/ /,$s);

if($a<=$k){
  $k = $k - $a;
  $a = 0;
}else{
  $a = $a -$k;
  print "$a $b";
  exit;
}
if($b<=$k){
  $k = $k - $b;
  $b = 0;
}else{
  $b = $b -$k;
}
print "$a $b";
  

Measured memory_bytes: 512
#include <iostream>
#include<algorithm>
#include<cstring>
#include<cmath>

using namespace std;

int main()
{
        string a;
        cin >> a;
        int len = a.length();
        if(len % 2 == 0){
                cout << "No" << endl;
                return 0;
        }else{
                for(int i = 0; i < len / 2; i++)
                {
                        if(a[i] == a[len - i - 1]) continue;
                        else{
                                cout << "No" << endl;
                                return 0;
                        }
                }
                int len1 = (len - 1) / 2 - 1, i = 0;
                while(i <= len1){
                        if(a[i] == a[len1]){
                                i++;len1--;
                        }else{
                                cout << "No" << endl;
                                return 0;
                        }
                }
                int len2 = (len + 3) / 2 - 1;i = len - 1;
                while(i >= len2){
                        if(a[i] == a[len2]){
                                i--;len2++;
                        }else{
                                cout << "No" << endl;
                                return 0;
                        }
                }
                cout << "Yes" << endl;
        }
        return 0;
}


Measured memory_bytes: 256
from sys import stdin

n, x = [int(x) for x in stdin.readline().rstrip().split()]
l_lst = [int(x) for x in stdin.readline().rstrip().split()]
d = 0
count = 0

for i, l in enumerate(l_lst):
  if d > x:  break
  else: count += 1
  d += l

if i == n-1 and d <= x:
  count += 1
 
print(count)

Measured memory_bytes: 3064
/*
  Author - KISHAN TIWARI
  Dream bigger. Do bigger.
  Wake up with determination. Go to bed with satisfaction.
*/
//Sometimes later becomes never. Do it now.
#include<bits/stdc++.h>
using namespace std;
#define ll           long long
#define f(i,a,b)     for(ll i=a;i<b;i++)
#define mod          1000000007
#define fi           first
#define se           second
#define pa           pair <ll,ll>
#define mp           make_pair
#define pb           push_back
#define ve           vector<ll>
#define vep          vector< pa >
#define all(a)       a.begin(), a.end()
#define sz(x)        (ll)x.size()
#define c(t)         cout<<t<<"\n"
using namespace std;
void solve()
{  ll n;
cin>>n;
vep v;
f(i,0,n)
{
    ll x,y;
    cin>>x>>y;
    v.pb(mp(y,x));
}
sort(all(v));
ll sum=0;
ll i=0,c=0;
while(i<n)
{
    sum+=v[i].se;
    if(v[i].fi<sum)
    {c=2;
    break;
    }
    i++;
}
if(c==0)
    cout<<"Yes\n";
else
    cout<<"No\n";
}
int main()
{
    ios::sync_with_stdio(true);
   //freopen ("input.txt","r",stdin);
   //freopen ("output.txt","w",stdout);
    cin.tie(0);
    cout.tie(0);
    ll t=1;
    //cin>>t;
    while(t--)
    {

        solve();
    }
return 0;
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int n; cin >> n;
  vector<int> p(n), q(n), f(n);
  rep(i,n) cin >> p[i];
  rep(i,n) cin >> q[i];
  rep(i,n) f[i] = i + 1;
  int a=0, b=0;
  int i = 1;
  do {
    if (p == f) a = i;
    if (q == f) b = i;
    if (a != 0 && b != 0) break;
    i++;
  } while (next_permutation(f.begin(), f.end()));
  //cout << a << " " << b << endl;
  cout << abs(a - b) << endl;
}

Measured memory_bytes: 3592
# 隣り合う2個というが、頭からみていったときに前のやつは流用できないので、あとのやつを優先的に減らしたほうがいい
n, x = map(int, input().split())
arr = list(map(int, input().split()))

cost = 0
for i in range(1, n):
    if arr[i] + arr[i - 1] > x:
        abure = arr[i] + arr[i-1] - x
        if arr[i] >= abure:
            arr[i] -= abure
        else:
          # 足りないぶんはひとつ前からも減らさねばならない
            arr[i - 1] -= abure - arr[i]
            arr[i] = 0
        cost += abure
print(cost)


Measured memory_bytes: 14052
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=85;
//↑templete
signed main(){
	string S, T;
	cin>>S>>T;
	cout<<T<<S<<endl;
	return 0;
}

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

int n;
int A[100005];

int main(){
    cin >> n;

    for(int i=0;i<n;i++)
        cin >> A[i];

    int cc=0;

    for(int i=0;i<n;i++)
        cc+=A[i]-1;

    cout << cc << endl;

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
const int N=1<<15|10,P=1e9+7;
int n,m,U,e[20],pw[300],cnt[N],f[N];
bool can[N];

inline void read(int &i){
	i=0;char c=getchar();bool j=0;
	for(;!isdigit(c);c=getchar())if(c=='-')j=1;
	for(;isdigit(c);c=getchar())i=(i<<1)+(i<<3)+c-'0';i=j?-i:i;
}
inline void add(int &x,int y){(x+=y)>=P?x-=P:0;}

int main(){
	read(n);read(m);U=(1<<n)-1;pw[0]=1;
	for(int i=1,x,y;i<=m;++i){
		read(x);read(y);
		x--;y--;
		e[x]|=1<<y;
	}
	for(int i=1;i<=U;++i)cnt[i]=cnt[i>>1]+(i&1);
	for(int i=1;i<=m;++i)pw[i]=pw[i-1],add(pw[i],pw[i-1]);
	for(int s=0;s<=U;++s)can[s]=(s&1)==(s>>1&1);
	f[0]=1;
	for(int s=1;s<=U;++s)if(can[s])
		for(int t=s;t;t=(t-1)&s)if(can[t]){
			ll as=1;
			for(int i=0;i<n;++i)if(s>>i&1){
				if(t>>i&1)as=as*pw[cnt[e[i]&(s^t)]]%P;
				else as=as*(pw[cnt[e[i]&t]]-1)%P;
			}
			add(f[s],as*f[s^t]%P);
		}
	printf("%d\n",(pw[m]-f[U]+P)%P);
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> p(n),q(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];
    vector<bool> p_check(n+1,true);
    vector<bool> q_check(n+1,true);
    int p_num = 0;
    int q_num = 0;
    vector<int> fact(n+1);
    fact[0]=1;
    for(int i=1; i<n; i++){
        fact[i] = fact[i-1]*i; 
        //cout << fact[i] << endl;
    }
    rep(i,n){
        int k = 0;
        for(int j=1; j<p[i]; j++){
            if(p_check[j]==true) k++;
        }
        p_num += fact[n-i-1]*k;
        p_check[p[i]] = false;
    }
    rep(i,n){
        int k = 0;
        for(int j=1; j<q[i]; j++){
            if(q_check[j]==true) k++;
        }
        q_num += fact[n-i-1]*k;
        q_check[q[i]] = false;
    }
    cout << abs(p_num - q_num) << endl;
    
    return 0;
}

Measured memory_bytes: 3632
import sys
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))
N, u, v = inpl()
u -= 1
v -= 1
edges = [set() for _ in range(N)]
AB = []
for i in range(N-1):
    A, B = inpl()
    edges[A-1].add(B-1)
    edges[B-1].add(A-1)

parent = [None]*N
position = [0]*N
depth = [0]*N
head, tail = 0, 1
pool = [(v, None, 0, head)]
while pool:
    n, p, d, pos = pool.pop()
    if pos == head:
        pool.append((n, p, d, tail))
        for c in edges[n]:
            if c == p:
                continue
            parent[c] = n
            position[c] = d+1
            pool.append((c, n, d+1, head))
    else:
        if p is not None:
            depth[p] = max(depth[n]+1, depth[p])

turn_d = position[u]//2 + 1
turn_node = u
for i in range(turn_d, position[u]):
    turn_node = parent[turn_node]

print(turn_d + depth[turn_node] - 1)


Measured memory_bytes: 81184
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<cstdlib>
#include<list>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

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

	if (b - a == c - b)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
dic1 = defaultdict(int)
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n = int(readline())
lst1 = list(map(int,readline().split()))
q = int(readline())
#exist = [0]*(10**5+1)
ans = 0
for i in lst1:
    dic1[i] += 1
    ans += i

for i in range(q):
    b,c = map(int,readline().split())
    val = dic1[b]
    ans -= val*b
    ans += val*c
    dic1[b] = 0
    dic1[c] += val
    print(ans)

Measured memory_bytes: 88580
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<int64_t> k(N+1);
  k.at(0) = 2;
  k.at(1) = 1;
 
 for(int i = 2; i <= N; i++) {
   k.at(i) = k.at(i-1) + k.at(i-2);
 }
  cout << k.at(N) << endl;
}

Measured memory_bytes: 3632
#!/usr/bin/env python3
import sys
import numpy as np

def solve(N: int, X: "List[int]"):
    cost = []
    X = np.asarray(X)
    for p in range(101):
        cost.append(np.sum((X-p)**2))
    print(min(cost))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    X = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, X)

if __name__ == '__main__':
    main()


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


int main(){
    string s;   cin >> s;
    string ans="AC";
    int cnt=0;
    if(s[0]!='A') ans = "WA";

    for(int i=1; i<s.size(); i++){
        if(s[i]=='C' && 2<=i && i<=s.size()-2) cnt +=1;
        else if('A'<=s[i] && s[i]<='Z') ans = "WA";
    }
    if(cnt!=1) ans="WA";
    cout << ans << endl;
    
    
}

Measured memory_bytes: 256
N = int(input())
D, X = map(int, input().split())
nums = [int(input()) for _ in range(N)]
cnt = 0
for num in nums:
  idx = 0
  while True:
    if idx * num + 1 > D:
      break
    else:
      cnt += 1
    idx += 1
print(cnt+X)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(X,A,B) for(int X=A;X<=B;X++)
#define tep(X,A,B) for(int X=A;X>=B;X--)
#define LL long long
#define DB double
const int N=2010;
const int M=4010;
const int maxn=2000;
const int mx=4000;
const LL MOD=998244353;
using namespace std;

int K,n;
LL C[M][M],g[N];

void INIT(){
	g[0]=1;
	rep(i,1,maxn)g[i]=g[i-1]*2%MOD;
	rep(i,0,mx)C[i][i]=C[i][0]=1,C[i][1]=i;
	rep(i,3,mx){
		rep(j,2,i-1){
			C[i][j]=(C[i-1][j]+C[i-1][j-1])%MOD;
		}
	}
}

LL GET(int cnt,int las,int tot){
	LL res=0;
	rep(i,0,cnt){
		res=(res+C[cnt][i]*g[i]%MOD*C[tot+las-1][i+las-1])%MOD;
	}
	return res;
}

LL SOLVE(int x){
	int cnt=0;
	rep(i,1,K)if(x-i<=K&&x-i>=1)cnt++;
	if(x&1)return GET(cnt/2,K-cnt,n);
	else return (GET((cnt-1)/2,K-cnt,n)+GET(cnt/2,K-cnt,n-1))%MOD;
}

int main(){
	scanf("%d%d",&K,&n);
	INIT();
	rep(i,2,2*K)printf("%lld\n",SOLVE(i));
	return 0;
}

Measured memory_bytes: 123904
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int k;
    cin >> k;
    vector<int> a(k), b(k);
    rep(i, k) cin >> a[i] >> b[i];
    
    vector<int> vec = {0, 1, 2, 3, 4, 5, 6, 7};
    do {
        bool judge = true;
        rep(i, k) {
            if (vec[a[i]] != b[i]) judge = false;
        }
        if (!judge) continue;
        rep(i, 8) rep(j, 8) {
            if (i == j) continue;
            if (abs(i - j) == abs(vec[i] - vec[j])) judge = false;
        }
        if (judge) {
            vector<vector<char>> ans(8, vector<char>(8, '.'));
            rep(i, 8) ans[i][vec[i]] = 'Q';
            rep(i, 8) {
                rep(j, 8) cout << ans[i][j];
                cout << endl;
            }
            return 0;
        }
    } while (next_permutation(vec.begin(), vec.end()));
}



Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    while(cin>>n){
        set<string>str;
        for(int i=0;i<n;i++){
            string s;
            cin>>s;
            str.insert(s);
        }
        cout<<str.size()<<endl;
    }
    return 0;
}


Measured memory_bytes: 19172
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True  and False
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
c = []
e = [0]*200001
x = [0]*200001
for i in range(n):
    c.append(inn())
ddprint(c)
x[0] = 1
e[c[0]] = 1
for i in range(1,n):
    if c[i]==c[i-1]:
        x[i] = x[i-1]
        continue
    x[i] = (x[i-1]+e[c[i]])%R
    e[c[i]] += x[i-1]
    #ddprint(x[:8])
    #ddprint(e[:8])
print(x[n-1])


Measured memory_bytes: 24420
#include<bits/stdc++.h>
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define printd(x) printf("%.12f\n", ans);
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

int main(void) {
    int n;
    cin >> n;
    int h[n];
    rep (i, n) cin >> h[i];

    for (int i = n - 2; i >= 0; i--) {
        if (h[i] > h[i + 1]) {
            h[i]--;
        }
        if (h[i] > h[i + 1]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int h, w; cin >> h >> w;
    int n; cin >> n;
    vi a(n); for(auto& e : a) cin >> e;

    int idx = 0;
    vector<vi> field(h, vi(w));
    rep(y, h){
        rep(_, w){
            int x = (y % 2 == 0 ? _ : w - 1 - _);
            if(a[idx] == 0) idx++;
            a[idx]--;
            field[y][x] = idx + 1;
        }
    }

    rep(y, h){
        rep(x, w){
            cout << (x == 0 ? "":" ") << field[y][x];
        }
        cout << endl;
    }

    return 0;
}


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

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>

#define INF 10e9
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

int main(){
   long long int n, m, R;
   cin >> n >> m >> R;
   vector<long long int> r(R);

   long long int i, j, k;
   long long int rr;
   for(i = 0; i < R; i++){
       cin >> rr;
       r[i] = rr-1;
   }
   sort(r.begin(), r.end());

   long long int dist[n][n];
   for(i = 0; i < n; i++){
       for(j = 0; j < n; j++){
           if(i == j){
               dist[i][j] = 0;
           }else{
               dist[i][j] = INF;
           }
       }
   }

   long long int a, b, c;
   for(i = 0; i < m; i++){
       cin >> a >> b >> c;
       dist[a-1][b-1] = c;
       dist[b-1][a-1] = c;
   }

   for(k = 0; k < n; k++){
       for(i = 0; i < n; i++){
           for(j = 0; j < n; j++){
               if(dist[i][k] != INF && dist[k][j] != INF){
                   dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
               }
           }
       }
   }

   long long int ans = INF;
   long long int count;
   do{
       count = 0;
       for(i = 0; i < R-1; i++){
           count += dist[r[i]][r[i+1]];
       }
       ans = min(ans, count);
   }while(next_permutation(r.begin(), r.end()));

   cout << ans << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define Rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

int main() {
	int N;
	cin >> N;
	vector<ll> a(N), sum(N + 1, 0);
	Rep(i, N) {
		cin >> a[i];
		sum[i + 1] = sum[i] + a[i];
	}
	ll res = sum[N];
	int left = 1;
	int right = 3;
	For(mid, 2, N - 1) {
		while (left + 1 < mid&&sum[left] < sum[mid] - sum[left]) left++;
		ll tmp1 = abs(sum[left] - (sum[mid] - sum[left]));
		ll tmp2 = abs(sum[left - 1] - (sum[mid] - sum[left - 1]));
		if (tmp1 > tmp2) left--;
		while (right + 1 < N&&sum[right] - sum[mid] < sum[N] - sum[right]) right++;
		tmp1 = abs(sum[right] - sum[mid] - (sum[N] - sum[right]));
		tmp2 = abs(sum[right - 1] - sum[mid] - (sum[N] - sum[right - 1]));
		if (tmp1 > tmp2) right--;
		ll M = max({ sum[left],sum[mid] - sum[left],sum[right]-sum[mid], sum[N] - sum[right]});
		ll m = min({ sum[left],sum[mid] - sum[left],sum[right] - sum[mid], sum[N] - sum[right] });
		if (res > M - m) res = M - m;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3328
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	static final PrintStream out = System.out;
	static final Scanner sc = new Scanner(System.in);
	static final long Mod = 1000_000_007L;
	int a,b;

	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
		System.exit(0);
	}

	void solve() {
		a = nextInt();
		b = nextInt();

		long res = 0;
		if(a < b) {
			for(int i=0,multi = 1;i<b;i++,multi*=10) {
				res += a * multi;
			}
		}else {
			for(int i=0,multi = 1;i<a;i++,multi*=10) {
				res += b * multi;
			}
		}

		out.println(res);
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)a[i] = nextInt();
		return a;
	}
	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)a[i] = nextLong();
		return a;
	}
	public int nextInt() {
		return Integer.parseInt(next());
	}
	public long nextLong() {
		return Long.parseLong(next());
	}
	public String next() {
		return sc.next();
	}

	long gcd(long m,long n) {
		if (m<n) return gcd(n,m);
		if (n==0)return m;
		return gcd(n,m%n);
	}

	long lcm(long m, long n) {
	        return m * n / gcd(m, n);
	}
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
void solve(){
    int n;
    cin>>n;
    int x=n%10;
    if(x==3){
        cout<<"bon"<<endl;
    }
    else if(x==0 || x==1 || x==6 || x==8){
        cout<<"pon"<<endl;
    }
    else {
        cout<<"hon"<<endl;
    }
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3632
let replace s =
  let s1 = Str.global_replace (Str.regexp "apple") "PEACH" s in
  let s2 = Str.global_replace (Str.regexp "peach") "apple" s1 in
  Str.global_replace (Str.regexp "PEACH") "peach" s2

let _ = 
  let s = read_line () in
  print_endline (replace s)
  

Measured memory_bytes: 2140
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int solve()
{
	ll n,k;cin>>n>>k;
	ll ans=0;
	while(n)
	{
		ans++;
		n/=k;
	}
	cout<<ans<<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 256
/******************************************
* AUTHOR : HRITIK AGGARWAL *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define vi vector<int>
#define vll vector<ll>
#define forr(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define ms(s, n) memset(s, n, sizeof(s))
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define int ll
ll po(ll a, ll x, ll m) { if (x == 0) {return 1;} ll ans = 1; ll k = 1;  while (k <= x) {if (x & k) {ans = ((ans * a) % m);} k <<= 1; a *= a; a %= m; } return ans; }
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    int k;
    cin >> n >> k;
    int a[n];
    forr(i, n)
    cin >> a[i];
    int dp[n];
    forr(i, n) {
        dp[i] = INT_MAX;
    }
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 1; j <= k && i + j < n; j++) {
            dp[i + j] = min(dp[i + j], dp[i] + abs(a[i] - a[i + j]));
        }
    }
    cout << dp[n - 1] << "\n";
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int m;
ll ans,ones,nnn;
int main(){
    scanf("%d",&m);
    for(int i=1;i<=m;i++){
        ll c,d;
        cin>>c>>d;
        ones+=c*d;
        nnn+=d;
    }
    ans=max((ones-1)/9,0ll);
    cout<<nnn-1+ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    string s,t;
    cin>>s;
    cin>>t;
    ll row = s.length();
    ll col = t.length();
    vector<vector<ll> > dp(row+1, vector<ll> (col+1));
    dp[0][0]=0;
    for(int i=0;i<=row;i++)
    dp[i][0]=0;
    for(int i=0;i<=col;i++)
    dp[0][i]=0;
    for(int i=1;i<=row;i++)
    {
        for(int j=1;j<=col;j++)
        {
            if(s[i-1] == t[j-1])
            dp[i][j]=1+dp[i-1][j-1];
            else
            dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
        }
    }
    int i=row,j=col;
    string ans="";
    while(i!=0 && j!=0)
    {
        if(dp[i][j] == dp[i-1][j])
        {
            i--;
        }
        else if(dp[i][j] == dp[i][j-1])
        {
            j--;
        }
        else if(dp[i][j] == dp[i-1][j-1]+1)
        {
            ans+=s[i-1];
            i--;
            j--;
        }
    }
    reverse(ans.begin(),ans.end());
    cout<<ans;
    return 0;
}

Measured memory_bytes: 70784
# [数学、特にグラフ理論の分野における木（き、）とは、連結で閉路を持たないグラフである。]
# なので1->Nは1通り。つまり1->Nの最短経路上にあるマスをつぶすのが先
# で、残ったのを探索できるが、こういう二段構えで実装するのが面倒。
# もうちょっと考えると、1->i とi->Nの距離をみたとき、前者が小さければ先に到達できるので黒で埋められることが分かる
# （進めなくなったら負け、がめんどくさいが、すすめなくなったらパス、とすると、勝敗は変わらないことになる）
# 1とNからスタートして2回BFSすりゃいいか

import sys
from collections import deque

sys.setrecursionlimit(10 ** 8)

n = int(input())
graph = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = map(lambda x: int(x) - 1, input().split())
    graph[a].append(b)
    graph[b].append(a)

table_from_one = [10 ** 5 for _ in range(n)]
table_from_one[0] = 0
table_from_n = [10 ** 5 for _ in range(n)]
table_from_n[-1] = 0
arr_from_one = deque([0])
arr_from_n = deque([n - 1])


def set_table(table, arr):
    while len(arr) > 0:
        cur = arr.popleft()
        for next_node in graph[cur]:
            if table[next_node] < 10 ** 5:
                continue
            table[next_node] = table[cur] + 1
            arr.append(next_node)


set_table(table_from_one, arr_from_one)
set_table(table_from_n, arr_from_n)
result = 0
for i in range(n):
    if table_from_one[i] <= table_from_n[i]:
        result += 1
    else:
        result -= 1
print("Fennec" if result > 0 else "Snuke")


Measured memory_bytes: 29500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ll N;
    cin >> N;
    vector<ll> v(5);
    for (int i = 0; i < 5; i++) {
        cin >> v[i];
    }
    ll p = min_element(v.begin(), v.end()) - v.begin();
    ll sum = (p + 1) + (3 - p) + (N + v[p] - 1) / v[p];
    cout << sum << endl;
}

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

using namespace std;

const int MAX_N = 1e5 + 5;
const int DAYS = 3;

int n, k;

int points[MAX_N][DAYS];

int dp[MAX_N][DAYS];

int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < DAYS; ++j) {
      cin >> points[i][j];
    }
  }
  for (int i = 0; i < DAYS; ++i) {
    dp[1][i] = points[1][i];
  }
  for (int day = 1; day < n; ++day) {
    dp[day + 1][0] = points[day + 1][0] + max(dp[day][1], dp[day][2]);
    dp[day + 1][1] = points[day + 1][1] + max(dp[day][0], dp[day][2]);
    dp[day + 1][2] = points[day + 1][2] + max(dp[day][1], dp[day][0]);
  }
  cout << max(dp[n][0], max(dp[n][1], dp[n][2])) << "\n";
  return 0;
}


Measured memory_bytes: 2560
// #include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <numeric>
#include <cmath>

#define rep(i,n) for (int i = 0; i < n; ++i)
#define repr(i,n) for (int i = n; i > 0; --i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int MAX = 100;
const int INF = (1<<12);

int main() {
  int N; cin >> N;
  int ans = 0;
  rep(i,N){
    int a; cin >> a;
    if(a % 2 && (i + 1) % 2) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3192
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define INF 1000000000000
#define MOD 1000000007
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3)                                                 \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << endl
#define debug_4(x1, x2, x3, x4)                                             \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5)                                         \
    cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
         << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

using namespace std;
using ll = long long;

int main() {
    char s;
    cin >> s;
    if (isupper(s)) {
        cout << "A" << endl;
    } else {
        cout << "a" << endl;
    }
    return 0;
}

Measured memory_bytes: 3028
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		String s = scan.next();
		String a = "";
		String okikae = new String("");

		for(int i=0;i<s.length();i++) {

			okikae = s.substring(i,i+1);
			 okikae = "x";
			 a = a+ okikae;

		}

		System.out.println(a);

		scan.close();

	}

}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
#define repi(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1LL << 60;
int main(){
    int n,m; cin >> n >> m;
    if(n==m) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
typedef pair < int , int > Pi;
#define fr first
#define sc second
#define INF ( 1 << 30 )
struct edge{
  int to, cost;
};
vector < edge > info[3001];
int main() {
  int N, M, K;

  cin >> N >> M >> K;
  for(int i = 0 ; i < M ; i++ ){
    int a, b, c;
    cin >> a >> b >> c;
    info[a].push_back((edge){ b, c});
    info[b].push_back((edge){ a, c});
  }

  int used[3001];
  fill_n( used, 3001, INF);
  priority_queue< Pi , vector< Pi >,greater< Pi > > que;
  for(int i = 0 ; i < K ; i++ ){
    int a;
    cin >> a;

    que.push(Pi( 0, a));
    used[a] = 0;

    while(!que.empty()){
      Pi p = que.top();
      que.pop();
      for(int j = 0 ; j < info[p.sc].size() ; j++ ){
        edge e = info[p.sc][j];
        if( used[e.to] > p.fr + e.cost ){
          used[e.to] = p.fr + e.cost;
          que.push( Pi( used[e.to], e.to));
        }
      }
    }
  }


  int ret = 0;
  for(int i = 1 ; i <= N ; i++ ){
    for(int j = 0 ; j < info[i].size() ; j++ ){
      if( used[i] <= used[info[i][j].to]){
        const int java = used[info[i][j].to] - used[i];
        ret = max( ret, used[i] + java + (info[i][j].cost - java + 1) / 2);
      }
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 4208
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

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

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	a := make([]int, N)
	for i := 0; i < N; i++ {
		a[i] = getInt()
	}
	b := 0
	for i := 0; i < N; i++ {
		if i%2 == 0 {
			b += a[i]
		} else {
			b -= a[i]
		}
	}

	w := bufio.NewWriter(os.Stdout)
	defer w.Flush()
	fmt.Fprint(w, b, " ")
	for i := 0; i < N-1; i++ {
		b = a[i] - b/2
		b *= 2
		fmt.Fprint(w, b, " ")
	}
	fmt.Fprintln(w)
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main()
    {
 
    long long int n,k=0;
    set<string>a;
    string s;
    cin>>n;
    while(n--){
        cin>>s;
        a.insert(s);
    }
    cout<<a.size();
 
 
 
 
 
    }

Measured memory_bytes: 19224
def main():
    # input
    n = int(input())
    s = input()

    ans = 0
    for i in range(0, 1000):
        num = str(i)
        num = '0'*(3-len(num))+num
        index = 0
        for i in s:
            if index == 3:
                ans += 1
                break
            elif num[index]==i:
                index += 1
        else:
            if index == 3:
                ans += 1

    print(ans)

    # calc


if __name__ == '__main__':
    main()


Measured memory_bytes: 40812
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (W, H, N): (i64, i64, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let (x, y, a): (Vec<i64>, Vec<i64>, Vec<usize>) = {
        let (mut x, mut y, mut a) = (vec![], vec![], vec![]);
        for _ in 0..N {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            x.push(iter.next().unwrap().parse().unwrap());
            y.push(iter.next().unwrap().parse().unwrap());
            a.push(iter.next().unwrap().parse().unwrap());
        }
        (x, y, a)
    };

    let L = (0..N).filter(|&i| a[i] == 1).map(|i| x[i]).max().unwrap_or(0);
    let R = (0..N).filter(|&i| a[i] == 2).map(|i| x[i]).min().unwrap_or(W);
    let T = (0..N).filter(|&i| a[i] == 3).map(|i| y[i]).max().unwrap_or(0);
    let B = (0..N).filter(|&i| a[i] == 4).map(|i| y[i]).min().unwrap_or(H);
    let ans = std::cmp::max(0, (R - L)) * std::cmp::max(0, (B - T));

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


Measured memory_bytes: 4352
n,m,q = map(int,input().split())
nums = []
for _ in range(q):
  a,b,c,d = map(int,input().split())
  a,b = a-1, b-1
  nums.append((a,b,c,d))


from itertools import combinations_with_replacement

cands = list(combinations_with_replacement(range(1,m+1), n))

ans = 0

for cand in cands:
  score = 0
  for a,b,c,d in nums:
    if cand[b] - cand[a] == c:
      score += d
  ans = max(ans, score)
print(ans)

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;

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

static const int MAXV = 100005;
vector<int> to[MAXV];

vector<bool> visited(MAXV, false);
vector<bool> calculated(MAXV, false);
int dp[MAXV];
int dfs(int v) {
  if (visited[v]) {
    if (!calculated[v]) return -1; // 閉路検出
    return dp[v];
  }

  visited[v] = true;
  dp[v] = 0;
  for (int u: to[v]) {
    int res = dfs(u);
    if (res == -1) return -1; // 閉路検出
    dp[v] = max(dp[v], res+1);
  }
  calculated[v] = true;
  return dp[v];
};

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

int main() {
  int N, M;
  cin >> N >> M;
  int x, y;
  rep(i, 0, M) {
    cin >> x >> y;
    x--; y--;
    to[x].pb(y);
  }

  int ans = 0;

  rep(v, 0, N) {
    ans = max(ans, dfs(v));
  }

  cout << ans << endl;
};


Measured memory_bytes: 8192
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		// 配列を準備
		// int[] array = new int[N];
		// 最初からリスト
		List<Integer> list = new ArrayList<>();
		// for文でN回繰り返し
		for (int i = 0; i < N; i++) {
			list.add(sc.nextInt());
		}
		Collections.sort(list);
		//Collections.reverse(list);
		//本当に反対にする必要があるか？
		// 大きい方から小さい方に？ 小さい方から大きい方に？⇒後で。

		// for(int i = 0; i < list.size();i++) {
		// 配列に対する操作であって、Collectionsに合わせたループがある
		boolean flag = true;
		int AliceMaxCount = 0;
		int BobMaxCount = 0;
		Iterator<Integer> i = list.iterator();
		while (i.hasNext()) {
			if (flag) {
				// true なので Alice
				// 該当カードを取得する
				AliceMaxCount += i.next();
				//
				flag = false;
			} else {
				// Bob
				BobMaxCount += i.next();
				flag = true;
			}
		}
		System.out.println(Math.abs(AliceMaxCount - BobMaxCount));
		sc.close();
	}
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'
#define rep(i,n) for(int_fast32_t i = 0; i < ((int_fast32_t)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int_fast32_t i = 1; i <= ((int_fast32_t)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int_fast32_t i = ((int_fast32_t)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int_fast32_t i = ((int_fast32_t)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

using namespace std;

template<typename T>
using vec = vector<T>;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using ll = long long;
using ld = long double;
using vi = vec<int_fast32_t>;
using vl = vec<int_fast64_t>;
using vld = vec<ld>;
using vii = vec<vi>;  // 2次元配列
using PII = pair<int_fast32_t, int_fast32_t>;

template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
constexpr ll infll = (1LL<<62)-1;
constexpr int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int START_TIME = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
//    cout << fixed << setprecision(15);

    i32 x; cin >> x;
    /**
     * 考えると-118 <= a <= 119, -119 <= b <= 118
     * だけを見ればいいと気付ける
     *
     * 無理でしたが
     *
     * 探索範囲を狭める
     */

    for(i32 a = -118; a < 120; ++a) {
        for(i32 b = -119; b < 119; ++b) {
            if(x == a*a*a*a*a - b*b*b*b*b) {
                cout << a << ' ' << b << '\n';
                return 0;
            }
        }
    }


    // printf("ExecutionTime: %d /ms\n",1000*(int)((clock()-START_TIME)/CLOCKS_PER_SEC));
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='9') s[i]='1';
        else if(s[i]=='1') s[i]='9';
    }
    cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 768