akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PF push_front
#define PB push_back
#define POF pop_front
#define POB pop_back
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int extgcd(int A,int B,int &X,int &Y){
  int D;
  if(B==0){
    D=A;
    X=1;
    Y=0;
  }else{
    D=extgcd(B,A%B,Y,X);
    Y-=A/B*X;
  }
  return D;
}
int main(){
  int a,b;
  cin>>a>>b;
  int x,y;
  extgcd(a,b,x,y);
  cout<<x<<" "<<y<<endl;
  return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    for (auto &e : a) std::cin >> e;

    int ret = std::numeric_limits<int>::max();
    for (int i = 1; i <= 100; i++) {
        int d = 0;
        for (auto e : a) d += (e - i) * (e - i);
        ret = std::min(ret, d);
    }

    std::cout << ret << std::endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int p[16384] = {0};
	int i,j,n;
	for(i = 2;i <= 16000;i++){
		if(p[i]){continue;}
		for(j = 2*i;j <= 16000;j+=i){
			p[j] = 1;
		}
	}
	while(scanf("%d",&n) , n != 0){
		for(i = n;i >= 5;i--){
			if(!(p[i]) && !(p[i-2])){printf("%d %d\n",i-2,i);break;}
		}
	}
	return 0;
}

Measured memory_bytes: 672
/*

    author : s@if

*/

#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define 		NIL 			-1
#define		 	fi	 		    first
#define 		sec 			second
#define 		MAX 			INT_MAX
#define			INF 			99999999
#define 		ll 			    long long
#define 		PI 			    acos(-1.0)
#define			MOD 			1000000007
#define 		PLL 			pair<ll,ll>
#define 		PII			    pair<int,int>
#define 		ull 			unsigned long long
#define 		For(i,a,b) 		for(int i=a;i<=(int)b;i++)
typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> new_data_set;

//*find_by_order(k)  gives the kth element;
//order_of_key(item)   gives the index(number of element strictly less than item) of item;


inline int in() {int x; scanf("%d", &x); return x; }
bool Check(int N , int pos)	{	return (bool) (N & (1<<pos));}
int Set(int N, int pos) {	return N = N | (1<<pos);}

int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};
int hr[]={-2,-2,-1,+1,+2,+2,-1,+1};
int hc[]={+1,-1,+2,+2,-1,+1,-2,-2};
int dx[]={+1,-1,+0,+0};
int dy[]={+0,+0,+1,-1};

const int MAXN = (int)1e5+9;

double dis(double x1, double y1, double x2, double y2)
{
    double ret = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));

    return ret;
}

int main()
{
/*	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);  */

    int i,j,k,l,m,n,p,q,x,y,u,v,r,tc,t;

    n = in(); double a[n+9], b[n+9];
    vector<int>vv; for(i=0; i<n; i++) vv.push_back(i);

    for(i=0; i<n; i++)
    {
        cin>>a[i]>>b[i];
    }

    double sum = 0;

    do{
        for(i=0; i+1<n; i++)
        {
            sum+=dis(a[vv[i]], b[vv[i]], a[vv[i+1]], b[vv[i+1]]);
        }

    }while(next_permutation(vv.begin(), vv.end()));

    m = 1;

    for(i=1; i<=n; i++)
        m*=i;

    double ans = sum/m;

    cout<<fixed<<setprecision(10)<<ans<<endl;

   // main();

    return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?)


Measured memory_bytes: 256
// #1140935 Solution for 0515: School Road by ryogo 
#include<iostream>
using namespace std;
int dp[20][20];
int main(){
	int a, b;
	int i, j;
	while(cin>>a>>b){
		if(a == 0 && b == 0) { break; }
		int n;
		cin>>n;
		for(i=1;i<=16;i++)for(j=1;j<=16;j++){dp[i][j]=0;}
		for(i=1;i<=n ;i++){
			int x,y;
			cin>>x>>y; dp[y][x]=-1;
		}
		dp[1][1]=1;
		for(i=1;i<=b;i++){
			for(j=1;j<=a;j++){
				if(i==1 && j==1)continue;
				if(dp[i][j]!=-1){
					dp[i][j]=dp[i][j-1]+dp[i-1][j];
				}
				else dp[i][j]=0;
			}
		}
 
		cout<<dp[b][a]<<endl;
	}
}


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

#include<bits/stdc++.h>

using namespace std;

#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mkp make_pair
#define pb push_back
#define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)

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

    int main()
    {
    	ios::sync_with_stdio(false);
    	int n;
    	string a,b,c;
    	cin>>n>>a>>b>>c;
    	int sum=0;
    	for(int i=0;i<n;i++)
    	{
    		if(a[i]==b[i]&&a[i]==c[i])
    			continue;
    		else if(a[i]==b[i]||a[i]==c[i]||b[i]==c[i])
    			sum++;
    		else
    			sum+=2;
    	}
    	cout<<sum<<endl;
    	return 0;
    }

Measured memory_bytes: 256
def main():
    n = int(input())
    total = 0

    for line in range(0, n):
        total += calc()

    print(total)


def calc():
    x, u = map(str, input().split())

    if u == "JPY":
        return int(x)

    if u == "BTC":
        return float(x) * 380000


if __name__ == '__main__':
    main()


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

int isSquare(int num){
    for(int i=0;i<=num;i++){
        if(i*i==num){
            return 1;
        }
    }
    return -1;
}
int main(){
    int n,d;
    cin>>n>>d;
    vector<vector<int>> x(n,vector<int>(d));
    for(int i=0;i<n;i++){
        for(int j=0;j<d;j++){
            cin>>x[i][j];
        }
    }
    int cnt=0;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            int dist=0;
            for(int k=0;k<d;k++){
             dist+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
            }
            if(1==isSquare(dist)){
                cnt++;
            }
        }
    }
    cout<<cnt<<endl;
    
    return 0;
}

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

using namespace std;
int a[300000],b[300000];
set<int> ans;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	memset(b,0,sizeof(b));
	for(int i=n;i>=n/2+1;i--) b[i]=a[i];
	for(int i=n/2;i>=1;i--){
		int now=0;
		for(int j=2*i;j<=n;j+=i){
			if(b[j]==1) now++;
		}
		if((now&1)){
			if(a[i]==1) b[i]=0;
			else b[i]=1;
		}
		else{
			if(a[i]==1) b[i]=1;
			else b[i]=0;
		}
	}
	for(int i=1;i<=n;i++){
		if(b[i]) ans.insert(i);
	}
	cout<<(int)ans.size()<<endl;
	for(auto v:ans) cout<<v<<' ';
	cout<<endl;
	return 0;
}

Measured memory_bytes: 8960
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 2000000010;
constexpr ll INF= 2000000000000000000;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;

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

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

ll mod(ll val, ll M) {
    ll res = val % M;
    if(res < 0) {
        res += M;
    }
    return res;
}

// N^P mod M（ただしM == -1の時はmodを取らない）
template<typename T>
T RS(T N, T P, T M){
    if(P == 0) {
        return 1;
    }
    if(P < 0) {
        return 0;
    }
    if(P % 2 == 0){
        ll t = RS(N, P/2, M);
        if(M == -1) return t * t;
        return t * t % M;
    }
    if(M == -1) {
        return N * RS(N,P - 1,M);
    }
    return N * RS(N, P-1, M) % M;
}

int main() {
    int N;
    cin >> N;
    vector<ll> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    ll Max = vec.at(0);
    ll ret = 0;
    for(int i = 1;i < N;i++) {
        if(Max > vec.at(i)) {
            ret += Max - vec.at(i);
        }
        chmax(Max,vec.at(i));
    }
    cout << ret << endl;
}

Measured memory_bytes: 4788
#include <functional>
#include <vector>
#include <iostream>
using namespace std;

const int M = 998244353;
long long modexp(int x, long long e, int m) {
    long long ans = 1, p = x % m;
    while (e > 0) {
        if (e % 2 != 0) ans = (ans * p) % m;
        p = (p * p) % m;
        e >>= 1;
    }
    return ans;
}

int bruteforce(int n, string &s) {
    int x = 0;
    for (int i = 0; i < n; i++) x = 2 * x + (s[i] - '0');
    int ans = 0;
    function<int(int)> step = [&](int y) {
        const int b = y & 1;
        return b == 0 ? (1 << (n - 1)) + y / 2 : y / 2;
    };
    for (int y = 0; y <= x; y++) {
        int z = y;
        do { ans++; z = step(z); } while (y != z);
    }
    return ans;
}

int main() {
    int n;
    string s;
    cin >> n >> s;
    vector<long long> h(n+1, 1);
    vector<bool> b(n+1, true);
    for (int p = 2; p <= n; p += 2) {
        b[p] = false;
        h[p] *= -1;
    }
    for (int p = 3; p <= n; p++) {
        if (!b[p]) continue;
        for (int q = p; q <= n; q += p) {
            b[q] = false;
            h[q] *= 1 - p;
            h[q] %= M;
        }
    }
    vector<int> factors;
    for (int i = 1; i <= n; i += 2)
        if (n % i == 0) factors.push_back(i);
    int a[n+1];
    a[n] = n;
    for (int k = 1; k <= n; k++) {
        if (n % k != 0) continue;
        int j = 0;
        while (j + k < n && s[j] != s[j + k]) j++;
        a[k] = j + k;
    }
    // for (int k = 0; k <= n; k++)  cerr << k << " " << a[k] << endl;
    function<long long(int, int)> f = [&](int l, int k) {
        int d = n / k;
        if (l >= d) return (long long)(a[d] == l);
        else return modexp(2, d - l - 1, M);
    };
    long long ans = 0;
    for (int l = 0; l <= n; l++) {
        if (l < n && s[l] == '0') continue;
        for (int k : factors) {
            // cerr << l << " " << k << " " << 2LL * n / k * h[k] % M * f(l, k) % M << endl;
            ans += 2LL * n / k * h[k] % M * f(l, k) % M;
        }
    }
    cout << (ans % M + M) % M << endl;
    // if (n <= 20) {
    //     int ans2 = bruteforce(n, s);
    //     if (ans != ans2) {
    //         cerr << "WA on " << s << endl
    //              << "expected " << ans2 << ", got " << ans << endl;
    //     } else {
    //         cerr << "OK\n";
    //     }
    // }
}


Measured memory_bytes: 4800
import sys
import numpy as np


def read():
    return sys.stdin.readline().rstrip()


def main():
    h, w, m = map(int, read().split())
    target = set()
    row = np.zeros(h, dtype=int)
    col = np.zeros(w, dtype=int)
    for _ in range(m):
        hi, wi = [int(i) - 1 for i in input().split()]
        target.add((hi, wi))
        row[hi] += 1
        col[wi] += 1
    r = np.arange(h)[row == row.max()]
    c = np.arange(w)[col == col.max()]
    ans = row.max() + col.max()
    for ri in r:
        for ci in c:
            if (ri, ci) not in target:
                print(ans)
                return
    print(ans - 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 85092
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
class Program
{
    static void Main()
    {
        //入力
        //int[] input = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        string[] input = Console.ReadLine().Split().Select(i => i).ToArray();
        //string input= Console.ReadLine();
        Console.WriteLine((input[0][0]+""+input[1][0]+""+input[2][0]).ToUpper());


        /*
        //処理速度計測
        var sw = new System.Diagnostics.Stopwatch();
        sw.Start();
        //解法
 
        //処理速度表示
        sw.Stop();
        TimeSpan ts = sw.Elapsed;
        Console.WriteLine((int)(Math.Floor((ts).TotalMilliseconds))+"ms");
        */
        Console.ReadLine();

    }
}

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

using namespace std;

vector<ll> a;
ll n,k;

bool f(ll comp){
	ll i,j;
	ll sum=0;
	for(i=0;i<a.size()-1;i++){
		if(a[i]>0){
			ll l,r,m;
			l=i;
			r=n-1;
			while(l+1<r){
			//	cout << 000 << endl;
			//	cout << l << " " << r << endl;
				m=(l+r)/2;
				if(a[i]*a[m]<comp){
					l=m;
				}
				else{
					r=m;
				}
			}
			sum=sum+l-i;
			if(a[i]*a[r]<comp){
				sum++;
			}
			//cout << sum << endl;
		}
		else{
			ll l,r,m;
			l=i;
			r=n-1;
			while(l+1<r){
			//	cout << 111 << endl;
			//	cout << l << " " << r << endl;
				m=(l+r)/2;
				if(a[i]*a[m]<comp){
					r=m;
				}
				else{
					l=m;
				}
			}
			//cout << l << " " << i << endl;
			if(a[i]*a[r]<comp){
				sum=sum+n-1-l;
			}
			//cout << sum << endl;
		}
	}
	//cout << comp << " " << sum << " " << k << endl;
	if(sum<k){
		return true;
	}
	else{
		return false;
	}
}

int main()
{
//    ios_base::sync_with_stdio(false);
//    cin.tie(0);
	ll i,j,t;
	cin >> n >> k ;
	for(i=0;i<n;i++){
		cin >> t;
		a.push_back(t);
	}
	stable_sort(a.begin(),a.end());
	ll l,r;
	l=-1000000000000000000;
	r=1000000000000000000;
	ll m;

	while(l+1<r){
		//cout << l << " " << r << endl;
		m=(l+r)/2;
		if(f(m)){
			l=m;
		}
		else{
			r=m;
		}
	}

	cout << l << endl;
    return 0;
}

Measured memory_bytes: 2672
from collections import deque
from copy import deepcopy

n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]

def BFS(m):
  t_l=deepcopy(l)
  del t_l[m]

  tree=[[] for j in range(n)]
  for a,b in t_l:
    a-=1
    b-=1
    tree[a].append(b)
    tree[b].append(a)

  dist=[-1 for i in range(n)]
  dist[0]=0

  que=deque()
  que.append(0)

  while que:
    x=que.popleft()
    for i in tree[x]:
      if dist[i]==-1:
        que.append(i)
        dist[i]=dist[x]+1

  return dist

ans=0
for i in range(m):
  d=BFS(i)
  if -1 in d:
    ans+=1

print(ans)

Measured memory_bytes: 3436
use std::cmp::Ordering;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let _: usize = read(&mut stdin_lock, &mut buf, b' ');
    let m: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut cv = vec![(0i32, 0i32, 0i32, 0i32); m];
    for i in 0..m {
        cv[i].0 = i as i32;
        cv[i].1 = read(&mut stdin_lock, &mut buf, b' ');
        cv[i].2 = read(&mut stdin_lock, &mut buf, b'\n');
    }

    cv.sort_by(|&(_, p1, y1, _), &(_, p2, y2, _)| match p1.cmp(&p2) {
        Ordering::Less => Ordering::Less,
        Ordering::Greater => Ordering::Greater,
        Ordering::Equal => y1.cmp(&y2),
    });
    let mut j = 1;
    cv[0].3 = 1;
    for i in 1..m {
        j = if cv[i - 1].1 == cv[i].1 { j + 1 } else { 1 };
        cv[i].3 = j;
    }
    cv.sort_by(|&(i1, _, _, _), &(i2, _, _, _)| i1.cmp(&i2));

    for i in 0..m {
        println!("{:06}{:06}", cv[i].1, cv[i].3);
    }
}


Measured memory_bytes: 9724
use std::collections::VecDeque;

fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n = sc.read();
    let m: usize = sc.read();
    let mut graph = vec![vec![]; n];
    for _ in 0..m {
        let a = sc.read::<usize>() - 1;
        let b = sc.read::<usize>() - 1;
        graph[a].push(b);
        graph[b].push(a);
    }
    let q: usize = sc.read();
    let mut potential = vec![-1; n];
    let mut color = vec![0; n];
    let vdc: Vec<_> = (0..q)
        .map(|_| (sc.read::<usize>() - 1, sc.read::<i64>(), sc.read::<usize>()))
        .collect();

    for (root, distance, c) in vdc.into_iter().rev() {
        if potential[root] >= distance {
            continue;
        }
        let mut q = VecDeque::new();
        q.push_back(root);
        if color[root] == 0 {
            color[root] = c;
        }
        potential[root] = distance;
        while let Some(v) = q.pop_front() {
            if potential[v] == 0 {
                continue;
            }
            for &next in graph[v].iter() {
                if color[next] == 0 {
                    color[next] = c;
                }
                if potential[next] < potential[v] - 1 {
                    potential[next] = potential[v] - 1;
                    q.push_back(next);
                }
            }
        }
    }

    for c in color.into_iter() {
        println!("{}", c);
    }
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 22780
#include<bits/stdc++.h>
using namespace std;
#define sz(a) int(a.size())

int main(){
	vector<int> a(3);
	for(int i = 0; i < 3; i++){
		cin>>a[i];
	}
	sort(a.begin(), a.end());
	int first = a[0];
	int second = a[2] * 10 + a[1];
	cout<<first + second <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(a) a.begin(), a.end()
#define P pair<int, int>
#define F first
#define S second
#define mod 1000000007
#define MOD 998244353
#define INF 10000000000000000
int dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
int dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
int dx4[4] = {-1, 0, 1, 0};
int dy4[4] = {0, -1, 0, 1};
template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void allcout(auto V) {
    for(auto x : V) cout << x << ' ';
    cout << endl;
}
signed main() {
    int H, N;
    cin >> H >> N;
    int A[N], B[N];
    rep(i, N) cin >> A[i] >> B[i];
    vector<int> dp(H + 1, INF);
    dp[0] = 0;
    rep(i, N) {
        int a = A[i], b = B[i];
        rep(j, H + 1) {
            chmin(dp[min(H, j + a)], dp[j] + b);
        }
    }
    cout << dp[H] << endl;
}


Measured memory_bytes: 384
import java.util.*;


/**
 * Created by santa on 2016/10/16.
 */

public class Main {

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

        int N = scanner.nextInt();
        String s = scanner.next();

        int val = 0;
        int left = N;
        int right = 0;
        for (int i = N - 1; i >= 0; i--) {
            if(s.charAt(i) == ')'){
                val += 1;
            }else{
                if(val > 0){
                    val--;
                    left -= 2;
                }else{
                    right += 1;
                    left--;
                }
            }

        }
        for (int i = 0; i < left; i++) {
            System.out.print("(");
        }
        System.out.print(s);
        for (int i = 0; i < right; i++) {
            System.out.print(")");
        }
        System.out.println();

        

    }// mainMethod






} // MainClass


Measured memory_bytes: 21716
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<min(min(a+b,b+c),a+c);
}

Measured memory_bytes: 256
function main(input) {
	var a = input[0].split(' ');

	if((parseInt(a[0]) < parseInt(a[1])) & (parseInt(a[1]) < parseInt(a[2]))){
		console.log("Yes")
	}else{
		console.log("No")
	}
}

var input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main(input);
});

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

int main() {
  int a,b,c,d;
  cin >> a>>b>>c>>d;
  int ans = 0;
  if(a>=b)
    ans+=b;
  else
    ans+=a;
  if(c>=d)
    ans+=d;
  else
    ans+=c;
  cout << ans << endl;
}


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

int main()
{
    int N,a,r;
    r=0;
    cin >>N;
    string S;
    cin>>S;
    if(N%2!=0){
        cout <<"No"<<endl;
    }else{
        for(int i=0;i<N/2;i++){
            if(S.at(i)==S.at(i+(N/2))){
                r++;
            }
        }
        if(r==N/2){
            cout <<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }

    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; ++i)
#define all(x) begin(x), end(x)
#define gets(s) fgets(s,size(s),stdin)
using namespace std;
typedef long long ll;
typedef string str;
template<typename T>
using vec=vector<T>;
template<typename T>
using uset=unordered_set<T>;
template<typename T,typename S>
using umap=unordered_map<T,S>;

const int mod=1000000007;
const double pi=3.1415926535;

int main() {
	int x,y;
	scanf("%d%d",&x,&y);
	if(!(y&1) && y>=2*x && y<=4*x) puts("Yes");
	else puts("No");
	return 0;
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

ll A[13][13];

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

  int n, m, x;

  cin >> n >> m >> x;

  vector<int> c(n);
  rep(i, n){
    cin >> c[i];
    rep(j, m){
      cin >> A[i][j];
    }
  }

  bool ok = false;
  ll ans = 1e12;
  for(int bit = 0; bit < (1<<n); bit++){

    vector<ll> R(m);
    rep(i, m){
      R[i] = 0;
    }
    ll tans = 0;
    for(int i = 0; i < n; i++){
      if(bit & (1<<i)){
        tans += c[i];
        rep(j, m){
          R[j] += A[i][j];
        }
      }
    }

    bool okok = true;
    rep(i, m){
      if(R[i] < x){
        okok = false;
      }
    }

    if(okok){
      ok = true;
      chmin(ans, tans);
    }

  }

  if(ok){
    cout << ans << endl;
  }else{
    cout << -1 << endl;
  }




  
  return 0;
}


Measured memory_bytes: 3660
// ABEY SAALE
// QUESTION KHUD KR SOLUTION KYU DEKH RHA H
 
 
 
 
 
 
 
 
//MAAF KIJIYEGA ME GUSSE ME IDHAR UDHAR NIKAL JATA HU
#include<bits/stdc++.h>
#define mod 998244353
#define fr first
#define se second
#define ll long long
#define PI 3.1415926535 
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;

ll fac[2000005];
void pre(){ fac[0]=1; fac[1]=1; for(int i=2;i<200005;i++) fac[i]=(i*fac[i-1])%mod;}
ll power(ll a,ll b){ll res=1;while(b){if(b&1) res=(res*a)%mod;a=(a*a)%mod;b=b/2;}return res%mod;}
ll ncr(ll n,ll r){return ((fac[n]*power(fac[r],mod-2))%mod*power(fac[n-r],mod-2))%mod;}
// DEKHIYE JI  WALID JO THE ABBA HAMARE WO YEH function CHHOD KR GYE THE
ll n,s;
ll a[3005];
ll dp[3005][3005];
signed main()
{   


      
      senky_bansal
      IIIT_ALLAHABAD
      
      // pre();
      ll t;
      // cin>>t;
      t=1;
      while(t--)
      { 
        ll ans =0;
        cin>>n>>s;
         for(int i=0;i<n;i++)
         {
             cin>>a[i];
             memcpy(dp[i+1],dp[i],sizeof(dp[i+1]));
             dp[i+1][a[i]]=(dp[i+1][a[i]]+i+1)%mod;
             for(int j=0;j+a[i]<=s;j++)
             {
                 dp[i+1][j+a[i]]+=dp[i][j];
                 dp[i+1][j+a[i]]%=mod;
             }
             ans+=dp[i+1][s];
             ans%=mod;
         }
         cout<<ans<<endl;
         

      }
      






}



























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

#define mem(a,n) memset(a,n,sizeof(a))
#define memc(a,b) memcpy(a,b,sizeof(b))
#define rep(i,a,n) for(int i=a;i<n;i++) ///[a,n)
#define pb push_back
#define IO ios::sync_with_stdio(false)
#define fre freopen("in.txt","r",stdin)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
typedef long long ll;
typedef unsigned long long ull;
const double PI=acos(-1.0);
const double E=2.718281828459045;
const double eps=1e-8;
const int INF=0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
const int MOD=1e3;
const int N=1e2+5;
const ll maxn=2e5+5;
const int dir[4][2]= {-1,0,1,0,0,-1,0,1};

int n,m;
int a[N],b[N],c[N],d[N];
int ans,match[N];
bool vis[N];
vector<int> vec[N];
bool dfs(int u)
{
	for(auto v:vec[u])
	{
	    if(vis[v]) continue;
		vis[v]=1;
		if(!match[v]||dfs(match[v]))
		{
			match[v]=u;
			return true;
		}
	}
	return false;
}
int main()
{
    IO;
	cin>>n;
	rep(i,1,n+1) cin>>a[i]>>b[i];
	rep(i,1,n+1) cin>>c[i]>>d[i];
	rep(i,1,n+1)
	{
		rep(j,1,n+1)
		{
			if(a[i]<=c[j]&&b[i]<=d[j]) vec[i].pb(j);
		}
	}
	rep(i,1,n+1)
	{
		mem(vis,0);
		if(dfs(i)) ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Scanner;

class Main
{
	public static void main(String[] args) throws Exception
	{
		invoke(System.in);
	}

	public static void	invoke(InputStream is) throws IOException
	{
		try (Scanner in = new Scanner(is))
		{
			int	n = in.nextInt();
			int[]	d = new int[n];
			for (int i = 0; i < d.length; ++i)
			{
				d[i] = in.nextInt();
			}

			Arrays.sort(d);
			int	cnt = 1;
			int	x = d[0];
			for (int i = 1; i < d.length; ++i)
			{
				if (d[i] != x)
				{
					x = d[i];
					++cnt;
				}
			}
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 21076
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        int n = sc.NextInt();
        int a = sc.NextInt();
        int b = sc.NextInt();

        string answer = Math.Abs(a - b) % 2 == 0 ? "Alice" : "Borys";

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 13140
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int i, k, searched, search;
		int[][] data = new int[N][3];
		int[] point = new int[N];

		for(i = 0; i < N; i++){
			for(k = 0; k < 3; k++){
				data[i][k] = sc.nextInt();
			}
		}

		for(i = 0; i < N; i++){
			for(k = 0; k < 3; k++){
				search = data[i][k];
				for(searched = 0; searched < N; searched++){
					if(i == searched)continue;
					if(search == data[searched][k])search = 0;
					if(search == 0)break;
				}
				point[i] += search;
			}
		}


		for(i = 0; i < N; i++){
			System.out.println(point[i]);
		}
	}
}

Measured memory_bytes: 28764
#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++)

int main() {
    int64_t N, A, B, amari;
    cin >> N >> A >> B;
    amari = min(N % (A + B), A);
    cout << N / (A + B) * A + amari << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
#include <stdio.h>

int main()
{
    long long int h, i, n, a, t = 0;    
    scanf("%lld %lld", &h, &n);
    for (i = 0; i < n; i++)
    {
        scanf("%lld", &a);
        t += a;
    }
    if(t >= h)
        printf("Yes");
    else
        printf("No");
	return 0;
}



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

 int main(void){
  char output[4];
  output[3] = '\0';
  std::string str;
  std::cin >> str;
  const char* c = str.data();
  for(int i= 0;i<3;i++){
    if(c[i]=='9') output[i]= '1';
 else  if(c[i]=='1') output[i]='9';

}
  std::cout << output;
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> pii;
#define FOR(i, n) for(int i = 1; i<=n; i++)
#define F0R(i, n) for(int i = 0; i<n; i++)
#define mp make_pair
#define pb push_back
#define f first
#define s second


//var 
const LL MOD = 998244353;
LL dp[200005], n, k;
pii rng[15];

void upd(LL g, LL k){
	for(; g<=n; g+=(g&-g)){
		dp[g] += k;
		dp[g] %= MOD;
	}
}

LL ge(LL g){
	if(g <= -1) return 0;
	LL res = 0;
	for(; g>0; g-=(g&-g)){
		res += dp[g];
		res %= MOD;
	} res += dp[0]; res %= MOD;
	return res;
}

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

	cin >> n >> k;
	FOR(i, k)
		cin >> rng[i].f >> rng[i].s;
	
	dp[0] = 1;
	FOR(j, n){
		FOR(i, k){
			if(j - rng[i].f < 0) continue;
			upd(j, ge(j-rng[i].f) - ge(max((LL)-1, j-rng[i].s-1)));
		}
		//cout << j << " " << (ge(j) - ge(j-1)) << endl;
	}
	
	cout << (ge(n-1) - ge(n-2) + MOD) % MOD << endl;


	cout.flush();
	return 0;
}

Measured memory_bytes: 5144
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Diagnostics;
using static System.Math;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;

public static class P
{
    static int[] a;
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        a = Console.ReadLine().Split().Select(int.Parse).ToArray();

        Top2[] top = Enumerable.Repeat(0, a.Length).Select(_ => new Top2()).ToArray();

        for (int i = 0; i < a.Length; i++)
        {
            var top2 = new Top2();
            for (int ind = 1; ind <= i; ind <<= 1)
                if ((i & ind) != 0) top[i].Update(top[i - ind]);
            top[i].Update(i);
        }
        int[] res = new int[a.Length];
        for (int i = 1; i < res.Length; i++)
            res[i] = Max(res[i - 1], top[i].First + top[i].Second);

        Console.WriteLine(string.Join("\n", res.Skip(1)));
    }

    class Top2
    {
        public int FirstInd = -1;
        public int SecondInd = -1;
        public int First { get { return a[FirstInd]; } }
        public int Second { get { return a[SecondInd]; } }
        public void Update(Top2 another)
        {
            Update(another.FirstInd);
            Update(another.SecondInd);
        }
        public void Update(int ind)
        {
            if (ind == -1 || ind == FirstInd || ind == SecondInd) return;
            if (FirstInd == -1 || First < a[ind])
            {
                SecondInd = FirstInd;
                FirstInd = ind;
            }
            else if (SecondInd == -1 || Second < a[ind])
            {
                SecondInd = ind;
            }
        }
    }
}


Measured memory_bytes: 55192
n, m = map(int, input().split())
lis = []
for i in range(n):
    lis.append(list(map(int, input().split())))
b = [[1, 1, 1], 
     [1, 1, -1], 
     [1, -1, 1], 
    [1, -1, -1], 
    [-1, 1, 1], 
    [-1, 1, -1], 
    [-1, -1, 1], 
    [-1, -1, -1]]
sum_lis = []
for i in range(8):
    sum_row_lis = []
    for j in range(n):
        sum_row_lis.append(b[i][0] * lis[j][0] + b[i][1] * lis[j][1] + b[i][2] * lis[j][2])
    sum_lis.append(sum_row_lis)
val_lis = []
for i in range(8):
    val_lis.append(sum(sorted(sum_lis[i], reverse = True)[0:m]))
print(max(val_lis))

Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる




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

  ll n,l;
  cin>>n>>l;

  vector<ll> p(n);
  rep(i,n){
    cin>>p[i];
  }

  int memo=-1;
  repo(i,n){
    if(p[i]+p[i-1]>=l) memo=i-1;
  }

  if(memo==-1){
    cout << "Impossible" << endl;
    return 0;
  }

  cout << "Possible" << endl;
  repo(i,memo+1){
    cout << i << endl;
  }
  for(int i=n-1;i>memo+1;i--){
    cout << i << endl;
  }
  cout << memo+1 << endl;


}

Measured memory_bytes: 3968
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

const long long M = 1e9 + 7;
const int MAXN = 1e5 + 5;
long long dp[MAXN][13];

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

	string s;
	cin >> s;
	int n = s.length();

	vector<long long> base(n);
	base[0] = 1;
	for (int i = 1; i < n; i++)
		base[i] = (base[i-1] * 10) % 13;

	long long r = 0;
	vector<long long> qbase;
	for (int i = 0; i < n; i++) {
		char c = s[n-1-i];
		if (c == '?')
			qbase.push_back(base[i]);
		else
			r = ((c - '0') * base[i] + r) % 13;
	}

	int m = qbase.size();
	dp[0][0] = 1;
	for (int i = 1; i <= m; i++) {
		for (int x = 0; x < 10; x++) {
			for (int j = 0; j < 13; j++) {
				int k = (qbase[i-1] * x + j) % 13;
				dp[i][k] += dp[i-1][j];
				if (dp[i][k] > M) dp[i][k] -= M;
			}
		}
	}
	/*
	for (int i = 0; i <= m; i++) {
		for (int j = 0; j < 13; j++) printf("%lld ", dp[i][j]);
		printf("\n");
	}
	*/

	r = (5 + 13 - r) % 13;
	printf("%lld\n", dp[m][r]);
}


Measured memory_bytes: 12276
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}
// mod 1000000007 の世界で a += b する関数
void add(long long& a, long long b) {
	a += b;
	if (a >= MOD) a -= MOD;
}
ll slide(vector<ll>& v, ll a, ll b) {
	ll azv = abs(v[0] - a);
	ll bzv = abs(v[0] - b);
	ll aov = abs(v[1] - a);
	ll bov = abs(v[1] - b);
	v[0] = a;
	v[1] = b;
	return max((azv + bov), (bzv + aov));
}
bool use[105];	int che[200010];
ll c[200010];
ll calc(int s, int g, int check) {
	ll ct = 0;
	ll bt = 0;
	ll pt = 1;
	for (int j = s; j <= g; j++)
	{
		if (c[j] == check) bt++;
		else {
			pt *= (bt - ct);
			pt %= INF;
			ct++;
		}
	}
	return pt;
}

void solv() {


	int n;
	cin >> n;
	ll p[100010];
	ll d[100010];
	for (size_t i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	for (size_t i = 0; i < n; i++)
	{
		cin >> d[i];
	}
	sort(p, p + n);
	sort(d, d + n);
	ll pc = 0;
	ll dc = 0;
	ll db = n * 2;
	for (size_t i = 0; i < db; i++)
	{
		if (pc == n) {
			c[i] = -1;
		}
		else if (dc == n) {
			c[i] = 1;
		}
		else if (p[pc] < d[dc]) {
			c[i] = 1;
			pc++;
		}
		else {
			c[i] = -1;
			dc++;
		}
	}
	int gr = 0;
	int bef = 0;
	for (size_t i = 0; i < db; i++)
	{
		che[i] = bef;
		gr += c[i];
		if (gr == 0) {
			bef = i + 1;
		}
	}

	ll res = 1;
	for (int i = db - 1; i >= 0; i--)
	{
		res *= max(calc(che[i],i,1),calc(che[i],i,-1));
		res %= INF;
		i = che[i];
	}
	cout << res << endl;
}
int main() {
	//COMinit();
	solv();

	return 0;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
template<class T>bool chmax(T &a, const T &b) { 
  if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) {
  if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  int n;
  cin>>n;

  vector<ll> p(n);
  rep(i,n){
    cin>>p[i];
  }

  ll allgcd=p[0];
  repo(i,n){
    allgcd=gcd(allgcd,p[i]);
  }

  if(allgcd!=1){
    cout << "not coprime" << endl;
    return 0;
  }

  vector<ll> q(1010101);
  rep(i,n){
    for(int j=1;j*j<=p[i];j++){
      if(p[i]%j!=0) continue;
      int a=j;
      int b=p[i]/j;
      bool asosu=true;
      if(a==1) asosu=false;
      for(int k=2;k*k<=a;k++){
        if(a%k==0) {
          asosu=false;
          break;
        }
      }
      if(asosu) {
        q[a]++;
        if(q[a]>=2) {
          cout << "setwise coprime" << endl;
          return 0;
        }
      }

      if(b==a) continue;
      bool bsosu=true;
      for(int k=2;k*k<=b;k++){
        if(b%k==0) {
          bsosu=false;
          break;
        }
      }      
      if(bsosu) {
        q[b]++;
        if(q[b]>=2){
          cout << "setwise coprime" << endl;
          return 0;
        }
      }
    }
  }

  cout << "pairwise coprime" << endl;
}


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

int main() {
	int n;
	cin >> n;
	vector<vector<int>> A(n);
	int q;
	cin >> q;
	for (int i = 0; i < q; ++i) {
		int query;
		cin >> query;
		if (query == 0) {
			int t, x;
			cin >> t >> x;
			A[t].push_back(x);
		}
		else if (query == 1) {
			int t;
			cin >> t;
			if (!A[t].empty()) {
				cout << A[t][0];
				for (int i = 1; i < A[t].size(); ++i) cout << ' ' << A[t][i];
			}
			cout << endl;
		}
		else {
			int t;
			cin >> t;
			A[t].clear();
		}
	}
}


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

#define rng(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define pb push_back
#define eb emplace_back
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed

int main() {
  int n, m, a, b, ans = 0;
  string s;
  cin >> n >> s;
  //vector<int> v(n), c(n);
  if(n >= s.size()) {
    cout << s << endl;;
    return 0;
  }
  rep(i, n) cout << s.at(i);
  cout << "..." << endl;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cstdlib> 
#include <cmath>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
using namespace std;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	
	if (a == b) {
		cout << c << endl;
		return 0;
	}
	else if (b == c) {
		cout << a << endl;
		return 0;
	} else if (a == c) {
		cout << b << endl;
		return 0;
	}
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())

#d=a
#e=b
#f=c

#result='{0}{1}{2}'.format(d,e,f)
    
    
if b<a:
    if c<b:
        if c<a:
            print(c,end=" ")
            print(b,end=" ")
            print(a)

    elif a<c:
        if b<c:
            print(b,end=" ")
            print(a,end=" ")
            print(c)
            
    elif c<a:
        if b<a:
            print(b,end=" ")
            print(c,end=" ")
            print(a)
            
elif a<b:
    if b<c:
        if a<c:
            print(a,end=" ")
            print(b,end=" ")
            print(c)
            
    elif c<a:
        if c<b:
            print(c,end=" ")
            print(a,end=" ")
            print(b)
    
    elif c<b:
        if a<b:
            print(a,end=" ")
            print(c,end=" ")
            print(b)
            


Measured memory_bytes: 5604
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	long long a, b, k[100005], cheap = 1000000005, most = 0;
	cin >> a >> b;
	for (int i = 0; i < a; ++i) {
		cin >> k[i];
		cheap = min(cheap, k[i]);
		k[i] -= cheap;
		most = max(most, k[i]);
	}
	int ans = 0;
	for (int i = 0; i < a; ++i) {
		if (k[i] == most) ++ans;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1024
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE BangPatterns #-}

module Main where

import Debug.Trace
--import Data.List
--import qualified Data.Set.Strict as Set
--import qualified Data.Map.Strict as Map

main :: IO ()
main = do
  a <- read <$> getLine
  --a `traceShow`
  print $ solve a

solve :: Int -> Int
solve a = a + a * a + a * a * a


Measured memory_bytes: 3872
// AOJ 2249: Road Construction
// 2017.11.15 bal4u@uu

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX 20000
typedef struct { int t, node; } QUE;
QUE que[MAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		QUE t = que[i]; que[i] = que[min]; que[min] = t;
		min_heapify(min);
	}
}

int deq(int *n)
{
	if (qsize == 0) return 0;
	*n = que[0].node;
	que[0] = que[--qsize];
	min_heapify(0);
	return 1;
}

void enq(int n, int t)
{
	int i, min;

	i = qsize++;
	que[i].node = n, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		QUE tt = que[i]; que[i] = que[min]; que[min] = tt;
		i = min;
	}
}

#define INF 0x55555555
#define TOSIZE 500
typedef struct { int len, lim, *to, *d, *c; } TBL;
TBL *tbl; int *node; char *visited; int size;
int *cost;

void dijkstra(int start)
{
	int i, k, s, e;
	TBL *tp;

	qsize = 0;
	memset(node, INF, sizeof(int)*size);
	memset(cost, INF, sizeof(int)*size);
	memset(visited, 0, sizeof(char)*size);
	node[start] = 0;
	enq(start, 0);
	while(deq(&s)) {
//		if (s == goal) break;
		if (visited[s]) continue;
		visited[s] = 1;
		tp = tbl + s;
		for (i = 0; i < tp->len; i++) {
			e = tp->to[i];
			if (visited[e]) continue;
			k = node[s] + tp->d[i];
			if (k < node[e]) {
				node[e] = k, enq(e, k);
				cost[e] = tp->c[i];
			} else if (k == node[e] && cost[e] > tp->c[i]) cost[e] = tp->c[i];
		}
	}
}


char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

void checkMem(TBL *p)
{
	int *to;
	if (p->len < p->lim) return;
	to = calloc(2 * p->lim + 2, sizeof(int));
	memcpy(to, p->to, p->lim * sizeof(int));
	p->lim *= 2;
	free(p->to);
	p->to = to;
}

int main()
{
	int n, m, i, k, u, v, d, c, ans;
	TBL *tp;

	while (fgets(p=buf, 40, stdin) && *p != '0') {
		size = n = getint(), p++, m = getint();

		tbl = calloc(size+2, sizeof(TBL));
		node = calloc(size+2, sizeof(int));
		visited = calloc(size+2, sizeof(char));
		cost = calloc(size+2, sizeof(int));
		for (i = 0; i < size; i++) {
			tbl[i].len = 0, tbl[i].lim = TOSIZE;
			tbl[i].to = calloc(TOSIZE+2, sizeof(int));
			tbl[i].c = calloc(TOSIZE+2, sizeof(int));
			tbl[i].d = calloc(TOSIZE+2, sizeof(int));
		}
		for (i = 0; i < m; i++) {
			fgets(p=buf, 40, stdin);
			u = getint()-1, p++, v = getint()-1, p++, d = getint(), p++, c = getint();
			tp = tbl+u, checkMem(tp);
			k = tp->len, tp->to[k] = v, tp->d[k] = d, tp->c[k] = c, tp->len++;
			tp = tbl+v, checkMem(tp);
			k = tp->len, tp->to[k] = u, tp->d[k] = d, tp->c[k] = c, tp->len++;
		}
		dijkstra(0);
		for (ans = 0, i = 0; i < size; i++) if (cost[i] != INF) ans += cost[i];
		printf("%d\n", ans);

		for (i = 0; i < size; i++) free(tbl[i].d), free(tbl[i].c), free(tbl[i].to);
		free(cost), free(visited), free(node), free(tbl);
	}
	return 0;
}

Measured memory_bytes: 56200