akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799;

//UnionFind木
const int MAX_N = 400000;
int par[MAX_N];
int rank_union_find[MAX_N];

void init(int n){
  for(int i = 0; i < n; i++){
    par[i] = i;
    rank_union_find[i] = 0;
  }
}

int find(int x){
  if(par[x] == x) return x;
  else return par[x] = find(par[x]);
}


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

  if(rank_union_find[x] < rank_union_find[y]){
    par[x] = y;
  }else{
    par[y] = x;
    if(rank_union_find[x] == rank_union_find[y]) rank_union_find[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}

int n, k, l;
int p[100000], q[100000], r[100000], s[100000];

int main(){
  cin >> n >> k >> l;
  rep(i, k) cin >> p[i] >> q[i];
  rep(i, l) cin >> r[i] >> s[i];
  init(2*n);
  rep(i, k){
    unite(p[i]-1, q[i]-1);
  }
  rep(i, l){
    unite(r[i] + n-1, s[i] + n-1);
  }
  map<P, int> ans;
  for(int i = 0; i < n; i++){
    ans[P(find(i), find(i+n))]++;
  }
  rep(i, n) cout<<ans[P(find(i), find(i+n))]<<" ";
}

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int N,Q;

int main(){
	cin >> N >> Q;
	repp(i,0,Q){
		int v,w;
		cin >> v >> w;
		if(N==1){
			cout << min(v,w) << endl;
			continue;
		}
		--v; --w;
		while(v != w){
			if(v < w) w = (w-1) / N;
			else v = (v-1) / N;
		}
		cout << v+1 << endl;
	}
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int x;
	cin>>x;
	if(x>=30)
	{
		cout<<"Yes";
	}
	else
		cout<<"No";
	
	return 0;
}



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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef long long i64;

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

  int n;
  cin >> n;
  vi a(n), b(n);
  rep(i, 0, n) cin >> a[i];
  rep(i, 0, n) cin >> b[i];

  i64 ans = 0;
  for(i64 bit = 1 << 28; bit != 0; bit >>= 1) {
    rep(i, 0, n) {
      a[i] %= bit << 1;
      b[i] %= bit << 1;
    }
    sort(all(b));

    i64 cnt = 0;
    rep(i, 0, n) {
      cnt += lower_bound(all(b), bit * 2 - a[i]) - lower_bound(all(b), bit - a[i]);
      cnt += lower_bound(all(b), bit * 4 - a[i]) - lower_bound(all(b), bit * 3 - a[i]);
    }
    ans += bit * (cnt % 2);
  }
  cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>

using namespace std;

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

	int count_R = 0;
	int count_B = 0;
	for (int i = 0; i < N; i++) {
		if (s[i] == 'R') {
			count_R++;
		}
		else {
			count_B++;
		}
	}

	if (count_R > count_B) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	

}





Measured memory_bytes: 3580
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * 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;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		ProblemD solver = new ProblemD();
		solver.solve(1, in, out);
		out.close();
	}

	static class ProblemD {
		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			List<Edge>[] edges = new List[n];
			for (int i = 0; i < n; i++) {
				edges[i] = new ArrayList<>();
			}
			int m = in.nextInt();
			for (int i = 0; i < m; i++) {
				int a = in.nextInt() - 1;
				int b = in.nextInt() - 1;
				int c = in.nextInt();
				edges[a].add(new Edge(b, c));
				edges[b].add(new Edge(a, -c));
			}
			int[] x = new int[n];
			boolean[] was = new boolean[n];
			for (int i = 0; i < n; i++) {
				if (!was[i]) {
					dfs(i, edges, x, was);
				}
			}
			for (int i = 0; i < n; i++) {
				for (Edge e : edges[i]) {
					if (x[e.dst] - x[i] != e.c) {
						out.println("No");
						return;
					}
				}
			}
			out.println("Yes");
		}

		private void dfs(int i, List<Edge>[] edges, int[] x, boolean[] was) {
			was[i] = true;
			for (Edge e : edges[i]) {
				int j = e.dst;
				if (was[j]) {
					continue;
				}
				x[j] = x[i] + e.c;
				dfs(j, edges, x, was);
			}
		}

		class Edge {
			int dst;
			int c;

			Edge(int dst, int c) {
				this.dst = dst;
				this.c = c;
			}

		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					String rl = in.readLine();
					if (rl == null) {
						return null;
					}
					st = new StringTokenizer(rl);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}



Measured memory_bytes: 81368
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int a,b;
    while(~scanf("%d%d",&a,&b))
    {
        if(a>=b)
            printf("%d\n",a-b);
        else
            printf("0\n");
    }
}

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

int main()
{
	string s1;
	int len;
	cin >> s1;

	len = s1.size();

	if (s1[len-1] == 's')
	{
		s1.insert(len, "es");
	}
	else
	{
		s1.insert(len, "s");
	}

	cout << s1 << endl;
}

Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
using namespace std;
int main()
{
  string S;
  cin >> S;
  long long ans = 0;
  for(int bit=0; bit<(1<<S.length()-1); ++bit) {
    long long add = 0;
    for(int i=0; i<S.length(); ++i) {
      add = add*10 + (S[i]-'0');
      if((1<<i)&bit) {
        ans += add;
        add = 0;
      }
    }
    ans += add;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
[N, D] = input().split()
s = 0
N = int(N)
D = int(D)
D = D**2
for i in range(N):
    [X, Y] = input().split()
    X = int(X)
    Y = int(Y)
    Z = X**2 + Y**2
    if Z <= D:
        s += 1
print(s)        

Measured memory_bytes: 9144
#include<stdio.h>

int main(){
  int x,y,z,ans;

  
  scanf("%d %d",&x,&y);

  if(x>=y){
    while(1){
   z=x%y;
   if(z==0){
     ans=y;
     break;
   }
   x=y;
   y=z;
    }
  }
    else if(y>x){
      while(1){
      z=y%x;
      if(z==0){
	ans=x;
	break;
      }
      y=x;
      x=z;
    }
    }
  printf("%d\n",ans);
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>	
#define pb push_back
#define N 100005
typedef long long ll;
using namespace std;

int A[100005];

int main(){
	int n,ans=0,sum=0,aux;
	scanf("%d",&n);

	for (int i = 0; i < n; ++i){
		scanf("%d",&A[i]);
	}

	for (int i = 1; i < n; ++i)
	{
		sum+=abs(A[i]-A[i-1]);
	}
	sum+=abs(A[n-1])+abs(A[0]);
	
	//cout<<sum<<endl;

	cout<<sum - abs(A[0]) + abs(A[1]) - abs(A[0]-A[1])<<endl;

	for (int i = 1; i <n-1 ; ++i)
	{
		aux = sum - (abs(A[i]-A[i-1])+abs(A[i]-A[i+1])) + abs(A[i-1]-A[i+1]);
		cout<<aux<<endl;
	}

	cout<<sum - abs(A[n-1]) - abs(A[n-1]-A[n-2]) + abs(A[n-2])<<endl;


	return 0;
}



Measured memory_bytes: 1664
#include <bits/stdc++.h>
//Remove below header file if c++ version greater than 14
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>

#define ll long long int
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define deb(x) cout << #x << " "<< x << endl;
#define fo(i, n) for(i=0; i<n; i++)
#define Fo(i, k, n) for(i=k; i<n; i++)

using namespace std;
using mii=map<int, int>;
using mll=map<ll, ll>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int mod = 1000000007;

ll desc(ll x, ll y)
{
    return x > y;
}

int main() {
    fastIO
    int n, i;
    cin >> n;
    vi arr(n, 0);
    fo(i, n)
        cin >> arr[i];
    int c = 0;
    fo(i, n)
    {
//        cout << arr[i] << " "<< i + 1 << endl;
        if(arr[i] != (i + 1))
            c++;
    }
//    cout << c << endl;
    if(c <= 2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;


    return 0;
}

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

int main()
{
    long long N, sum = 0;
    cin >> N;
    for (int i = 1; i <= N;i++){
        if(i%3==0&&i%5==0){
        }
        else if (i % 3 == 0 )
        {
        }
        else if (i % 5 == 0)
        {
        }
        else{
            sum += i;
            //cout << sum << endl;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3636
package main

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

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

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

func main() {
	n := nextInt()
	for i:= 0; i<50000; i++ {
		x := int(float64(i) * 1.08)
		if x == n {
			fmt.Printf("%d", i)
			return
		}

		if x > n {
			fmt.Printf(":(")
			return
		}
	}
}


Measured memory_bytes: 640
n = int(input())
a = list(map(int, input().split()))
MAXAI = 10000

b = [0] * n
c = [0] * (MAXAI + 1)
for i in range(n):
    c[a[i]] += 1
for i in range(1, MAXAI + 1):
    c[i] += c[i-1]
for j in range(n-1, -1, -1):
    b[c[a[j]]-1] = a[j]
    c[a[j]] -= 1

print(' '.join(map(str, b)))



Measured memory_bytes: 240584
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef long long LL;
const int MaxN = 1e5 + 5;
const int pt = 1e9 + 7;
int n, m;
LL sum_x, ans;
LL x[MaxN], y[MaxN];
LL sx[MaxN], sy[MaxN];
int main(){
	while(~scanf("%d %d", &n, &m)){
		LL xx, yy;
		xx = yy = 0;
		for(int i = 1; i <= n; i++){
			scanf("%lld", &x[i]);
			if(i == 1) sx[i] = 0;
			else sx[i] = sx[i - 1] + (i - 1) * (x[i] - x[i - 1] % pt) % pt;
			xx = (xx + sx[i]) % pt;
		}
		for(int i = 1; i <= m; i++){
			scanf("%lld", &y[i]);
			if(i == 1) sy[i] = 0;
			else sy[i] = sy[i - 1] + (i - 1) * (y[i] - y[i - 1] % pt) % pt;
			yy = (yy + sy[i]) % pt;
		}
		printf("%lld\n", xx * yy % pt);
	}
	return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast")
#define rep(i,n) for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
using ll=long long;
using P=pair<ll,ll>;
using PP=tuple<ll,ll,ll>;
using S=multiset<ll>;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
void decimal(int x){cout<<fixed<<setprecision(x);}
ll GCD(ll a,ll b){if(b==0) return a; return GCD(b,a%b);}
ll LCM(ll a,ll b){return(a/GCD(a,b))*(b/GCD(a,b))*GCD(a,b);}
ll POW(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*POW(a,b-1)%mod;ll k=POW(a,b/2);return k*k%mod;}
vi calc(ll x){vi res;while(x>0){res.eb(x%10);x/=10;}reverse(all(res));return res;}

void solve(){
  string s;
	cin>>s;
	bool f;
	if((int)s.size()<4) f=false;
	else{
		f=true;
		if(s[0]!='Y') f=false;
		if(s[1]!='A') f=false;
		if(s[2]!='K') f=false;
		if(s[3]!='I') f=false;
	}
	YesNo(f);
}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 256
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;


public class Main {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
    public static long mod = (long) (1e9+7);
    public final static int MAX = (int)1e5;
  // static Scanner sc = new Scanner(System.in);
   static List<Integer>[] edge;
	public static void main(String[] args) {
	   
	 FastReader sc = new FastReader();
	int n = sc.nextInt();
	double[] r = new double[n];
	for(int i=0;i<n;++i) r[i] = sc.nextDouble();
	double ans = 0.0;
	for(int i=0;i<n;++i) {
		ans += 1/r[i];
	}
	out.print(1/ans);
		out.close();
	}
	
	
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
ll ni(int x){
    return x*(x+1)/2;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    
    string s;
    cin>>s;
    int n=s.size();
    vector<P> count(1000000);
    count[0].first=1;
    if(s[0]=='>'){
        count[0].sc=1;
    }
    int c=0;
    rep(i,n){
        if(i==0){
            continue;
        }
        if(s[i-1]==s[i]){
            count[c].first++;
        }
        else{
            c++;
            count[c].first++;
            if(s[i]=='>'){
                count[c].sc=1;
            }
        }
        //cout<<s[i]<<endl;
    }
    c++;
    //rep(i,c){
      //  debug(count[i].first);
        //debug(count[i].sc);
    //}
    ll ans=0;
    int x=c;
    c=0;
    if(count[0].sc==1){
        ans+=ni(count[0].fs);
        c=1;
    }
    Rep(i,c,x){
        if(count[i].sc==0){
            ans+=ni(count[i].fs);
        }
        else{
            ans+=ni(count[i].fs);
            ans-=min(count[i-1].fs,count[i].fs);
            //cout<<min(count[i-1].fs,count[i].fs)<<endl;
        }
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;



}

Measured memory_bytes: 8732
//I had a dream...
#include <bits/stdc++.h>
//#ifdef atom #else #endif
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
#define X first
#define Y second
#define vi vector<int>
#define vvi vector< vi >
#define vii vector< ii >
#define mp make_pair
#define pb push_back
int a[100005];
int find(int x)
{
    if(a[x] != -1) return a[x];
    printf("%d\n", x);
    fflush(stdout);
    string pong;
    cin >> pong;
    if(pong == "Male") return a[x] = 1;
    else if(pong == "Female") return a[x] = 0;
    else exit(0);
}
int main()
{
    //#ifndef atom freopen(".in", "r", stdin); freopen(".out", "w", stdout); #endif
    memset(a, -1, sizeof a);
    int n; scanf("%d", &n);
    int pong = find(0);
    int lo = 1, hi = n-1;
    while(lo< hi)
    {
        int mid = (lo+hi)/2;
        int roo = find(mid);
        if(pong == (roo+mid)%2) lo = mid+1;
        else hi = mid-1;
    }
    find(lo);
}


Measured memory_bytes: 1236
#include<iostream>
#include<string>
using namespace std;
int main(){
	int N;
	cin >> N;
	string S;
	cin >> S;
	
	string T("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
	size_t size=S.length();
	for(int i=0;i<size;i++){
		for(int k=0; k<26; k++){
			if(T[k]==S[i]){
				cout << T[(k+N)%26];
				break;
			}
		}
	}
	
	cout << endl;
	
	return 0;
}

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

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> vec(n);
  int count = 0;
  for ( int i = 0; i < n; i++){
    cin >> vec.at(i);
  }
  
  for ( int i = 0; i < n; i++){
    if (vec.at(i) % 2 == 1 && (i + 1) % 2 == 1 ){
      count++;
    }
  }
  cout << count << endl;
}



Measured memory_bytes: 3584
#include <cctype>
#include <cstring>
#include <iostream>

using namespace std;

int main()
{
	char S[256];

	cin.getline(S, 256);

	for (int i = 0; i < strlen(S); i++)
	{
		if (islower(S[i]) != 0)
		{
			S[i] = toupper(S[i]);
		}

		cout << S[i];
	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 1124
import itertools
n,m,q=map(int,input().split())
array=[list(map(int,input().split())) for _ in range(q)]
a=list(range(1,m+1))
A=[]
for i in itertools.combinations_with_replacement(a,n):
  A.append(list(i))
ans=[0]
for j in range(len(A)):
  AA=A[j]
  count=0
  for i in range(q):
    if AA[array[i][1]-1]-AA[array[i][0]-1]==array[i][2]:
      count+=array[i][3]
    else:
      pass
  ans.append(count)
print(max(ans))

Measured memory_bytes: 26164
N = int(input())
memo = [-1]*(N+1)
import sys
sys.setrecursionlimit(10**8)
def rec(n):
    if n == 0:return 0
    if memo[n] != -1:return memo[n]

    res = float('inf')

    pow6 = 1
    while pow6 <= n:
        res = min(res,rec(n-pow6)+1)
        pow6 *= 6

    pow9 = 1
    while pow9 <= n:
        res = min(res,rec(n-pow9)+1)
        pow9 *= 9

    memo[n] = res
    return memo[n]

print(rec(N))

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

int A, B;

int main () {
	cin >> A >> B;
	
	if (A==B) {
		cout << "Draw" << endl;
	} else if (A==1) {
		cout << "Alice" << endl;
	} else if (B == 1) {
		cout << "Bob" << endl;
	} else if (A > B) {
		cout << "Alice" << endl;
	} else if (A < B) {
		cout << "Bob" << endl;
	}
}


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

struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int> > ;
using GraphEdge = vector<vector<int> > ;

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
int main(){
    string S;cin >> S;
    int N = S.length();
    queue<char> Q;
    int count = 0;
    int tmp = 0;
    rep(i,N){
       if(S[i]=='1')count++;
       else tmp++;
    }
    int ans = min(tmp, count);

    cout << ans*2 << endl;
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  std::vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  long double total = 0.0;
  rep(i,n) {
    total += 1.0 / a.at(i);
  }
  cout << std::fixed << std::setprecision(12) << 1.0 / total << endl;
}


Measured memory_bytes: 3716
#include <stdio.h>
#include <iostream>
#include <algorithm>

using namespace std;
#define N 100

int main(void){
    int n;
    int p[N + 1],m[N + 1][N + 1] = {};
    
    cin >> n;
    for(int i = 1;i <= n;++i){
        cin >> p[i - 1] >> p[i];
    }
    for(int l = 2;l <= n;++l){
        for(int i = 1;i <= n - l + 1;++i){
            int j = i + l - 1;
            m[i][j] = __INT_MAX__;
            for(int k = i;k <= j - 1;++k){
                m[i][j] = min(m[i][j],m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
            }
        }
    }
    cout << m[1][n] << endl;
}



Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MAX = 330;
int A[MAX][MAX];
int ptr[MAX];
int cnt[MAX];
int N, M;

int mx() {
	int res = 0;
	for(int i = 1; i <= M; i++)
		res = max(res, cnt[i]);
	return res;
}

bool check(int num) {
	fill(cnt, cnt + M + 1, 0);
	for(int i = 1; i <= N; i++) {
		ptr[i] = 1;
		cnt[A[i][1]]++;
	}
	while(1) {
		debug("%d ~ %d\n", num, mx());
		if(mx() <= num) return true;
		int t = 0;
		for(int i = 1; i <= M; i++)
			if(cnt[i] > num) {
				t = i;
				break;
			}
		debug("t = %d\n", t);
		cnt[t] = -1;
		for(int i = 1; i <= N; i++) {
			if(cnt[A[i][ptr[i]]] != -1) continue;
			while(ptr[i] <= M && cnt[A[i][ptr[i]]] == -1)
				ptr[i]++;
			if(ptr[i] > M) return false;
			debug("Add: %d\n", A[i][ptr[i]]);
			cnt[A[i][ptr[i]]]++;
		}
	}
}

int main() {
	scanf("%d%d", &N, &M);
	for(int i = 1; i <= N; i++)
		for(int j = 1; j <= M; j++)
			scanf("%d", &A[i][j]);
	int l = 1, r = N;
	int ans = N;
	while(l <= r) {
		int m = (l + r) / 2;
		if(check(m))
			ans = min(ans, m), r = m - 1;
		else
			l = m + 1;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>

using std::cin;
using std::cout;

long gcd(long a, long b) {
  if (a < b) {
    const auto tmp = b;
    b = a;
    a = tmp;
  }
  long c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }

  return b;
}

long min_divider(long d, long from) {
  for (long i = from; i * i <= d; ++i) {
    if (d % i == 0) {
      return i;
    }
  }
  return d;
}

int main(int argc, char* argv[]) {
  long a, b;
  cin >> a >> b;

  long d = gcd(a, b);
  int count = 1;
  long from = 2;
  while (d != 1) {
    long div = min_divider(d, from);
    from = div + 1;
    d /= div;
    ++count;
    while (d % div == 0) {
      d /= div;
    }
  }
  cout << count;

  return 0;
}


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


int main(){
    char st;
    cin >> st;
    if (isupper(st))
   {
       cout << 'A'<< endl;
   }
   else
   {
       cout << 'a' << endl;
   }

}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int> > vvi;

ull x,y;


int main()
{
    cin >> x >> y;
    if(x<y) cout <<x;
    else if(x>=y)
    {
        if(x%y==0) cout << -1;
        else cout << x;
    }
}


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

int main() {
  int H,W; cin >>H>>W;
  string S;
  for(int i=0; i<W+2; i++) cout <<'#';
  cout <<endl;
  for(int i=0; i<H; i++){
    cin >>S;
    cout <<'#'<<S<<'#'<<endl;
  }
  for(int i=0; i<W+2; i++) cout <<'#';
  cout <<endl;
  
}

Measured memory_bytes: 256
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>

using namespace std;

typedef long long ll;

const ll N = 200010;

ll n;
ll a[N], b[N];

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

	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
	sort(a + 1, a + n + 1);
	sort(b + 1, b + n + 1);

	if (n % 2) cout << b[n / 2 + 1] - a[n / 2 + 1] + 1 << endl;
	else cout << (b[n / 2 + 1] + b[n / 2]) - (a[n / 2 + 1] + a[n / 2]) + 1 << endl;

	return 0;
}

Measured memory_bytes: 6744
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

N = int(input())
X = list(map(int, input().split()))
ans = 1000000000
for i in range(1, 101):
    sum = 0
    for x in X:
        sum += (x - i) * (x - i)
    ans = min(sum, ans)

print(ans)


Measured memory_bytes: 65772
n = int(input())
k = int(input())
x = list(map(int,input().split()))
ans = 0
for i in range(0,n):
  if (x[i]-0 >= k-x[i]):
    ans += (k-x[i])*2
  else:
    ans += (x[i]-0)*2
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>

using namespace std;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A,B,C;
	cin >> A >> B >> C;
	if(A == B) cout << C;
	if(A == C) cout << B;
	if(B == C) cout << A;
	cout << endl;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <limits.h>
#include <math.h>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'

using namespace std;

typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> vint;
const int INF = INT_MAX;

int main() {
  int N;cin >> N;
  //debug(N);
  vector<ll> A(N);
  vector<ll> sum(N+1,0);
  repeat(i,N){
    cin >> A[i];
    sum[i+1] = sum[i]+A[i];
    //debug(sum[i+1]);
  }
  ll ans = INF;
  int l=1,r=3;
  for(int i=2;i<N-1;i++){
    while(l+1<i&&abs(sum[i]-sum[l]*2)>=abs(sum[i]-sum[l+1]*2)){
      l++;
    }
    while(r+1<N&&abs((sum[N]-sum[i])-(sum[r]-sum[i])*2)>=abs((sum[N]-sum[i])-(sum[r+1]-sum[i])*2)){
      r++;
    }
    cerr << "l " << l << " r " << r << endl;
    ll mi = min(min(sum[l],(sum[i]-sum[l])),min((sum[r]-sum[i]),(sum[N]-sum[r])));
    ll ma = max(max(sum[l],(sum[i]-sum[l])),max((sum[r]-sum[i]),(sum[N]-sum[r])));
    ans = min(ans,ma-mi);
  }
  cout << ans << endl;
  return 0;
}


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

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORTASC(c) sort((c).begin(),(c).end())
#define SORTDESC(c,t) sort((c).begin(),(c).end(), std::greater<t>());
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double PI  = acos(-1.0);

using ll = long long;
using namespace std;

int main() {
    double a, b, n;

    cin >> a >> b >> n;

    if (n < b){
        cout << floor(a*n/b) - a*floor(n/b) << endl;
    } else {
        cout << floor(a*(b-1)/b) - a*floor((b-1)/b) << endl;
    }

    return 0;
}

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



int main()
{


    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   
    long long int nish;
    cin>>nish;
    long long int temp=nish-1;
    long long int total=0;
    for(long long int i=1;i*i<=temp;i++)
    {
        if(temp%i==0){
            if(i!=1)
                total++;

        if((temp/i)!=i)
            total++;
        }
    }


     vector<long long int>nish2;

    for(long long int i=1;i*i<=nish;i++)
    {
        if(nish%i==0){
            nish2.push_back(i);
        if((nish/i)!=i)
            nish2.push_back(nish/i);
        }
    }
    for(auto it:nish2)
    {
        long long int temp1=nish;
        int c=0;
        if(it==1)
            continue;
        while(temp1%it==0)
            temp1/=it,c=1;

        if(c==0)
            continue;
        if(temp1%it==1)
            total++;
    }
    cout<<total<<endl;

return 0;

}

Measured memory_bytes: 384
// AOJ 1240 "Unreliable Messengers" (ICPCアジア地区予選 会津大会 2003 Problem A)
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        for (int i = 0; i < n; i++) {
            String messenger = sc.next();
            StringBuffer message = new StringBuffer(sc.next());
            
            for (int j = messenger.length() - 1; j >= 0; j--) {
                char tmp;
                switch(messenger.charAt(j)) {
                case 'C':
                    tmp = message.charAt(0);
                    message.deleteCharAt(0);
                    message.append(tmp);
                    break;
                    
                case 'J':
                    tmp = message.charAt(message.length() - 1);
                    message.deleteCharAt(message.length() - 1);
                    message.insert(0, tmp);
                    break;
                    
                case 'E':
                    char tmp2;
                    int length = message.length();
                    String s1 = message.substring(0, length / 2);
                    String s2 = message.substring((length + 1) / 2);
                    tmp2 = message.charAt(length / 2);
                    message.delete(0, length);
                    message.append(s1);
                    if (length % 2 == 1) {
                        message.insert(0, tmp2);
                    }
                    message.insert(0, s2);
                    break;
                    
                case 'A':
                    message.reverse();
                    break;
                    
                case 'M':
                    for (int k = 0; k < message.length(); k++) {
                        tmp = message.charAt(k);
                        if ('0' <= tmp && tmp <= '8') {
                            tmp++;
                        } else if (tmp == '9') {
                            tmp = '0';
                        }
                        message.setCharAt(k, tmp);
                    }
                    break;
                    
                case 'P':
                    for (int k = 0; k < message.length(); k++) {
                        tmp = message.charAt(k);
                        if ('1' <= tmp && tmp <= '9') {
                            tmp--;
                        } else if (tmp == '0') {
                            tmp = '9';
                        }
                        message.setCharAt(k, tmp);
                    }
                    break;
                }
            }
            System.out.println(message);
        }
    }
}

Measured memory_bytes: 17192
n = int(input())
t = list(map(int, input().split()))
m = int(input())
p = [0 for _ in range(m)]
x = [0 for _ in range(m)]
for i in range(m):
    p[i], x[i] = map(int, input().split())

temp = sum(t)

for i in range(m):
    print(temp + (x[i] - t[p[i]-1]))

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

int main()
{
    /*
    int n;
    cin>>n;
    for(int i=0;i<=n;i++)
    {
        int x = i*1.08;
        if(x==n)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
    */
    /*
    int n,m,c;
    cin>>n>>m>>c;
    int a[n][m];
    int b[m];
    int count = 0;
    for(int i=0;i<m;i++)
    {
        cin>>b[i];
    }
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>a[i][j];
        }
    }

    for(int i=0;i<n;i++)
    {
        int sum=0;
        for(int j=0;j<m;j++)
        {
            sum+=a[i][j]*b[j];
        }
        if(sum+c>0)
        {
            count++;
        }
    }

    cout<<count<<endl;
    */
    /*
    ll h,w;
    cin>>h>>w;
    if(h==1 || w==1)
    {
        cout<<1<<endl;
        return 0;
    }
    if(h*w%2==0)
    {
        cout<<(h*w)/2<<endl;
    }
    else
    {
        cout<<(h*w)/2+1<<endl;
    }
    */
    string a,b;
    cin>>a>>b;
    int num = stoi(a+b);
    for(int i=1;i<=317;i++)
    {
        if(num==i*i)
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import math
import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)

X,Y = mips()
#X = tsuru + kame
#Y = 2 * tsuru + 4 * kame
for t in range(0,100):
    kame = X-t
    if kame < 0:
        break
    if 2 * t + 4 * kame == Y:
        print("Yes")
        sys.exit(0)
print("No")

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

#define MAXN 110
#define MAXV 100010
#define INF 1000000000000000000LL

using namespace std;
typedef pair<int,int> pii;
typedef long long int lli;

int n, w;
int n1, n2;

lli dp[MAXN][MAXV];

vector<pii> v;

int main()
{
	scanf("%d %d",&n,&w);

	for(int g = 0 ; g < n ; g++)
	{
		scanf("%d %d",&n1,&n2);

		v.push_back({n1 , n2});
	}

	dp[0][0] = 0;

	for(int g = 1 ; g < MAXV ; g++)
		dp[0][g] = INF;

	for(int g = 1 ; g <= n ; g++)
	{
		for(int s = 1 ; s < MAXV ; s++)
		{
			if(s < v[g - 1].second)
			{
				dp[g][s] = dp[g - 1][s];
				continue;
			}

			dp[g][s] = min(dp[g - 1][s] , dp[g - 1][s - v[g - 1].second] + v[g - 1].first);
		}
	}

	for(int g = MAXV - 1 ; g >= 0 ; g--)
	{
		if(dp[n][g] <= w)
		{
			printf("%d\n",g);

			return 0;
		}
	}
}

Measured memory_bytes: 80128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
struct uftree{
private:
  int par[100005]={0},rank[100005]={0};
  ll sum[100005]={0};
public:
  uftree(int n){
    for(int i=1;i<=n;i++){
      par[i]=i;
      rank[i]=0;
      sum[i]=1;
    }
  }
  int find(int x){
    if(par[x]==x) return x;
    else return par[x]=find(par[x]);
  }
  ll unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b) return 0;
    ll ret=sum[a]*sum[b];
    if(rank[a]<rank[b]){
      par[a]=b;
      sum[b]+=sum[a];
    }
    else{
      par[b]=a;
      sum[a]+=sum[b];
      if(rank[a]==rank[b]) rank[a]++;
    }
    return ret;
  }
};
int main(){
  ll n,m;
  cin>>n>>m;
  vector<P> v;
  vector<ll> ans;
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    v.push_back(P(a,b));
  }
  ll ka=n*(n-1)/2;
  uftree uf=uftree(n);
  for(int i=m-1;i>=0;i--){
    ans.push_back(ka);
    ll del=uf.unite(v[i].first,v[i].second);
    ka-=del;
  }
  for(int i=m-1;i>=0;i--) cout<<ans[i]<<endl;
}


Measured memory_bytes: 4596
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    std::string s; std::cin >> s;
    int n = s.size();
    int cur = 0, p = 1;
    std::vector<long long> cnt(2019);
    for (int i = n - 1; i >= 0; i--) {
        cur = (cur + p*(s[i] - '0')) % 2019;
        cnt[cur]++;
        p = 10 * p % 2019;
    }
    cnt[0]++;
    long long ans = 0;
    for (int i = 0; i < 2019; i++) {
        ans += cnt[i] * (cnt[i] - 1) / 2;
    }
    std::cout << ans << std::endl;
    return 0;
}
 

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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int n;
    cin >> n;

    int ans = n * (n - 1)/2;
    cout << ans << endl;
}

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

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int N;
map<string, int> m;


signed main(){
    cin >> N;
    rep(i, 0, N){
        string S;
        cin >> S;
        m[S]++;
    }

    int c = 0;
    for(auto p : m) chmax(c, p.second);
    for(auto p : m) if(c == p.second) cout << p.first << endl;

    return 0;
}

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

int main(){
    long x,y,ans=-1;
    cin>>x>>y;

    for(long i=0;i<1000000000000000001;i+=x){
        if(x%y==0) break;
        else if(i%y!=0) {ans=i; break;}
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

#define MAX_V 5010
typedef vector<int> Vec;

int N, M;
Vec G[MAX_V];

bool visit(int v, Vec &order, Vec &color)
{
    color[v] = 1;
    for (int i = 0; i < (int)G[v].size(); i++) {
        int to = G[v][i];
        if (color[to] == 2) continue;
        if (color[to] == 1) return false;
        if (!visit(to, order, color)) return false;
    }
    order.push_back(v);
    color[v] = 2;
    return true;
}

bool topologicalSort(Vec &order)
{
    Vec color(N, 0);
    for (int i = 0; i < N; i++) {
        if (color[i] == 0 && !visit(i, order, color)) {
            return false;
        }
    }
    reverse(order.begin(), order.end());
    return true;
}

int main()
{
    int s, t;
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        cin >> s >> t; s--; t--;
        G[s].push_back(t);
    }
    Vec order;
    if (topologicalSort(order)) {
        bool is_hamiltonian_path = 1;
        for (int i = 0; i < N-1; i++) {
            if (G[order[i]].size() == 0) {
                is_hamiltonian_path = 0;
            }
        }
        for (int i = 0; i < N; i++) {
            cout << order[i]+1 << endl;
        }
        cout << !is_hamiltonian_path << endl;
    }
    return 0;
}

Measured memory_bytes: 3908
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
//:/
#define pb push_back
#define mp make_pair
#define nt _ll128
#define ld long double
long double PI =3.14159265358979323846;
using ll = long long;



const ll modo=1e9+7;
const ll inf=1e17;
const ll ms=(1e5)+5;

ll modpow(ll a,ll b)
{
    ll r=1;
    while(b)
    {
        if(b&1)
        {
            r=(r*a)%modo;
        }
        b>>=1;
        a=(a*a)%modo;
    }
    return r;
}

ll ncr(int n,int r)
{
    ll ans=1;
    int lim=max(r,n-r);
    ll cc=1;
    for(ll i=lim+1;i<=n;i++)
    {
        ans=((ans*i)%modo)*modpow(cc,modo-2);
        ans%=modo;
        cc++;
    }
    return ans;
}

int main()
{
    idfc;

    int x,y;
    cin>>x>>y;


    int a= 2*y-x;
    int b;
    if(a>=0&&((a%3)==0))
    {
        a/=3;
        b=y-(2*a);
      //  cout<<a<<" "<<b<<"\n";
        if(a>=0&&b>=0)
        {
            cout<<ncr(a+b,a);
        }
        else{
            cout<<0;
        }
    }
    else{
        cout<<0;
    }


    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n-1;i>s;i--)
#define rep_re(i,s,n)for(ll i = n-1;i>=s;i--)
ll MOD = 1e9+7;

ll x[100] = {};
int main() {
	ll n; cin >> n;
	ll L = 101, R = 0;
	rep(i, 0, n) {
		cin >> x[i];

		L = min(L, x[i]);
		R = max(R, x[i]);
	}

	ll ans = MOD;
	repe(j, L, R) {
		ll dis = 0;
		rep(i, 0, n) {
			dis += (x[i] - j) * (x[i] - j);
		}
		ans = min(ans, dis);
	}
	cout << ans << endl;

	return 0;
}


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

const int LIMIT = 50;

int n, m;
vector<vector<bool>>graph(LIMIT, vector<bool>(LIMIT));
vector<bool>visited(LIMIT);

void dfs(int v) {
	visited[v] = true;
	for (int cnnt = 0; cnnt < n; cnnt++) {
		if (graph[v][cnnt] == false)continue;
		if (visited[cnnt] == true)continue;
		dfs(cnnt);
	}
}

int main() {
	cin >> n >> m;
	vector<int>a(LIMIT), b(LIMIT);
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	int ans = 0;
	for (int i = 0; i < m; i++) {
		graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;

		for (int j = 0; j < n; j++)visited[j] = false;

		dfs(0);

		bool bridge = false;
		for (int j = 0; j < n; j++)if (visited[j] == false)bridge = true;
		if (bridge)ans++;

		graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, m;
    cin >> n >> m;
    set<pair<int, int>> st;
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        st.insert({a, b});
    }

    bool flag = false;
    for (int i = 2; i <= n - 1; i++) {
        if (st.count({1, i}) && st.count({i, n})) {
            flag = true;
            break;
        }
    }

    cout << (flag ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
using namespace std;

const int N=1e6+5;
int n,k,l,cnt,color[N],res[N];
vector<int> road[N],rail[N];
bool vst[N];
set<int> type,s[N];

void dfs(int u){
	color[u]=cnt;
	for(int v:road[u]) if(!color[v]) dfs(v);
}

void dfs2(int u){
	vst[u]=true;
	type.insert(color[u]);
	s[color[u]].insert(u);
	for(int v:rail[u]) if(!vst[v]) dfs2(v);
}

int main() {
	#ifdef kvutxdy
	freopen("C:/Users/khanh/OneDrive/RoadtoPurple/Code/Codeforces/input.in", "r", stdin);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cin>>n>>k>>l;
	for(int i=0;i<k;++i){
		int u,v;
		cin>>u>>v;
		road[u].push_back(v);
		road[v].push_back(u);
	}
	for(int i=0;i<l;++i){
		int u,v;
		cin>>u>>v;
		rail[u].push_back(v);
		rail[v].push_back(u);
	}
	for(int i=1;i<=n;++i) if(!color[i]){
		++cnt;
		dfs(i);
	}
	for(int i=1;i<=n;++i) if(!vst[i]){
		type.clear();
		dfs2(i);
		for(int col:type){
			for(int u:s[col])
				res[u]=(int)s[col].size();
			s[col].clear();
		}
	}
	for(int i=1;i<=n;++i) cout<<res[i]<<' ';
}

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

int main(){
	int n,m,b,c;
	cin>>n>>m>>b;
	for(int i=0;i<100;i++){
		if((b+i*60)%(n+m)<=n){
			c=b+i*60;
			goto Exit1;
		}
	}
	c=-1;
Exit1:
	cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 1160
# include <iostream>
# include <cstring>
# include <queue>

using namespace std;
# define pii pair<int,int>
int R, C;
char grid[1005][1005];
int dis[1005][1005];
int dx[] = {-1,0,1,0};
int dy[] = {0,-1,0,1};

bool inside(int r, int c){
  return 1 <= r && r <= R && 1 <= c && c <= C;
}

int main(){
  cin >> R >> C;
  queue<pii> q;
  memset(dis, -1, sizeof(dis));

  for(int i=1; i<=R; i++){
    for(int j=1; j<=C; j++){
      cin >> grid[i][j];
      if(grid[i][j] == '#'){
        q.push({i,j});
        dis[i][j] = 0;
      }
    }
  }

  int ans = 0;
  while(!q.empty()){
    pii cur = q.front();
    q.pop();

    int r = cur.first, c = cur.second;
    ans = max(ans, dis[r][c]);
    for(int d=0; d<4; d++){
      int nxr = r+dx[d];
      int nxc = c+dy[d];
      if(!inside(nxr, nxc)) continue;
      if(dis[nxr][nxc] != -1) continue;
      if(grid[nxr][nxc] == '#') continue;

      dis[nxr][nxc] = dis[r][c] + 1;
      q.push({nxr, nxc});
    }
  }

  cout << ans << endl;
  return 0;
}

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

typedef long long ll;
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define endl '\n'
const int N = 2e5 + 5;
using namespace std;

int main() {
    IO;
    ll n,a[N],X=0;
    cin>>n;
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
        X^=a[i];
    }
    for (int i = 0; i < n; ++i) {
        cout<<(X^a[i])<<" ";
    }

}

Measured memory_bytes: 5108