akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;


int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  int ans = 0;
  for(int i = 0; i < N; ++i){
    cin >> a[i];
    ans += a[i] - 1;
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256
# ABC122 C-GetAC

N, Q = map(int, input().split())
S = input()
lr = []
for _ in range(Q):
    lr.append(list(map(int, input().split())))
    
ArrayAC = [0]*(N)
for j, i in enumerate(S):
    if j == N-1:
        break
    
    if S[j:j+2] == "AC":
        ArrayAC[j+1] = ArrayAC[j] + 1
    else:
        ArrayAC[j+1] = ArrayAC[j]
        
        
for i, j in lr:
    print(ArrayAC[j-1] - ArrayAC[i-1])

Measured memory_bytes: 68824
n = int(input())

a = [0]*(10**4)

for x in range(1,10**2):
    for y in range(1,10**2):
        for z in range(1,10**2):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if s <= 10**4:
                a[s-1] += 1

for i in range(n):
    print(a[i])

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

using namespace std;

typedef pair<int,int>   II;
typedef vector< II >    VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define SI(n) scanf("%d",&n)
#define PI(n) printf("%d\n",n)
#define SLL(n) scanf("%lld",&n)
#define PLL(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);

int main()
{
	string s;
	cin >> s;
	string ss = "YAKI";
	if (s.size() < ss.size())
		cout << "No\n";
	else {
		for (int i = 0 ; i < 4 ; i++)
			if (s[i] != ss[i]) {
				cout << "No\n";
				return 0;
			}
		cout << "Yes\n";
	}
	return 0;
}


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

#define fir first
#define sec second

typedef pair <int, int> pii;
const int maxn = 1e5 + 10;
pii a[maxn];
int n, m, ans, len;

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= m; i++) {
		scanf("%d %d", &a[i].fir, &a[i].sec);
	}
	sort(a + 1, a + m + 1);
	for (int i = 1; i <= m; i++) {
		if (a[i].fir < len) {
			len = min(len, a[i].sec);
		} else {
			ans++, len = a[i].sec;
		}
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
int main(){
	char x[100];
	char y[100];
	long a,b;
	scanf("%s %s",&x,&y);
	a=strtol(x,NULL,16);
	b=strtol(y,NULL,16);
	if (a>b)
	{
		printf(">\n");
	}else if (a<b){
		printf("<\n");
	}else{
		printf("=\n");
	}
	}

Measured memory_bytes: 128
x, y = map(int, input().split())
 
def xy_judge(x, y):
    if x >= 0:
        x_pos = True
    else:
        x_pos = False
    
    if y > 0:
        y_pos = True
    else:
        y_pos = False
        
    if abs(x) > abs(y):
        bifunc = 'g'
    elif abs(x) == abs(y):
        bifunc = 'e'
    else:
        bifunc = 'l'
    
    return x_pos, y_pos, bifunc
  
def x_pos_func(x, y, y_pos, bifunc):
    
    if bifunc == 'g' and y_pos:
        return (x - y) + 2
    
    elif bifunc == 'l' and y_pos:
        return (y - x)
    
    elif bifunc == 'g' and not y_pos:
        return (x - abs(y)) + 1
    
    elif bifunc == 'l' and not y_pos:
        return (abs(y) - x) + 1
    
    elif bifunc =='e' and y_pos:
        return 0
    
    elif bifunc =='e' and not y_pos:
        return 1
      
def x_neg_func(x, y, y_pos, bifunc):
    
    if bifunc == 'g' and y_pos:
        return (abs(x) - y) + 1
    
    elif bifunc == 'l' and y_pos:
        return (y - abs(x)) + 1
    
    elif bifunc == 'g' and not y_pos:
        return (abs(x) - abs(y))
    
    elif bifunc == 'l' and not y_pos:
        return (abs(y) - abs(x)) + 2
    
    elif bifunc =='e' and y_pos:
        return 1
    
    elif bifunc =='e' and not y_pos:
        return 0
      
x_pos, y_pos, bifunc = xy_judge(x, y)
 
if x_pos:
    print(x_pos_func(x, y, y_pos, bifunc))
elif not x_pos:
    print(x_neg_func(x, y, y_pos, bifunc))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

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

signed main(){
	int a,b,c,d,e,k;
	cin >> a >> b >> c >> d >> e >> k;
	if(e - a > k) cout << ":(" << endl;
	else cout << "Yay!" << endl;
	return 0;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
int n,m,k,t;
using namespace std;
int main()
{
    int i,j;
    string s;
    cin>>s;
    int ret=s.size();
    for(i=0;i<s.size()-1;i++)
    {
        if(s[i]!=s[i+1])ret=min(ret,max(i+1,(int)s.size()-1-i));
    }
    printf("%d\n",ret);
    return 0;
}



Measured memory_bytes: 512
s = input()
k = int(input())
if len(s)==1:
    print(k//2)
    exit()
import re


def nchars(s, n):
    """文字列 s に、同じ文字が n 個以上連続している部分文字列を見つける        
    """
    assert n > 0
    reg = re.compile("(.)\\1{%d,}" % (n - 1))
    while True:
        m = reg.search(s)
        if not m:
            break
        yield m.group(0)
        s = s[m.end():]
lst = list(nchars(s,2))
count = 0
for i in lst:
    count += len(i)//2
count = count*k

if s[0]==s[-1]:

    first = s[0]
    f = 0
    e = 0
    end = s[-1]
    for i in s:
        if first == i:
            f += 1
        else:
            break
    for i in reversed(s):
        if end == i:
            e += 1
        else:
            break
    if f % 2 == 1 and e % 2 == 1:
        if f == len(s) and k % 2 ==1:
            count+=k//2
        else:
            count += k-1

print(count)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int N, D;
  scanf("%d %d", &N, &D);

  vector<int> xs(N), ys(N);
  for(int i=0;i<N;i++){
      scanf("%d %d", &xs[i], &ys[i]);
  }
  
  int S = 0;
  for(int i=0;i<N;i++){
    if( pow(xs[i],2) + pow(ys[i],2) <= pow(D, 2) ){
        S++;
    }
  }

  printf("%d\n", S);

  return 0;
}

Measured memory_bytes: 4832
import re

N = input()

def long_repeat(line):
 
    max = 0
    cnt = 1
    
    for i in range(len(line)-1):
        if cnt > 1:
            cnt -= 1
            continue
        for j in range(i+1,len(line)):
            if line[i] == line[j]:
                cnt += 1
            else:
                break
        if max < cnt:
            max = cnt
 
    return max

if long_repeat(N) >= 3 and len(N)==4:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3316
package main

import (
        "fmt"
)

func solution(n int, s string) int {
        out := -1 << 31
        for i := 1; i < n; i++ {
                x := count(s[:i])
                y := count(s[i:])
                t := 0
                for j := 0; j < 26; j++ {
                        if x[j] > 0 && y[j] > 0 {
                                t++
                        }
                }
                out = max(out, t)
        }
        return out
}

func count(s string) [26]int {
        var a [26]int
        for _, r := range s {
                a[r-'a']++
        }
        return a
}

func max(x, y int) int {
        if x > y {
                return x
        }
        return y
}

func main() {
        var n int
        var s string
        fmt.Scan(&n, &s)
        fmt.Println(solution(n, s))
}

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

#pragma GCC optimize("Ofast")

using namespace std;

typedef long long ll;
typedef long double ld;
mt19937 rnd(time(0));
#define ioss ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("avia.in", "r", stdin); freopen("avia.out", "w", stdout);
#define _GLIBCXX_DEBUG
#define s second
#define f first
#define pb push_back
#define add insert
#define del erase
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pii pair<int,int>
#define res resize
#define PI acos(-1)
const ll INF = 1e9;//9223372036854775807L; //LONG_MAX;
constexpr ll mod = 1e9 + 7;


void solve() {
    ll n, ans = 0, l = 5;
    cin >> n;
    if (n % 2 == 1) {
        cout << 0 << '\n';
        return;
    }
    while (n >= l) n /= l, ans += n / 2;
    cout << ans << '\n';

}

signed main() {
    ioss
    //file
    //id.resize(3e5);
    int t = 1;                                                                                                                                                                        //ll
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
//  s.at(0) = toupper(s.at(0));//小文字なら大文字へ//大文字の場合はそのまま
//  s.at(i) = tolower(s.at(i));//大文字なら小文字へ//小文字の場合はそのまま
//  string s;
//  cin >> s;
//  cout << s.at(0) <<endl;
//  cout << s.at(0)-'0' <<endl;
//  Aが16？
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  if(a>k)cout<<k<<endl;
  else{
    if(a+b>k)cout<<a<<endl;
    else{
      if(a+b+c>k)cout<<a-1*(c-(a+b+c-k))<<endl;
      else cout<<a-c<<endl;
    }
  }
}


Measured memory_bytes: 3544
#include<bits/stdc++.h>
using namespace std;
int a[105];
int main()
{
	int n,cnt=0;
	cin >> n;
	for(int i=1;i<=n;i++){
		cin >> a[i];
		if(i&1&&a[i]&1) cnt++;
	}
	cout << cnt << endl;
	return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

VI edge[300000];
ll cost[300000];
bool visited[300000];
void dfs(ll node){
  visited[node] = true;
  for(int next: edge[node]){
    if(visited[next]) continue;
    cost[next] += cost[node];
    dfs(next);
  }
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,q;
  cin >> n >> q;
  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    a--,b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }

  rep(i,q){
    ll p,x;
    cin >> p >> x;
    p--;
    cost[p]+=x;
  }

  dfs(0);
  rep(i,n){
    cout << cost[i] << " ";
  }
  cout << endl;
  return 0;
}


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

typedef  long long ll;
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//
//
#define int long long

using namespace std;

int ctoi(char c) {
 switch (c) {
 case '0': return 0;
 case '1': return 1;
 case '2': return 2;
 case '3': return 3;
 case '4': return 4;
 case '5': return 5;
 case '6': return 6;
 case '7': return 7;
 case '8': return 8;
 case '9': return 9;
 default: return 0;
 }
}


 ll  a,b,c,s,t,i,j,k,x,y,z;
 ll A,B,C,S,T,X,Y,Z;
 ll count;
signed main(){
	string N,K;
	cin>>N>>K;

	REP(i,N.size()){
		if(K[i]!=N[i]) {
			cout<<"No";
			return 0;
		}
	}

	cout<<"Yes";

	
 return 0;
}


Measured memory_bytes: 3612
K = int(input())
t = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'.replace(',', '')
#print(t)
print([int(i) for i in t.split()][K - 1])


Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    string s, t;
    cin >> s >> t;
    ll n = s.size();
    ll m = t.size();

    vl x(n);
    rep(i, n) {
        if(s[i] == 'A') {
            x[i] = 1;
        }
        else {
            x[i] = 2;
        }
    }

    vl y(m);
    rep(i, m) {
        if(t[i] == 'A') {
            y[i] = 1;
        }
        else {
            y[i] = 2;
        }
    }

    vl ruiX(n+1);
    rep(i, n) {
        ruiX[i+1] = ruiX[i] + x[i];
    }

    vl ruiY(m+1);
    rep(i, m) {
        ruiY[i+1] = ruiY[i] + y[i];
    }

    ll q;
    cin >> q;

    vl ans(q);
    rep(i, q) {
        ll a, b, c, d;
        cin >> a >> b >> c >> d;
        a--;  c--;
        if( (ruiX[b] - ruiX[a])%3 == (ruiY[d] - ruiY[c])%3 ) {
            ans[i] = 1;
        }
    } 

    rep(i, q) {
        if(ans[i]) {
            out("YES");
        }   
        else {
            out("NO");
        }
    }
    
    re0;
}

Measured memory_bytes: 4864
// AtCoder Beginner Contest 111 - Problem B: AtCoder Beginner Contest 111 (https://beta.atcoder.jp/contests/abc111/tasks/abc111_b)
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

#define REP(i, a, b) for (int (i) = (a); (i) <= (b); (i)++)
#define REPN(i, N) for (int (i) = 0; (i) < N; (i)++)
#define DEC(i, b, a) for (int (i) = (b); (i) >= (a); (i)--)
#define DECN(i, N) for (int (i) = N - 1; (i) >= 0; (i)--)

#define LOG(var, sep) (cerr << #var << " = " << (var) << (sep))
#define LOGM(msg) (cerr << (msg))
#define LOGV(vec, sep) { cerr << #vec << " ="; for (const auto& v : (vec)) cerr << " " << v; cerr << (sep); }
#define LOGA(arr, N, sep) { cerr << #arr << " ="; for (int i = 0; i < N; ++i) cerr << " " << (arr)[i]; cerr << (sep); }
#define LOGA2(arr, N, M, sep) { cerr << #arr << " =\n"; for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) cerr << (arr)[i][j] << " "; cerr << endl; } cerr << (sep); }

ostream& operator<<(ostream& os, const ii& p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

const int MAX { 2000010 };
const int oo { 2000000010 };
const int MOD { 1000000007 };

void solve(int N)
{
    vector<int> contests;

    for (int d = 1; d <= 9; ++d)
        contests.push_back(100*d + 10*d + d);

    auto it = lower_bound(contests.begin(), contests.end(), N);
    auto ans = *it;

    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    solve(N);

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

cnt_dict = {}

s = sum(A)
ans = []

for item in A:
    if item not in cnt_dict:
        cnt_dict[item] = 0
    cnt_dict[item] += 1

for _ in range(Q):
    b, c = map(int, input().split())

    if b not in cnt_dict:
        cnt_dict[b] = 0
    if c not in cnt_dict:
        cnt_dict[c] = 0

    s -= b * cnt_dict[b]
    s += c * cnt_dict[b]

    cnt_dict[c] += cnt_dict[b]
    cnt_dict[b] = 0

    ans.append(s)

for i in range(Q):
    print(ans[i])

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

int main(void){
    int i,j,k,n;

    vector<vector<int> > A(4, vector<int>(4));
 
   for (int i = 1; i <= 3; i++) {
    for (int j = 1; j <= 3; j++) {
      cin >> A.at(i).at(j);
    }
   }

   cin >> n;

    vector<int> b(n+1);
    for(i=1; i<=n; i++){
        cin >> b.at(i);

        for(j=1; j<=3; j++){
            for(k=1; k<=3; k++){
                if(A.at(j).at(k) == b.at(i)) A.at(j).at(k) = 0;
            }
        }
    }

    if( (A.at(1).at(1) == 0 && A.at(1).at(2) == 0 && A.at(1).at(3) == 0) ||
        (A.at(2).at(1) == 0 && A.at(2).at(2) == 0 && A.at(2).at(3) == 0) || 
        (A.at(3).at(1) == 0 && A.at(3).at(2) == 0 && A.at(3).at(3) == 0) || 

        (A.at(1).at(1) == 0 && A.at(2).at(1) == 0 && A.at(3).at(1) == 0) ||
        (A.at(1).at(2) == 0 && A.at(2).at(2) == 0 && A.at(3).at(2) == 0) || 
        (A.at(1).at(3) == 0 && A.at(2).at(3) == 0 && A.at(3).at(3) == 0) || 
        
        (A.at(1).at(1) == 0 && A.at(2).at(2) == 0 && A.at(3).at(3) == 0) ||
        (A.at(3).at(1) == 0 && A.at(2).at(2) == 0 && A.at(1).at(3) == 0) ){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        };

    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
abl = []
for _ in range(n):
    a,b = map(int,input().split())
    abl.append((a,b))

cdl = []
for _ in range(m):
    c,d = map(int,input().split())
    cdl.append((c,d))

for a,b in abl:
    ans = float("inf")
    log = -1
    for idx, (c,d) in enumerate(cdl):
        tmp = abs(a-c) + abs(b-d)
        if ans > tmp:
            ans = tmp
            log = idx+1
    print(log)








Measured memory_bytes: 39280
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

using namespace std;
typedef long long ll;

int main() {

    ll N;
    cin >> N;
    ll p = 0;
    ll P = 0;
    ll count = 0;
    string out = "YES";
    rep(i,N){
        cin >> p;
        if(p!=i+1){
            count++;
            if(count==1) P = p;
            else if(count==2){
                if(P!=i+1){
                    out = "NO";
                    break;
                }
            }else{
                out = "NO";
                break;
            }
        }
    }
    cout << out << endl;
    return 0;
}


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

int main() {
  int N, M;
  cin >> N;
  string s[N];
  REP(i, N) cin >> s[i];
  cin >> M;
  string t[M];
  REP(i, M) cin >> t[i];

  map<string, int> m;
  REP(i, N) m[s[i]] += 1;
  REP(i, M) m[t[i]] -= 1;

  int ans = 0;
  for (auto &p : m) {
    // cerr << p.first << ":" << p.second << endl;
    ans = max(p.second, ans);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back 
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
#define Uniq(v) v.erase(unique(All(v)),v.end())
typedef pair<int, int> Pii; 
typedef pair<int, Pii> Pip;
typedef pair<string, int> Psi;
const int INF = (1<<30);
const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};

string s;
ll K;

int main()
{
  cin >> s;
  cin >> K;
 
  for(int i=0; i<s.size(); i++) {
    if( s[i] != 'a' && 'z' - s[i] < K  ) {
      K -= ('z'-s[i] + 1);
      s[i] = 'a';
    } 
  }

  K %= 26;
  for(int i=0; i<K; i++) {
    if( s[s.size()-1] == 'z' ) s[s.size()-1] = 'a';
    else s[s.size()-1]++;
  }

  cout << s << endl;
}


Measured memory_bytes: 640
// Example program
#include <iostream>
#include <string>
long long int q,h,s,d,n,k=0,o=0;
using namespace std;
int main()
{
    cin >> q >> h >> s >> d;
    cin >> n;
    n*=4;
    d=min(d,2*s);
    d=min(d,4*h);
    d=min(d,8*q);
    s=min(s,2*h);
    s=min(s,4*q);
    h=min(h,2*q);
    o=n/8;
    n%=8;
    k+=o*d;
    o=n/4;
    n%=4;
    k+=o*s;
    o=n/2;
    k+=o*h;
    n=n%2;
    k+=n*q;
    cout << k;
    return 0;
}


Measured memory_bytes: 256
from sys import exit

n, y = list(map(int, input().split()))
for i in range(n + 1):
    for j in range(n + 1):
        if i + j > n:
            continue
        if (y - (10000 * i + 5000 * j)) // 1000 == n - i - j:
            print(i, j, n - i - j)
            exit(0)
print('-1 -1 -1')

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ll s;
    cin >> s;

    ll x1, y1, x2, y2;
    x1 = 1e9;
    y2 = (s + x1 - 1) / x1;
    x2 = 1;
    y1 = x1 * y2 - s;

    cout << 0 << ' ' << 0 << ' ' << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << endl;

    //sは18桁の素数
    //x1*y2-x2*y1==s
    //x1*y2-s=x2*y1

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;	//using vi = vector<int>;

#define rep(i, N) for (int i = 0; i < N; i++)

int main()
{
	int n;
	cin >> n;
	vector<ull> v;
	v.push_back(2);
	v.push_back(1);

	for (int i = 2; i <= n; i++) {
		v.push_back(v[i - 1] + v[i - 2]);
	}

	cout << v[n] << endl;

	//system("pause");

	return 0;
}

Measured memory_bytes: 256
def resolve():
    K, N = map(int, input().split())
    A = tuple(map(int, input().split()))
    t = [0] * len(A)
    max_v = K - A[-1] + A[0]
    curr_sum = max_v
    for i in range(1, len(A)):
        max_v = max(max_v, A[i] - A[i-1])
        curr_sum += A[i] - A[i-1]
    print(curr_sum - max_v)

resolve()

Measured memory_bytes: 25916
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        try(Scanner sc = new Scanner(System.in)){
            while(true){
                double sum = 0, ave, var = 0;
                int n = sc.nextInt();
                if(n==0) break;
                int[] scores = new int[n];
                for(int i=0;i<n;i++) {
                    scores[i] = sc.nextInt();
                    sum += scores[i];
                }
                ave = sum/n;

                for(int i=0; i<n; i++){
                    var += Math.pow((scores[i] - ave),2)/n;
                }

                System.out.printf("%f\n",Math.sqrt(var));
            }
        }
    }
}


Measured memory_bytes: 31400
using System;
using System.Linq;

class C
{
	static void Main()
	{
		Func<int[]> read = () => Console.ReadLine().Split().Select(int.Parse).ToArray();
		var h = read();
		Console.WriteLine(read().GroupBy(x => x).Select(g => g.Count()).OrderBy(x => -x).Skip(h[1]).Sum());
	}
}


Measured memory_bytes: 44800
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <bitset>

using namespace std;

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

    int isEight=0;

    for(int x=3; x<=N; x+=2){
        int cnt = 2;
        for(int i=3; i<x; i+=2){
            if( 0 == (x%i) ){
                cnt = cnt + 1;
            }
            else{
                /* nothing */
            }
        }
        if(8 == cnt){
            isEight = isEight + 1;
        }
    }

    cout << isEight << endl;

}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
#define int long long
int MAX=998244353;
int modpow(int a, int n, int mod) {
    int res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
  vector<int> k;
signed main() {
    int n;
    cin>>n;
  pair<int,int> t[n],s[n];
  int x,y[n];
  for(int i=0;i<n;i++){
    cin>>x>>y[i];
    t[i]=make_pair(x,i);
 
  }
  sort(t,t+n);
  for(int i=0;i<n;i++){
    s[i]=make_pair(y[t[i].second],i);

  }
  sort(s,s+n);
 int bbit[n+1]={};
  int a[n],b[n],c[n],d[n],p,q;
for(int i=0;i<n;i++){
  p=s[i].second+1;
  a[i]=0;
  while(p>0){
    a[i]+=bbit[p];
    p-= p & -p;
  }
  p=s[i].second+1;
  while(p<=n){
    bbit[p]++;
    p += p & -p;
  }
  b[i]=i-a[i];

}
for(int i=0;i<n;i++){
  p=s[i].second+1;
  c[i]=-1-a[i];
  while(p>0){
    c[i]+=bbit[p];
    p-= p & -p;
  }
  
  d[i]= n-1-a[i]-b[i]-c[i];

}

  int md[n+1];
  md[0]=1;
  for(int i=0;i<n;i++){
    md[i+1]=(md[i]*2)%MAX;
  }
  int ans=0;q=md[n]-1;
  for(int i=0;i<n;i++){
    p=(md[a[i]+b[i]]-1+md[d[i]+b[i]]-1+md[a[i]+c[i]]-1+md[c[i]+d[i]]-1+MAX-md[a[i]]+1+MAX-md[b[i]]+1+MAX-md[c[i]]+1+MAX-md[d[i]]+1)%MAX;
 
    ans=(ans+q+MAX-p)%MAX;
  }
  cout<<ans;

    return 0;
}


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

using namespace std; 
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define forin(i, n) for ( i = 0; i < (int)n; ++i )
typedef long long ll;
const char nl = '\n';

int main()
{
    IOS

    ll a, b;
    string nb;

    cin >> a >> nb;

    b = stoll(nb.substr(0,1)) * 100; 
    b += stoll(nb.substr(2,2));
    ll c = (a*b)/100;

    cout << c;
    return 0;
}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;cin>>s;
	if(s[0]=='R')
	{
		if(s[1]=='R')
		{
			if(s[2]=='R')
			cout<<"3"<<endl;
			else
			cout<<"2"<<endl;
		}
		else
		{
			if(s[2]=='R')
			cout<<"1"<<endl;
			else
			cout<<"1"<<endl;
		}
	}
	else
	{
		if(s[1]=='R')
		{
			if(s[2]=='R')
			cout<<"2"<<endl;
			else
			cout<<"1"<<endl;
		}
		else
		{
			if(s[2]=='R')
			cout<<"1"<<endl;
			else
			cout<<"0"<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3620
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

bool calc(string s) {
    for (int i = 0; i < s.length; i++) {
        if (i % 2 == 0) {
            if (s[i] == 'L') return false;
        }
        else if (s[i] == 'R') return false;
    }
    return true;
}

void main() {
    string s = read!string;
    writeln(calc(s) ? "Yes" : "No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=1e6+5;
pair<int,int> red[MAXN],blue[MAXN];

vector <int> g[MAXN];
int matcha[MAXN],matchb[MAXN],vis[MAXN];

bool dfs(int s){
    if(vis[s]) return false;
    vis[s]=1;
    for(int to:g[s])
        if(matchb[to]==-1 || dfs(matchb[to])){
            matchb[to]=s;
            matcha[s]=to;
            return true;
        }
    return false;
}

int maxMatching(int n,int m){
    fill(matcha,matcha+n,-1);
    fill(matchb,matchb+n+m,-1);
    int res=0,czy=1;
    while(czy){
        czy=0;
        fill(vis,vis+n,0);
        for(int i=0;i<n;i++)
            if(matcha[i]==-1)
                czy+=dfs(i);
        res+=czy;
    }
    return res;
}

int main(){
    ios::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
		cin >> red[i].first >> red[i].second;
	for(int i=0;i<n;i++)
		cin >> blue[i].first >> blue[i].second;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			if(red[i].first<blue[j].first && red[i].second<blue[j].second){
				g[i].push_back(j+n);
				g[j+n].push_back(i);
			}
	cout << maxMatching(n,n);	
}


Measured memory_bytes: 33024
# include "bits/stdc++.h"
 
using namespace std;
 
#define endl "\n"
typedef long long int ll;
#define f first
#define s second
 
inline void fastio(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
inline void setPrecision(int n){cout.precision(n);}
 
//DEBUG
#define BR cerr<<endl
#define dbg(x) cerr<<(#x)<<": "<<x<<endl
#define dbgV(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgS(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<it<<" "; cerr<<endl;
#define dbgM(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
#define dbg2D(x) cerr<<(#x)<<": \n"; for(auto y: x) { for(auto it: y) cerr<<it<<" "; cerr<<endl; } cerr<<endl;
#define dbgA(x, n) cerr<<(#x)<<": "; for(int i=0;i<n;++i) cerr<<x[i]<<" "; cerr<<endl;
#define dbgVP(x) cerr<<(#x)<<": "; for(auto it: x) cerr<<"["<<it.f<<", "<<it.s<<"] "; cerr<<endl;
 
ll INF = 1e10;
int MOD = 1e9+7;

int main(){
	#ifndef ONLINE_JUDGE
        freopen("inputf.in", "r", stdin);
    #endif
    fastio();

    string s, t;
    cin >> s >> t;
    cout << t << s << endl;

    return 0;
}

/*

*/

Measured memory_bytes: 3620
main :: IO ()
main = do
    n <- readLn :: IO Int
    a <- map read . words <$> getLine :: IO [Int]
    b <- map read . words <$> getLine :: IO [Int]
    c <- map read . words <$> getLine :: IO [Int]
    print $ sum [ let ai = a!!(i-1)
                      bi = b!!(ai-1)
                      ci = if i /= 1 && ai == (a!!(i-2) + 1)
                              then c!!(ai-2) else 0
             in bi + ci | i <- [1..n] ] 

Measured memory_bytes: 764
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int a,b;cin>>a>>b;
  int ans=0;
  if(a>b)swap(a,b);
  ans+=b--;
  if(a>b)swap(a,b);
  ans+=b--;
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

void _max(int & a,int b){if(b>a) a=b;}
int a[3001],b[3001],f[3000][2];
int main()
{
    int n,t;
    scanf("%d%d",&n,&t);
    for (int i=1;i<=n;++i)
        scanf("%d%d",&a[i],&b[i]);


    for (int i=1;i<=n;++i){
        for (int j=t-1;j>=a[i];--j){
            _max(f[j][1],f[j][0]+b[i]);
            _max(f[j][1],f[j-a[i]][1]+b[i]);
            _max(f[j][1],f[j][0]);
            _max(f[j][0],f[j-a[i]][0]+b[i]);
        }
        for (int j=a[i]-1;j>=0;--j){
            _max(f[j][1],f[j][0]+b[i]);
        }
    }

    printf("%d\n",f[t-1][1]);


}


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

int main()
{
	int val = 0;
	int seven = 0;
	int five = 0;
	for(int i = 0; i < 3; i++){
		cin >> val;
		if(val == 5)
			five++;
		else if(val == 7)
			seven++;
	}

	if(seven == 1 && five == 2)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    string s;
    cin >> s;
    if (s == "abc" || s == "acb" || s == "bac" || s == "bca" || s == "cab" || s == "cba")
        OP("Yes");
    else
        OP("No");
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    n, x = map(int, input().split())
    lst = list(map(int,input().split()))
    lst = lst[:n]

    d = []
    for i in range(n + 1):
        if i == 0:
            d.append(0)
        else:
            d.append(d[i - 1] + int(lst[i - 1]))

    bound = 0

    for n, i in enumerate(d):
        if i <= x:
            bound += 1
        else:
            break
    print(bound)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#!/user/bin/python
# coding: UTF-8

N = int(raw_input())
K = int(raw_input())
x = raw_input().split()
x = map(int, x)

n = 0

for i in xrange(N):
    if x[i] < K - x[i]:
        n = n + x[i] * 2
    else:
        n = n + (K - x[i]) * 2
print n

Measured memory_bytes: 2568
program digits_parade
  implicit none
  integer(8), parameter :: md = 1000000007_8
  character(100000) :: s
  integer :: n, i, j, k, l = 0
  integer(8) :: dp(0:1,0:12) = 0_8
  read(*,*) s
  s = trim(adjustl(s))
  n = len_trim(s)
  dp(0,0) = 1_8
  do i = 1, n
    l = 1-l
    dp(l,:) = 0_8
    if (s(i:i) == "?") then
      do k = 0, 9
        do j = 0, 12
          dp(l,mod(10*j+k,13)) = mod(dp(l,mod(10*j+k,13))+dp(1-l,j),md)
        end do
      end do
    else
      k = ichar(s(i:i))-48
      do j = 0, 12
        dp(l,mod(10*j+k,13)) = dp(1-l,j)
      end do
    end if
  end do
  write(*,'(i0)') dp(l,5)
  stop
end program digits_parade

Measured memory_bytes: 2432
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

struct Point {
  int x;
  int y;
};

int main() {
  int N; std::cin >> N;
  std::vector<Point> ps(N);
  for (int n = 0; n < N; ++n) {
    Point& p = ps[n];
    std::cin >> p.x >> p.y;
  }

  std::vector<int> indices(N);
  for (int i = 0; i < N; ++i) indices[i] = i;

  int cnt = 0;
  double length = 0;
  do {
    int x1 = ps[indices[0]].x;
    int y1 = ps[indices[0]].y;
    for (int i = 1; i < indices.size(); ++i) {
      int x2 = ps[indices[i]].x;
      int y2 = ps[indices[i]].y;
      length += std::hypot(x1-x2, y1-y2);
    }
    ++cnt;
  } while (std::next_permutation(indices.begin(), indices.end()));
  printf("%.7f\n", length/cnt);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 1e5 + 10;

char s[MAX], t[MAX];

bool judge() {
    int N = strlen(s + 1);
    for (int i = 1; i <= N; i++)
        if (s[i] != t[i]) return false;
    return true;
}

int main() {
#ifdef ACM_LOCAL
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
#endif
    scanf("%s%s", s + 1, t + 1);
    printf("%s\n", judge() ? "Yes" : "No");

    return 0;
}

Measured memory_bytes: 3688
using static System.Console;
using static System.Convert;

class Program
{
    static void Main(string[] args)
    {
        var input = ReadLine().Split(' ');
        var min = ToInt32(input[0]);
        var max = ToInt32(input[1]);
        var result = 0;
        for(var i = min; i <= max; i++)
        {
            var num = i.ToString();
            var isMatch = true;
            for(var j = 0; j < num.Length / 2; j++)
            {
                if (!(num.Substring(j, 1) == num.Substring(num.Length - 1 - j, 1))) { isMatch = false;break; }
            }
            if (isMatch) result++;
        }
        WriteLine(result);
    }
}



Measured memory_bytes: 15312
#include <bits/stdc++.h>
using namespace std;
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)
#define pb push_back
#define deb(x) cout<<#x<<" "<<x<<endl;
#define deb2(x, y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define deb3(x, y, z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<endl;
#define all(x) x.begin(), x.end()
#define sz(a) int((a).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
const int mod = 1e9 + 7;
template<class T, class U> inline void add_self(T &a, U b){a += b;if (a >= mod) a -= mod;if (a < 0) a += mod;}
template<class T, class U> inline void min_self(T &x, U y) { if (y < x) x = y; }
template<class T, class U> inline void max_self(T &x, U y) { if (y > x) x = y; }

template <typename T>void print(T v, bool show_index = false){int w = 2;if(show_index){for(int i=0; i<v.size(); i++)cout<<setw(w)<<i<<" ";cout<<endl;}for(auto i= v.begin(); i!=v.end(); i++)cout<<setw(w)<<*i<<" ";cout<<endl;}
template <typename T>void print_vv(T v){if(v.size()==0) {cout<<"Empty"<<endl; return;} int w = 3;cout<<setw(w)<<" ";for(int j=0; j<v[0].size(); j++)cout<<setw(w)<<j<<" ";cout<<endl;for(auto i= 0; i<v.size(); i++){cout<<i<<" {";for(auto j = 0; j!=v[i].size(); j++){cout<<setw(w)<<v[i][j]<<",";}cout<<"},"<<endl;}cout<<endl;}
template <class T, class U> void print_m(map<T,U> m, int w=3){if(m.empty()){cout<<"Empty"<<endl; return;}for(auto x: m)cout<<"("<<x.first<<": "<<x.second<<"),"<<endl;cout<<endl;}

int main(){
    string s, out;
    cin>>s;
    if(s=="ABC")
        cout<<"ARC"<<endl;
    else
        cout<<"ABC"<<endl;
    return 0;
}

Measured memory_bytes: 3588
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

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

    // int T;cin>>T;while(T--) 
    {
        string s,t;
        cin>>s;
        ll n = s.length();
        t = s;
        bool f=1;
        reverse(all(s));
        f &= (s==t);
        t = s.substr(0,(n-1)/2);
        s = t;
        reverse(all(s));
        f &= (s==t);
        if(f) cout<<"Yes\n";
        else cout<<"No\n";
    }
    return 0;
}

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

typedef long long ll;

const int kN = 2e5 + 5;

int a[kN], d[kN];

int main() {
	int n; ll k; scanf("%d%lld", &n, &k);
	for(int i = 1; i <= n; ++i) scanf("%d", a + i);
	if(k <= n) {
		int x = 1;
		for(int i = 1; i <= k; ++i) x = a[x];
		printf("%d\n", x);
		return 0;
	}
	int ptr = 1, p = 0; d[1] = 1;
	while(!d[a[ptr]]) {
		d[a[ptr]] = d[ptr] + 1;
		ptr = a[ptr];
	}
	p = d[ptr] - d[a[ptr]] + 1;
	ptr = a[ptr];
	//printf("%d\n", p);
	k -= d[ptr] - 1; k %= p;
	for(int i = 1; i <= k; ++i) ptr = a[ptr];
	printf("%d\n", ptr);
	return 0;
}

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c; cin>>a>>b>>c;
	if (a+b+c<=21) cout<<"win";
	else cout<<"bust";
	return 0;
}


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

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

    vector<long> a(n);
    for(auto &x: a) cin >> x;
    for(int i=0; i<n-1; i++)
        a[i+1] += a[i];

    vector<long> b;
    for(int i=0; i<n; i++) {
        b.push_back(a[i]);
        for(int j=0; j<i; j++)
            b.push_back(a[i]-a[j]);
    }

    long r = 0;
    for(long x=1LL<<40; x; x>>=1) {
        r |= x;
        long cnt = 0;
        for(auto &y: b) cnt += (r & y) == r;
        if(cnt < k) r &= ~x;
    }

    cout << r << endl;
}


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

using namespace std;

int main(){
	int N,K,d,a,count=0;
	cin >> N >> K;
	bool S[N];
	for(int i=0;i<N;i++){
		S[i]=false;
	}
	for(int i=0;i<K;i++){
		cin >> d;
		for(int j=0;j<d;j++){
			cin >> a;
			S[a-1]=true;
		}
	}
	for(int i=0;i<N;i++){
		if(S[i]==false){count++;}
	}
	cout << count << endl;
	
	return 0;
}

Measured memory_bytes: 3596
#include"bits/stdc++.h"

using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    int i;
    string s;
    //入力
    cin>>s;
    //処理
    const char* a=s.c_str();
    
    int len=strlen(a),count=1,c[len]={0};
    for(int i=0;i<len-1;i++){
        if(a[i]==a[i+1])count++;
        else {
            c[i]=count;
            count=1;
        }
    }
    c[len-1]=count;
    
    int d[len]={0},o=0;
    for(int i=0;i<len;i++){
        if(c[i]>0){
            if(a[i]=='R'){
            d[i]+=c[i]-c[i]/2;
            d[i+1]+=c[i]/2;
            o=i;
            }else{
                d[o]+=c[i]/2;
                d[o+1]+=c[i]-c[i]/2;
            }
        }
    }
    //出力
    rep(i,len){
        cout<<d[i]<<' ';
    }
}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, x, ans;
	cin >> x >> a >> b;
	x -= a;
	ans = x % b;
	cout << ans << "\n";

	return 0;
}



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

int main(){
    ll X;
    cin >> X;
    ll ans = 0;
    ll x = 100;
    while(x < X){
        ans++;
        long double tmp = floorl(x * 0.01);
        x += ll(tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
import sys
LIM = 1000000000


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


def main():
    s = int(input())

    x1 = 0 if s == LIM * LIM else 1
    y1 = 0
    x2 = min((s // LIM) + 1, LIM)
    y2 = s % LIM
    x3 = 0
    y3 = LIM
    print(x1, y1, x2, y2, x3, y3)


main()


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

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

Measured memory_bytes: 256
def dfs(i, A, B, C):
    global ans
    if i == n:
        if A and B and C:
            s = 0
            ABC = [A, B, C]
            for i in range(3):
                s += (len(ABC[i]) - 1) * 10 + abs(sum(ABC[i]) - abc[i])
            ans = min(ans, s)
    else:
        dfs(i + 1, A + [l[i]], B, C)
        dfs(i + 1, A, B + [l[i]], C)
        dfs(i + 1, A, B, C + [l[i]])
        dfs(i + 1, A, B, C)

n, a, b, c = map(int, input().split())
l = [int(input()) for i in range(n)]
abc = [a, b, c]
ans = float("inf")
dfs(0, [], [], [])
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define mo 998244353
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long n,i,j,r[1000005],top,x[1000005],y[1000005];
long long head,tail,sum,max1,zhan[1000005];
char s[1000005],t[1000005];
int main(){
	n=read();
	scanf("%s%s",s+1,t+1);
	for(i=1;i<=n;i++)
		if(s[i]!=t[i])
			break;
	if(i==n+1){
		pus(0,2);
		return 0;
	}
	j=n;
	for(i=n;i>=1;i--){
		if(i<j)
			j=i;
		while(j!=0&&t[i]!=s[j])
			j--;
		if(j==0){
			pus(-1,2);
			return 0;
		}
		if(r[j]==0)
			r[j]=i;
	}
	for(i=1;i<=n;i++)
		if(r[i]!=0){
			top++;
			x[top]=i;
			y[top]=r[i];
		}
	head=1;
	for(i=top;i>=1;i--){
		while(head<=tail&&y[i]<zhan[head]-sum)
			head++;
		tail++;
		sum++;
		zhan[tail]=x[i]+sum;
		max1=max(max1,tail-head+1);
	}
	pus(max1,2);
	return 0;
}

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}
template <typename T>
T gcd(const T x, const T y) {
  if (x == 0) {
    return y;
  } else if (y == 0) {
    return x;
  } else if (x < y) {
    return gcd(x, y % x);
  } else if (y < x) {
    return gcd(y, x % y);
  } else {
    return x;
  }
}

template <typename T>
T lcm(const T x, const T y) {
  if (x == 0 || y == 0) {
    return 0;
  } else {
    return x / gcd(x, y) * y;
  }
}

int main() {
  int64_t a, b, c, d;
  std::cin >> a >> b >> c >> d;

  const auto c_a = (a - 1) / c, c_b = b / c, d_a = (a - 1) / d, d_b = b / d;
  const auto g = lcm(c, d);
  const auto g_a = (a - 1) / g, g_b = b / g;

  std::cout << b - a + 1 - (c_b - c_a) - (d_b - d_a) + (g_b - g_a) << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  string s;
  cin>>s;
  bool a[26];
  rep(i,0,26) a[i]=true;
  bool b=true;
  rep(i,0,s.size()){
    if(a[s[i]-'a']) a[s[i]-'a']=false;
    else b=false;
  }
  if(b) cout<<"yes"<<endl;
  else cout<<"no"<<endl;
}

Measured memory_bytes: 256