akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>                                                   //---------------------------------------------------------------

# define ll long long
# define mod 1000000007
# define MAX 100005
# define PI 3.141592653589793238                                                                                  //shortcut keys

# define pb push_back
# define mp make_pair
# define all(x) x.begin(),x.end()
# define fr(i,a,b) for(int i=a;i<=b;i++)

# define decimal(k) fixed<<setprecision(k)
# define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);        //---------------------------------------------------------------
using namespace std;

int main()
{
	int d,t,s;cin>>d>>t>>s;
	if(s*t>=d)cout<<"Yes"<<'\n';
	else cout<<"No"<<'\n';

	return 0;
}



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

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    ll all = 0;
    for (int i = 0; i < n; ++i) {
        ll x;
        cin >> x;
        a[i] = x;
        all ^= x;
    }
    for (ll i : a) {
        cout << (ll)(i ^ all) << endl;
    }
}


Measured memory_bytes: 4712
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
   int n;
   cin >> n;
   vector<pair<string,pii>>a;
   rep(i,n){
      string s;
      int d;
      cin >> s >> d;
      a.emplace_back(s,pii(-d,i));
   }
   sort(a.begin(),a.end());
   rep(i,n){
      cout << a[i].second.second + 1 << endl;
   }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<iostream>
using namespace std;
const int MaxN = 2e5 + 5;

int main(){
	int a, b;
	scanf("%d %d", &a, &b);
	if(a <= b) cout << a << endl;
	else cout << (a - 1) << endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
B=list(map(int,input().split()))
ans=[]
while B:
    tmp = -1
    for i,b in enumerate(B):
        if i+1 < b:
            print(-1)
            exit()
        elif i+1 == b:
            tmp = i
    ans.append(B[tmp])
    del B[tmp]
for a in reversed(ans):
    print(a)


Measured memory_bytes: 38640
#include <bits/stdc++.h>
using namespace std;
#define mp(a, b) make_pair(a, b)
const int INF = 1e9;
typedef pair<int, int> pii;
const int maxn = 1e5 + 10;
vector<int> E[maxn];
int n, k, pos[maxn], val[maxn], dep[maxn], d[maxn];
pii range[maxn];
void no() { puts("No"); exit(0);}
void getdep(int x, int fa)
{
	dep[x] = dep[fa] + 1;
	for(auto v : E[x])
		if(v != fa)
			getdep(v, x);
}
void merge(pii & i, const pii & j)
{
	i = mp(max(i.first, j.first), min(i.second, j.second));
	if(i.first > i.second) no();
}
pii add(const pii & i)
{
	return i.second == INF ? i : mp(i.first, i.second + 2);
}
void getrange(int x, int fa)
{
	for(auto v : E[x])
		if(v != fa)
		{
			getrange(v, x);
			merge(range[x], add(range[v]));
		}
}
void getd(int x, int fa)
{
	for(auto v : E[x])
		if(v != fa)
		{
			if(range[v].first <= d[x] && d[x] <= range[v].second)
				d[v] = d[x];
			else
				d[v] = d[x] - 2;
			getd(v, x);
		}
}
int main()
{
	scanf("%d", &n);
	for(int i = 1; i < n; ++i)
	{
		int u, v;
		scanf("%d%d", &u, &v);
		E[u].push_back(v);
		E[v].push_back(u);
	}
	scanf("%d", &k);
	for(int i = 1; i <= k; ++i) 
		scanf("%d%d", &pos[i], &val[i]);
	getdep(pos[1], 0);
	for(int i = 1; i <= k; ++i)
	{
		d[pos[i]] = val[i] - dep[pos[i]];
		if((d[pos[i]] & 1) != (d[pos[1]] & 1))
			no();
	} 
	for(int i = 1; i <= n; ++i) range[i] = mp(-INF, INF);
	for(int i = 1; i <= k; ++i) range[pos[i]] = mp(d[pos[i]], d[pos[i]]);
	getrange(pos[1], 0);
	getd(pos[1], 0);
	puts("Yes");
	for(int i = 1; i <= n; ++i) printf("%d\n", d[i] + dep[i]);
	return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}



int main() {
    li n;
    cin >> n;
    string s;
    cin >> s;

    for (auto c : s) {
        li abc = c - 'A';
        li new_abc = (abc + n) % 26;
        cout << (char)(new_abc + 'A');
    }
    cout << endl;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char str[1001];
	cin>>str;
	int s=strlen(str);
	cout<<str;
	if(str[s-1]=='s')
	cout<<"es\n";
	else
	cout<<"s\n";
	return 0;
} 

Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=30;
int a[maxn][10],kt[30];
int main()
{
	int n,tt;
	scanf("%d%d",&n,&tt);
	
	if(n<3) 
	{
		cout<<0<<endl;
		return 0;
	}
	
	for(int i=1;i<=20;i++)
	for(int j=1;j<=7;j++)
	a[i][j]=((i-1)%11*7%11+j)%11;
	
	
	for(int ii=3;ii<=20;ii++)
	{
		int num=0;
		for(int j=1;j<=5;j++)
		{
			int tmp=0;
			for(int i=ii-2;i<=ii;i++)
			for(int k=j;k<=j+2;k++)
			{
				tmp+=a[i][k];
			}
			if(tmp%11==tt)
			{
				num++;
			}
		}
		kt[ii]=num;
	}
	
	n-=2;
	ll sum=0;
	for(int i=3;i<=13;i++)
	sum+=(ll)kt[i];
	
	sum*=(ll)n/11;
	for(int i=1;i<=n%11;i++)
	sum+=(ll)kt[2+i];
	
	cout<<sum<<endl;

	return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
S = list(input())

if len(S) == 1:
    print(1)
elif len(S) == 2:
    print(2)
elif S[0] == '0':
    LA = [0]
    LB = [0]
    for i in range(0,N-1):
        if (S[i] != S[i+1]) & (S[i] == '0'):
            LA.append(i+1)
    for i in range(1,N-1):
        if (S[i] != S[i+1]) & (S[i] == '1'):
            LB.append(i)
    LB.append(N-1)
    ANS = 0
    if K >= len(LB)-1:
        print(N)
    else:
        for i in range(len(LB)-K):
            J = LB[i+K]-LA[i]+1
            if J > ANS:
                ANS = J
        print(ANS)
else:
    LA = [0]
    LB = []
    for i in range(0,N-1):
        if (S[i] != S[i+1]) & (S[i] == '0'):
            LA.append(i+1)
        elif (S[i] != S[i+1]) & (S[i] == '1'):
            LB.append(i)
    LB.append(N-1)
    ANS = 0
    if K >= len(LB)-1:
        print(N)
    else:
        for i in range(len(LB)-K):
            J = LB[i+K]-LA[i]+1
            if J > ANS:
                ANS = J
        print(ANS)

Measured memory_bytes: 7904
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c;
    int h, w;
    cin >> h >> w;
    vector<vector<char>> S(h, vector<char>(w));
    vector<vector<int>> JO(h, vector<int>(w, 0));
    vector<vector<int>> JI(h, vector<int>(w, 0));
    rep(i, h) rep(j, w) {
        cin >> c;
        S[i][j] = c;
    };
    rep(i, h) {
        JO[i][w - 1] = (S[i][w - 1] == 'O');
        for(int j = w - 2; j >= 0; j--) {
            JO[i][j] = JO[i][j + 1] + (S[i][j] == 'O');
        }
    }
    rep(j, w) {
        JI[h - 1][j] = (S[h - 1][j] == 'I');
        for(int i = h - 2; i >= 0; i--) {
            JI[i][j] = JI[i + 1][j] + (S[i][j] == 'I');
        }
    }
    ll ans = 0;
    rep(i, h) rep(j, w) if(S[i][j] == 'J') ans += JO[i][j] * JI[i][j];
    cout << ans << endl;
}


Measured memory_bytes: 82300
import sys
from math import log2, ceil

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    N, K = map(int, readline().split())

    ans = 0
    for n in range(1, N + 1):
        if n >= K:
            ans += 1
        else:
            ans += pow(2, -ceil(log2(K / n)))

    print(ans / N)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
using namespace std;

void solve(){
  int n; cin >> n;
  vector<int> t(n), a(n);
  for(int i = 0; i < n; i++){
    cin >> t[i] >> a[i];
  }
  unsigned long long ts = t[0], as = a[0];
  for(int i = 1; i < n; i++){
    unsigned long long int x = ts / t[i];
    if(ts % t[i] != 0) x++;
    unsigned long long int y = as / a[i];
    if(as % a[i] != 0) y++;
    for(unsigned long long int j = max(x, y); ; j++){
      if(t[i] * j >= ts && a[i] * j >= as){
        ts = t[i] * j;
        as = a[i] * j;
        break;
      }
    }
    //cout << ts << " " << as << endl;
  }
  cout << ts + as << endl;
  return;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
using namespace std;

int main(){
  string S;
  cin>>S;
  bool CAN=false;
  if((S.at(0)==S.at(1) && S.at(2)==S.at(3)) && S.at(1)!=S.at(2)) CAN=true;
  else if((S.at(0)==S.at(2) && S.at(1)==S.at(3)) && S.at(1)!=S.at(2)) CAN=true;
  else if((S.at(0)==S.at(3) && S.at(1)==S.at(2)) && S.at(1)!=S.at(3)) CAN=true;
  if(CAN) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;


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

  int n,m;
  cin >> n >> m;
  
  vector <ll>a[8];
  
  int vx[8] = {1,1,1,1,-1,-1,-1,-1};
  int vy[8] = {1,1,-1,-1,1,1,-1,-1};
  int vz[8] = {1,-1,1,-1,1,-1,1,-1};
  
  REP(i,n){
    ll x,y,z;
    cin >> x >> y >> z;
    REP(j,8){
      a[j].push_back(vx[j]*x + vy[j]*y + vz[j]*z);
    }
  }
  

 REP(i,8){
   sort(a[i].begin(),a[i].end());
 }
  
  ll ans = 0;

  REP(i,8){
    ll sum = 0;
    REP(j,m){
      sum += a[i][n-1-j];
    }
    ans = max(ans,sum);
}
  
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;

int main(){
	int card[200],n,now,a;
	bool f;
	vector<int> tc,hc;
	while(cin >> n,n){
		memset(card,0,sizeof(card));
		for(int i = 0;i < n;++i){
			cin >> a;
			card[--a] = 1;
		}
		for(int i = 0;i < 2 * n;++i){
			if(card[i]) tc.push_back(i+1);
			else hc.push_back(i+1);
		}
		sort(tc.begin(),tc.begin()+n);
		sort(hc.begin(),hc.begin()+n);
		now = 0;
		while(1){
			f = false;
			for(int i = 0;i < tc.size();++i){
				if(now < tc[i]){
					f = true;
					now = tc[i];
					tc.erase(remove(tc.begin(),tc.end(),tc[i]),tc.end());
					break;
				}
			}
			if(!f) now = 0;
			if(tc.empty()) break;
			f = false;
			for(int i = 0;i < hc.size();++i){
				if(now < hc[i]){
					f = true;
					now = hc[i];
					hc.erase(remove(hc.begin(),hc.end(),hc[i]),hc.end());
					break;
				}
			}
			if(!f) now = 0;
			if(hc.empty()) break;
		}
		cout << hc.size() << endl << tc.size() << endl;
		hc.clear();tc.clear();
	}
	return 0;
}

Measured memory_bytes: 1216
#include <stdio.h>
#include<string.h>
 
int main(void){
    int l;
 
    char n[4];
    int A=0;
    int B=0;
    int C=0;
    int D=0;
    scanf("%d", &l);
 
    for(int i = 0; i < l; i++) {
        scanf("%s", n);
 
        if (strcmp("AC",n)==0){
            A++ ;
        }
        else if (strcmp("WA",n)==0){
            B++ ;
        }
        else if (strcmp("TLE",n)==0){
            C++ ;
        }
        else if (strcmp("RE",n)==0){
            D++ ;
        }
    }
    printf("AC x %d \n", A);
    printf("WA x %d \n", B);
    printf("TLE x %d \n", C);
    printf("RE x %d \n", D);
 
    return 0;
}

Measured memory_bytes: 1716
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            if ((a * b) % 2 == 0) {
                out.print("Even");
            } else {
                out.print("Odd");
            }
        }

    }
}



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


int main(){
  ll n,a,b;
  cin >> n >> a >> b;
  ll ans=0;
  ans=(n/(a+b))*a;
  ll no=n;
  no=n-((n/(a+b))*(a+b));
  
  if(no<=a){
    ans=ans+no;
  }else{
    ans=ans+a;
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
vi high(10000, 0), par(10000);
inline int findSet(int x) {
	if(x != par[x]) par[x] = findSet(par[x]);
	return par[x];
}
inline void link(int x, int y) {
	if(high[x] > high[y]) par[y] = x;
	else {
		par[x] = y;
		if(high[x] == high[y]) ++high[y];
	}
}
inline void unite(int x, int y) { link(findSet(x), findSet(y)); }
inline bool same(int x, int y) { return findSet(x) == findSet(y); }
int main() {
	int n, q; cin >> n >> q;
	iota(all(par), 0);
	int t, a, b;
	rep(i, 0, q) {
		cin >> t >> a >> b;
		if(t == 0) unite(a, b);
		else if (t == 1) P(same(a, b) ? 1 : 0);
	}
	return 0;
}

Measured memory_bytes: 3296
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<ll>l(n),r(n);
    REP(i,n)cin>>l[i] >> r[i];
    ll answer = 0;
    REP(i,n){
        answer += r[i]-l[i]+1;
    }
    cout << answer << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int w[10];
  int k[10];
  for(int i=0;i<10;i++){
    cin >>w[i];
  }
  for(int i=0;i<10;i++){
    cin >>k[i];
  }
  sort(w,w+10,greater<int>());
  sort(k,k+10,greater<int>());
  cout<<w[0]+w[1]+w[2]<<' '<<k[0]+k[1]+k[2]<<endl;
}

  

Measured memory_bytes: 1176
# -*- coding: utf-8 -*-
import math
import datetime

# 入力
#N = int(input())
#S = str(input())
#H, W = map(int, input().split())
N, K = map(int, input().split())
S = str(input())

if S[K-1] == "A" :
  print (S[:K-1] + "a" + S[K:])
elif S[K-1] == "B" :
  print (S[:K-1] + "b" + S[K:])
elif S[K-1] == "C" :
  print (S[:K-1] + "c" + S[K:])


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int h,w,m; cin >> h >> w >> m;
  int br[300001];
  int bc[300001];
  int cntr[300001] = {};
  int cntc[300001] = {};
  int maxr=0,maxc=0;
  for(int i = 0; i < m; ++i){
    cin >> br[i] >> bc[i];
    ChangeMax(maxr,++cntr[br[i]]);
    ChangeMax(maxc,++cntc[bc[i]]);    
  }
  uset<int>r,c;
  for(int i = 1; i <= h; ++i)if(maxr == cntr[i])r.insert(i);
  for(int i = 1; i <= w; ++i)if(maxc == cntc[i])c.insert(i);
  int cntd = 0;
  for(int i = 0; i < m; ++i)
    cntd += r.count(br[i])&&c.count(bc[i]);
  cout << maxr + maxc - (cntd == (ll)r.size()*(int)c.size()) << endl;
}


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

using namespace std;

int main(){
	map<int, int> mp;
	int n; scanf("%d", &n);
	int arr[n], val = 0;
	for(int i = 0; i < n; i++){
		int num; scanf("%d", &num);
		if(mp[num] == 0){
			arr[val] = num; ++val;
		}
		mp[num]++;
	}int res = 0;
	for(int i = 0; i < val; i++){
		if(mp[arr[i]] > arr[i]) res += (mp[arr[i]] - arr[i]);
		else if(mp[arr[i]] < arr[i]) res += mp[arr[i]];
	}
	printf("%d\n", res);
}

Measured memory_bytes: 5120
#include<iostream>
#include<string>

using namespace std;

int main(){
    string s;
    cin >> s;
    pair<char, int> p[4];
    for(int i = 0; i < 4; i++){
        p[i].first = 'a';
        p[i].second = 0;
    }
    for(int i = 0; i < 4; i++){
        for(int j = 0; j < 4; j++){
            if (p[j].first == s[i]) {
                p[j].second++;
                break;
            }else if (p[j].first == 'a') {
                p[j].first = s[i];
                p[j].second++;
                break;
            }
        }
    }
    // for(int i = 0; i < 4; i++){
    //     cout << p[i].first << " " << p[i].second << endl;
    // }
    
    for(int i = 0; i < 2; i++){
        if (p[i].second != 2) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    

}

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

bool check_prime(int p){
  if (p==1) return false;
  if (p==2) return true;
  if (p%2 == 0) return false;
  for (int i=3; i*i <= p; i+=2){
    if (p%i == 0) return false;
  }
  return true;
}

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

  while (!check_prime(x)){
    x++;
  }
  cout << x << endl;

  return 0;
}

Measured memory_bytes: 256
io = STDIN
str=io.gets.chomp
def check(str)
  n=str.size
  str==str.reverse &&
  str[0...(n-1)/2]==str[0...(n-1)/2].reverse &&
  str[(n+3)/2-1..-1]==str[(n+3)/2-1..-1].reverse
end
if check(str)
  puts 'Yes'
else
  puts 'No'
end


Measured memory_bytes: 1788
#include<stdio.h>
#include<string.h>
int main(void) {
	int i, j;

	int h, w;

	scanf("%d", &h);
	scanf("%d", &w);

	char s[100][100][100];

	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			scanf("%s", s[i][j]);
		}
	}
	int ansh;
	char answ;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			if (!strcmp(s[i][j], "snuke")) {
				answ = j + 0x41;
				ansh = i + 1;
				goto UNKO;
			}
		}
	}
UNKO:
	printf("%c%d\n", answ, ansh);
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rrep(i,n) for(ll i=(n);i>=0;i--)
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<ll>>;
template<typename T=ll,typename U=ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;

void a(){
    string s; cin >> s;
    if(s.find("A")==string::npos){
        cout << "No";
    }else if(s.find("B")==string::npos){
        cout << "No";
    }else{
        cout << "Yes";
    }
}


void b(){
    ll n,a,b; cin >> n >> a >> b;
    ll amari = n%(a+b);
    ll count = n/(a+b);
    ll counta=0;
    ll countb=0;
    if(amari<=a){
        counta = amari;  
    }else{
        counta = a;
        countb = amari-a;
    }
    counta += a*count;
    countb += b*count;
    cout << counta;

}

int main(){
    b();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define WHITE 0
#define GRAY 1
#define BLACK 2
int color[101], A[101][101], d[101], f[101], nt[101], time = 0;
int S[101],s = 1;
void dfs(int);
void dfsvisit(int,int);
void pop(void);
int next(int,int);
void push(int);
int empty(int,int);
void initstack(int);
int top(int);

int  main() {
	int i,j,n, u, v, k;
	scanf("%d",&n);
	initstack(n);
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= n; j++) {
			A[i][j] = 0;
		}
	}

	for (i = 1; i <= n; i++) {
		scanf("%d", &u);
		scanf("%d", &k);
		for (j = 1; j <= k; j++) {
			scanf("%d", &v);
			A[u][v] = 1;
		}
	}
	dfs(n);
}
void dfs(int n) {
	int i,u;
	for (i = 1; i <= n; i++) {
		color[i] = WHITE;
		nt[i] = 0;
	}
	for (u = 1; u <= n; u++) {
		if (color[u] == WHITE) {
			dfsvisit(u,n);
		}
	}
	for (i = 1; i <= n;i++) {
		printf("%d %d %d\n",i,d[i],f[i]);
	}
}
void dfsvisit(int u,int n) {
	int i,v;
	for (i = 1; i <= n; i++) {
		nt[i] = 0;
	}
	push(u);
	color[u] = GRAY;
	d[u] = ++time;

	while (empty(u, n)) {
		u = top(n);
		if (u == -1)break;
		v = next(u, n);
		if (v != -1) {
			if (color[v] == WHITE) {
				color[v] = GRAY;
				d[v] = ++time;
				push(v);
			}
		}
		else {
			pop();
			color[u] = BLACK;
			f[u] = ++time;
		}
	}
}
void initstack(int n) {
	int i;
	for (i = 1; i <= n; i++) {
		S[i] = -1;
	}
}
void pop() {
	//printf("pop = %d\n", S[s-1]);
	S[s-1] = -1;
	s--;
}
int next(int u,int n) {
	int i;
	for (i = nt[u]; i <= n;i++) {
		nt[u] = i+1;
		if (A[u][i]) {
			//printf("i = %d\n",i);
			return i;
		}
	}
	return -1;
}
void push(int u) {
	S[s] = u;
	s++;
}
int empty(int u,int n) {
	int i,flag = 0;
	for(i = 1; i <= n; i++) {
		if (S[i] > -1) {
			flag = 1;
		}
	}
	return flag;
}
int top(int n) {
	int i;
	for (i = n; i > 0;i--) {
		if (S[i] > 0) {
			//printf("top = %d\n",S[i]);
			return S[i];
		}
	}
	return -1;
}


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


int main()
{
	int n;
	cin>>n;
	float ans=0;
	float odd=0;
	float even=0;
	for(int i=1;i<=n;i++)
	{
		if(i&1)
		{
			odd++;
		}
		else{
			even++;
		}
	}
	ans=odd/(odd+even);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3756
# A
S, T = list(map(str, input().split()))
A, B = list(map(int, input().split()))
U = str(input())

if S==U:
    print("{} {}".format(A-1, B))
elif T==U:
    print("{} {}".format(A, B-1))
else:
    print("{} {}".formata(A, B))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int h, w, n;
map<pair<int, int>, bool> ma;
vector<int> ures;
vector<pair<int, int> > blocks;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>h>>w>>n;
    for(int i=1; i<=n; i++)
    {
        int aa, bb;
        cin>>aa>>bb;
        blocks.push_back({aa, bb});
        ma[{aa, bb}]=true;
    }
    ures.push_back(0);
    ures.push_back(1);
    int cnt=2;
    for(int i=2; i<=w; i++)
    {
        while(ma[{cnt, i}]) cnt++;
        ures.push_back(cnt);
        cnt++;
    }
    int ans=h;
    for(int i=0; i<blocks.size(); i++)
    {
        if(blocks[i].first>ures[blocks[i].second])
        {
            ans=min(ans, blocks[i].first-1);
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 27632
N=int(input())
cnt,zero,one,two,more,d=0,0,0,0,0,0
A=list(map(int,input().split()))
B=A[:]
for i in range(N):
  while B[i]%2==0:
    if B[i]%2==0:
      B[i]=B[i]//2
      cnt=cnt+1
  if cnt==0:zero += 1
  elif cnt==1:one += 1
  else:more += 1
  cnt=0
if one%2!=0:d=1
print("No" if (zero+d)>(two+more+1) else "Yes")

Measured memory_bytes: 14480
#include <iostream>
#include <iomanip>
#include <math.h>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
using namespace std;

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vd vector<double>
#define vb vector<bool>
#define vs vector<string>
#define vii vector<vector<int>>
#define vll vector<ll>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()
#define sort_v(a) sort(a.begin(), a.end())
#define reverse_v(a) reverse(a.begin(), a.end())
#define fi first
#define se second

void print(bool c)
{
    (c) ? (cout << "Yes" << endl) : (cout << "No" << endl);
}

void Print(bool c)
{
    (c) ? (cout << "YES" << endl) : (cout << "NO" << endl);
}

//最小公倍数
template <typename T>
T gcd(T a, T b)
{
    while (1)
    {
        if (a < b)
            swap(a, b);
        if (b == 0)
            break;
        a %= b;
    }
    return a;
}

//最大公約数
template <typename T>
T lcm(T a, T b)
{
    return a * b / gcd(a, b);
}
//セカンドキー->ファーストキーの順ソート
bool cmp(const pii &a, const pii &b)
{
    if (a.second != b.second)
        return a.second < b.second;
    return a.first < b.first;
}

//右下左上
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};

int eve(int x)
{
    if (x % 400 == 0)
        return 1;
    if (x % 100 == 0)
        return 0;
    if (x % 4 == 0)
        return 1;
    return 0;
}

ll h, w;
vllll pass(50, vll(50));
vs s(50);
queue<pair<int, pii>> q;

ll bfs()
{
    if (q.empty())
        return -1;
    pair<int, pii> p = q.front();
    q.pop();
    if (p.first == h - 1 && p.second.first == w - 1)
        return p.second.second;
    rep(i, 0, 4)
    {
        if (0 > p.first + dy[i] || p.first + dy[i] >= h || 0 > p.second.first + dx[i] || p.second.first + dx[i] >= w)
            continue;
        if (s[p.first + dy[i]][p.second.first + dx[i]] == '.' && (!pass[p.first + dy[i]][p.second.first + dx[i]]))
        {
            q.push({p.first + dy[i], {p.second.first + dx[i], p.second.second + 1}});
            pass[p.first + dy[i]][p.second.first + dx[i]] = 1;
        }
    }
    return bfs();
}

int main(void)
{
    cin >> h >> w;
    rep(i, 0, h) cin >> s[i];

    ll ans = 0;
    rep(i, 0, h) rep(j, 0, w) if (s[i][j] == '.') ans++;
    q.push({0, {0, 1}});
    pass[0][0] = 1;
    ll num = bfs();

    cout << (num == -1 ? -1 : ans - num) << endl;
}


Measured memory_bytes: 512
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author cherrypi59
 */

#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FFOR(i, a, b) FOR(i, a, b+1)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) FOR(i, 1, n+1)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define LEN(x) (int)(x).size()
#define DUMP(x) cerr<<__LINE__<<' '<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

using namespace std;
using lint = long long;
using pii =  pair<int, int>;
using pll =  pair<lint, lint>;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vector<T>>;
template <typename T> inline bool chmax(T &a, T b){if(a<b){a = b; return true;} return false;}
template <typename T> inline bool chmin(T &a, T b){if(a>b){a = b; return true;} return false;}

constexpr lint ten(int n) {return n==0 ? 1 : ten(n-1)*10;}

class AHitachiString {
public:
    void solve(std::istream& in, std::ostream& out){
        ios_base::sync_with_stdio(false);
        in.tie(nullptr), out.tie(nullptr);
        string s;
        in>>s;
        if(LEN(s)&1){
            out<<"No\n";
            return;
        }
        bool ok = true;
        for(int i=0;i<LEN(s);i+=2){
            if(s[i]!='h' or s[i+1]!='i') ok = false;
        }
        if(ok) out<<"Yes\n";
        else out<<"No\n";
    }
};


int main() {
	AHitachiString solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

// Author: Ashish

int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n,k;
  cin>>k>>n;
  vector<int> input(n);
  for(auto&itr:input) cin>>itr;
  vector<int> temp;
	temp.push_back(input[0]+k-input[n-1]);
	for(int i=1;i<n;i++) temp.push_back(input[i]-input[i-1]);
	int answer=0;
	sort(temp.begin(), temp.end());
	for(auto&itr:temp) answer+=itr;
	answer-=temp[n-1];
	cout<<answer;


  return 0;
}

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

int N;
int A[50];
vector<pair<int,int>> Ans;

void nondec(int l,int r){
    if(r<=l)return;
    int M=0,m=0;
    for(int i=l;i<=r;i++){
        if(A[M]<=A[i])M=i;
        if(A[m]>A[i])m=i;
    }
    if(A[M]==A[m])return;
    if(abs(A[M])>abs(A[m])){
        for(int i=l;i<=r;i++){
            Ans.push_back({M,i});
        }
        for(int i=l;i<r;i++){
            Ans.push_back({i,i+1});
        }
    }else{
        for(int i=l;i<=r;i++){
            Ans.push_back({m,i});
        }
        for(int i=r;i>l;i--){
            Ans.push_back({i,i-1});
        }
        
    }
}

signed main(void){
    cin >> N;
    REP(i,N){
        cin >> A[i];
    }
    nondec(0,N-1);
    cout << Ans.size() << endl;
    REP(i,Ans.size()){
        cout << Ans[i].first+1 MM Ans[i].second+1 << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector> 
#include<map>
using namespace std;
const int M=1e5+5;
struct node{
	int p,y;
	int k,num;
}q;
bool comp(node a,node b){
	return a.y<b.y;
}
vector<node> a[M];
map<int,node> Map;
int main(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++){
    	int p,y;
    	cin>>p>>y;
    	q.p=p; q.y=y;
    	q.k=i;
    	Map[i]=q;
    	a[p].push_back(q);
	}
	for(int i=1;i<=n;i++){
		sort(a[i].begin(),a[i].end(),comp);
		for(int j=0;j<a[i].size();j++)
			Map[a[i][j].k].num=j+1;	
	}
	for(int i=1;i<=m;i++)
		printf("%06d%06d\n",Map[i].p,Map[i].num);
}

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

int main () {
  int n;
  cin >> n;
  set<string> st;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    st.insert(s);
  }
  cout << st.size() << endl;
}

Measured memory_bytes: 19192
a = int(input())
b,c = map(int,input().split())
d = list(map(int,input().split()))
e = []
f = []
ans = 10**9
for i in d:
  e.append(b-0.006*i)
for j in e:
  f.append(abs(c-j))
print(f.index(min(f))+1)





Measured memory_bytes: 9272
from math import factorial as f

N = int(input())

primes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
divs = []
for i in range(1,101):
    tmp = [0 for _ in range(len(primes))]
    for j in range(len(primes)):
        p = primes[j]
        tmp[j] = 0
        while(i//p==i/p):
            i = i//p
            tmp[j] += 1
    divs.append(tmp)
#print(divs)

divsum = [0 for _ in range(len(primes))]
for i in range(1, N+1):
    for j in range(len(primes)):
        divsum[j] += divs[i-1][j]
#print(divsum)

def num(n):
    return len(list(filter(lambda x:x>=n-1, divsum)))

ans = 0

# >=74
ans += num(75)

# >=14 & 13~4
ans += num(15)*(num(5)-1)

# >=24 & 23~2
ans += num(25)*(num(3)-1)

# >=4,>=4 & >=2
ans += num(5) * (num(5)-1) * (num(3)-2) // 2 
print(int(ans))

Measured memory_bytes: 3064
s= input().split()
ab=abs(int(s[0])-int(s[1]))
bc=abs(int(s[1])-int(s[2]))
ac=abs(int(s[0])-int(s[2]))

if ac<=int(s[3]):
  print("Yes")
else:
  if ab<=int(s[3]) and bc<=int(s[3]):
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int maxn = 0x3f3f3f3f;
int mn[801000];
int cost[200100];
int dp[200100];
vector<int>v[200100];
void add_edge(int l,int r,int root){
    if(l==r){
        mn[root]=maxn;//叶子节点
        return ;
    }
    int mid=(l+r)/2;
    add_edge(l,mid,root<<1);//递归构造左子树
    add_edge(mid+1,r,(root<<1)+1);//递归构造右子树
    mn[root]=min(mn[root<<1],mn[(root<<1)+1]);//根据左右子树根节点的值，更新当前根节点的值
}
int query(int left,int right,int l,int r,int root){//区间查找，l和r表示当前区间端点，left和right表示查询区间端点
    if(left<=l&&r<=right)//当前节点区间包含在查询区间内
        return mn[root];
    int mid=(l+r)/2;
    int res=maxn;
    if(left<=mid)
        res=min(res,query(left,right,l,mid,root<<1));//分别从左右子树查询，返回两者查询结果的较小值
    if(right>mid)
        res=min(res,query(left,right,mid+1,r,(root<<1)+1));
    return res;
}
void update(int pos/*待更新节点的标*/,int val/*更新的值*/,int l,int r,int root){//当前区间的端点
    if(l==r){
        mn[root]=min(mn[root],val);//找到了相应的节点，更新（这里更新的是叶子节点，会对父节点产生影响）
        return;
    }
    int mid=(l+r)/2;
    if(pos<=mid)
        update(pos,val,l,mid,root<<1);//在左子树中更新
    else
        update(pos,val,mid+1,r,(root<<1)+1);//在右子树中更新
    mn[root]=min(mn[root<<1],mn[(root<<1)+1]);//根据左右子树的值回溯更新当前节点的值
}
int main(){
    int n,q;
    int cnt=0;
    scanf("%d",&n);
    add_edge(1,n,1);
    for(int i=1,j;i<=n;i++){
        scanf("%d",&j);
        cnt+=!j;//b中0的个数
        cost[i]=j?1:-1;//当前bi为1即为1，bi为0即为-1，在加和前x位时即可得到bi为1的数量减去bi为零的数量
    }
    scanf("%d",&q);
    for(int i=0,j,k;i<q;i++){
        scanf("%d%d",&j,&k);
        v[j].push_back(k);//存下区间
    }
    memset(dp,maxn,sizeof(dp));
    dp[0]=0;
    for(int i=1;i<=n;i++){
        int ct = v[i].size();//左端点为i的区间的个数
        for (int k = 0; k < ct;k++){
            int j=v[i][k];//右端点
            int tmp=dp[i-1];
            tmp=min(tmp,query(max(i-1,1)/*i为1时仍为1，其他为i-1*/,j,1,n,1));
            if(tmp<dp[j]){//存在更优解
                dp[j]=tmp;
                update(j,tmp,1,n,1);
            }
        }
        dp[i]=min(dp[i],dp[i-1]+cost[i]);//cost[i]为1表示b[i]=1，cost[i]为-1表示b[i]=0，由于dp[i]表示a0b1-a0b0
    }
    printf("%d\n",dp[n]+cnt);//cnt表示b0的数量
    return 0;
}

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

using namespace std;

#define int long long
#define MOD 1000000007

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

    int n, W;
    cin >> n >> W;

    vector<int> w(n + 1), v(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> w[i] >> v[i];
    }
    int dp[W + 1][n + 1] = {};
    for (int wt = 1; wt <= W; wt++) {
        for (int i = 1; i <= n; i++) {
            if (w[i] <= wt)
                dp[wt][i] = max(dp[wt][i - 1], v[i] + dp[wt - w[i]][i - 1]);
            else
                dp[wt][i] = dp[wt][i-1];
        }
    }
    cout << dp[W][n];
    return 0;
}

Measured memory_bytes: 79232
export const main = (input: string) => {
  const lines = input.split('\n')
  const cols = lines[1].split(' ')
  const flags = {
    P: false, W: false, G: false, Y: false
  }
  let count = 0
  cols.forEach((elem) => {
    if (flags[elem] === false) {
      count = count + 1
      flags[elem] = true
    }
  })
  console.log(`${count === 3 ? 'Three' : 'Four'}`)
}

if (process.env.NODE_ENV !== 'test') {
  main(require('fs').readFileSync('/dev/stdin', 'utf8'))
}


Measured memory_bytes: 7372
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;

int main(){
    int X,Y;
    cin>>X>>Y;
    if(X%Y==0){
        cout<<-1<<endl;
    }else{
        cout<<X<<endl;
    }
    return 0;
}

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

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    string t;
    cin >> t;

    // int ans = 0;
    FOR(i, 0, t.size()){
        if (t[i] == '?') t[i]='D';
        // if (t[i-1]=='P' && t[i]=='D') ans++;
        // if (t[i] == 'D') ans++;
    }
    cout << t << endl;
    return 0;
}

Measured memory_bytes: 3744
import math
member = []
score = []
while True:
    num = int(raw_input())
    if num == 0: break
    member.append(num)
    score.append(map(int, raw_input().split()))

alpha = []
for m, s in zip(member, score):
    average = sum(s)/float(m)
    sigma = 0
    for t in s:
        sigma += (t - average)**2
    else:
        alpha += [sigma/m]

for a in alpha:
    #print '%.8f' % math.sqrt(a)
    print math.sqrt(a)

Measured memory_bytes: 6452
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> divisor(ll n) {
  vector<ll> ret;
  for(ll i = 1; i * i <= n;i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
int main(){
    ll n,k,sum;
    ll ans = 0;
    ll MAX = 0;
    sum = 0;
    cin >> n >> k;
    vector<ll> a(n);
    for(ll i = 0;i < n;i++){
        cin >> a[i];
        sum += a[i];
    }
    vector<ll> d = divisor(sum);
    ll size = d.size();
    for(ll i = 0;i < size;i++){
        ll MOD = d[i];
        vector<ll> r(n);
        ll modsum = 0; 
        for(int j = 0;j < n;j++){
            r[j] = (a[j] % MOD);
            modsum += a[j] % MOD;
        }
        sort(r.begin(),r.end(),greater<ll>());
        ll s = modsum / MOD;
        for(int j = 0;j < s;j++){
            modsum -= r[j];
        }
        if(modsum <= k)ans = MOD;

    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x,y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x,y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define d4(x,y,z,w)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z << " | "<< #w << "--> " << w <<endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
#define T ll tt; cin>>tt; while(tt--)
using namespace std;
ll mode=1e9+7;
const ll maxn=2*1e5+5;
const ll inf=99999999999;
ll __lcm(ll a, ll b){ return (a*b)/__gcd(a,b); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getRand(ll l, ll r){ uniform_int_distribution<int> uid(l, r); return uid(rng); }
template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) { return out << "(" << a.F << ", " << a.S << ")"; }
template <class A> ostream& operator << (ostream& out, const vector<A> &v) { 
out << "["; for (int i=0;i<v.size();i++) { if(i) out << ", "; out << v[i]; } return out << "]"; } 


void solve(){


	vector<ll> v(6);
	for (int i=1;i<=5;i++) cin>>v[i];
	for (int i=1;i<=5;i++){
		if (v[i]==0){
			cout<<i<<endl;
			return;
		}
	}
	
	return;
}

int main(){ 
    
    #ifndef ONLINE_JUDGE
	//	freopen("input.txt", "r", stdin);
    #endif
    srand(time(0)); 
    
    ios::sync_with_stdio(0);
    cin.tie(0);
 
	
	//T{ solve(); }
	solve();
	
	
	return 0;
}

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

using namespace std;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int N) : par(N) {
        for(int i=0; i<N; i++) par[i]=i;
    }
    
    int root(int x) {
        if(par[x]==x) return x;
        else return par[x]=root(par[x]);
    }
    
    void unite(int x, int y) {
        int rx=root(x), ry=root(y);
        if(rx==ry) return;
        else par[rx] = ry;
    }
    
    bool same(int x, int y) {
        int rx=root(x), ry=root(y);
        return rx==ry;
    }
};

int main() {
    long int N, M;
    cin >> N >> M;
    UnionFind tree(N);
    
    long int p[N];
    for(long int i=0; i<N; i++) {
        cin >> p[i];
    }
    
    long int x, y;
    for(long int i=0; i<M; i++) {
        cin >> x >> y;
        tree.unite(x-1, y-1);
    }
    
    long int cnt=0;
    for(long int i=0; i<N; i++) {
        if(tree.same(i, p[i]-1)) {
            cnt++;
        }
    }
    
    cout << cnt << endl;

    return 0;
    
}

Measured memory_bytes: 1408
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

class UnionFind:
    def __init__(self, size):
        self.rank=[0]*size
        self.par =[int(i) for i in range(size)]
        self.grp =size

    def find(self, x):
        if x==self.par[x]: return x

        self.par[x]=self.find(self.par[x])
        return self.par[x]

    def same(self, x, y): #2つの頂点が同じグループであるかを判定する
        return self.find(x)==self.find(y)

    def unite(self, x, y): #辺で接続されている2つの頂点を投げて統合する
        x,y=self.find(x),self.find(y)
        if x==y:
            return

        self.grp-=1
        if self.rank[x]<self.rank[y]:
            self.par[x]=y
        else:
            self.par[y]=x
            if self.rank[x]==self.rank[y]:
                self.rank[x]+=1

    def group_num(self):
        return self.grp


n,m=map(int, input().split())

uf=UnionFind(n)

for i in range(m):
    x,y,z=map(int, input().split())
    uf.unite(x-1,y-1)

print(uf.grp)

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

#define pb push_back
#define fst first
#define snd second
#define INF 0x7fffffff
#define INFLL 0x7FFFFFFFFFFFFFFF
#define lenA(ar) sizeof(ar)/sizeof(*ar)
#define lenrows(mat) sizeof(mat)/sizeof(*mat)
#define lencols(mat) sizeof(*mat)/sizeof(**mat)
#define fill(a,c) memset(&a, c, sizeof(a))
#define fore(i,x,y) for(ll i=x;i<y;i++)
#define foreI(i,x,y) for(ll i=x-1;i>=y;i--)
#define max2(a,b) max(a, b)
#define max3(a,b,c) max2(max2(a,b),c)
#define min2(a,b) min(a, b)
#define min3(a,b,c) min2(min2(a,b),c)
#define MOD 1000000009
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

typedef long long ll;
typedef unsigned long long ull;

using namespace std;
ll arr[200010];
ll dp[200010];
int n,k;
ll solve(int pos){
    if(pos==n-1) return 0;
    if(dp[pos]>-1) return dp[pos];
    ll &r = dp[pos];
    ll mini = INFLL;
    fore(i,1,k+1){

        if(pos+i>=n){
            mini = min(mini,solve(n-1)+abs(arr[pos]-arr[n-1]));
        }else{
            mini = min(mini,solve(pos+i)+abs(arr[pos]-arr[pos+i]));
        }
    }

    return r=mini;

}

int main() {
    
    cin>>n>>k; arr[n];
    fill(dp,-1);
    fore(i,0,n)cin>>arr[i];
    cout<<solve(0)<<"\n";
    return 0;
}



Measured memory_bytes: 7296
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
int b[20];
int main(){
	for(int i=0;i<4;i++){
		int a;scanf("%d",&a);b[a]++;
	}
	if(b[1]&&b[9]&&b[7]&&b[4])printf("YES\n");
	else printf("NO\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
// for(long long i = 0;i < num; i++){}
int main() {
    //
    long long x;
    long long cnt = 0;

    cin >> x;

    if (x <= 6) cout << 1;
    else if(x <= 11) cout << 2;
    else if (x % 11 == 0) cout << x / 11 * 2;
    else if (x % 11 <= 6) cout << x / 11 *2+1;
    else cout << x / 11 *2+2;
    //
}


Measured memory_bytes: 3628