akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<pii> vpii;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-7
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(n) ((n) * (n))
#define INF 300000005
#define MAXN 10001

int main()
{
	int n;
	scanf("%d", &n);
	vll arr;
	REP(i, n)
	{
		ll tmp;
		scanf("%lld", &tmp);
		arr.pb(tmp);
	}
	SORT(arr);
	rv(arr);
	int col = 0;
	unsigned long long  a = 0, b = 0;
	REP(i, sz(arr) - 1)
	{
		if (arr[i] == arr[i + 1])
		{
			if (a == 0)
			{
				a = arr[i];
			}
			else
			{
				b = arr[i];
			}
			col++;
			i++;
		}
		if (col == 2)
		{
			break;
		}
	}
	printf("%lld", a*b);
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;
const double PI=3.1415926535897932;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

ll h,w, hh, ww;

int main(){
    cin >> h >> w >> hh >> ww;
    ll tmp = hh*w + h*ww - hh*ww;
    cout << h*w - tmp << endl;
}

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

signed main()
{
  string s,t;
  int ans=10000000;
  cin>>s>>t;
  for(int si = 0; si<s.size(); ++si){
    if(si+t.size() > s.size()) break;
    int cnt = 0;
    for(int i = 0; i<t.size(); ++i){
      if(s[si+i] != t[i]) ++cnt;
    }
    ans = min(ans, cnt);
  }
  cout<< ans<<endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

class UF{
    public:
        vector<int> rank,parent;
        UF(int n) : rank(n,0) , parent(n,0){
            for(int i=0;i<n;i++) parent[i]=i;
        }
        int find_root(int x){
            if(parent[x]==x) return x;
            else return parent[x] = find_root(parent[x]);
        }
        void unite(int x,int y){
            x=find_root(x);
            y=find_root(y);
            if(x==y) return;
            if(rank[x]<rank[y]) parent[x] = y;
            else{
                parent[y]=x;
                if(rank[x]==rank[y])rank[x]++;
            }
        }
        bool same(int x,int y){
            return find_root(x)==find_root(y);
        }
};


ll N,K,L;

int main(){
    cin >> N >> K >> L;
    UF uf1(N),uf2(N);
    rep(i,K){
        int p,q;cin>>p>>q;p--;q--;
        uf1.unite(p,q);
    }
    rep(i,L){
        int r,s;cin>>r>>s;r--;s--;
        uf2.unite(r,s);
    }

    map<pii,int> mp;
    rep(i,N){
        int x = uf1.find_root(i);
        int y = uf2.find_root(i);
        mp[pii(x,y)]++;
    }

    rep(i,N){
        int x = uf1.find_root(i);
        int y = uf2.find_root(i);
        pii p(x,y);
        cout << mp[p] << " ";
    }
    cout << endl;
}


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

#define MOD 1000000007
template<typename ty1,typename ty2>
inline int add(ty1 x, ty2 y) {
	if(y>=MOD)y%=MOD;
	if(x>=MOD)x%=MOD;
    x += y; return x < MOD ? x : x - MOD;
}
template<typename ty1,typename ty2>
inline void addto(ty1 &x, ty2 y) {
		  if(y>=MOD)y%=MOD;
		  if(x>=MOD)x%=MOD;
	      x += y; if (x >= MOD) x -= MOD;
}
template<typename ty1,typename ty2>
inline int sub(ty1 x, ty2 y) {
		if(y>=MOD)y%=MOD;
		 if(x>=MOD)x%=MOD;
        x -= y; return x < 0 ? x + MOD : x;
}
template<typename ty1,typename ty2>
inline void subto(ty1 &x, ty2 y) {
	if(y>=MOD)y%=MOD;
	if(x>=MOD)x%=MOD;
    x -= y; if (x < 0) x += MOD;
}
template<typename ty1,typename ty2>
inline int mul(ty1 x, ty2 y) {
        if(y>=MOD)y%=MOD;
		if(x>=MOD)x%=MOD;
        return 1ll * x * y % MOD;
}
template<typename ty1,typename ty2>
void multo(ty1 &x, ty2 y) {
        if(y>=MOD)y%=MOD;
		if(x>=MOD)x%=MOD;
        x=1ll * x * y % MOD;
}

#define MAX 200002

int n;
int m;

vector<pair<long long int,long long int> > v;
int main(){
	cin>>m;
	long long int sum=0;
	long long int cn=0;
	for(int i=0;i<m;i++){
		long long int d,c;
		scanf("%lld%lld",&d,&c);
		v.push_back(make_pair(d,c));
		sum+=(d*c);
		cn+=c;
	}
	sum-=9;
	sum+=8;
	sum/=9LL;
	sum+=cn-1;
	printf("%lld\n",sum);
	return 0;
}


Measured memory_bytes: 6512
object Main {
  def main(args: Array[String]): Unit = {
    val factor_num = scala.io.StdIn.readInt
    val factors    = scala.io.StdIn.readLine.split(" ").map{_.toInt}.sorted
    var sum        = 0

    for(i <- 0 until (factors.length - 1)) {
      sum += factors(i)
    }

    if(sum > factors.last) println("Yes")
    else                   println("No")
  }
}

Measured memory_bytes: 27420
S = str(input())
alphabet = "abcdefghijklmnopqrstuvwxyz"

flag = [0] * 26
for i in range(26):
    if alphabet[i] in S:
        flag[i] = 1

for i in range(26):
    if flag[i] == 0:
        print(alphabet[i])
        break

if flag == [1] * 26:
    print("None")


Measured memory_bytes: 3188
#include <stdio.h>
#define MAX 200001

int main(){
  int i,count;
  char s[MAX];
  
  scanf("%s", s);
  
  i=1;
  count=1;
  while(s[i]!='\0'){
    if(s[i] == s[i-1]){
      i++;
      if(s[i]=='\0')break;
      i++;
      count++;
      if(s[i]=='\0')break;
      i++;
      count++;
    }else{
      i++;
      count++;
    }
  }
  
  printf("%d", count);
  return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int Signum(double x){
	return abs(x)<EPS?0:x<0?-1:1;
}

struct Point{
	double x,y;
	Point(){}
	Point(double x,double y):x(x),y(y){}
};
bool operator==(Point a,Point b){
	return abs(a.x-b.x)<EPS && abs(a.y-b.y)<EPS;
}
bool operator!=(Point a,Point b){
	return abs(a.x-b.x)>=EPS || abs(a.y-b.y)>=EPS;
}
Point operator+(Point a,Point b){
	return Point(a.x+b.x,a.y+b.y);
}
Point operator-(Point a,Point b){
	return Point(a.x-b.x,a.y-b.y);
}
Point operator*(double c,Point p){
	return Point(c*p.x,c*p.y);
}
double Abs2(Point p){
	return p.x*p.x+p.y*p.y;
}
double Dot(Point a,Point b){
	return a.x*b.x+a.y*b.y;
}
double Cross(Point a,Point b){
	return a.x*b.y-a.y*b.x;
}

int CCW(Point a,Point b,Point c){
	Point d1=b-a,d2=c-a;
	if(int sign=Signum(Cross(d1,d2)))
		return sign;	// 1:ccw,-1:cw
	if(Dot(d1,d2)<-EPS)
		return -2;		// c-a-b
	if(Abs2(d1)<Abs2(d2)-EPS)
		return 2;		// a-b-c
	return 0;			// a-c-b
}

struct Line{
	Point pos,dir;
	Line(){}
	Line(Point p,Point d):pos(p),dir(d){}
	Line(double px,double py,double dx,double dy):pos(px,py),dir(dx,dy){}
};
typedef Line Segment;
Point InterLL(Line a,Line b){
	if(abs(Cross(a.dir,b.dir))<EPS)
		return a.pos;
	return a.pos+Cross(b.pos-a.pos,b.dir)/Cross(a.dir,b.dir)*a.dir;
}
Point InterLS(Line l,Segment s){
	return InterLL(s,l);
}

vector<Point> ConvexCut(const vector<Point>& ps,Line l){
	int n=ps.size();
	vector<Point> res;
	rep(i,n){
		int c1=CCW(l.pos,l.pos+l.dir,ps[i]);
		int c2=CCW(l.pos,l.pos+l.dir,ps[(i+1)%n]);
		if(c1!=-1)
			res.push_back(ps[i]);
		if(c1*c2==-1)
			res.push_back(InterLS(l,Segment(ps[i],ps[(i+1)%n]-ps[i])));
	}
	return res;
}

int main()
{
	for(int n;cin>>n,n;){
		vector<Point> ps(n);
		rep(i,n) cin>>ps[i].x>>ps[i].y;
		
		vector<Point> qs=ps;
		rep(i,n){
			Line l(ps[i],ps[(i+1)%n]-ps[i]);
			qs=ConvexCut(qs,l);
		}
		cout<<!!qs.size()<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <vector>

#define MAX_V 100010
using namespace std;

struct edge{long long to,cost; };
vector<edge> G[MAX_V];

bool used[MAX_V];
int l[200010],r[200010];
long long d[MAX_V],k[200010];
int V,E;

void dfs(int s){
	used[s] = true;
	int i = 0;
	while(true){
		edge e = G[s][i];
		if(e.to==-1){
			break;
		}
		i++;
		if(!used[e.to]){
			used[e.to] = true;
			d[e.to] = d[s]+e.cost;
			dfs(e.to);
		}
	}
}

int main(){
	int i;
	cin >> V >> E;
	for(i=0;i<E;i++){
		cin >> l[i] >> r[i] >> k[i];
		l[i]--; r[i]--;
		edge e;
		e.to = r[i];
		e.cost = k[i];
		G[l[i]].push_back(e);
		e.to = l[i];
		e.cost = -k[i];
		G[r[i]].push_back(e);
		}
	for(i=0;i<V;i++){
		edge e;
		e.to = -1; e.cost = 0;
		G[i].push_back(e);
		used[i] = false;
	}
	
	for(i=0;i<V;i++){
        if(!used[i]){
            d[i] = 0;
            dfs(i);
        }
	}
	
	for(i=0;i<E;i++){
		if(k[i]==d[r[i]]-d[l[i]]){
			continue;
		}
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 21248
import java.lang.reflect.Array;
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int k = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        String ans = "NG";
        for (int i = a;i<b+1;i++){
            if (i%k == 0){
                ans = "OK";
                break;
            }
        }
        System.out.println(ans);

    }
}


Measured memory_bytes: 35380
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <climits>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

#define INF INT_MAX/3
#define REP(i,n) for(int i=0;i<n;i++)

int main(){
	int A,B,C;
	cin>>A>>B>>C;


	int count = 0;	
	while(1){
		if(A == B && B  == C){
			if(A % 2 == 0)cout<<-1<<endl;
			else cout<<count<<endl;
			return 0;
		}

		if( (A % 2 == 1) || (B % 2 == 1)|| (C % 2 == 1)){
			break;
		}
		int tmp_a = A,tmp_b = B;	
		A = (B + C) / 2;
		B = (tmp_a + C) / 2;
		C = (tmp_a + tmp_b) / 2;

		count++;

	}
	cout<<count<<endl;
	return 0;
}


Measured memory_bytes: 256
//************************
//** author  :  Alex Hu **
//************************

//  _______        __________         ________        __
//  \      \   ____\______   \ ____  /  _____/  _____/  |_
//  /   |   \ /  _ \|       _// __ \/   \  ____/ __ \   __\
// /    |    (  <_> )    |   \  ___/\    \_\  \  ___/|  |
// \____|__  /\____/|____|_  /\___  >\______  /\___  >__|
//         \/              \/     \/        \/     \/

#include<bits/stdc++.h>

using namespace std;

#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mkp make_pair
#define pb push_back
#define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define fi first
#define se second
#define sqr(a) ((a)*(a))

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

const ll mod=1e9+7;
const int INF=0x3f3f3f3f;

ll a,b,ans;

int main()
{
	cin>>a>>b;
	for (ll i=40;i>=0;i--)
	{
		ll l=(1ll<<i);
		ll d1=(l<<1);
		ll ans1=a/d1*l+max(0ll,a%d1-l);
		ll ans2=(b+1)/d1*l+max(0ll,(b+1)%d1-l);
		if ((ans2-ans1)%2) ans+=l;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import Data.List.Split
import Data.List

gcd' :: [Int] -> Int
gcd' (x:[]) = x
gcd' (x:y:[]) = gcd x y
gcd' (x:y:xs) = (gcd (gcd x y) (gcd' xs))

getMultipleInt :: IO [Int]
getMultipleInt = 
    getLine >>= \x ->
    (return . (map read)) $ splitOn " " x
    
    
main = do
    base <- fmap (!! 1) getMultipleInt
    dat <- getMultipleInt
    let d = [abs(base - dt) | dt <- dat]
    putStrLn . show $ gcd' d

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

int main() {
    int n, k, q;
    cin >> n >> k >> q;
    int a[q];
    rep(i, q) cin >> a[i];
    int p[n];
    rep(i, n) p[i] = k-q;
    rep(i, q) p[a[i]-1]++;
    rep(i, n) {
      if(p[i] > 0) cout << "Yes" << endl;
      else cout << "No" << endl;
    }
  
    return 0;
}

Measured memory_bytes: 1408
def judgetest(a, b, c):
    if a == -1 or b == -1:
        return 'F'
    sum = a + b
    if sum >= 80:
        return 'A'
    elif sum >= 65:
        return 'B'
    elif sum >= 50:
        return 'C'
    elif sum >= 30:
        if c >= 50:
            return 'C'
        else:
            return 'D'
    else:
        return 'F'

list = []
while True:
    a, b, c = map(int, input().split())
    if a == b == c == -1:
        break
    list.append(judgetest(a, b, c))

for s in list:
    print(s)

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

int main(void) {
	int A, B;
	cin >> A >> B;

	int ans = -1;
	int max_x = 100 * 101 / 8;
	for (int x = 0; x <= max_x; ++x) {
		int val_a = x * 8 / 100;
		int val_b = x * 10 / 100;
		if (val_a == A && val_b == B) {
			ans = x;
			break;
		}
	}

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    vector<pair<long long,long long>>p(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        p[i]={a[i],i};
    }
    sort(p.begin(),p.end(),greater<pair<long long,long long>>());
    vector<vector<long long>>dp(n+1,vector<long long>(n+1,-1000000000000000000));//左に何人、右に何人いるか
    dp[0][0]=0;
    for(int i=0;i<=n;i++){
        for(int j=0;i+j<=n;j++){
            if(i<n)dp[i+1][j]=max(dp[i+1][j],dp[i][j]+p[i+j].first*abs(p[i+j].second-i));
            if(j<n)dp[i][j+1]=max(dp[i][j+1],dp[i][j]+p[i+j].first*abs(n-j-1-p[i+j].second));
        }
    }
    long long m=0;
    for(int i=0;i<=n;i++)for(int j=0;i+j<=n;j++)m=max(m,dp[i][j]);
    cout<<m<<endl;
    return 0;
}

Measured memory_bytes: 34668
#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;

ll countBit(ll b) {  // bの立っているbitの数を返す
    ll res = 0;
    rep(i, 60) {
        if(b & 1LL<<i) {
            res++;
        }
    }
    return res;
}
 
int main() {
    ll n;
    cin >> n;

    vector<vector<P>> v(n);  // v[i][j] : 人iのj個目の証言
    rep(i, n) {
        ll a;
        cin >> a;
        rep(j, a) {
            ll x, y;
            cin >> x >> y;
            x--;
            v[i].pb(make_pair(x, y));
        }
    }

    ll ans = 0;
    exrep(b, 1, (1<<n)-1) {
        bool ok = true;
        rep(i, n) {
            if(b & 1<<i) {
                for(auto p : v[i]) {
                    ll x = p.first;
                    ll y = p.second;
                    if(y == 0) {
                        if(b & 1<<x) {
                            ok = false;
                        }
                    }
                    else {
                        if(!(b & 1<<x)) {
                            ok = false;
                        }
                    }
                }
            }
        }
        if(ok) {
            chmax(ans, countBit(b));
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>

using namespace std;

int main()
{
    int N;
    cin >> N;
    
    string Command, Str;
    
    map<string, string> Dict;

    for(int i = 0; i < N; ++i)
    {
        cin >> Command;
        cin >> Str;
        
        if(Command == "insert")
          Dict[Str] = Str;
        else 
        {
          if(Dict.find(Str) != Dict.end())
            cout << "yes" << endl;
          else 
            cout << "no" << endl;
        }
        
        
    }
    
    return 0;
}


Measured memory_bytes: 41016
from copy import deepcopy

d=int(input())
c=list(map(int,input().split()))
s=[]
for i in range(d):
    a=list(map(int,input().split()))
    s.append(a)

def score_calculator(l):
    score=0
    las=[0]*26
    for i in range(d):
        for j in range(26):
            las[j]+=1
        las[l[i]]=0
        for j in range(26):
            score-=las[j]*c[j]
        score+=s[i][l[i]]
    return score
    
highest_sum_score=-1000000000000

for i in range(1,26):
    last=[0]*26
    temp_ans_lst=[]
    for j in range(d):
        daily_highest_score=-10000000000000
        for k in range(26):
            temp_score=s[j][k]
            temp_last=deepcopy(last)
            for p in range(26):
                temp_last[p]+=1
            temp_last[k]=0
            for p in range(26):
                down=temp_last[p]
                for q in range(i):
                    qdown=down+i+1
                    down+=qdown
                temp_score-=down*c[p]
            if temp_score>daily_highest_score:
                daily_highest_score=temp_score
                daily_choice=k
        for k in range(26):
            last[k]+=1
        last[daily_choice]=0
        temp_ans_lst.append(daily_choice)
    if score_calculator(temp_ans_lst)>highest_sum_score:
        ans_lst=deepcopy(temp_ans_lst)
        highest_sum_score=score_calculator(temp_ans_lst)
        
for i in ans_lst:
    print(i+1)

Measured memory_bytes: 86264
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int a, b, c;
	cin >> a >> b >> c;
	cout << b + min(c, a + b + 1) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
    oreno_initializer() {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }
} oreno_initializer;



string s[2];

signed main() {
    while (1) {
        cin >> s[0];
        if (s[0]==".") break;
        cin >> s[1];
        vector<string> ss[2];
        rep(id,2) {
            rep(i,s[id].size()) if (s[id][i]=='\"') {
                s[id].erase(s[id].begin() + i);
                string x;
                while (s[id][i]!='\"') {
                    x.push_back(s[id][i]);
                    s[id].erase(s[id].begin() + i);
                }
                //s[id].erase(s[id].begin() + i);
                ss[id].push_back(x);
                //i--;
            }
        }

        if (s[0]!=s[1] || ss[0].size()!=ss[1].size()) cout << "DIFFERENT" << endl << flush;
        else {
            int d = 0;
            rep(i,ss[0].size()) d += ss[0][i] != ss[1][i];
            if (d==0) cout << "IDENTICAL" << endl << flush;
            else if (d==1) cout << "CLOSE" << endl << flush;
            else cout << "DIFFERENT" << endl << flush;
        }
    }
}



Measured memory_bytes: 3216
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define emp emplace

using namespace std;
using ll = long long;
using ii = pair<int, int>;

const int N = 100010;
int pd[N][3];
int h[N][3];

int main()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < 3; j++)
			scanf("%d", &h[i][j]);
	
	for (int i = n-1; i >= 0; i--)
	{
		for (int j = 0; j < 3; j++)
		{
			pd[i][j] = 0;
			for (int k = 0; k < 3; k++)
			{
				if (k == j) continue;
				pd[i][j] = max(pd[i][j], h[i][k] + pd[i+1][k]);
			}
		}
	}
	int ans = max({pd[0][0], pd[0][1], pd[0][2]});
	printf("%d\n", ans);
	return 0;
}



Measured memory_bytes: 2560
/*
 Templatka c++ Kacper Fis																							   																											   //
*/

#include <iostream>
#include <cstdio>
#include <limits>
#include <cstdlib>
#include <utility>
#include <iterator>
#include <bitset>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
#include <time.h>
#include <iomanip>
#include <sstream>
#include <bits/stdc++.h>

using namespace std;

const int INF = 1000000001;
const float PI = 3.14;
typedef long long LL;

typedef vector<int> vi;
typedef list<int> li;
typedef queue<int> qi;
typedef pair<int,int> ii;
typedef map<string,int> msi; //np msi['nazwa'] = 'liczba'
typedef vector<ii> vii; //vector par<int>, do tworzenia tablicy dla grafów wagowych #dijkstra #Bellman_Ford
typedef priority_queue< ii, vector<ii>, greater<ii> > pq; //kolejka priorytetowa vectorów par(top()=min) #dijkstra


#define print_list(x) for(it = (x).begin(); it != (x).end(); it++) {cout << *it << " ";}
#define print_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++) {cout << *it2 << " ";}
#define search_list(x) for(it = (x).begin(); it != (x).end(); it++)
#define search_vector(x) for(it2 = (x).begin(); it2 != (x).end(); it2++);
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x, y) make_pair(x, y)
///////////////////////////////////////////////GLOBAL DEFINITIONS////////////////////////////////////////////////////////



///////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////////////////



/////////////////////////////////////////////////////MAIN////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{ios_base::sync_with_stdio(false); cin.tie(NULL);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
	double a, b;
	cin >> a >> b;
	if(a == 1 || b == 1){
		cout << "1" << endl;
	}
	else cout << setprecision(0) << fixed << ceil(a * b / 2) << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int N;
    cin >> N;
    
    int a;
    vector<int> color(9);
    for (int i = 0; i < N; i++) {
        cin >> a;
        if (a < 400) color[0]++;
        else if (a < 800) color[1]++;
        else if (a < 1200) color[2]++;
        else if (a < 1600) color[3]++;
        else if (a < 2000) color[4]++;
        else if (a < 2400) color[5]++;
        else if (a < 2800) color[6]++;
        else if (a < 3200) color[7]++;
        else color[8]++;
    }

    int count = 0;
    for (int i = 0; i < 8; i++) count += (color[i] > 0);

    cout << max(count, 1) << " " << count+color[8] << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<functional>
#include<iostream>
int main()
{
	int i, n, a, b, c, d[10000], g, maxv;
	scanf("%d", &n);
	scanf("%d %d", &a, &b);
	scanf("%d", &c);
	for (i = 0; i < n; i++){
		scanf("%d", &d[i]);
	}
	std::sort(d, d + n, std::greater<int>());
	maxv = c / a;
	for (i = 1; i <= n; i++,g = 0){
		for (int i2 = 0; i2 < i; i2++){
			g += d[i2];
		}
		maxv = std::max(maxv, (g + c) / (a + i*b));

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

Measured memory_bytes: 3248
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;++i)

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int m,n;

int main()
{
	scanf("%d%d",&m,&n);
	int ans=1;
	while(n > 0){
		if(n & 1){
			ans = (ll)ans * m % MOD;
		}
		m = (ll)m*m%MOD;
		n >>= 1;
	}
	printf("%d\n",ans);
	return 0;
}

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

int n, x;
int m = 0, buf;
int mini = 1000;

int main(){
    cin >> n >> x;
    for(int i = 0; i < n; i++){
        cin >> buf;
        m = m + buf;
        if(buf < mini){
            mini = buf;
        }
    }
    cout << (x - m) / mini + n <<endl;
    return 0;
}

Measured memory_bytes: 256
S = list(input())
ans = 'Yes'
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == 'L':
            ans = 'No'
            break
    if i % 2 == 1:
        if S[i] == 'R':
            ans = 'No'
            break
print(ans)


Measured memory_bytes: 9084
n = int( input( ) )
s = [ int( val ) for val in input( ).split( " " ) ]
q = int( input( ) )
t = [ int( val ) for val in input( ).split( " " ) ]

cnt = 0
cnt = 0
for ti in t:
	low = 0
	high = n - 1
	while low <= high:
		m = ( low+high )//2
		if ti < s[m]:
			high = m - 1
		elif s[m] < ti:
			low = m + 1
		else:
			cnt += 1
			break

print( cnt )

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

using namespace std;

#define ll long long

int main()
{
	ll X;
	cin >> X;
	for (ll i = -120; i < 120; i++) {
		for (ll j = -120; j < 120; j++) {
			if (X == pow(i, 5) - pow(j, 5)) {
				cout << i << " " << j << endl;
                return 0;
			}
		}
	}
	return 0;
}


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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
bool chmin(T &a,T b){if(a>b){a=b;return true;}else return false;}
template<typename T>
bool chmax(T &a,T b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  ll n,k;cin>>n>>k;
  vector<ll>x(n);
  rep(i,0,n)cin>>x[i];
  res=INF;
  rep(i,0,n){
    if(i+k>n)break;
    if(x[i]<0&&x[i+k-1]>0){
      chmin(res,-x[i]+x[i+k-1]+min(-x[i],x[i+k-1]));
    }
    else chmin(res,max(abs(x[i]),abs(x[i+k-1])));
  }
  cout<<res<<endl;
  return 0;
}

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

int main()
{
    int n, k;
    cin >> n >> k;
    
    vector<int> a;
    for(int i = 0; i < n; ++i)
    {
        int x;
        cin >> x;
        a.push_back(x);
    }
    
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    
    ll sum = 0;
    for(int i = 0; i < k; ++i)
    {
        sum += a[i];
    }
    
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    static void solve(Scanner sc) {
        int x = sc.nextInt();
        int y = sc.nextInt();
        int z = sc.nextInt();
        int ans = (x - z) / (y + z);
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iterator>
#include <functional>
#include <numeric>
using namespace std;

#define ll long long
#define forn(i,n)for(i=0;i<n;i++)
#define forc(i,c,n)for(i=c;i<=n;i++)
typedef list<ll> LST;
typedef vector<ll> VEC;
typedef map<ll, ll> MAP;


int main() {
	ifstream fin("Text.txt");
	ll i, j, q;
	ll n, m, p, k, t;
	ll a, b, c, d;
	ll y, z;
	ll x=0;
	ll one = 1, zero = 0;
	ll ans = 0;
	ll l, r;
	string st;
	
	cin >> n >> m;
	a = n - m;
	b = m;
	forn(i, m)
		one <<= 1;
	ans += one*(a * 100);
	ans += one*(b * 1900);
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int N = 7;

char grid[N][N];
int n, m, k;

int main()
{
  cin >> m >> n >> k;
  
  for(int i = 0; i < m; ++i)
  	for(int j = 0; j < n; ++j)
      cin >> grid[i][j];
  
  int res = 0;
  for(int r = 0; r < (1 << m); ++r)
    for(int c = 0; c < (1 << n); ++c)
    {
      int cnt = 0;
      for(int i = 0; i < m; ++i)
        for(int j = 0; j < n; ++j)
        {
          if(r & (1 << i) || c & (1 << j))
            continue;
          cnt += grid[i][j] == '#';
        }
      if(cnt == k)
        res++;
    }
  cout << res << endl;
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n); ++i)
#define INF 100000 // 2^31-1
#define MAX_V 100000


using namespace std;

using ll =long long;
using P = pair<int,int>;

string replaceAll(string &replacedStr, string from, string to) {
    unsigned int pos = replacedStr.find(from);
    int toLen = to.length();
 
    if (from.empty()) {
        return replacedStr;
    }
 
    while ((pos = replacedStr.find(from, pos)) != string::npos) {
        replacedStr.replace(pos, from.length(), to);
        pos += toLen;
    }
    return replacedStr;
}
 
int ctoi(const 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 -1;
  }
}

//22
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int gettt(long long int num){
    int digit=0;
if(num<10){
digit=0;
}else{
    while(num>1){
        num /= 10;
        digit++;
    }
}
    return digit;
}

string sfg[27]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",""};





int main() {

ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
int ac=0,wa=0,tle=0,re=0;
for(int i=0;i<n;i++){
string s;
cin>>s;
if(s=="AC")ac++;
if(s=="WA")wa++;
if(s=="TLE")tle++;
if(s=="RE")re++;
}

cout<<"AC x "<<ac<<endl;
cout<<"WA x "<<wa<<endl;
cout<<"TLE x "<<tle<<endl;
cout<<"RE x "<<re<<endl;




}
//double res=10.11;
//printf("%.10f",ans);
//cout << fixed << setprecision(5) <<(n*2)*M_PI << endl;


Measured memory_bytes: 3656
import math

n = int(input())
pt = [True for i in range(n + 1)]
ps = []
for i in range(2, n + 1):
    if pt[i]:
        ps.append(i)
        m = i * 2
        while m <= n:
            pt[m] = False
            m += i

ans = 0
fa = math.factorial(n)

for p in ps:
    po = p ** 74
    if fa % po == 0:
        ans += 1
    for q in ps:
        if q == p:
            continue
        po = (p ** 2) * (q ** 24)
        if fa % po == 0:
            ans += 1
        po = (p ** 4) * (q ** 14)
        if fa % po == 0:
            ans += 1
        for r in ps:
            if r == p or r <= q:
                continue
            po = (p ** 2) * (q ** 4) * (r ** 4)
            if fa % po == 0:
                ans += 1

print(ans)


Measured memory_bytes: 40176
D,N = map(int, input().split())
if D == 0:
  if N == 100:
    print(101)
  else:
    print(N)
elif D == 1:
  if N == 100:
    print(10100)
  else:
    print(100*N)
else:
  if N ==100:
    print(1010000)
  else:
    print(10000*N)

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

int main() {
    int A,B,C,D;
    cin>>A>>B>>C>>D;
  if((A+B)>(C+D)){
        cout<<"Left";
    }
    else if((A+B)<(C+D)){
        cout<<"Right";
    }
    else {
        cout<<"Balanced";
    }
}

Measured memory_bytes: 256
class UnionFindTree:
	def __init__(self,size):
		"""
		size個の集合を作成
		負の値は、ルートで集合の個数
		正の値は、次の要素
		"""
		self.table=[-1 for _ in range(size)]

	def find(self,x):
		"""
		グループ番号を取得
		"""
		# 本質的には、木を上に辿るだけ
		# ただし、通常、UnionFindでは経路圧縮を行うのが普通らしい
		if self.table[x] < 0:
			# 一個上がルートならば、それを返して終わり
			return x
		else:
			# そうでなければ、ルートまで辿るついでに経路圧縮
			self.table[x] = self.find(self.table[x])
			return self.table[x]
		return x

	# 併合
	def union(self,x,y):
		# s1,s2は正
		# table[s1],table[s2]は負
		s1=self.find(x)
		s2=self.find(y)
		if s1!=s2:
			# 個数が小さい方をルートにくっつける
			# ルートサイズは負なので、ルートが大きい方が個数が小さい?
			if self.table[s2]<=self.table[s1]:
				# s1が小さい
				self.table[s1]+=self.table[s2]
				self.table[s2]=s1
			else:
				# s2が小さい
				self.table[s2]+=self.table[s1]
				self.table[s1]=s2
			return True
		return False

	def maxGroupCount(self):
		"""
		Groupの中で最大のものの数
		"""
		cnt = 0
		for i in range(len(self.table)):
			if self.table[i] < 0:
				cnt = max( cnt, -self.table[i] )
		return cnt


N,M=map(int,input().split())
uf=UnionFindTree(N)

for m in range(M):
	A,B=map(lambda x: int(x)-1,input().split())
	uf.union(A,B)

# for n in range(N):
# 	print(n+1, "さん:",uf.find(n))


print(uf.maxGroupCount())



Measured memory_bytes: 16992
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef vector<lint> vlint;

#define inf 1e+9
#define endl "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define rep_rev(i, n) for (int i = n-1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()

#define pb push_back
#define eb emplace_back
#define Size(c) (int)(c).size()

#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))

template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {a = b;return 1;} return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {a = b;return 1;} return 0;
}
template <class T>
void line(vector<T> &x){for (auto&& xi : x) cin >> xi;}

inline void IN(void){ return;}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){ cin >> first; IN(rest...); return;}

#define INT(...) int __VA_ARGS__; IN (__VA_ARGS__)
#define LINT(...) lint __VA_ARGS__; IN (__VA_ARGS__)
#define STR(...) string __VA_ARGS__; IN(__VA_ARGS__)

template <class T> void UNIQUE(vector<T> &x) {
    sort(all(x)); x.erase(unique(all(x)), x.end());
}
template <class T> void print_vec(T first, T end){
    for (auto i = first; i < end - 1; i++) cout << *i << " ";
    cout << *(end-1) << endl;
}

template<class... T>
void debug_print(T... args){
    vector<lint> tmp = initializer_list<lint>{args...};
    print_vec(all(tmp));
}
template<class T>
void print(T a){ cout << a << endl;}

vector<string> Yes = {"No", "Yes"};
vector<string> YES = {"NO", "YES"};

int ord(char x){ return (int)(x - 'a');}
char chr(lint x){ return (char)(x + (lint)('a'));}
lint mod = 1e9+7;
// lint mod = 

lint sum(vlint a){lint ret = 0; for(auto&& v:a) ret += v; return ret;}
lint vmini(vlint a, lint &index){
    lint ret = LLONG_MAX;
    rep(i, Size(a)){ if (chmin(ret, a[i])) index = i;}
    return ret;
}
lint vmaxi(vlint a, lint &index){
    lint ret = -LLONG_MAX;
    rep(i, Size(a)){ if (chmax(ret, a[i])) index = i;}
    return ret;
}

lint vmin(vlint a){
    lint ret = LLONG_MAX; for (auto && v : a) chmin(ret, v); return ret;
}
lint vmax(vlint a){
    lint ret = -LLONG_MAX; for (auto && v : a) chmax(ret, v); return ret;
}


vlint base_3(int k){
    vlint ret; while (k > 0){ ret.pb(k % 3); k /= 3;} reverse(all(ret)); return ret;
}
map<lint, lint> trial_division(lint n){
    map<lint, lint> factor;
    lint tmp = (lint)(sqrt(n)) + 1;
    for (lint i = 2; i < tmp; ++i){
        while (n % i == 0){
            n /= i;
            factor[i] ++;
        }
    }
    if (n != 1) factor[n] ++;
    return factor;
}

int main(){
    INT(n); int cnt = 0;
    rep1(i, n+1){
        if (i % 2 == 0) continue;
        map<lint, lint> td = trial_division(i);
        int ret = 1;
        for (auto&& [key, value] : td){
            ret *= (value+1);
        }
        if (ret == 8){
          cnt++;}
    }
    print(cnt);
    
    
}


Measured memory_bytes: 3620
def isort(n,a):
    p(a)
    for j in range(1,n):
        key = a[j]
        i = j-1
        while i >= 0 and a[i] > key:
            a[i+1] = a[i]
            i = i - 1
        a[i+1] = key
        p(a)

def p(a):
    print " ".join(map(str, a))

n = int(raw_input())
a = map(int, raw_input().split())
isort(n,a)

Measured memory_bytes: 4224
function Main(input){
  	var coins = input.split("\n");
	
  	var a_s = 500;
  	var b_s = 100;
  	var c_s = 50; 	
  	var a = 0;
  	var b = 0;
  	var c = 0;
  	var count = 0;
  
  	c += 1;
  	inf_loop:
  	while(1)
    { 
    c += 1;
  	if(c>coins[2]){
    	c = 0; // cの数をリセット
    	b += 1;
    	if(b>coins[1]){
        	b = 0; // bの数をリセット
        	a += 1;
            if(a>coins[0]){
               break inf_loop;
            }else{
              if(a*a_s+b*b_s+c*c_s == coins[3]){
                count += 1;
              }
            }
        }else{
              if(a*a_s+b*b_s+c*c_s == coins[3]){
              	count += 1;
              }
        }
    }else{
    	if(a*a_s+b*b_s+c*c_s == coins[3]){
        count += 1;
        }
    }
    }
    console.log(count);

}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7500
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }


int main() {
	
	ll Q;
	cin >> Q;
	rep(i, Q) {
		ll a, b, A, B;
		cin >> a >> b;
		A = min(a, b), B = max(a, b);

		if (A == B) cout << 2 * A - 2 << endl;
		else if (A + 1 == B) cout << 2 * A - 2 << endl;
		else {
			ll C = 1e9, ng = -1;
			while (abs(C - ng) > 1) {
				ll mid = (C + ng) / 2;
				if (mid * mid >= A * B) C = mid;
				else ng = mid;
			}
			--C;
			if (A * B <= C * (C + 1)) cout << (A - 1) + (2 * C - A - 1) << endl;
			else cout << (A - 1) + (2 * C - A) << endl;
		}
	}


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const int INF = 1001001001;
main(){
  string N;
  cin>>N;
  if(N.at(N.size()-1)=='2'||N.at(N.size()-1)=='4'||N.at(N.size()-1)=='5'||
     N.at(N.size()-1)=='7'||N.at(N.size()-1)=='9'){
       cout<<"hon"<<endl;
     }
   if(N.at(N.size()-1)=='0'||N.at(N.size()-1)=='1'||N.at(N.size()-1)=='6'||N.at(N.size()-1)=='8'){
     cout<<"pon"<<endl;
   }
   if(N.at(N.size()-1)=='3'){
     cout<<"bon"<<endl;
   }
  return 0;
  }

Measured memory_bytes: 3624
#include <iostream>
#include<algorithm>
#include<vector>
#define ll long long
using namespace std;


int main() {
	
	vector<ll>vec;
	for(int i=0;i<3;i++)
	{
	    int temp;
	    cin>>temp;
	    vec.push_back(temp);
	}
	sort(vec.begin(),vec.end());
	if((vec[1]-vec[0])==(vec[2]-vec[1]))
	{
	    cout<<"YES"<<endl;
	}
	else{
	    cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N;
  cin >> N;
  if(N == 2) {
    vector<ll> as(N);
    for(int i = 0; i < N; ++i) {
      cin >> as[i];
    }
    sort(as.begin(), as.end());
    cout << as[1] - as[0] << endl;
    cout << as[1] << " " << as[0] << endl;
    return 0;
  }

  vector<ll> pas;
  vector<ll> nas;
  {
    int a;
    for(int i = 0; i < N; ++i) {
      cin >> a;
      if(a >= 0) {
        pas.push_back(a);
      } else {
        nas.push_back(a);
      }
    }
  }
  sort(pas.begin(), pas.end());
  sort(nas.begin(), nas.end());

  vector<pair<ll, ll>> log;

  if(pas.size() == 0) { // negativeしかない場合
    auto mx = nas.back();
    nas.pop_back();
    auto mn = nas.front();
    nas.erase(nas.begin());

    log.push_back(make_pair(mx, mn));
    pas.push_back(mx - mn);
  } else if(nas.size() == 0) { // positiveしかない
    auto mn = pas.front();
    pas.erase(pas.begin());
    auto mx = pas.back();
    pas.pop_back();

    log.push_back(make_pair(mn, mx));
    nas.push_back(mn - mx);
  }

  // positiveが１個になるまでnegative化する
  while(pas.size() > 1) {
    auto p = pas.back();
    pas.pop_back(); // 末尾を消す
    auto n = nas.back();
    nas.pop_back();

    log.push_back(make_pair(n, p));
    nas.push_back(n - p); //
  }
  // negativeがなくなるまでpositive化する
  while(nas.size() > 0) {
    auto p = pas.back();
    pas.pop_back();
    auto n = nas.back();
    nas.pop_back();

    log.push_back(make_pair(p, n));
    pas.push_back(p - n);
  }

  cout << pas.front() << endl;
  for(auto l : log) {
    cout << l.first << " " << l.second << endl;
  }
  return 0;
}

Measured memory_bytes: 5104
from itertools import combinations

D,G=map(int,input().split())
p=[0]*D
c=[0]*D
for i in range(D):
	p[i],c[i]=map(int,input().split())


ans=100*10

for i in range(0,D+1):
	for v in combinations(range(D), i):
		t=0
		s=0
		for j in v:
			t+=p[j]
			s+=p[j]*(j+1)*100 + c[j]
		
		if s<G:
			for j in range(D)[::-1]:
				if j in v:
					pass
				else:
					k=(G-s)//((j+1)*100)
					t+=min(p[j]-1,k)
					s+=min(p[j]-1,k)*(j+1)*100
					
					if s>=G:break
		
		if s>=G:
			ans=min(ans,t)
		
print(ans)


Measured memory_bytes: 3064