akhauriyash/Code-Regression huggingface dataset:
#include <math.h>
#include <iostream>
#include<string>
#include <algorithm>
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;

int main()
{
string deck,cpdeck;
int m,h,k;
k=0;
cin >> deck;
while(deck!="-")
{
cin >> m;
cpdeck=deck;
for(int i=0;i<m;i++)
{
cin >> h;
k+=h;
}
k=k%deck.size();
deck=deck.substr(k)+cpdeck.erase(k);
cout << deck << endl;
k=0;
cin >> deck;
}
}



Measured memory_bytes: 3156
#include<iostream>

using namespace std;

int main(){
	
	int n;
	int x, y, z;
	
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x >> y >> z;
		if(x > y && x > z){
			if((x * x) == ((y * y) + (z * z))){
				cout << "YES" << endl;
			}else{
				cout << "NO" << endl;
			}
		}else if(y > x && y > z){
			if((y * y) == ((x * x) + (z * z))){
				cout << "YES" << endl;
			}else{
				cout << "NO" << endl;
			}
		}else {
			if((z * z) == ((x * x) + (y * y))){
				cout << "YES" << endl;
			}else{
				cout << "NO" << endl;
			}
		}
		
	}
	
	return 0;
}


Measured memory_bytes: 3016
import java.io.*;
import java.util.*;

public class Main implements Runnable {
	public static void main (String[] args) {new Thread(null, new Main(), "_cf", 1 << 28).start();}

	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("");

		int a = fs.nextInt(), b = fs.nextInt(), c = fs.nextInt();
		int lf = a-b;
		int res = Math.max(0, c-lf);
		out.println(res);
		out.close();
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) {
			try {
				in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
			}
			catch (Exception e) {
				in = new BufferedInputStream(System.in, BS);
			}
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
		
		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}
		
	}

}

Measured memory_bytes: 23380
import math

a, b, h, m = map(int,input().split())

time = h + m/60

anglea = (time/12)*360 % 360

a_x = a*math.sin(math.radians(anglea))
a_y = a*math.cos(math.radians(anglea))

angleb = time*360 % 360

b_x = b*math.sin(math.radians(angleb))
b_y = b*math.cos(math.radians(angleb))


result = math.sqrt((a_x-b_x)**2 + (a_y-b_y)**2)
print('{:.12f}'.format(result))


Measured memory_bytes: 9508
import math

N = int(input().strip())
grid = []
for i in range(N):
	array = list(map(int, input().strip().split(' ')))
	grid.append(array)

for i in grid:
	i.sort()
	a,b = [i[0],i[1]]
	if(a == b or a+1 == b):
		print(2*a-2)
	else:
		c = int(math.sqrt(a*b))
		if c**2 == a*b:
			c-=1
		if(c*(c+1)>=a*b):
			print(2*c-2)
		else:
			print(2*c-1)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>

#define rep(i, initial_value, max_value) for (uint64_t i{initial_value}; i < max_value; ++i)
#define fore(i, a) for(auto &i:a)
#define each(i, c) \
    for( \
        __typeof((c).begin()) i{(c).begin()}, __typeof((c).end()) end{(c).end()}; \
        i != end; \
        ++i \
    )
#define dbg(x) cerr << __LINE__ << ": " << #x << " = " << (x) << endl
#define all(x) (x).begin(),(x).end()

using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using i64 = int64_t; using i32 = int32_t; using u64 = unsigned long long; using u32 = unsigned long;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<class T>bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }

// ===

void _main() {
  int n;
  int m;

  cin >> n >> m;

  int L[m];
  int R[m];

  rep(i, 0, m) cin >> L[i] >> R[i];

//  sort(L, L + m, greater<int>());
//  sort(R, R + m);

  int maxL{1};
  int minR{n};

  rep(i, 0, m) {
    maxL = max(maxL, L[i]);
    minR = min(minR, R[i]);
  }

//  int r = R[0];
//  chmin(r, n);
//
//  int ans = r - L[0] + 1;
//  chmax(ans, (int)0);

  int ans = minR - maxL + 1;
  ans = max(ans, 0);

  cout << ans << endl;
}

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


int main() {
    char a;
    cin>>a;
    if(a=='A'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='B'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='C'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='D'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='E'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='F'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='G'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='H'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='I'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='J'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='K'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='L'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='M'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='N'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='O'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='P'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='Q'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='R'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='S'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='T'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='U'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='V'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='W'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='X'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='Y'){
        cout<<'A'<<endl;
        return 0;
    }
    else if(a=='Z'){
        cout<<'A'<<endl;
        return 0;
    }
    else{
        cout<<'a'<<endl;
        return 0;
    }
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

int sumOfdigits(int x)
{
    int sum = 0;
    while(x > 0)
    {
        sum += x % 10;
        x /= 10;
    }

    return sum;
}



int main(void)
{
    int N, ans = 45;
    cin >> N;

    for(int a = 1; a < N; a++)
    {
        int b = N - a;
        ans = min(ans, sumOfdigits(a) + sumOfdigits(b));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        N,K = list(map(int, input().split()))
        A = np.asarray(list(str(input())))
    else:
        pass
    A[K-1] = A[K-1].lower()

    print("".join(A))
if __name__ =='__main__':
    main()

Measured memory_bytes: 21884
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N;
string S;
bool good_prefix[500000], good_suffix[500000];

vector<int> KMP(string &S) {
  vector<int> A(S.length()+1, -1);
  A[0] = -1;
  int j = -1;
  rep(i, S.length()) {
    while (j >= 0 && S[i] != S[j]) j = A[j];
    A[i+1] = ++j;
  }
  A.erase(A.begin());
  return A;
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> S;
  N = S.length();
  vector<int> A = KMP(S); rep(i, N) A[i] = i+1 - A[i];
  rep(i, N) good_prefix[i] = !((i+1) % A[i] == 0 && A[i] != i+1);
  if (A[N-1] == 1) {
    cout << N << "\n";
    cout << 1 << "\n";
    return 0;
  }

  reverse(all(S));
  A = KMP(S); rep(i, N) A[i] = i+1 - A[i];
  rep(i, N) good_suffix[i] = !((i+1) % A[i] == 0 && A[i] != i+1);

  if (good_prefix[N-1]) {
    cout << 1 << "\n";
    cout << 1 << "\n";
    return 0;
  }
  int s = 0;
  for (int p=1; p<=N-1; p++) {
    if (good_prefix[p-1] && good_suffix[N-1-p]) s++;
  }
  cout << 2 << "\n";
  cout << s << "\n";
  return 0;
}


Measured memory_bytes: 5276
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
int main()
{
    string S;
    cin >> S;
    string ans = "";
    REP(i, S.size()) ans += "x";
    cout << ans << endl;
}

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

using namespace std;

int main()
{
    int A,B,T;  cin >> A >> B >> T;
    int t = A ,Ans = 0;
    while(t <= T){
        Ans+=B;
        t+=A;
    }
    cout << Ans;
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class CDivideTheProblems {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            Integer[] d = new Integer[n];
            for (int i = 0; i < n; i++)
                d[i] = in.nextInt();

            Arrays.sort(d);

            int answer = d[n / 2] - d[n / 2 - 1];

            out.println(answer);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



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

int main()
{
    int a, b, c, x, y;
    int x1,y1,c1,cmax,total,tmin;

    cin >> a  >> b >> c >> x >> y;

    if (x >= y)
        cmax = 2 * x;
    else
        cmax = 2 * y;

    tmin = INT_MAX;
    for (c1 = 0;c1 <= cmax;c1+=2) {
        x1 = x - c1 / 2;    if (x1 < 0)  x1 = 0;
        y1 = y - c1 / 2;    if (y1 < 0)  y1 = 0;
        total = c1 * c + a * x1 + b * y1;
        if (total < tmin)
            tmin = total;
    }

    cout << tmin << endl;
}


Measured memory_bytes: 3556
# Airplane
import sys
import itertools

input = sys.stdin.readline #sys.stdin.readline()のほうが早いらしい

a_list = list(map(int, input().split()))

combi = list(itertools.combinations(a_list, 2))
sum_list = [sum(i) for i in combi]
print(min(sum_list))

Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define INF (1<<29)

typedef pair<int, int> pii;

int dp[150][10][80]; //[i][j][k] i???????????§??§(i???,j??????)????????§?????????k????????£????????§????????¨??????????°????
vector<pii> stone[150]; // x[0-indexed], suberi
int n, m;

int main() {
	while (cin >> n >> m, n || m) {
		fill(dp[0][0], dp[n][0], INF);
		REP(i, n) stone[i].clear();
		
		REP(i, n) {
			int k;
			scanf("%d", &k);
			REP(j, k) {
				int a, b;
				scanf("%d %d", &a, &b);
				stone[i].push_back(pii(a, b));
			}
		}
		
		REP(i, stone[0].size()) dp[0][i][m] = 0;
		if (m != 0) REP(i, stone[1].size()) dp[1][i][m - 1] = 0;
		
		REP(i, n - 1) REP(j, stone[i].size()) REP(k, m + 1) {
			pii &from = stone[i][j];
			
			// 1????£???°???
			if (i < n - 2 && k > 0) {
				REP(l, stone[i + 2].size()) {
					pii &to = stone[i + 2][l];
					int cost = (from.second + to.second) * abs(from.first - to.first);
					dp[i + 2][l][k - 1] = min(dp[i + 2][l][k - 1], dp[i][j][k] + cost);
				}
			}
			
			REP(l, stone[i + 1].size()) {
				pii &to = stone[i + 1][l];
				int cost = (from.second + to.second) * abs(from.first - to.first);
				dp[i + 1][l][k] = min(dp[i + 1][l][k], dp[i][j][k] + cost);
			}
		}
		
		int ans = INF;
		REP(i, stone[n - 1].size()) REP(j, m + 1) ans = min(ans, dp[n - 1][i][j]);
		if (n > 1) REP(i, stone[n - 2].size()) FOR(j, 1, m + 1) ans = min(ans, dp[n - 2][i][j]);
		if (ans == INF) ans = 0;
		cout << ans << endl;
	}
	return 0;
}

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

int main(void){
    int N,K;
    cin>>N>>K;
    vector<pair<ll,ll>> p(N);
    rep(i,N) cin>>p[i].x>>p[i].y;
    ll res = LLONG_MAX;
    rep(a,N)rep(b,N)rep(c,N)rep(d,N){
        ll L = min({p[a].x, p[b].x, p[c].x, p[d].x});
        ll R = max({p[a].x, p[b].x, p[c].x, p[d].x});
        ll D = min({p[a].y, p[b].y, p[c].y, p[d].y});
        ll U = max({p[a].y, p[b].y, p[c].y, p[d].y});
        int cnt=0;
        rep(i,N) if(L<=p[i].x && p[i].x<=R && D<=p[i].y && p[i].y<=U)
            cnt++;
        if(cnt>=K) res = min(res,(R-L)*(U-D));
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
require("fs").readFileSync("/dev/stdin","utf8").split(/\s/).map(function(i){(j=+i)?console.log(j<=48?'light fly':j<=51?'fly':j<=54?'bantam':j<=57?'feather':j<=60?'light':j<=64?'light welter':j<=69?'welter':j<=75?'light middle':j<=81?'middle':j<=91?'light heavy':'heavy'):0})

Measured memory_bytes: 7644
n = int(input())
*a, = map(int, input().split())

def gcd(x, y):
  return gcd(y, x%y) if y else x

l, r = [], []

for i in range(n):
  l.append(gcd(l[i-1], a[i-1]) if i else 0)
  r.append(gcd(r[i-1], a[n-i]) if i else 0)
print(max([gcd(l[i], r[n-i-1]) for i in range(n)]))


Measured memory_bytes: 14076
#include <stdio.h>
#define N 33000

int main( void ) {
  int i, j;
  int num[ N ];

  for( i = 2; i < N; i++ )
    num[ i ] = 1;
  for( i = 2; i < N; i++ )
    for( j = i*2; j < N; j += i )
      num[ j ] = 0;

  while( 1 ) {
    int n;
    int count = 0;

    scanf( "%d", &n );
    if( !n ) break;

    for( i = 2; i <= n/2; i++ )
        if( num[ i ] && num[ ( n-i ) ] )
          count++;

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

  return( 0 );
}

Measured memory_bytes: 0
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long total = 0;
		for (long i = 0; i < n; i++)
		{
			total += sc.nextInt();
		}
		System.out.println(total / n);
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int DP[(int)1e5 + 2][3];
vector<vector<int>> scores;

int maxHapiness(int i, int j) {
	if (DP[i][j] != -1) { return DP[i][j]; }
	if (i >= scores.size()) { return DP[i][j] = 0; }

	int c1 = maxHapiness(i + 1, (j + 1) % 3);
	int c2 = maxHapiness(i + 1, (j + 2) % 3);

	DP[i][j] = max(c1, c2) + scores[i][j];
	return DP[i][j];
}

int main() {
	for (int i = 0; i < (int)1e5 + 2; i++)
		for (int j = 0; j < 3; j++)
			DP[i][j] = -1;

	int N; cin >> N;
	scores.resize(N);
	for (auto &x : scores) { x.resize(3); cin >> x[0] >> x[1] >> x[2]; }

	cout << max(maxHapiness(0, 0), max(maxHapiness(0, 1), maxHapiness(0, 2))) << endl;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M;
vector <int> Graph[int(1e5+5)];
int DP[int(1e5+5)];
bool visited[int(1e5+5)];

int Solve(int num){
  if (visited[num]) return DP[num];
  visited[num] = true;
  int ans = 0;
  for (int next : Graph[num]){
    ans = max(ans, Solve(next) + 1);
  }
  return DP[num] = ans;
}

int main(){
  cin >> N >> M;
  for (int i = 0; i < M; i++){
    int X, Y; cin >> X >> Y;
    Graph[X].push_back(Y);
  }

  int ans = 0;
  for (int i = 1; i <= N; i++){
    ans = max(ans, Solve(i));
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 11432
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
using ld = long double;
 
constexpr ll MOD = 1000000007;
 
#ifndef ONLINE_JUDGE
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " (" << x.first << " : " << x.second << ")" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "["; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "(" << obj.first << ", " << obj.second << ")"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print_sim_py(void) {cout << endl;}
template <class Head> void print_sim_py(Head&& head) {cout << head;print_sim_py();}
template <class Head, class... Tail> void print_sim_py(Head&& head, Tail&&... tail) {cout << head << " ";print_sim_py(forward<Tail>(tail)...);}
 
#define print(...) print_sim_py(__VA_ARGS__);
#else
#define print(...);
#endif


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

    ll a,b,c,d;

    cin >> a >> b >> c >> d;

    ans = max(a*c, a*d);
    ans = max(b*c, ans);
    ans = max(b*d, ans);

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



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

int main() {

    int N, Y;
    cin >> N >> Y;

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

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<string>

using namespace std;

int main(){
	int k; cin >> k;
	string s; cin >> s;
	int len;
	len = s.length();

	if(len > k){
		cout << s.substr(0,k) << "..." << endl;
	}
	else { 
		cout << s << endl;	
	}
}


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

bool map[11][11] = { false };
int x = 1, y = 1, vec = 0;
int dir[4] = {3, 0, 1, 2};
int dx[2][4] = { {1, 0, -1, 0}, {2, 0, -2, 0} };
int dy[2][4] = { {0, 1, 0, -1}, {0, 2, 0, -2} };
string opr[] = { "R", "D", "L", "U" };

void solve() {
	int tmp = 0;
	bool next = true;
	while (next) {
		for (int i = 0; i < 4; i++) {
			tmp = (dir[vec] + i) % 4;
			if (map[y + dy[0][tmp]][x + dx[0][tmp]]) {
				y += dy[1][tmp];
				x += dx[1][tmp];

				vec = tmp;
				cout << opr[tmp];
				if (x == 1 && y == 1) next = false;
				break;
			}
		}
	}
	cout << endl;
}

int main() {
	string str;
	int tmp;
	for (int i = 0; i < 9; i++) {
		cin >> str;
		if (i % 2 == 0) {
			for (int j = 0; j < 4; j++) {
				tmp = str[j] - '0';
				if (tmp == 1) {
					map[(i / 2) * 2 + 1][j * 2 + 1] = true;
					map[(i / 2) * 2 + 1][(j + 1) * 2] = true;
					map[(i / 2) * 2 + 1][(j + 1) * 2 + 1] = true;
				}
			}
		} else {
			for (int j = 0; j < 5; j++) {
				tmp = str[j] - '0';
				if (tmp == 1) {
					map[(i / 2 + 1) * 2][j * 2 + 1] = true;
					map[(i / 2 + 1) * 2 + 1][j * 2 + 1] = true;
				}
			}
		}
	}
	solve();

	return 0;
}

Measured memory_bytes: 3140
import java.util.Scanner;

public class Main {
    static Scanner sc;
    public static void main(String[] args) {
        sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] a = new int[M];
        int[] c = new int[M];
        for(int i = 0; i < M; i++) {
            a[i] = sc.nextInt();
            int b = sc.nextInt();
            for(int j = 0; j < b; j++) {
                int v = sc.nextInt();
                c[i] += pow(2, v-1);
            }
        }

        long dp[][] = new long[M+1][pow(2,N)];
        for(int i = 0; i <= M; i++) {
            for(int j = 0; j < pow(2,N); j++) {
                dp[i][j] = Integer.MAX_VALUE;
            }
        }
        dp[0][0] = 0;

        for(int i = 1; i <= M; i++) {
            for(int j = 0; j < pow(2,N);j++) {
                dp[i][j] = dp[i-1][j];
            }
            for(int j = 0; j < pow(2,N); j++) {
                dp[i][j|c[i-1]] = Math.min(dp[i][j | c[i-1]], dp[i-1][j] + a[i-1]);
            }
        }
        long ans = dp[M][pow(2,N) - 1] == Integer.MAX_VALUE ? -1: dp[M][pow(2,N) - 1];

        System.out.println(ans);
    }

    static int pow (int a, int b)
    {
        if ( b == 0)        return 1;
        if ( b == 1)        return a;
        if (b % 2 == 0)    return     pow ( a * a, b/2); //even a=(a^2)^b/2
        else                return a * pow ( a * a, b/2); //odd  a=a*(a^2)^b/2

    }
}

Measured memory_bytes: 65328
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use proconio::{marker::*, *};
#[fastout]
fn main() {
    input! {
        n:usize,a:usize,b:usize
    }
    if a + 1 == b {
        yn(false);
        return;
    }

    if (a + b) % 2 == 0 {
        yn(true);
    } else {
        yn(false);
    }
}
pub fn yn(ans: bool) {
    if ans {
        println!("Alice");
    } else {
        println!("Borys");
    }
}


Measured memory_bytes: 2144
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define all(a) a.begin(),a.end()
using namespace std;

 ll mod=1e9 +7;

ll expo(ll base,ll exponent,ll mod){
    ll ans=1;
    while(exponent!=0){
        if(exponent&1) ans=(1LL*ans*base)%mod;
        base=(1LL*base*base)%mod;
        exponent>>=1;
    }
    return ans%mod;
}
 
vector<bool>  prime(90000002,true);
void Sieve() 
{ 
   
    for (int p=2; p*p<=90000001; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=90000001; i += p) 
                prime[i] = false; 
        } 
    } 
}

ll get_val(vector<ll>&ft,ll index)
{
  ll res=0;
  for(;index>=0;index=(index & (index+1))-1)
    res+=ft[index];
  return res;
}

void update(vector<ll>&ft,ll index,ll val)
{
  for(;index<(ll)ft.size();index|=index+1)
    ft[index]+=val;
}

ll mex(vector<ll>&a, ll n)
{
  ll res=0;
  // set<ll>st;
  vector<ll>b(n+1,0);
  for(auto x:a) b[x]++;
    while(res<n && b[res]>0) res++;
  return res;
}



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //   #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif
    
    // Sieve();
   ll tests=1;
 // cin>>tests;
  // ll t=1;
    while(tests--)
    {
      ll n;
      cin>>n;
      if(n%1000==0) {cout<<0; return 0;}
      cout<<1000-(n%1000);

    }

    return 0;
   }

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

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

    int sum = 0, t = n;
    while (t != 0) {
        sum += t % 10;
        t /= 10;
    }

    cout << (n%sum==0 ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 3548
s=str(input())
s=list(s)
ans=0
if s[0]!="C":
  ans=ans+1
if s[1]!="O":
  ans=ans+1
if s[2]!="D":
  ans=ans+1
if s[3]!="E":
  ans=ans+1
if s[4]!="F":
  ans=ans+1
if s[5]!="E":
  ans=ans+1
if s[6]!="S":
  ans=ans+1
if s[7]!="T":
  ans=ans+1
if s[8]!="I":
  ans=ans+1
if s[9]!="V":
  ans=ans+1
if s[10]!="A":
  ans=ans+1
if s[11]!="L":
  ans=ans+1
if s[12]!="2":
  ans=ans+1
if s[13]!="0":
  ans=ans+1
if s[14]!="1":
  ans=ans+1
if s[15]!="6":
  ans=ans+1
print(ans)

Measured memory_bytes: 9100
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long u_ll;
typedef pair<int, int> pair_;
 
const int INF = 1001001001;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int k;
 
int gcd(int a, int b){
    if(b == 0) return a;
 
    return gcd(b, a%b);
}
 
int main(){
    int n;
    cin>>n;
    vector<int> p(n),q(n);

    rep(i,n) cin>>p[i];
    rep(i,n) cin>>q[i];
    vector<int> a(n);
    rep(i,n) a[i]=i+1;

    map<vector<int>, int> mp;
    do{
        mp[a] = mp.size();
    }while(next_permutation(a.begin(),a.end()));

    int ans = abs(mp[p]-mp[q]);
    cout << ans;

    return 0;
}

Measured memory_bytes: 5248
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        
        while(true){
            String[] tests=reader.readLine().split(" ");
            
            if(tests[0].equals("-1")&&tests[1].equals("-1")&&tests[2].equals("-1")) break;
            
            if(tests[0].equals("-1")||tests[1].equals("-1")) System.out.println("F");
            else if(Integer.parseInt(tests[0])+Integer.parseInt(tests[1])>=80) System.out.println("A");
            else if(Integer.parseInt(tests[0])+Integer.parseInt(tests[1])>=65) System.out.println("B");
            else if(Integer.parseInt(tests[0])+Integer.parseInt(tests[1])>=50) System.out.println("C");
            else if(Integer.parseInt(tests[0])+Integer.parseInt(tests[1])>=30){
                if(Integer.parseInt(tests[2])>=50) System.out.println("C");
                else System.out.println("D");
            } 
            else if(Integer.parseInt(tests[0])+Integer.parseInt(tests[1])<30) System.out.println("F");
        }
    }
}

Measured memory_bytes: 24452
#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <string>
#include <cmath>
#include <set>
#include <functional>
#include <map>
#include <queue>
#include <cstring>
#include <stack>
#include <iomanip>
#include <climits>
#include <numeric>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define show(x) cout << #x << " = " << x << endl;
typedef long long ll;
typedef pair<int,int> pii;
int main(){
    int n;
    cin >> n;
    int c = 0;
    int a;
    rep(i,n){
        cin >> a;
        if(a%2==1)c++;
    }
    if(c%2==1)cout << "NO" << endl;
    else cout << "YES" << endl;
}

Measured memory_bytes: 384
from subprocess import*
with open('Main.java','w')as f:f.write(r"""
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		int max = 0;
		int gcd = 0;
		for (int i = 0; i < n; i++) {
			int a = Integer.parseInt(sc.next());
			max = Math.max(max, a);
			gcd = gcd(gcd, a);
		}
		if (k <= max && k % gcd == 0)
			System.out.println("POSSIBLE");
		else
			System.out.println("IMPOSSIBLE");
	}
	static int gcd(int a, int b) {
		if(b == 0) return a;
		return gcd(b, a%b);
	}
}
""")
call(('javac','Main.java'))
call(('java','Main'))

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (auto &e : A) cin >> e;
  vector<int> sieve(1000001);
  for (int i = 0; i < 1000001; i++) sieve[i] = i;
  for (int i = 2; i < 1000; i++) {
    if (sieve[i] != i) continue;
    for (int j = 2; i*j < 1000001; j++) sieve[i*j] = i;
  }
  set<int> div_a;
  int q = gcd(A[0],A[1]);
  int s = 0;
  for (int i = 2; i < N; i++) q = gcd(q,A[i]);
  if (q > 1) cout << "not coprime" << endl;
  else {
    for (auto e : A) {
      set<int> div;
      while (e > 1) {
        div.insert(sieve[e]);
        div_a.insert(sieve[e]);
        e /= sieve[e];
      }
      int a = div.size();
      s += a;
    }
    int t = div_a.size();
    cout << (s == t ? "pairwise coprime" : "setwise coprime") << endl; 
  }
}

Measured memory_bytes: 14788
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
 
int main() {
	int a,b,c,k;
	cin >> a >> b >> c >>k;
	int sum=0;
	
		while(a && k)
		{
			sum++;
			a--;
			k--;
		}
		while(b && k)
		{
			b--;
			k--;
		}
		while(c && k)
		{
			sum--;
			c--;
			k--;
		}
		cout << sum << endl;
	
	return 0;

}

Measured memory_bytes: 3636
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from itertools import islice

IS = lambda: int(input())
IA = lambda: [int(x) for x in input().split()]

N = IS()
A = IA()

h = N//2

a1 = 0
s = 1
for x,y in islice(zip(A, reversed(A)), h):
    a1 += s * (x + y)
    s *= -1
a1 += s * A[h]

ans = [a1]
for a in A[:-1]:
    ans.append((a - ans[-1] // 2) * 2)

print(*ans)

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

using namespace std;

int N;

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

    int cnt = 0;
    bool yes = false;
    for(int i = 0; i < N; i++){
        int d, e;
        cin >> d >> e;
        cin.ignore();

        if(d == e){
            ++cnt;
            if(cnt == 3){
                yes = true;
            }
        } else {
            cnt = 0;
        }
    }
    if(yes){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

    

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
#include <string>
int main(){
    string s;
    cin >>s;
    int ans=0;
    for (int i=1;i<s.size();i++){
        if (s[i]==s[i-1]){
            
            ans++;
            if (s[i-1]=='1'){
                s[i]='0';
            }
            else{
                s[i]='1';
            }
        }
    }
    cout <<endl;
    cout <<ans << endl;

    return 0;
}


Measured memory_bytes: 512
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF 1e18
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
#define int long long
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
struct edge{int to,cost;};
typedef pair<int,int> P;

bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isPrime(int x){if(x==1)return 0;if(x==2)return 1;if(x%2==0)return 0;for(int i=3;i*i<=x;i++)if(x%i==0)return 0;return 1;}
bool iskaibun(string s){for(int i=0;i<s.size()/2;i++)if(s[i]!=s[s.size()-i-1])return 0;return 1;}

signed main (){
    int n,m;cin>>n>>m;
    vector<P> v(m);
    rep(i,0,m)cin>>v[i].se>>v[i].fi;
    sort(all(v));
    int ans=0,last=0;
    rep(i,0,m){
        if(last<v[i].se){
            ans++;
            last=v[i].fi-1;
        }
    }
    cout<<ans<<endl;
}
/*

*/


Measured memory_bytes: 1792
// Apna Time Aayega :)
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define MOD 1000000007
#define vpi vector<pair<int, int>>
#define ll long long int
#define MAX 1000000
#define inf 1000000000
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#include <chrono>

int main() {
    FIO
    int N; cin>>N;
    string x; cin>>x;
    int arr[3][N];
    if(x[0]=='R'){
        arr[0][0] = 1;
        arr[1][0] = 0;
        arr[2][0] = 0;
    }
    else if(x[0]=='G'){
        arr[0][0] = 0;
        arr[1][0] = 1;
        arr[2][0] = 0;
    }
    else{
        arr[0][0] = 0;
        arr[1][0] = 0;
        arr[2][0] = 1;
    }
    // cout<<arr[0][0]<<" "<<arr[1][0]<<" "<<arr[2][0]<<endl;
    for(int i=1; i<N; ++i){
        if(x[i]=='R'){
        arr[0][i] = arr[0][i-1] + 1;
        arr[1][i] = arr[1][i-1];
        arr[2][i] = arr[2][i-1];}
        else if(x[i]=='G'){
        arr[1][i] = arr[1][i-1] + 1;
        arr[0][i] = arr[0][i-1];
        arr[2][i] = arr[2][i-1];}
        else if(x[i]=='B'){
        arr[2][i] = arr[2][i-1] + 1;
        arr[1][i] = arr[1][i-1];
        arr[0][i] = arr[0][i-1];}
        // cout<<arr[0][i]<<" "<<arr[1][i]<<" "<<arr[2][i]<<endl;
    }
    long long int answer = 0;
    for(int i=0; i<N-2; ++i){
        char current = x[i];
        for(int j=i+2; j<N; j++){
            // cout<<"i = "<<i<<"j = "<<j<<endl;
            // cout<<"left = "<<current<<" right = "<<x[j]<<endl;
            int middleElement = (i+j)/2;
            bool valid = true;
            if((i+j)%2!=0) valid = false;
            char next = x[j];
            if(current==next) continue;
            // cout<<"Not matched"<<endl;
            int position = -1;
            // cout<<"Current = "<<current<<" Next = "<<next<<endl;
            if(current=='G' && next=='B') position = 0;
            if(current=='B' && next=='G') position = 0;
            if(current=='R' && next=='G') position = 2;
            if(current=='G' && next=='R') position = 2;
            if(current=='R' && next=='B') position = 1;
            if(current=='B' && next=='R') position = 1;
            
            // else if((current=='R' && next=='G') || (current=='G' && next=='R')) position = 2;
            // else if((current='R' && next=='B') || (current=='B' && next=='R')) position = 1;
            // else if ((current='B' && next=='G') || (current=='G' && next=='B'))position = 0;
            // cout<<"POsition = "<<position<<endl;
            // cout<<"Answer before = "<<answer<<endl;
            // cout<<"Valid = "<<valid<<endl;
            string alpha = "RGB";
            if(valid)
            {
                answer += arr[position][middleElement] - arr[position][i];
                answer += arr[position][j] - arr[position][middleElement];
                if(x[middleElement]==alpha[position]) answer = answer - 1;
            }
            else{
                answer += arr[position][j] - arr[position][i];
            }
            // cout<<"Answer after = "<<answer<<endl;
        }
    }
    cout<<answer<<endl;
}

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

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

  string s, t; cin >> s >> t;
  string ans = "Yes";
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != t[i]) ans = "No";
  }
  if (s.size() + 1 != t.size()) {
    ans = "No";
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
typedef long long ll;

int main(){
    int a,b;
    cin >> a >> b;

    if(a < 6){
        cout << 0 << endl;
    }
    else if(6 <=a && a <= 12){
        cout << b/2 << endl;
    }
    else {
        cout << b << endl;
    }
}

Measured memory_bytes: 256
program test
	implicit none
	integer a, b, c, d
	read *, a, b, c, d
	if (abs(c-a)<= d) then
		print '(A)', "Yes"
	else if (abs(b-a) > d) then
		print '(A)', "No"
	else if (abs(b-c) > d) then
		print '(A)', "No"
	else
		print '(A)', "Yes"
	end if
end program test

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

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

    double h, w, x, y;
    cin >> w >> h >> x >> y;
    int a = 0;

    double s = h * w / 2.0;
    if (x * 2 == w && y * 2 == h)
        a = 1;

    cout << s << ' ' << a << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int t; cin >> t; cin.ignore(); while(t--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
 
int main(){
    fast();
 
/* you get what you work for not what you wish for */
    
    inp(n);
    string a, b;
    cin >> a >> b;
    for(int i=0; i<a.size()*2; i++){
        ll j = i/2;
        if(i&1){
            cout << b[j];
        }
        else{
            cout << a[j];
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
n=int(input())
l=[*map(int,input().split())]
f=lambda p: exit(print(['pairwise','setwise','not'][p]+' coprime'))
from math import *
g=l[0]
for x in l: g=gcd(g,x)
if g>1: f(2)
from collections import *
C=Counter()
b=0
for x in l:
  for i in range(2,int(x**0.5)+1):
    if x%i<1:
      if C[i]: f(1)
      C[i]=1
    while x%i<1: x//=i
    if x<2: break
  if x>1:
    if C[x]: f(1)
    C[x]=1
f(0)

Measured memory_bytes: 197720
using System;

class Shinobu
{
  static int Main(string[] args)
  {
    int n = int.Parse(Console.ReadLine());
    string[] cnt = new string[6];
    
    for (int i = 0; i < n; i++){
      double h = double.Parse(Console.ReadLine());
      if (h >= 185.0){
        cnt[5] += "*";
      } else if (h >= 180.0){
        cnt[4] += "*";
      } else if (h >= 175.0){
        cnt[3] += "*";
      } else if (h >= 170.0){
        cnt[2] += "*";
      } else if (h >= 165.0){
        cnt[1] += "*";
      } else {
        cnt[0] += "*";
      }
    }
    
    for (int i = 0; i < 6; i++){
      System.Console.WriteLine(i + 1 + ":" + cnt[i]);
    }
    
    return 0;
  }
}

Measured memory_bytes: 8924
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int t; cin >> t; cin.ignore(); while(t--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
 
int main(){
    fast();
 
/* you get what you work for not what you wish for */
    
    ll x;
    cin >> x;
    ll num = x/100;
    ll z = x%100;
    ll a[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    ll dp[100];
    for(int i=0; i<100; i++){
        dp[i] = 1e18;
    }
    dp[0] = 0;
    for(ll i=1; i<=99; i++){
        for(ll j=0; j<=5; j++){
            if(j<=i){
                dp[i] = min(dp[i], dp[i-j]+1);
            }
        }
    }
    if(dp[z]>num){
        cout << 0 << endl;
    }
    else{
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n, m;
    cin >> n >> m;
    auto edge = initVec2<int>(n + 1, 0);
    rep(i, m){
        int u, v, w;
        cin >> u >> v >> w;
        edge[u].emplace_back(v);
        edge[v].emplace_back(u);
    }

    int c = 0;
    vector<int> ans(n + 1, -1);
    for(int i = 1; i <= n; i++){
        if(ans[i] != -1){
            continue;
        }
        stack<P> st;
        st.emplace(i, 0);

        while(not st.empty()){
            int v = st.top().first;
            int per = st.top().second;
            st.pop();

            if(ans[v] != -1){
                continue;
            }
            ans[v] = c;

            for(int u : edge[v]){
                if(u == per){
                    continue;
                }
                st.emplace(u, v);
            }
        }
        c++;
    }
    cout << c << endl;

    return 0;
}


Measured memory_bytes: 8820