akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率

def input(): return sys.stdin.readline()[:-1]
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    X,Y = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    if (Y-2*X)//2>=0 and (Y-2*X)%2==0 and 2*X-Y//2>=0:
        print("Yes")
    else:
        print("No")




if __name__ == "__main__":
    main()

Measured memory_bytes: 68116
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);


    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//code here;
	string s;
	long long int k,i,j,count=0,last=0;
	cin>>s>>k;
	if(s.size()==1) {
		cout<<k/2<<endl;
		return 0;
	}
	char prev=s[0];
		for(i=1;i<s.size();i++) {
			char curr=s[i];
			//cout<<prev<<" "<<curr<<endl;
			if(curr==prev) {
				if(i==s.size()-1) {
					//cout<<i<<" "<<count<<endl;
					count++;
					last++;
					break;
				}
				for(j=0;j<26;j++) {
					//cout<<j+'a'<<" "<<prev<<" "<<s[(i+1)%s.size()]<<endl;
					if(j+'a'!=prev && j+'a'!=s[(i+1)]) {
						curr=j+'a';
						count++;
						break;
					}
				}
			}
			prev=curr;
		}
		if(last>=1) {
			cout<<count*k<<endl;
		} else {
			for(i=0;i<s.size();i++) {
				if(s[0]!=s[i]) break;
			}
			if(i==s.size() && s.size()%2==1 && s[0]==s[s.size()-1]) {
				cout<<count*k+k/2<<endl;
			}
			else if(s[0]==s[s.size()-1] && (i)%2==0) cout<<count*k<<endl;
			else if(s[0]==s[s.size()-1] && (i)%2==1) cout<<count*k+k-1<<endl;	
			else cout<<count*k<<endl;
		}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define per(i,m,n) for(lli i=m-1;i>=n;i--)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<max(a*b,c*d)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
 
int main()
{
  int n,x,t;
  int ans = 0;
  std::cin >> n >> x >> t;
  
  if(n <= x){
   ans = t;
  }
  if(n % x == 0 ){
     if(n > x){
        ans = t*(n/x);
     }
  }
  else if(n % x != 0){
      if(n > x){
        ans = t*(n/x + 1);
     }
  }
  cout << ans;
  
} 

Measured memory_bytes: 3624
<?php

fscanf(STDIN, '%d %d %d %d %d', $W, $H, $x, $y, $r);

//円の左端が0未満
if ($x - $r < 0
    //円の右端が長方形の幅超
    || $x + $r > $W
    //円の下端が0未満
    || $y - $r < 0
    //円の上端が長方形の高さ超
    || $y + $r > $H) {
    echo 'No';
} else {
    echo 'Yes';
}

echo PHP_EOL;

Measured memory_bytes: 6524
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;

//using ll = long long;
typedef long long ll;

//#define scanf_s scanf // 必ず消す!!

#define INF ((1LL << 31) - 1)
#define INFLL ((1LL << 62) - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()

// 4近傍のときは for(int i = 0; i < 8; i+=2) などとして使うこと
int vx[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, vy[8] = { -1, -1, 0, 1, 1, 1, 0, -1 };

// [sx, se), [sy, ey)であることに注意
inline bool check(int sx, int ex, int sy, int ey, int x, int y) {
	return (sx <= x and x < ex and sy <= y and y < ey);
}

inline bool check(int ex, int ey, int x, int y) {
	return check(0, ex, 0, ey, x, y);
}

inline void init() {
	cin.tie(0);
	ios::sync_with_stdio(false);
}

ll x, y, k, ans;

int main() {
	cin >> x >> y;

	k = x;

	while (k <= y) {
		ans++;
		k *= 2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;


int H,W,K;
int sx,sy,gx,gy;
vector<char>c[1000005];
vector<int>dis[1000005][4];
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
vector<int>l[1000005],r[1000005],u[1000005],d[1000005];
signed main(){
	cin>>H>>W>>K;
	cin>>sx>>sy>>gx>>gy;
	sx--;sy--;gx--;gy--;
	rep(i,H){
		c[i].resize(W);
		l[i].resize(W);r[i].resize(W);
		u[i].resize(W);d[i].resize(W);
		rep(j,4)dis[i][j].resize(W,inf);
	}
	rep(i,H)rep(j,W)cin>>c[i][j];
	rep(i,H){
		int now=-1;
		rep(j,W){
			if(c[i][j]=='@')now=-1;
			if(now==-1&&c[i][j]=='.')now=j;
			l[i][j]=now;
		}
		now=-1;
		for(int j=W-1;j>=0;j--){
			if(c[i][j]=='@')now=-1;
			if(now==-1&&c[i][j]=='.')now=j;
			r[i][j]=now;
		}
	}
	rep(j,W){
		int now=-1;
		rep(i,H){
			if(c[i][j]=='@')now=-1;
			if(now==-1&&c[i][j]=='.')now=i;
			u[i][j]=now;
		}
		now=-1;
		for(int i=H-1;i>=0;i--){
			if(c[i][j]=='@')now=-1;
			if(now==-1&&c[i][j]=='.')now=i;
			d[i][j]=now;
		}
	}
	queue<pair<int,P>>que;
	rep(i,4)que.push({i,{sx,sy}});
	rep(i,4)dis[sx][i][sy]=0;
	while(!que.empty()){
		pair<int,P> q=que.front();que.pop();
		rep(i,4){
			int gen;
			if(i==0)gen=d[q.second.first][q.second.second]-q.second.first;
			else if(i==1)gen=r[q.second.first][q.second.second]-q.second.second;
			else if(i==2)gen=q.second.first-u[q.second.first][q.second.second];
			else gen=q.second.second-l[q.second.first][q.second.second];
			chmin(gen,K);
			for(int j=gen;j>0;j--){
				int nx=q.second.first+dx[i]*j;
				int ny=q.second.second+dy[i]*j;
				if(nx<0||ny<0||nx>=H||ny>=W)break;
				if(c[nx][ny]=='@')break;
				int ne=dis[q.second.first][q.first][q.second.second]+(j+K-1)/K;
				if(dis[nx][i][ny]<=ne)break;
				dis[nx][i][ny]=ne;
				que.push({i,{nx,ny}});
			}
		}
	}
	/*rep(i,H){
		rep(j,W)cout<<dis[i][j]<<" ";
		cout<<endl;
	}*/
	int mn=inf;
	rep(i,4)chmin(mn,dis[gx][i][gy]);
	if(mn==inf)cout<<-1<<endl;
	else cout<<mn<<endl;
}


Measured memory_bytes: 281424
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
        string[] s = Console.ReadLine().Split(' ').Select(x => x.ToUpper()).ToArray();
        Console.WriteLine("{0}{1}{2}", s[0][0].ToString(), s[1][0].ToString(), s[2][0].ToString());
    }
}


Measured memory_bytes: 13396
S=input()
def judge(S):
    count=0
    count_1=0
    T=[]
    if(S[0]=="A"):
        T.append("a")
        T.append(S[1])
        for s in range(2,len(S)-1):
            if(S[s]=="C"):
                T.append("c")
                count_1+=1
            else:
                T.append(S[s])
        if(count_1==1):
            T.append(S[-1])
            R="".join(T)
            if(R.lower()==R):
                return "AC"
    return "WA"
print(judge(S))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<string> s;
int main() {
	ll n,i,l;
	string p,a;
	cin>>n>>l;
	for(i=0;i<n;i++){
		cin>>a;
		s.push_back(a);
	}
	sort(s.begin(),s.end());
	for(i=0;i<n;i++)
	cout<<s[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
s=int(input())
def collatz(number):            
    if number % 2 == 0:          
        number /= 2              
    else:                        
        number = 3 * number + 1  
    return int(number)
c=0
while s!=1 and s!=2 and s!=4:
    s=collatz(s)
    c=c+1
else:
    print(c+4)

Measured memory_bytes: 9072
using System;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var str = ReadLine();
        string compA, compB;
        do
        {
            str = str.Remove(str.Length - 1);
            if (str.Length % 2 != 0)
            { str = str.Remove(str.Length - 1); }
            compA = str.Substring(0, str.Length / 2);
            compB = str.Substring(str.Length / 2);
        } while (compA != compB);
        WriteLine(str.Length);
    }
}

Measured memory_bytes: 13140
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: June 5 2019
 * 
 */

#include <bits/stdc++.h>

//#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(x) for(auto i=0 ; i<(x); ++i)
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define endl '\n'
using namespace std;




auto SOLUTION_FUNCTION( void ) ->void {

    // your solution goes here 

    int a , b ,c;
    cin>>a>>b>>c;

    cout<<min((int)floor(b/a) , c)<<endl;



    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("ain","r",stdin);
    freopen("aout","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

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

int main()
{
	int N,Y;
	int x,y,z;
	
	cin>>N>>Y;
	
	for(x=0; x<=Y/10000; x++)
	   for(y=0; y<=Y/5000; y++)
	   {
	   	if(N>=x+y)
	   	{
	   		z=N-x-y;
	   		if(x*10000+y*5000+z*1000==Y)
	   		{
	   			cout<<x<<' '<<y<<' '<<z<<endl;
				return 0; 
	   		}
	   	}
	   }
	   
	cout<<"-1 -1 -1"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i,n,m) for(int i = (int)(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 4e18;

int main() {
    int n, m; cin >> n >> m;
    ll ans = 0;
    vector<vector<int>> ab(100001);
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        a--;
        ab[a].push_back(b);
    }
    priority_queue<int> pq;
    REP(i, m) {
        for (int j : ab[i]) {
            pq.push(j);
        }
        if (!pq.empty()) {
            ans += pq.top(); pq.pop();
        }
    }
    cout << ans << endl;
    getchar(); getchar();
}

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

using namespace std;

int main(int argc, char *argv[]) {
    int N;
    cin >> N;
    
    long double ans = 0;

    long double x;
    string u;
    for (int i = 0; i < N; i++) {
        cin >> x;
        cin >> u;
        if (u == "JPY") {
            ans += x;
        }
        if (u == "BTC") {
            long double tmpx = 380000.0 * x;
            ans += tmpx;
        }
    }

    cout << setprecision(15) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int a, b;
  cin >> a >> b;
  for (int i = 0; i < 100000; i++) {
    if (int(i * 0.08) == a && int(i * 0.10) == b) {
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    ll ans = 0;
    rep(i, 60) {
        ll x = 0;
        rep(j, n) if (a[j]>>i&1) ++x;
        ll now = x*(n-x)%mod;
        rep(j, i) now = now * 2 % mod;
        ans += now;
        ans %= mod;
    }    
    cout << ans << endl;
}


Measured memory_bytes: 2560
#include <algorithm>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define REP(i, m, n) for (int i = int(m); i < int(n); i++)
#define RREP(i, m, n) for (int i = int(n) - 1; i >= int(m); --i)
#define EACH(i, c) for (auto &(i) : c)
#define all(c) begin(c), end(c)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(begin(c), end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x) cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s)                                                               \
    do {                                                                       \
    } while (0)
#define dump(x)                                                                \
    do {                                                                       \
    } while (0)
#define BR
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int, int>;
using VP = vector<PII>;

void solve() {
    int n, in;
    LL ans = 0;
    cin >> n;
    REP(i, 0, n) {
        cin >> in;
        ans += in - 1;
    }
    cout << ans << endl;
}

signed main() {
    solve();

    return 0;
}

Measured memory_bytes: 256
X, N = map(int, input().split())
p = list(map(int, input().split()))
if X not in p:
    print(X)
else:
    n = 1
    ans = ""
    while ans == "":
        if X - n not in p:
            ans = X - n
        elif X + n not in p:
            ans = X + n
        n += 1
    print(ans)

Measured memory_bytes: 9192
#include <bits/stdc++.h>
	using namespace std;
	typedef long long ll;
	#define endl "\n"
	#define space " "
	#define ll long long int
	#define vl vector<ll>
	#define vvl vector < vll >
	#define pii pair<int,int>
	#define pll pair<ll,ll>
	#define vpl vector < pll >
	#define mod 1000000007
	#define pi 3.1415926535897932384626433
	#define inf 1000000000000000001;
	#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y) 
	#define mem(a,val) memset(a,val,sizeof(a))
	#define pb push_back
	#define f first
	#define s second
	
	void solve()
	{
		 int n; cin>>n;
		 vector<ll>l(n);
		 ll c=0;
		 for (int i = 0; i < n; ++i)
		 {
		 	/* code */cin>>l[i];
		 }
		 sort(l.begin(), l.end());
		 for (int i = 0; i < n-2; ++i)
		 {
		 	/* code */
		 	for (int j = i+1; j < n-1; ++j)
		 	{
		 		/* code */
		 		for (int k = j+1; k < n; ++k)
		 		{
		 			/* code */
		 			if((l[i]+l[j]>l[k]) and l[i]!=l[j] and l[j]!=l[k]) c++;
		 		}
		 	}
		 }
		 cout<<c;
	}

	signed main()
	{

	fast;
	#ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
     #endif

	ll T=1;
	// cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
	}


Measured memory_bytes: 3660
package main

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

type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

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

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func main() {
	sc := NewScanner()
	N := sc.nextInt()
	s := make(map[string]int)
	for i := 0; i < N; i++ {
		s[sc.nextStr()]++
	}
	M := sc.nextInt()
	for i := 0; i < M; i++ {
		s[sc.nextStr()]--
	}
	max := 0
	for _, v := range s {
		if max < v {
			max = v
		}
	}
	fmt.Println(max)
}


Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }


void solve() {
    LL a;
    string s;
    cin >> a >> s;
    LL b1 = stoll(s.substr(0,s.size()-3));
    LL b2 = s[s.size()-2] - '0';
    LL b3 = s[s.size()-1] - '0';
    dump(b1);
    dump(b2);
    dump(b3);
    LL ans = a * b1;
    LL sum = (a * b2 * 10 + a * b3);
    sum /= 100;
    ans += sum;
    cout << ans << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>

long fun(long a,long b){
	if(a==b){
		return a;
	}else if(a>b){
		return fun(a-b,b);
	}else{
		return fun(b-a,a);
	}
}
	

int main(){
	long a,b,c,d;
	while(scanf("%ld %ld",&a,&b)!=EOF){
		c = fun(a,b);
		d = (a*b)/c;

		printf("%ld %ld\n",c,d);
	}
	return 0;
}

Measured memory_bytes: 596
n = map(int, input().split())
pnt = list(map(int, input().split()))

s_pnt = sorted(pnt)

cnt = 0
for p, s in zip(pnt, s_pnt):
    if p != s:
        cnt += 1


if cnt <= 2:
    print("YES")
else:
    print("NO")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define int long long
const int MOD = 998244353;
using pii=std::pair<int,int>;
using namespace std;

const int maxn = 2e5 + 5, maxk = 15;

int n, k, l[maxk], r[maxk], dp[2 * maxn], prefdp[2 * maxn];
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    for(int i = 0; i < k; i++)
        cin >> l[i] >> r[i];
    dp[n - 1] = 1;
    prefdp[n - 1] = 1;
    for(int i = n - 2; i >= 0; i--)
    {
        int curans = 0;
        for(int j = 0; j < k; j++)
        {
            curans += (prefdp[i + l[j]] - prefdp[i + r[j] + 1]);
            curans %= MOD;
            curans += MOD;
            curans %= MOD;
        }
        dp[i] = curans;
        prefdp[i] = dp[i] + prefdp[i + 1];
        prefdp[i] %= MOD;
    }
    cout << dp[0] << "\n";
    return 0;
}

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

using namespace std;

struct UnionFind
{
  vector< int > data;
  vector< bool > flag;

  UnionFind(int sz)
  {
    data.assign(sz, -1);
    flag.assign(sz, false);
  }

  bool unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(flag[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }

  int find(int k)
  {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k)
  {
    return (-data[find(k)]);
  }
};

int main()
{
  int N, T, K;
  int A[10000], B[10000], C[10000];
  int testcase = 1;

  while(scanf("%d %d %d", &N, &T, &K), N) {
    vector< pair< int, int > > es;
    for(int i = 1; i < N; i++) {
      scanf("%d %d %d", &A[i], &B[i], &C[i]);
      --A[i], --B[i];
      es.emplace_back(C[i], i);
    }
    UnionFind uf(N);
    for(int i = 0; i < T; i++) {
      int x;
      scanf("%d", &x);
      uf.flag[--x] = true;
    }
    sort(es.rbegin(), es.rend());
    int ret = 0;
    vector< int > costs;
    for(auto &e : es) {
      int x = uf.find(A[e.second]);
      int y = uf.find(B[e.second]);
      if(x != y) {
        if(uf.flag[x] && uf.flag[y]) costs.emplace_back(C[e.second]);
        uf.unite(x, y);
      }
    }
    reverse(begin(costs), end(costs));

    printf("Case %d: %d\n", testcase++, accumulate(begin(costs), begin(costs) + K, 0));
  }
}

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

int main(){
  ll a;
  double b;
  cin >> a >> b;
  int B = round(b*100);
  ll ans = (ll)a*B/100;
  cout << ans << endl;
  return 0;
}

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  int A, B;
  cin >> A >> B;
  if (B % A == 0)
    cout << A + B << endl;
  else
    cout << B - A << endl;

  return 0;
}

Measured memory_bytes: 256
'''
問題：
    snuke 君は自転車を買いに来ました。
    snuke 君はすでに買う自転車を決めたのですが、その自転車にはベルが付いていないため、 自転車とは別にベルも買う必要があります。
    snuke 君は安全意識が高いので、ベルをどちらの手でも鳴らせるよう、
    両方のハンドルに 1 つずつ 付けることにしました。

    お店にあるベルは 3 種類で、それぞれ a円、b円、c円です。
    この 3つのうち、異なる 2つのベルを選んで買うときの、値段の合計の最小値を求めて下さい。
'''

'''
制約：
    1 ≤ a,b,c ≤ 10000
    a,b,cは整数
'''

# 標準入力から a, b, c の値を取得する
a, b, c = map(int, input().split())

result = [a + b, b + c, a + c]  # 結果出力用リスト

print(min(result))


Measured memory_bytes: 9136
//52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

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

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    string s;cin >> s;
    if(s == "AAA" || s == "BBB"){
        cout << "No" << '\n';
    }else{
        cout << "Yes" << '\n';
    }
    return 0;
}
/*
 *!!CHECK!! 
 * intの掛け算をしてる場合：overflowは大丈夫？
 * 制約の下限・上限は大丈夫？
 * 木構造は一直線にした時TLEしない？
 * */


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(z => int.Parse(z)*2).ToArray();

            var ans = new long[N];

            var baseVal = 0L;
            for (var i = 0; i < N; i++)
            {
                baseVal = A[i] - baseVal;
            }

            var current = baseVal / 2;
            for (var i = 0; i < N; i++)
            {
                Console.Write($" {current}");
                current = A[i] - current;
            }
            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 28248
from itertools import accumulate
n, k = map(int, input().split())
P= list(map(int, input().split()))
e = [(1+p) / 2 for p in P]
ps =[0] + list(accumulate(e))
a = 0
for i in range(n+1- k):
    if a < ps[i+k] - ps[i]:
        a = ps[i+k] - ps[i]

print(a)
    

Measured memory_bytes: 26236
while True:
    try:
        s= input()
    except:
        break
    j=i=0
    j= sum(1 for k in range(len(s)-1) if s[k]=="J"and s[k+1]=="O"and s[k+2]=="I")
    i= sum(1 for k in range(len(s)-1) if s[k]=="I"and s[k+1]=="O"and s[k+2]=="I")
    print("\n".join(map(str, [j, i])))

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  ll n,k;
  cin >> n >> k;
  vector<ll> a(n);
  ll i;
  rep(i,n) cin >> a[i];
  ll now = 0;
  while(now < k)
  {
    vector<ll> sum(n+1,0);
    rep(i,n)
    {
      sum[max(i-a[i],(ll)0)]++;
      sum[min(i+a[i]+1,n)]--;
    }
    rep(i,n)
    {
      sum[i+1] += sum[i];
    }
    bool ch = false;
    rep(i,n)
    {
      if(a[i] != sum[i]) ch = true;
      a[i] = sum[i];
    }
    now++;
    if(!ch) break;
  }
  rep(i,n)
  {
    if(i != 0) cout << ' ';
    cout << a[i];
  }
  cout << endl;
}

Measured memory_bytes: 6428
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        s: Bytes,
        mut t: Bytes,
    }
    t.pop();
    if s == t {
        println!("Yes");
    } else {
        println!("No");
    }
    // println!("{}", );
}


Measured memory_bytes: 2096
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
using namespace std;
int main(){
    int n,x;
    cin >> n >> x;
    int ans =0;
    vector<int> num(n);
    for(int i=0;i<n;i++){
        cin >> num[i];
    }
    
       num.push_back(x);
       sort(num.begin(),num.end());
       ans = abs(num[1]-num[0]);
       for(int i=1;i<num.size()-1;i++){
           ans = __gcd(ans, abs(num[i+1]-num[i]));
    }
    
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main() {
    string S;
    cin >> S;
    int sum = 0;
    for (int i = 0; i < 3; i++) {
        if (S[i] == 'o') {
            sum += 100;
        }
    }
    cout << 700 + sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main() {


    zoom;
    ll K, A, B;
    cin>>K>>A>>B;
    ll tot = 1;
    if(K <= A - 1) {
        tot += K;
        cout<<tot;
        return 0;
    }
    else {
        tot = A;
        K -= (A - 1);
    }
    if(B - A <= 2)
        tot += K;
    else {
        tot += ((K / 2) * (B - A));
        if(K % 2 == 1)
            tot += 1;
    }
    cout<<tot;
    return 0;
}

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

int main(){
        int n;
        int a[1000];
        cin>>n;
        for(int i=0; i<n; i++){
                cin>>a[i];
        }
        sort(a, a+n);
        int ans=a[n-1]-a[0];
        cout<<ans<<endl;
        return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		String[] str;
		int a, b;
		int menseki, shunonagasa;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        str = br.readLine().split(" ", 0);
        a = Integer.parseInt(str[0]);
        b = Integer.parseInt(str[1]);
        menseki = a * b;
        shunonagasa = 2 * (a + b);
        System.out.println(menseki + " " + shunonagasa);

	}
}

Measured memory_bytes: 24052
"""
 // Author : snape_here - Susanta Mukherjee
 // Date : 27/07/2019

"""
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
else:
    _str = str
    str = lambda x=b"": x if type(x) is bytes else _str(x).encode()

    
#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
from math import ceil,floor,log,sqrt,factorial,pow,pi
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading


# For getting input from input.txt file 
#sys.stdin = open('input.txt', 'r')  
  
# Printing the Output to output.txt file 
#sys.stdout = open('output.txt', 'w') 

def ii(): return int(input())
def fi(): return float(input())
def si(): return str(input())
def mi(): return map(int,input().split())
def li(): return list(mi())

def main():
    
    a,b,c=mi()
    ans=c-(a-b)
    if ans<0:
        ans=0 
    print(ans)

# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s

    def read(self):
        if self.buffer.tell():
            return self.buffer.read()
        return os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", b" "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", b"\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip(b"\r\n")

# endregion

if __name__ == "__main__":
    main()

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


int n,m;
vector<vector<int>> v(100010);

bool used[100010];

bool iscycle(int p,vector<int> went){
    used[p] = 1;
    bool ret = false;
    went[p] = 1;
        
    for(auto i:v[p]){
        if(!used[i]){
            ret |= iscycle(i,went);
        }
        if(went[i]) ret = 1;
    }
    return ret;
}

signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);

    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        v[a].push_back(b);
    }    
    for(int i=0;i<n;i++){
        vector<int> wet(100010);
        if(!used[i]){
            if(iscycle(i,wet)){
                cout<<1<<endl;
                return 0;
            }
        }
    }
    cout<<0<<endl;
}


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

int main(void){
  int i,n = 0;
  char w[11], t[1001];

  scanf("%s", w);

  do{
    scanf("%s",t);
    if(!strcmp(t,"END_OF_TEXT")) break;
      for(i=0;t[i]!='\0';i++)
        if(t[i]<91) t[i] += 32;
    if( !strcmp(w,t) ) n++;
  }while(1);

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

  return 0;
}



Measured memory_bytes: 2056
//Night's template
//orzakyrt
#include <bits/stdc++.h>
#define R register
#define LL long long
#ifdef __DEBUG__
	#define Debug (fprintf(stderr,"orzyrt\n"),fflush(stderr))
	#define debug(__a...) (fprintf(stderr,__a),fflush(stderr))
	#define setfile(__a) ('orzyrt')
	#define Compile(__a) system("g++ "__a".cpp -lm -o "__a)
#else
	#define Debug ('orzyrt')
	#define debug(__a...) ('orzyrt')
	#define setfile(__a) freopen(__a".in","r",stdin);freopen(__a".out","w",stdout)
	#define Compile(__a) ('orzyrt')
#endif
template<class TT>inline TT Max(R TT a,R TT b){return a<b?b:a;}
template<class TT>inline TT Min(R TT a,R TT b){return a<b?a:b;}
template<class TT>inline TT Abs(R TT a){return a<0?-a:a;}
template<class TT>inline TT cmin(R TT &a,R TT b){(b<a)&&(a=b);}
template<class TT>inline TT cmax(R TT &a,R TT b){(a<b)&&(a=b);}
using namespace std;
template<class TT>inline void read(R TT &x){
	x=0;R bool f=false;R char c=getchar();
	for(;c<48||c>57;c=getchar())f|=(c=='-');
	for(;c>47&&c<58;c=getchar())x=(x<<1)+(x<<3)+(c^48);
	(f)&&(x=-x);
}
//end template

namespace Night{
	const int mod = 1e9+7;
	int n;
	bool isp(R int x){
		for(R int i=2;i*i<=x;++i){
			if(x%i==0)return 0;
		}
		return 1;
	}
	map<int,int>mp;
	vector<int>ps;
	vector<int>c;
	int main(){
		read(n);
		for(R int i=2;i<=n;++i){
			if(isp(i)){
				ps.push_back(i);
				c.push_back(1);
				mp[i]=ps.size()-1;
			}else{
				R int x=i;
				for(R int j=0;j<ps.size();++j){
					if(x%ps[j]==0){
						R int cnt=0;
						while(x%ps[j]==0){
							x/=ps[j];
							cnt++;
						}
						c[mp[ps[j]]]+=cnt;
					}
				}
			}
		}
		R int ans=1;
		for(R int i=0;i<c.size();++i){
			ans=1ll*ans*(c[i]+1)%mod;
		}
		cout<<ans;
		return 0;
	}
}
int main(){
	return Night::main();
}


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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    int a=1000;
    if (n<=a) cout<<abs(n-a)<<endl;
    else{
    while (true){
        if (a%n==a)
            a+=1000;
        else {
            cout<<a%n<<endl;
            return 0;
        }
    }
    }
    
}

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

int main(){
    int n;
    cin>>n;
    int ans=0;
    for(int i=0;i<n;++i){
        int l,r;
        cin>>l>>r;
        ans+=r-l+1;
    }
    cout<<ans<<endl;
}

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

struct UnionFind{
    vector<int> p;
    vector<int> r;

    UnionFind(int n){
        p.resize(n, -1);
        r.resize(n, 1);
    }

    int find(int x){
        if(p[x] == -1) return x;
        else return p[x] = find(p[x]);
    }

    void unite(int x, int y){
        x = find(x);
        y = find(y);

        if(x == y) return;
        if(r[x] > r[y]) swap(x, y);
        if(r[x] == r[y]) ++r[y];

        p[x] = y;
    }
};

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

    int n;
    cin >> n;

    vector<int> x(n), y(n);
    rep(i, n) cin >> x[i] >> y[i];

    vector<pair<int, int>> p_x(n), p_y(n);
    rep(i, n){
        p_x[i] = make_pair(x[i], i);
        p_y[i] = make_pair(y[i], i);
    }

    sort(p_x.begin(), p_x.end());
    sort(p_y.begin(), p_y.end());

    vector<pair<int, pair<int, int>>> dist;
    rep(i, n-1){
        dist.push_back(make_pair(abs(p_x[i].first - p_x[i+1].first), make_pair(p_x[i].second, p_x[i+1].second)));
        dist.push_back(make_pair(abs(p_y[i].first - p_y[i+1].first), make_pair(p_y[i].second, p_y[i+1].second)));
    }

    sort(dist.begin(), dist.end());

    // rep(i, dist.size()) cout << dist[i].first << " ";
    // cout << endl;

    UnionFind uf(n);
    int res = 0;
    rep(i, dist.size()){
        int cost = dist[i].first;
        int from = dist[i].second.first;
        int to = dist[i].second.second;

        if(uf.find(from) != uf.find(to)){
            res += cost;
            uf.unite(from, to);
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 7156
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

string s[51];
const int dx[]={-1,0,1,0},dy[]={0,-1,0,1};
bool used[51][51];
int main(){
    int h,w;
    cin>>h>>w;
    rep(i,h) cin>>s[i];
    int wc=0;
    rep(i,h)rep(j,w){
        if(s[i][j]=='.') ++wc;
    }
    queue<pair<pint,int> > q;
    q.push({{0,0},0});
    used[0][0]=true;
    while(!q.empty()){
        pair<pint,int> pi=q.front();q.pop();
        rep(i,4){
            int tx=pi.first.first+dx[i],ty=pi.first.second+dy[i];
            if(tx>=0&&ty>=0&&tx<w&&ty<h&&s[ty][tx]=='.'&&!used[ty][tx]){
                if(tx==w-1&&ty==h-1){
                    cout<<wc-pi.second-2<<endl;
                    return 0;
                }
                q.push({{tx,ty},pi.second+1});
                used[ty][tx]=true;
            }
        }
    }
    cout<<-1<<endl;
    return 0;
}

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

typedef long long ll; 

int main(){
    string s; cin>>s; 
    vector<int> vv(26,0); 
    for(int i=0;i<s.size();i++) { vv[s[i]-97]++; }
    if(s.size()<26){
        cout<<s; 
        for(int i=0;i<26;i++) { if(vv[i]==0) { cout<<(char)(i+97); return 0;} }
    }
    for(int i=25;i>=1;i--){
        if(s[i] > s[i-1]) { cout<<s.substr(0,i-1); char c=s[i]; for(int j=i+1;j<s.size();j++) { if(s[j]<c && s[j]>s[i-1]) c=s[j]; } cout<<c;  return 0; }
    }
    cout<<-1; 

	return 0; 

}



Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long 
int mx=999;
string to_String(int n)  
{  
    int m=n;  
    int i=0,j=0;  
    char s[mx];  
    char ss[mx];  
    while(m>0)  
    {  
        s[i++]= m%10 + '0';  
        m/=10;  
    }  
    s[i]='\0';  
  
    i=i-1;  
    while(i>=0)  
    {  
        ss[j++]=s[i--];  
    }  
    ss[j]='\0';  
    return ss;  
} 
int main()
{
	int n;
	cin>>n;
	string s;
	s=to_String(n);
	for(int i=0;i<s.size();i++){
		if(s[i]=='9'){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
    return 0;
}

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

void main() {
    auto N = readln.split[0].to!ulong;
    auto A = readln.split.to!(ulong[]);
    auto grps = sort(A.dup).group;
    size_t[ulong] nums;
    
    //grps.array.writeln;
    
    foreach (tup; grps) {
        nums[tup[0]] = tup[1];
    }
    
    //nums.writeln;
    
    ulong all_num = nums.values.dup.map!(a => a*(a-1)).sum / 2;
    
    foreach (k; 0 .. N) {
        //writeln("he", A[k], " ", nums[A[k]], " ", ((nums[A[k]])*(nums[A[k]]-1))/2, " ", ((nums[A[k]]-1)*(nums[A[k]]-2))/2 );
        writeln( all_num - (nums[A[k]] - 1) );
    }
}



Measured memory_bytes: 26512
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A[] = new int[N];
		for(int i = 0 ; i < N ; ++i){
			A[i] = sc.nextInt();			
		}
		int cur = 1;
		int broke = 0;
		for(int i = 0 ; i < N ; ++i){
			if(A[i] == cur){
				++cur;
			}else{
				++broke;				
			}
		}
		if(broke == N){
			System.out.println(-1);
		}else{
			System.out.println(broke);			
		}
	}
}


Measured memory_bytes: 86508
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

int main() {
  ll N;

  cin >> N;

  string str = to_string(N);
  ll sum = 0;
  for (size_t i = 0; i < str.length(); i++) {
    sum += str[i] - '0';
  }

  string ans = "No";
  if (N % sum == 0) ans = "Yes";

  cout << ans << endl;

  return 0;
}


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

import sys

def readInts():
  line = sys.stdin.readline().rstrip("\n")
  return map(int, line.split())

def solve(a, b):
  n = a - 1
  if b >= a:
    n += 1
  return n

if __name__ == "__main__":
  a, b = readInts()
  ans = solve(a, b)
  print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int n,a,x[51];
long long dp[51][2501]; 
int main(){
	cin>>n>>a;
	for(int i=0;i<n;i++)cin>>x[i];
	dp[0][0]=1;
	for(int i=0;i<n;i++)
		for(int j=50;j>=0;j--)
			for(int k=0;k<=2500;k++){
				if(!dp[j][k])continue;
				dp[j+1][k+x[i]]+=dp[j][k];
			}
	long long ans=0;
	for(int i=1;i<=50;i++)
		for(int j=0;j<=2500;j++)
			if(i*a==j)
				ans+=dp[i][j];
	cout<<ans;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T, typename U, typename V>
ostream &operator<<(ostream &os, const tuple<T, U, V> &t){
  os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef tuple<int, int, int> TT;
typedef pair<int, TT> PT;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


signed main(){
  int n, k;cin >> n >> k;k--;
  string str;cin >> str;
  str[k] = (str[k]-'A') + 'a';
  cout << str << endl;
  return 0;
}






Measured memory_bytes: 256