akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, cnt = 0;
  
  cin >> A >> B;
  
  for(int i = 0; i < B - A + 1; i++){
    int N = A + i;
    
    int dig10000 = N / 10000;
    int dig1000 = (N - dig10000 * 10000) / 1000;
    int dig100 = (N - dig10000 * 10000 - dig1000 * 1000) / 100;
    int dig10 = (N - dig10000 * 10000 - dig1000 * 1000 - dig100 * 100) / 10;
    int dig1 = N - dig10000 * 10000 - dig1000 * 1000 - dig100 * 100 - dig10 * 10;
    
    if((dig10000 == dig1) && (dig1000 == dig10)) cnt++;
  }
  
  cout << cnt << endl;

}

Measured memory_bytes: 256
w = input()

if w[0] == "R" :
        if w[1] == "R" :
                if w[2] == "R" :
                        print("3")
                else :
                        print("2")
        elif w[2] == "R":
                print("1")
        else :
                print("1")
else :
        if w[1] == "R" :
                if w[2] == "R" :
                        print("2")
                else :
                        print("1")
        elif w[2] == "R":
                    print("1")
        else :
                    print("0")

Measured memory_bytes: 9124
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.LongStream;
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 Nikita Mikhailov
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BHomework solver = new BHomework();
        solver.solve(1, in, out);
        out.close();
    }

    static class BHomework {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.readInt();
            int m = in.readInt();
            long sum = in.streamLongs(m).sum();
            if (sum > n) {
                out.println("-1");
            } else {
                out.println(n - sum);
            }
        }

    }

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

        public FastScanner(final InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

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

        public int readInt() {
            return Integer.parseInt(readToken());
        }

        public long readLong() {
            return Long.parseLong(readToken());
        }

        public LongStream streamLongs(final int n) {
            return LongStream.range(0, n).map(operand -> readLong());
        }

    }
}



Measured memory_bytes: 35344
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n,a,b,c,x;
  while(cin>>n>>a>>b>>c>>x,n) {
    int h[n];
    REP(i,n) {
      cin >> h[i];
    }
    int cnt =0;
    bool f[n];
    memset(f,0,sizeof(f));
    int i=0;
    for (i=0;i<=10000;++i) {
      if (h[cnt]==x) {
        cnt++;
      }
      if (cnt==n)
        break;
      x = (a*x+b)%c;
    }
    if (cnt==n) {
      cout << i << endl;
    }else
      cout << -1 << endl;
      
  }
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cmath>
#include <climits>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

#define fast_cin() ios_base::sync_with_stdio(false)

typedef long double ld;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int max_N = 55;

ll compute_mx(const vector<ll> &inp);
ll ceil_div(ll a, ll b);

int main()
{
	int N;
	cin >> N;
	vector<ll> inp(N);

	for (int i = 0; i < N; ++i) {
		cin >> inp[i];
	}

	ll K = 0;
	while(compute_mx(inp) > N - 1) {
		ll temp = 0;
		for (auto &x : inp) {
			if (x >= N) {
				temp += ceil_div(x - N + 1, N);
			}
		}

		K += temp;
		for (auto &x : inp) {
			if (x >= N) {
				ll b = ceil_div(x - N + 1, N);
				x -= b * N;
				x += (temp - b);
			} else {
				x += temp;
			}
		}
	}

	cout << K << endl;
}

ll compute_mx(const vector<ll> &inp)
{
	ll mx = 0;
	for (auto &x : inp) {
		mx = max(mx, x);
	}

	return mx;
}

ll ceil_div(ll a, ll b)
{
	return (a / b) + (a % b > 0);
}

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

using namespace std;

typedef long long ll;
const ll N=1e5+5;
ll f[N],g[N];
ll x[N],v[N];
ll sum1[N];
ll sum2[N];
ll dp[N][2];
ll ans;
ll n,c;

int main()
{
	cin>>n>>c;x[n+1]=c;
	for (ll i=1;i<=n;i++)cin>>x[i]>>v[i];
	
	for (ll i=1;i<=n;i++)sum1[i]=sum1[i-1]+v[i]-(x[i]-x[i-1]);
	for (ll i=n;i>=1;i--)sum2[i]=sum2[i+1]+v[i]-(x[i+1]-x[i]);
	for (ll i=1;i<=n;i++)sum1[i]=max(sum1[i-1],sum1[i]);
	for (ll i=n;i>=1;i--)sum2[i]=max(sum2[i+1],sum2[i]);
	
	for (ll i=1;i<=n;i++)
	{
		dp[i][0]=max(dp[i][0],max(sum1[i],sum1[i]-x[i]+sum2[i+1]));
		dp[i][1]=max(dp[i][1],max(sum2[i],sum2[i]-(c-x[i])+sum1[i-1]));
	}
	for (ll i=1;i<=n;i++)ans=max(ans,max(dp[i][0],dp[i][1]));
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 8292
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int n,r;
    cin >> n >> r;

    cout << r + 100*max(0, 10-n) << endl;
//    bool ans =
//    cout << (ans? "Yes" : "No") << endl;
}

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

typedef struct {
    int tid;
    int pid;
    int time;
    string message;
} record;

typedef struct {
    int tid;
    int solved;
    int penalty;
    int penalArray[11];
} team;

int main(){
    team teams[51];
    record rec[501];
    int t, p, r;
    while (1){
	cin >> t >> p >> r;
	if (t == 0 && p == 0 && r == 0) break;

	for (int i = 0; i < r; i++){
	    cin >> rec[i].tid >> rec[i].pid >> rec[i].time >> rec[i].message;
	}
	
	for (int i = 0; i < t+1; i++){
	    teams[i].penalty = teams[i].solved = 0;
	    teams[i].tid = i;
	    for (int j = 1; j <= p; j++){
		teams[i].penalArray[j] = 0;
	    }
	}
	// for (int i = 0; i < t+1; i++)
	//     cout << teams[i].tid << " " << teams[i].solved << endl;
	
	for (int i = 0; i < r; i++){
	    if(rec[i].message == "CORRECT") {
		teams[rec[i].tid].solved++;
		teams[rec[i].tid].penalty += teams[rec[i].tid].penalArray[rec[i].pid] * 1200 + rec[i].time;
	    }
	    else if (rec[i].message == "WRONG") teams[rec[i].tid].penalArray[rec[i].pid]++;
	}

	// sort with solved
	team b;
	for (int j = 0; j < t*t*t; j++){
	    for (int i = 1; i < t; i++){
		if (teams[i].solved < teams[i+1].solved){
		    b = teams[i];
		    teams[i] = teams[i+1];
		    teams[i+1] = b;
		}
	    }
	}

	for (int j = 0; j < t*t*t; j++){
	    for (int i = 1; i < t; i++){
		if (teams[i].solved == teams[i+1].solved && teams[i].penalty > teams[i+1].penalty){
		    b = teams[i];
		    teams[i] = teams[i+1];
		    teams[i+1] = b;
		}
	    }
	}
	for (int j = 0; j < t*t*t; j++){
	    for (int i = 1; i < t; i++){
		if (teams[i].solved == teams[i+1].solved && teams[i].penalty > teams[i+1].penalty && teams[i].tid > teams[i+1].tid){
		    b = teams[i];
		    teams[i] = teams[i+1];
		    teams[i+1] = b;
		}
	    }
	}

	for (int i = 1; i <= t; i++){
	    cout << teams[i].tid << " " << teams[i].solved << " " << teams[i].penalty << endl;
	}
    }
}

Measured memory_bytes: 948
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		
    		int a=Integer.parseInt(scan.next());
    		int b=Integer.parseInt(scan.next());
    		int c=Integer.parseInt(scan.next());
    		int[] array= {a,b,c};
    		Arrays.parallelSort(array);
    		System.out.print(array[2]*10+array[1]+array[0]);
     
    }
    }
// end 

Measured memory_bytes: 21844
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors
N,K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
li = make_divisors(sum(A))
for i in li[::-1]:
    cnt = 0
    B = [x%i for x in A]
    B.sort(reverse=True)
    now_all = sum(B)
    for j in B:
        if(now_all==0):break
        if(j!=0):
            cnt += i-j
            now_all -= i
    if(cnt<=K):
        print(i)
        break
        

Measured memory_bytes: 42732
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    S=ST()
    g = S.count("g")
    p = S.count("p")
    print(abs((g+p)//2 - p))
if __name__ == '__main__':
    main()

Measured memory_bytes: 39536
N=int(input())

n=0
m=0
for i in range(N):

    n = 0
    for j in range(N):
        if (i+1)%(j+1)==0:
            #print("i: ", i+1, "j: ", j+1)
            n+=1
   # print("\tn: ", n, "m:", m)
    if n==8 and (i+1)%2!=0:
     m+=1
    # n=0
    
print(m)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <stack>
#include <cmath>
#include <utility>
#include <complex>

using ll = long long;
template <class T>
using vec = std::vector<T>;

using pos = std::complex<int>;

int main()
{
    using namespace std;

    int n, m;
    cin >> n >> m;

    vector<pos> students(n), checkPoints(m);
    for (auto& e : students)
    {
        int x, y;
        cin >> x >> y;
        e = {x, y};
    }

    for (auto& e : checkPoints)
    {
        int x, y;
        cin >> x >> y;
        e = {x, y};
    }

    vec<int> ans(n);
    vec<int> distances(n, 1000000000);

    for (int s = 0; s < n; ++s)
        for (int ci = m - 1; ci >= 0; --ci)
        {
            auto diff = students[s] - checkPoints[ci];
            auto d = abs(diff.real()) + abs(diff.imag());
            if (d <= distances[s])
            {
                distances[s] = d;
                ans[s] = ci + 1;
            }
        }

    for (auto e : ans)
        cout << e << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cmath>
#include <map>
#define ull unsigned long long
#define ll long long
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,ans=1;
    cin >> n;
    while(1){
        ans*=2;
        if(ans>n){
            cout << ans/2 << endl;
            return 0;
        }
    }
    return 0;
}


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

int n,m,l,r,d,dist[100010];
vector<pair<int,int> > v[100010];
bool vis[100010];

inline bool dfs(int loc,int dis)
{
    if(vis[loc]) return dist[loc]==dis;
	vis[loc]=true;dist[loc]=dis;
	for(int ii=0;ii<v[loc].size();ii++){
	    int t1=v[loc][ii].first,t2=v[loc][ii].second;
	    if(!dfs(t1,dis+t2)) return false;
    }
	return true;
}

int main()
{
    cin>>n>>m;
	for(int i=1;i<=m;i++){
	    scanf("%d%d%d",&l,&r,&d);
	    v[l].push_back(make_pair(r,d));
	    v[r].push_back(make_pair(l,-d));
	}
	for(int i=1;i<=n;i++) if(!vis[i]){
	    if(!dfs(i,0)){
	        cout<<"No"<<endl;
	        return 0;
	    }
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int k, x;
  cin >> k >> x;
  if (k * 500 >= x) yes(); no();
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<utility>
using namespace std;

int main(){
    double r;
    cin >> r;
    double PI = M_PI;
    printf("%f %f\n", PI*r*r, 2*PI*r);
}


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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair



bool solve(string& s, string& t) {
    int L = s.size();
    map<int, set<int>> st, ts;
    vector<int> vis(26, 0);
    rep(i,L){
        int ch = (int)(s[i] - 'a'), target = (int)(t[i] - 'a');
        st[ch].insert(target);
        ts[target].insert(ch);
    }
    rep(i, 26) {
        if (st[i].size() >= 2 || ts[i].size() >= 2) return false;
    }

    return true;
}

int main() {
    string s, t; cin >> s >> t;
    cout << (solve(s, t) ? "Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 776
from fractions import gcd
from collections import Counter

def prime_factorize(n):
    a=[]
    while n%2 == 0:
        a.append(2)
        n//=2
    f=3
    while f*f <= n:
        if n%f ==0:
            a.append(f)
            n//=f
        else:
            f+=2 # +1だと2の倍数にもなっちゃうからね
    if n!=1:
        a.append(n)
    return a

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

ab = gcd(a,b)
soinsu = prime_factorize(ab)
sosu = Counter(soinsu).keys()

print(len(sosu)+1)

Measured memory_bytes: 5048
#include <iostream>

using namespace std;

int main(){

    string S,T;
    
    cin >> S >> T;
    
    int i;
    int count=0;
    
    for(i=0;i<3;i++){
        if(S[i] == T[i]){
            count++;
        }
    }
    
    cout << count << endl;
    
}


Measured memory_bytes: 256
N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))

x = 1
s = {1}
count = 0
while x != 2:
    x = a[x-1]
    count += 1
    if x in s:
        print(-1)
        break
    s.add(x)
else:
    print(count)

Measured memory_bytes: 13220
#include<bits/stdc++.h>
using namespace std;
    
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
    
#define int long long
#define double long double
    
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
    
#define ff first
#define ss second
#define mp make_pair
         
#define pb push_back
#define endl "\n" 
         
#define f(i,l,r) for(int i=l;i<=r;i++)
#define rf(i,r,l) for(int i=r;i>=l;i--)    

#define bp __builtin_popcountll
#define inf 3e15
    
const int N=1e5+5;
const int M=1e9+7;

void solve()
{
	int n,k;
	cin>>n>>k;
	int f[n+1]={0};
	f(i,1,k)
	{
		int d;
		cin>>d;
		while(d--)
		{
			int x;
			cin>>x;
			f[x]++;
		}
	}
	int ans=0;
	f(i,1,n) if(f[i]==0) ans++;
	cout<<ans;
}
signed main()  
{
	FAST
    int t=1;
    // cin>>t;
    for(int tc=1;tc<=t;tc++)
    {
    	// cout<<"Case #"<<tc<<": ";
    	solve();
    }
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (ll i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using ld=long double;
using vin=vector<int>;
using vvin=vector<vin>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main(){cout<<fixed<<setprecision(20);
		   ll a,b,c,d;
           cin>>a>>b>>c>>d;
           ll ans=-INF;
           chmax(ans,a*c);
           chmax(ans,a*d);
           chmax(ans,b*c);
           chmax(ans,b*d);
           cout<<ans<<endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;
const int INF=1e9;

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; }

long long gd(long long n){
    return log10(n)+1;
}

int main(){
    int a, b, c, d, e, f;
    cin>>a>>b>>c>>d>>e>>f;
    int answ=1, anss=0;
    for(int i=0; 100*a*i<=f; i++){
        for(int j=0; 100*b*j<=f-100*a*i; j++){
            int w=100*a*i+100*b*j;
            for(int k=0; k*c<=f-w; k++){
                for(int l=0; l*d<=f-w-k*c; l++){
                    int s=c*k+d*l;
                    if((double)s/w<=(double)e/100&&(double)s/(w+s)>(double)anss/(answ+anss)){
                        answ=w;
                        anss=s;
                    }
                        
                }
            }
        }
    }
    if(anss==0) answ=100*a;
    cout<<answ+anss<<' '<<anss<<endl;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! get {
    ([$t:ty] ; $n:expr) => {
        (0..$n)
        .map(|_| get!([$t])).collect::<Vec<_>>()
    };
    ($($t:ty),+ ; $n:expr) => {
        (0..$n).map(|_| get!($($t),+)).collect::<Vec<_>>()
    };
    ([$t:ty]) => {
        rl().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect::<Vec<$t>>()
    };
    ($t:ty) => {
        rl().parse::<$t>().unwrap()
    };
    ($($t:ty),*) => {
        {
            let line =rl();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap()),*)
        }
    };
}
fn rl() -> String {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    line.trim().to_string()
}

fn main() {
    let s1 = get!(String);
    let s: Vec<char> = (" ".to_string() + &s1).chars().collect();
    let t1 = get!(String);
    let t: Vec<char> = (" ".to_string() + &t1).chars().collect();
    let mut dp = vec![vec![0; s.len() + 1]; t.len() + 1];
    //1:↖ 2:↑ 3:←
    let mut prev = vec![vec![0; s.len() + 1]; t.len() + 1];
    for j in 0..s.len() {
        for i in 0..t.len() {
            if i == 0 || j == 0 {
                continue;
            }
            if t[i] == s[j] {
                dp[i][j] = dp[i - 1][j - 1] + 1;
                prev[i][j] = 1;
            } else if t[i] != s[j] {
                if dp[i - 1][j] < dp[i][j - 1] {
                    dp[i][j] = dp[i][j - 1];
                    prev[i][j] = 3;
                } else {
                    dp[i][j] = dp[i - 1][j];
                    prev[i][j] = 2;
                }
            }
        }
    }
    //for i in 0..dp.len() {
    //    eprintln!("{:?}", dp[i]);
    //}
    let mut si = s.len() - 1;
    let mut ti = t.len() - 1;
    let mut ans = Vec::new();
    while 1 <= si && 1 <= ti {
        if prev[ti][si] == 1 {
            ans.push(s[si]);
            si -= 1;
            ti -= 1;
        } else if prev[ti][si] == 2 {
            ti -= 1;
        } else if prev[ti][si] == 3 {
            si -= 1;
        }
    }
    ans.reverse();
    for i in ans.iter() {
        print!("{}", i);
    }
    println!("");
}


Measured memory_bytes: 78076
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define fore(i,a) for(auto &i:a)
#define all(a) (a).begin(),(a).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using ll = long long; constexpr int inf = INT_MAX / 2; constexpr ll infl = 1LL << 60;
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; }

void _main() {
  int A, B, C;
  cin >> A >> B >> C;

  if (A == B && B == C) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#define MAX 100
#define MAXNUM 10000001
using namespace std;
int n, minv, M[MAX][MAX];
int w[MAX], color[MAX] = {};

void dijkstra() {
	for (int i = 0; i < n; i++) {
		w[i] = MAXNUM;
	}
	w[0] = 0;
	color[0] = 1;
	while (1) {
		minv = MAXNUM;
		int u = -1;
		for (int i = 0; i < n; i++) {
			if (w[i] < minv && color[i] != 2) {
				u = i;
				minv = w[i];
			}
		}
		if (u == -1) break;
		color[u] = 2;
		for (int i = 0; i < n; i++) {
			if (color[i] != 2 && M[u][i] != MAXNUM) {
				if (w[i] > w[u] + M[u][i]) {
					w[i] = w[u] + M[u][i];
					color[i] = 1;
				}
			}
		}
	}
}

int main() {
	int u, k, v, c;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			M[i][j] = MAXNUM;
		}
	}
	for (int i = 0; i < n; i++) {
		cin >> u >> k;
		for (int j = 0; j < k; j++) {
			cin >> v >> c;
			M[u][v] = c;
		}
	}
	dijkstra();
	for (int i = 0; i < n; i++) {
		cout << i << " ";
		if (w[i] != MAXNUM) {
			cout << w[i] << endl;
		}
	}
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF ((ll)1<<31)-1
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int gcd(int a,int b){
	if(!a)return b;
	return gcd(b%a,a);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
signed main(){
	string s;
	cin>>s;
	if(s=="ani")puts("square1001");
	else puts("e869120");
    return 0;
}




Measured memory_bytes: 3108
while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    for i in range(H):
        for j in range(W):
            if i==0 or i==H-1 or j==0 or j==W-1:
                print("#",end="")
            else:
                print(".",end="")
        print()

    print()


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

int main() {
    int n;
    string S;
    cin >> S;
    n = S.size();
    int st = 0, en = 0;
    for(int i = 0; i < n; i++) {
        if(S[i] == 'A') {
            st = i; 
            break;
        }
    }

    for(int i = n - 1; i >= 0; i--) {
        if(S[i] == 'Z') {
            en = i; 
            break;
        }
    }

    cout << en - st + 1 << endl;
    return 0;
}

Measured memory_bytes: 640
#include<map>
#include<cstdio>
#include<iostream>
using namespace std;
map < int , int > a;
int main() {
	int n, ans = 0; scanf("%d", &n);
	for (int t; n--;)
		scanf("%d", &t), ++a[t];
	for (map < int , int > :: iterator it = a.begin(); it != a.end(); ++it) {
		if (it->second < it->first) ans += it->second;
		else if (it->second > it->first) ans += it->second - it->first;
	} printf("%d\n", ans);
	return 0;
}

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

template <typename A, typename B>string to_string(pair<A, B> p);

template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {return '"' + s + '"';}

string to_string(const char* s) {return to_string((string) s);}

string to_string(bool b) {return (b ? "true" : "false");}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

template <typename A, typename B, typename C>string to_string(tuple<A, B, C> p) {return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";}

template <typename A, typename B, typename C, typename D>string to_string(tuple<A, B, C, D> p) {return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";}

void debug_out() { cout << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << " " << to_string(H);
  debug_out(T...);
}

#define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

const unsigned long long Mod = 1000000000 + 7;
typedef unsigned long long ull;

const ull maxA = 1000006;

int main(){	
	ios::sync_with_stdio(false);
	cin.tie(0);
	ull n;
	cin >> n;
	vector <ull> v(n), cnt(maxA,0);
	for (int i = 0; i < n; i++){
		cin >> v[i];
		cnt[v[i]] += 1;
	}	
	bool is_pair = true;            
	for (int i = 2; i < maxA; i++){
		int foo = 0;
		for (int j = i; j < maxA; j+=i){
			foo += cnt[j];		
		}
		if (foo > 1){
			is_pair = false;
			break;
		}
		if (!is_pair){ break;}
	}	
	if (is_pair){
		cout << "pairwise coprime";
		return 0;
	}     
	auto gcd = [&](ull a, ull b){
		while (b){
			a %= b;
			swap(a,b);
		}	
		return a;	
	};	
	
	ull g = v[0];
	for (int i = 1; i < n; i++){
		g = gcd(g,v[i]);
	}
	if (g == 1){
		cout << "setwise coprime";
	}
	else{
		cout << "not coprime";
	}    return 0;
}













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

 int main()
{
    vector <long long int> v,p;
   long long int x,n;
   cin>>n;
   for(int i=0; i<n; i++)
   {
       cin>>x;
       v.push_back(x);
   }

   int i;
   if(n%2==0)
   {
    for(int i=n-1; i>0; i-=2)
   {
       p.push_back(v[i]);
   }
        for(int i=0; i<n-1; i+=2)
    p.push_back(v[i]);

   }
   else
   {
    for(int i=n-1; i>=0; i-=2)
   {
       p.push_back(v[i]);
   }
        for(int i=1; i<n-1; i+=2)
    p.push_back(v[i]);

   }


 for(int i=0; i<p.size()-1; i++)
    cout<<p[i]<<" ";
 cout<<p[p.size()-1]<<endl;

}


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


//c++ templte for help............................................................................................................................................
typedef long long ll;

template<typename... T>
void print1(T... t){
	((cout<<t<<" "),...);
}

template<typename... T>
void print2(T... t){
		vector<vector<ll>> ans={t...};
		for(ll i=0;i<(ll)ans.size();i++){
			if(i!=0) cout<<"\t\t";
			else cout<<"\t";
			for(ll j=0;j<(ll)ans[i].size();j++){
				cout<<ans[i][j]<<" ";
			}
			if(i!=(ll)ans.size()-1)
			cout<<endl;
		}
}	
#define deb(...) cout<<" [ "#__VA_ARGS__<<" : "; print1(__VA_ARGS__); cout<<"]"<<endl; 
#define vdeb(...) cout<<" [ "#__VA_ARGS__<<" : "; print2(__VA_ARGS__); cout<<"]"<<endl;





	
 
//for loop
//#define fo(i,n) for(int i=0;i<(ll)n;i++)
//#define Fo(i,k,n) for(int i=k;i<n;i++)
 
 
//to print vector element 
//template<typename T>
//void printV(T vec){
	//fo(i,vec.size()) cout<<vec[i]<<" "<<flush;
	//cout<<endl;
	//}
	
 
//#define modulo 1000000007
//const int INF=1e9+5;
 
//iterate map
//template<typename T>
//void itR(T map){
	 //for(auto itr=map.begin();itr!=map.end();itr++){
				//deb(itr->first,itr->second);
			//}
	//cout<<endl;
//}
 
 
 
//c++ template for help...........................................................................................................................................

bool fact(ll num,map<ll,ll> mp,ll k){
	ll temp=num;
	for(ll i=2;i<=sqrt(temp);i++){
		if(num%i==0){
			deb(num);
			if(mp.find(i)!=mp.end()) return false;
			while(num%i==0){
				num/=i;
			}
		}
	}if(num!=1 and mp[num]!=k ) return false;
	
	deb(1111);
	return true; 
}

ll solve(){
	ll n;
	cin>>n;
	vector<ll> vec(n);
	map<ll,ll> mp;
	for(ll i=0;i<n;i++){
		cin>>vec[i];
	}
	
	
	sort(vec.begin(),vec.end());
	
	ll count=0;
	for(ll i=0;i<n;i++){
		ll temp=vec[i];
		ll j=1;
		
		if(i<(ll)vec.size() and vec[i+1]==vec[i]); 
		else if(mp.find(vec[i])==mp.end()) {count++;}  
		
		while(temp*j<=vec[vec.size()-1]){
			mp[temp*j]++;
			j++;
		}
	}
	
	return count;

}

int main() {
	//stringstream ss;
	//ss<<"akhil";
	//cout<<ss.str()<<endl;
	cout<<setprecision(50);
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	
	 // TESTCASE KO DEKH KA BHAUT SARA CONDITION GENERATE MAT KRO 
	 // PAPER PD CONFIRM HO JAO THORA JADA TIME HI KYU NA LGA
	 // greedy ma jadatr exceptional case check kr ke dekh lo
	 
	 // WHILE DOING THE QUESTION OF DYNAMIC PROGRAMMING GREEDY KA TRAH SOCHNA BAND KRO
	 // DP M DATA KA BHI USE KRNA PDTA HA BE BHULO MT 
	 // DP BHI WO LEETCODE WALE MATRIX KA QUESTION KI TARAH HA
	 // CONSTRAIN WILL BE THE DIMENSION OF DP
	 // DP MA STATE PTA KRO AUR PHIR FUNCTION GENERATE KRO
	 // OBJECT KO CHOOSE KIA YA NAE KIA AGAR KIA TO KYA HOGA AUR NAE KIA TO KYA HOGA
	 // KYA KYA CHEJ IMPORTANT HA WO STATE BN JAGA AUR HUM LOG STATE KO CHANGE KR SKTA HA JYSA KNPSACK 2 WALE PROBLEM MA KIA THA
	 

	 
	//ll testCase;
	//cin>>testCase;
	//for(ll tt=0;tt<testCase;tt++){
		//solve();
		ll ans=solve();
		cout<<ans<<endl;
	//}
	return 0;
}


Measured memory_bytes: 67092
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

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

	int A, B, C;
	
	cin >> A >> B >> C;

	if ((A == B) && (B == C))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	

	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
	string s;
	cin >> s;
	if (s == "ABC")
		cout << "ARC" << endl;
	else
		cout << "ABC" << endl;


	return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,K;
  cin >> N >> K;
  ll ans=0;
  if(N==1) ans=K;
  else ans= K * pow(K-1,N-1);
  cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define eb emplace_back
#define precision(n) cout << fixed << setprecision(n);
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
int main()
{
    fast;
 long long int  x,p,v,w;
 cin>>x;
 p=x/500;
 v=(x-p*500);
 w=v/5;
 cout<<p*1000+w*5<<endl;
    return 0;
}




Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#define maxn 200100
using namespace std;
struct edge
{
	int s,t,vid;
};
vector<edge>edges;
int ma=0;
vector<int>Eg[maxn];
int val[maxn];
void addedges(int a,int b)
{
	edge K;
	K.s=a;
	K.t=b;
	K.vid=1;
	edges.push_back(K);
	Eg[a].push_back(ma);
	Eg[b].push_back(ma);
	ma++;
}

void bfs(int l)
{
	queue<int>o;
	o.push(l);
	while(!o.empty())
	{
		int y=o.front();
		o.pop();
		int L=Eg[y].size();
		for(int i=0;i<L;i++)
		{
			int Q=Eg[y][i];
			if(edges[Q].vid)
			{
				int h;
				if(edges[Q].s==y)
					h=edges[Q].t;
				else
					h=edges[Q].s;
				val[h]+=val[y];
				o.push(h);
				edges[Q].vid=0;
			}
		}
	}
}
int   main()
{
	int n,q,a,b,x,y;
	scanf("%d%d",&n,&q);
	for(int i=1;i<n;i++)
	{
		val[i]=0;
		scanf("%d%d",&a,&b);
		addedges(a,b);
	}
	val[n]=0;
	
	for(int i=0;i<q;i++)
	{
		scanf("%d%d",&x,&y);
		val[x]+=y;
	}
	
	bfs(1);
	for(int i=1;i<n;i++)
		printf("%d ",val[i]);
	printf("%d\n",val[n]);
}
	

Measured memory_bytes: 17840
#include "bits/stdc++.h"

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)


signed main(){

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

	int m = INF;
	for (int i = 0; i <= n - 3; i++){
		int t = (s[i] - '0') * 100 + (s[i + 1] - '0') * 10 + (s[i + 2] - '0');
		m = min(m, abs(t - 753));
	}
	cout << m << endl;


	return 0;
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  const ll INF = 1e15;
  VLL dp(n,INF);
  ll a;
  rep(i,n){
    cin >> a;
    *lower_bound(all(dp),a) = a;
  }
  cout << (lower_bound(all(dp),INF) - dp.begin()) << endl;
  return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int a,b;
  cin>>a>>b;
  int X;
  if(a%2==1 && b%2==0){
      a=a+1;
  }else if(a%2==0 && b%2==1){
      b=b+1;
  }
  X = (a+b)/2;
  cout<<X<<endl;

}

Measured memory_bytes: 3648
# frozen_string_literal: true

require 'prime'

n = gets.to_i
a = gets.split.map(&:to_i)

@p = {}

@primes = Prime.each(Math.sqrt(a.max)).to_a

def prime_division(n)
  return @p[n] if @p[n]
  return @p[n] = [n] if n.prime?

  divs = []
  @primes.each do |p|
    break if n == 1

    if n.prime?
      divs.push n
      break
    end
    if (n % p).zero?
      divs.push p
      n /= p while (n % p).zero?
    end
  end
  @p[n] = divs
end

b = Array.new(n + 1, false)
flag = true
a.each do |e|
  prime_division(e).each do |p|
    if b[p]
      flag = false
      break
    end
    b[p] = true
  end
  break unless flag
end

if flag
  puts 'pairwise coprime'
  exit
end

g = a[0]
(1..(n - 1)).each do |i|
  g = g.gcd(a[i])
end

if g == 1
  puts 'setwise coprime'
else
  puts 'not coprime'
end


Measured memory_bytes: 88612
#include<iostream>

using namespace std;

int main()
{
	int n, i, flag;
	cin >> n;
	for(i = 1; i <= 9; i++)
	{
		if(n % i == 0 && n / i <= 9)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


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

#define int long long

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
 
using namespace std;

int32_t main(){
    int n;
    cin >> n;
    vector<int> v(2*n);
    REP(i, 2*n){
        cin >> v[i];
    }
    SORT(v);

    int ans=0;
    for(int i=0; i<2*n; i+=2){
        ans+=v[i];
    }

    cout << ans << endl;
}

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

using namespace std;

#define IOS ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);

#define endl "\n";


#define mod 1000000007
#define loop(i,s,n)  for(ll i=s;i<n;i++)
#define test  ll t; cin>>t; while(t--)
#define p push_back
typedef long long ll;
int main()
{
    
ll n,i,j,k,count=0,sum=1;
string s;
cin>>s;
n=s.length();

if(s[n-1]=='s')
{cout<<s<<"es";}
else{cout<<s<<"s";}
    return 0;
}




Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <iostream>
#include <functional>
#include <vector>
#include <stdio.h>
#include <queue>
#include <string.h>
#include <math.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define rep1(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define per1(i,a,n) for (int i=a;i>n;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define endl "\n"
#define pi 3.14159265358979323846264338327950288419716939937510
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res, t;res=1;t=a%c;while(b){if(b & 1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
// head
ll n,ans=1;
char a,pre;
int main()
{
    //IOS;
    cin>>n;
    cin>>a;
    pre=a;
    rep(i,2,n)
    {
        cin>>a;
        if(pre!=a)
        {
            pre=a;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}
/*

*/


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

int main() {
    int n;
    cin >> n;
    int p[n];
    for (int i = 0; i < n; i++) cin >> p[i];

    int count = 0;
    for (int i = 0; i < n; i++) {
        if (p[i] != i+1) count++;
    }

    if (count <= 2) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
int as(int a)
{
    int i,b,c=0,d;
    for(i=0;;i++)
    {
        b=a%10;
        if(b==7)
        {
            c=1;
            break;
        }
        a=a/10;
        if(a==0)
            break;
    }
    return c;
}

int main()
{
    long long int a;
    cin>>a;
    int b=as(a);
    if(b==1)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}


Measured memory_bytes: 3596
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i,n)   for (int i = 0; i < (n); ++i)
#define SORT(a)    sort((a).begin(), (a).end());
#define UNIQ(a)    SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end());
#define FIND(a,x)  find((a).begin(), (a).end(), (x)) != (a).end()
#define REVERSE(a) reverse((a).begin(), (a).end());
#define OUT(d) cout << (d);
#define OUT_L(d) std::cout<<(d)<<"\n";
#define Yes() printf("Yes\n");
#define No() printf("No\n");
#define YES() printf("YES\n");
#define NO() printf("NO\n");
#define CEIL(x, y) ((x + y - 1) / (y))

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

// 最大公約数
ll gcd(ll a, ll b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}

// 最大公約数
ll gcd(vector<ll> a) {
  ll ret = a[0];
  for (int i = 1; i < a.size(); i++) {
    ret = gcd(ret, a[i]);
  }
  return ret;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));

  ll N; cin >> N;
  vector<ll> a(N);
  REP(i, N) cin >> a[i];

  OUT_L(gcd(a))
}


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

int main(){
  ll x, k, d;
  cin >> x >> k >> d;
  ll a = abs(x) / d;
  ll ans;
  if (abs(x) / d > k) ans = abs(x) - d * k;
  else if ((a % 2) == (k % 2)) ans = abs(x) % d;
  else ans = abs((abs(x) % d) - d);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    A, B = map(int, input().split())

    for i in range(1, 1300):
        if (i * 8) // 100 == A and (i * 10) // 100 == B:
            print(i)
            break
    else:
        print(-1)


main()


Measured memory_bytes: 3060
#include"bits/stdc++.h"
#include<cassert>
#define fr first
#define sc second
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 998244353;
const long long inf = 1ll << 62;
typedef pair<int, int> P;
typedef pair<int, P> PP;
int t[100006], d[100006];
P p[100006];
int ut[100006];
signed main() {
	int n, k; cin >> n >> k;
	rep(i, n)cin >> t[i] >> d[i];
	rep(i, n)p[i] = P(d[i], t[i]);
	sort(p, p + n);
	reverse(p, p + n);
	int ans = 0, now = 0;
	set<int>S;
	priority_queue<P>Q;
	priority_queue<P, vector<P>, greater<P>>Q1;
	rep(i, k) {
		now += p[i].first;
		S.insert(p[i].second);
		ut[p[i].second]++;
		if (ut[p[i].second] > 1)Q1.push(p[i]);
	}
	int Z = S.size();
	ans=now+ Z*Z;
	for (int i = k; i < n; i++)Q.push(p[i]);
	while (Q.size()) {
		P x = Q.top();
		Q.pop();
		if (ut[x.second])continue;
		if (Q1.size()) {
			P y = Q1.top(); Q1.pop();
			Z++;
			ut[x.second]++;
			now -= y.first;
			now += x.first;
		}
		ans = max(ans, now + Z*Z);
	}
	cout << ans << endl;
}

Measured memory_bytes: 8056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  string s;
  cin >> s;
  string cf = "CODEFESTIVAL2016";

  int ans =0 ;
  rep(i, 16) {
    if (cf[i] != s[i]) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import statistics
import math

N = int(input())

min_x = []
max_x = []

for i in range(N):
    A, B = map(int, input().split())
    min_x.append(A)
    max_x.append(B)

min_x.sort()
max_x.sort()

result = []

if len(min_x) % 2 == 0:
    min_median = (min_x[len(min_x)//2-1] + min_x[len(min_x)//2])
    max_median = (max_x[len(min_x)//2-1] + max_x[len(min_x)//2])
    print(len(range(math.floor(min_median), math.ceil(max_median) + 1)))

else:
    min_median = min_x[len(min_x)//2]
    max_median = max_x[len(min_x)//2]
    print(max_median - min_median + 1)


Measured memory_bytes: 27312