akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair< int ,int > pii;
#define all(v) v.begin(),v.end()
#define PB push_back
#define T(val) while(val--)
#define FIN for(i=0;i<n;i++)
#define FIS for(i=0;i<s.length();i++)
#define AIN for(i=0;i<n;i++){cin>>a[i];}
#define F(i,k,n) for(i=k;i<n;i++)
#define FG(i,k,n,x) for(i=k;i<n;i+=x)
#define YES cout<<"YES\n"; 
#define NO cout<<"NO\n"; 
#define ll long long
#define MOD 1000000007
#define deb(x) cout << #x << "=" << x << endl;
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//sort(arr, arr+n, greater<int>()); For sorting in reverse order 
 
int solve(){
  string a,b;
  cin>>a>>b;
  ll n=a.length(),m=b.length();
  ll dp[n+1][m+1],choice[n+1][m+1];
  memset(dp,0,sizeof(dp));
  memset(choice,0,sizeof(choice));
  // 1..i-- 0.. j-- 2.. i-- j-- 
  ll i,j;
  dp[0][0]=(a[0]==b[0]);
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      if(i>0&&dp[i][j]<dp[i-1][j]){
        dp[i][j]=dp[i-1][j];
        choice[i][j]=1;
      }
      if(j>0&&dp[i][j]<dp[i][j-1]){
        dp[i][j]=dp[i][j-1];
        choice[i][j]=0;
      }
      if(a[i]==b[j]){
        ll ans=1;
        if(i>0 && j>0){
          ans= 1 + dp[i-1][j-1];
        }
        if(ans>dp[i][j]){
          dp[i][j]=ans;
          choice[i][j]=2;
        }
      }
    }
  }
  
  int cnt=0;
  string ans;
  i=n-1,j=m-1;
  while(cnt!=dp[n-1][m-1]){
    if(choice[i][j]==1){
      i--;
    }
    else if(choice[i][j]==0){
      j--;
    }
    else{
      ans.push_back(a[i]);
      i--,j--;
      cnt++;
    }
  }
  reverse(ans.begin(),ans.end());
  cout<<ans<<"\n";
  return 0;
}
int main(){
fast
  int t=1;
  // cin>>t; 
  T(t){
    solve();
  }
  return 0;
}


Measured memory_bytes: 144256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int x,y,s;
	while(cin>>x>>y>>s,x){
		int max_zeigo = 0;
		for(int i=1;i<1000;i++)
			for(int j=1;j<1000;j++){
				int tmp = i * (100 + x)/100 + j * (100+x)/100;
				if(tmp == s)max_zeigo = max(i*(100+y)/100+j*(100+y)/100,max_zeigo);
			}
		cout << max_zeigo << "\n";
	}
	return 0;
}

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

#define INF 1000000

using namespace std;

int H, W, N, sy, sx, k[1001][1001];
char c[1001][1001];
queue<pair<int, int>> q;

void reset(int y, int x){
    int i, j;

    while(!q.empty())q.pop();

    for(i = 0; i < 1001; i++){
        for(j = 0; j < 1001; j++){
            if(i != y || j != x){
                k[i][j] = INF;
            }
        }
    }

    q.push(make_pair(y, x));
}

int solve(int n){
    int y, x;

    while(!q.empty()){
        y = q.front().first;
        x = q.front().second;
        q.pop();
        if(c[y][x] == n + '0'){
            break;
        }
        if(x > 0 && c[y][x - 1] != 'X' && k[y][x - 1] == INF){
            q.push(make_pair(y, x - 1));
            k[y][x - 1] = k[y][x] + 1;
        }
        if(x < W - 1 && c[y][x + 1] != 'X' && k[y][x + 1] == INF){
            q.push(make_pair(y, x + 1));
            k[y][x + 1] = k[y][x] + 1;
        }
        if(y > 0 && c[y - 1][x] != 'X' && k[y - 1][x] == INF){
            q.push(make_pair(y - 1, x));
            k[y - 1][x] = k[y][x] + 1;
        }
        if(y < H - 1 && c[y + 1][x] != 'X' && k[y + 1][x] == INF){
            q.push(make_pair(y + 1, x));
            k[y + 1][x] = k[y][x] + 1;
        }
    }
    sy = y;
    sx = x;

    return y * W + x;
}

int main()
{
    int i, j, z;

    cin >> H >> W >> N;
    for(i = 0; i < H; i++){
        for(j = 0; j < W; j++){
            cin >> c[i][j];
            if(c[i][j] == 'S'){
                sy = i;
                sx = j;
            }
        }
    }
    k[sy][sx] = 0;

    for(i = 1; i <= N; i++){
        reset(sy, sx);
        z = solve(i);
    }

    cout << k[z / W][z % W] << endl;
}

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

using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;

	if (A == B) {
		cout << "Draw" << endl;
	}
	else if (A == 1 or (A > B and B != 1)) {
		cout << "Alice" << endl;
	}
	else {
		cout << "Bob" << endl;
	}
	
	return (0-0);	
}

Measured memory_bytes: 256
/*input
5 1
1 999999997 999999998 999999999 1000000000
*/
#include <bits/stdc++.h>
using namespace std;
long long pref[500005],n, a[500005], x;
__int128 get(int trips){
	__int128 ret = 2*pref[trips] + (n+trips)*x;
	for(int i=trips,now=3;i<500005;i+=trips,now+=2)
		ret += (pref[i] - pref[i-trips])*now;
	return ret;
}
int main(){
	#ifdef ONLINE_JUDGE
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	#endif
	cin>>n>>x;
	for(int i=1,x;i<=n;cin>>a[i++]);
	reverse(a+1,a+n+1);
	for(int i=1;i<500005;++i) pref[i] = pref[i-1]+a[i];
	__int128 ans = LLONG_MAX;
	for(int trips = 1; trips <= n; ++trips)
		ans = min(ans,get(trips));
	cout<<(unsigned long long)ans;
}

Measured memory_bytes: 7552
using System;
using System.Linq;
using System.Collections.Generic;

public class Program{
    public static void Main(){
        var n = int.Parse(Console.ReadLine());
        var problems = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var m = int.Parse(Console.ReadLine());
        for(int i=0; i<m; i++){
            var info = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var times = problems.Clone() as int[];
            times[info[0]-1] = info[1];
            Console.WriteLine(times.Sum());
        }
    }
}


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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
#define pb push_back

using namespace std;
using ll=long long;
using pii= pair<int, int>;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... T> void rd(T&... args) {((cin>>args), ...);}
template<typename... T> void wr(T... args) {((cout<<args<<" "), ...);cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    char ch;
    cin>>ch;
    if(isupper(ch)) cout<<"A";
    else cout<<'a';
    return 0;
}



Measured memory_bytes: 3652
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
INIT_VAL = 0
def DD2(d1,d2): return [[INIT_VAL]*d2 for _ in range(d1)]
def DD3(d1,d2,d3): return [DD2(d2,d3) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x, 'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x, 'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x, 'x') # rev => int(res, 16)
MOD=10**9+7
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(MAX_NUM=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(MAX_NUM+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(MAX_NUM**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, MAX_NUM+1, i):
            is_prime[j] = False
    return [i for i in range(MAX_NUM+1) if is_prime[i]]
## libs ##
from itertools import accumulate as acc
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left

#======================================================#

def main():
    n, k = MII()
    aa = Counter(MII())
    c = aa.most_common()[::-1][:len(aa)-k]
    print(sum([ci[1] for ci in c]))

if __name__ == '__main__':
    main()

Measured memory_bytes: 38048
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ff first
#define ss second
int level[100005]={0},parent[100005]={0},coin[100005]={0},visited[100005]={0};
int main()
{
    int a,b;
    cin>>a>>b;
    if((a+b)%3==0||a%3==0||b%3==0)
        cout<<"Possible";
    else
        cout<<"Impossible";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
  
int main(int argc, char *argv[]) {
    int n;
    int a[100];

    scanf("%d", &n);

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

    int max = a[0];
    int min = a[0];

    for (int i = 1; i < n; i++) {
        if (a[i] > max) max = a[i];
        if (a[i] < min) min = a[i];
    }

    printf("%d\n", max - min);

    return 0;
}

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

int main(){
   int n; cin>>n;
   vector<int> b(n-1);
   rep(i,n-1) cin>>b[i];
   vector<int> a(n);
   a[0]=b[0];
   for(int i=1;i<n-1;i++){
      a[i]=min(b[i-1],b[i]);
   }
   a[n-1]=b[n-2];
   int sum=0;
   rep(i,n) sum+=a[i];
   cout<<sum<<endl;
   return 0;
}


Measured memory_bytes: 256
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


void solve(long long n, std::vector<long long> a, std::vector<long long> b, long long m, std::vector<long long> u, std::vector<long long> v){
    vector<vector<int>> edges(n);
    for(int i = 0; i < n - 1; ++i){
        edges[--a[i]].emplace_back(--b[i]);
        edges[b[i]].emplace_back(a[i]);
    }
    for(auto& x : u)
        --x;
    for(auto& x : v)
        --x;

    bitset<50> bs;
    vector<set<pair<int,int>>> masks_i(m);

    function<bool(int,int)> f = [&](int x, int idx){
        if(x == v[idx]){
            return true;
        }
        for(auto& y : edges[x]){
            if(!bs[y]){
                bs.set(y);
                if(f(y, idx)){
                    masks_i[idx].emplace(minmax(x, y));
                    return true;
                }
            }
        }
        return false;
    };

    for(int i = 0; i < m; ++i){
        bs.reset();
        bs.set(u[i]);
        f(u[i], i);
    }

    /*
    for(auto& x : masks_i){
        for(auto &p : x)
            cout << p.first << ":" << p.second << " ";
        cout << endl;
    }
    */

    vector<int> masks(n - 1, 0);
    for(int i = 0; i < n - 1; ++i)
        for(int j = 0; j < m; ++j){
            if(masks_i[j].find(minmax(a[i], b[i])) != masks_i[j].end())
                masks[i] |= (1 << j);
        }


    int k = (n - 1) / 2;

    // zen-re-kkyo
    vector<vector<int>> bit_all(2, vector<int>(1 << m, 0));

    for(int i = 0; i < (1 << k); ++i){
        int mask = 0;
        for(int j = 0; j < k; ++j)
            if(i & (1 << j))
                mask |= masks[j];
        ++bit_all[0][mask];
    }
    for(int i = 0; i < (1 << (n - 1 - k)); ++i){
        int mask = 0;
        for(int j = 0; j < (n - 1 - k); ++j)
            if(i & (1 << j))
                mask |= masks[j + k];
        ++bit_all[1][mask];
    }


    // bit_all[0] zeta
    for(int i = 0; i < m; ++i)
        for(int j = 0; j < (1 << m); ++j)
            if(!(j & (1 << i)))
                bit_all[0][j] += bit_all[0][j | (1 << i)];



    i64 ans = 0;
    for(int i = 0; i < (1 << m); ++i){
        ans += 1LL * bit_all[0][((1 << m) - 1) ^ i] * bit_all[1][i];
    }
    cout << ans << endl;

}


signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> a(N-1);
    std::vector<long long> b(N-1);
    for(int i = 0 ; i < N-1 ; i++){
        scanf("%lld",&a[i]);
        scanf("%lld",&b[i]);
    }
    long long M;
    scanf("%lld",&M);
    std::vector<long long> u(M);
    std::vector<long long> v(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&u[i]);
        scanf("%lld",&v[i]);
    }
    solve(N, std::move(a), std::move(b), M, std::move(u), std::move(v));
    return 0;
}


Measured memory_bytes: 12544
using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using Debug = System.Diagnostics.Trace;
using SB = System.Text.StringBuilder;
using static System.Math;
using Number = System.Int32;

namespace Program {
	public class Solver {
		Random rnd = new Random();
		public void Solve() {
			var n = ri;
			if (n == Enumerate(n, x => ri).Distinct().Count())
				Console.WriteLine("YES");
			else Console.WriteLine("NO");
		}
		const long INF = 1L << 60;
		static int[] dx = { -1, 0, 1, 0 };
		static int[] dy = { 0, 1, 0, -1 };
		int ri { get { return sc.Integer(); } }
		long rl { get { return sc.Long(); } }
		double rd { get { return sc.Double(); } }
		string rs { get { return sc.Scan(); } }
		public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());

		static T[] Enumerate<T>(int n, Func<int, T> f) {
			var a = new T[n];
			for (int i = 0; i < a.Length; ++i) a[i] = f(i);
			return a;
		}
		static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
	}
}

#region main
static class Ex {
	static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
	static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") {
		return string.Join(st, ie);
	}
	static public void Main() {
		Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = true });
		var solver = new Program.Solver();
		//* 
		var t = new System.Threading.Thread(solver.Solve, 50000000);
		t.Start();
		t.Join();
		//*/
		// solver.Solve();
		Console.Out.Flush();
	}
}
#endregion
#region Ex
namespace Program.IO {
	using System.IO;
	using System.Text;
	using System.Globalization;

	public class Printer : StreamWriter {
		public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
		public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
	}

	public class StreamScanner {
		public StreamScanner(Stream stream) { str = stream; }

		public readonly Stream str;
		private readonly byte[] buf = new byte[1024];
		private int len, ptr;
		public bool isEof = false;
		public bool IsEndOfStream { get { return isEof; } }

		private byte read() {
			if (isEof) return 0;
			if (ptr >= len) {
				ptr = 0;
				if ((len = str.Read(buf, 0, 1024)) <= 0) {
					isEof = true;
					return 0;
				}
			}
			return buf[ptr++];
		}

		public char Char() {
			byte b = 0;
			do b = read(); while ((b < 33 || 126 < b) && !isEof);
			return (char)b;
		}
		public string Scan() {
			var sb = new StringBuilder();
			for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);
			return sb.ToString();
		}
		public string ScanLine() {
			var sb = new StringBuilder();
			for (var b = Char(); b != '\n' && b != 0; b = (char)read()) if (b != '\r') sb.Append(b);
			return sb.ToString();
		}
		public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }
		public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }
		public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }
	}
}

#endregion


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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)

int main(int argc, char *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, r;
    cin >> n >> r;

    if (n <= 10)
    {
        r += 100 * (10 - n);
    }

    cout << r << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin >> s;
  int ans = 0;
  cin >> t;
  while(t!="END_OF_TEXT"){
    for(int i=0;i<(int)t.size();++i){
      t.at(i) = tolower(t.at(i));
    }
    if(t==s) ++ans;
    cin >> t;
  }
  cout << ans << endl;
}




Measured memory_bytes: 3192
using System;
using System.Collections.Generic;
using System.Linq;

class Progaram
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var stus = new List<int[]>();
        var l = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        for (var i = 1; n >= i; i++)
        {
            stus.Add(new int[] { l[i - 1], i });
        }
        stus = stus.OrderBy(x => x[0]).ToList();
        Console.Write(stus[0][1]);
        for (var i = 1; n > i; i++)
        {
            Console.Write($" {stus[i][1]}");
        }
        Console.WriteLine();
    }
}


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

int main(){
  ll N;
  int flag;
  string ans;
  cin >> N;
  for (int i = 1; i < 10; i++){
    for (int j = 1; j < 10; j++){
      if(i*j == N){
        printf("Yes\n");
        return 0;
      }
    }
  }
  printf("No\n");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int par[100000];
struct node{
  node *next;
  int key;
};
 
node *head[100000];

void mk_node(int key,node *next,node *prev){
  node *n=(node *)malloc(sizeof(node));
  n->key=key;
  n->next=next;
  prev->next=n;
}
 
void insert(int x,int i){mk_node(x,head[i]->next,head[i]);}

void init(int n){
    for(int i=0;i<n;i++){
    par[i]=-1;
    head[i]=(node *)malloc(sizeof(node *));
    head[i]->next=head[i];
    head[i]->key=-1;
  }
 
}

int get_dep(int x,int dep){
  if(x==-1) return dep;
  return get_dep(par[x],dep+1);
}

void print_list(int x){
  int a[100000];

  node *i=head[x]->next;
  int idx=0;
  while(i!=head[x])a[idx++]=i->key,i=i->next;
  
  cout <<"[";
  for(int j=idx-1;j>=1;j--)cout << a[j]<<", ";
  if(idx) cout <<a[0];
  cout <<"]"<<endl;
}

int main(){
  int n;
  cin>>n;
  
  init(n);
  for(int i=0,a,b;i<n;i++){
    cin>>a>>b;
    for(int j=0,c;j<b;j++){
      cin>>c;
      insert(c,a);
      par[c]=a;
    }
    
  }

  for(int i=0;i<n;i++){
    printf("node %d: parent = %d, depth = %d, ",i,par[i],get_dep(i,-1));
    if(par[i]==-1) cout <<"root, ";
    else if(head[i]->next->key==-1) cout <<"leaf, ";
    else cout << "internal node, ";
    print_list(i);
  }

  
  return 0;
}

Measured memory_bytes: 9028
#include<bits/stdc++.h>
using namespace std;
int const nax = 3e5 + 10;
int n;
int f[10][10];
pair<int, int> g(int x){
    static int a[10];
    int top = 0;
    for(; x > 0 ; x /= 10)
        a[top ++] = x % 10;
    return make_pair(a[0], a[top - 1]);
}

int main(){
    scanf("%d", &n);
    for(int i = 1 ; i <= n ; i ++){
        auto cur = g(i);
        f[cur.first][cur.second] ++ ;
    }
    long long ans = 0;
    for(int i = 1 ;i <= n ;i ++){
        auto cur = g(i);
        ans += f[cur.second][cur.first];
    }
    printf("%lld\n", ans);
}
/*
    Good Luck
        -Lucina
*/


Measured memory_bytes: 256
#include<cstdio>
#include <iostream>

using namespace std;
int a,b,c;
long long k;
int main()
{
    scanf("%d%d%d%lld",&a,&b,&c,&k);
    if(a-b>1000000000000000000)
        printf("Unfair\n");
        else
        {
            if(k%2==0)
        printf("%d\n",a-b);
            else
        printf("%d\n",b-a);

        }
    return 0;
}


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

int main()
{
    int i,N;
    string city;
    int point;
    cin >> N;
    pair<pair<string,int>,int> p[N];
    for(i=0;i<N;i++){
        cin >> city >> point;
        p[i] = make_pair(make_pair(city,-1*point),i);
    }
    sort(p,p+N);
    
    for(i=0;i<N;i++){
        printf("%d\n",p[i].second+1);
    }
}


Measured memory_bytes: 3684
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	int n, m, k;
	cin >> n >> m >> k;
	
	int mx = max(n, m);
	
	int ans = 0;
	while(k > 0){
		k -= mx;
		ans++;
	}
	
	cout << ans << endl;
	

	return 0;
}

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



int main() {
   ios_base::sync_with_stdio(false);

   long long int n,c=0;
   cin>>n;
   long long k=1;
   while(n!=0)
   {
       c+=k;
       k*=2;
       n/=2;
   }
   cout<<c<<"\n";
  return 0;
}


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

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

    int kk = 1;
    for (int i = min(a, b); ; i--) {
        if (a % i == 0 && b % i == 0) {
            if (kk++ == k) {
                cout << i << endl;
                return 0;
            }
        }
    }

    return 0;
}


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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	auto N=in();
	int M=(1<<N);
	
	int K=in();
	vector<int> mask(K);
	REP(i,K){
		mask[i] = in();
	}
	int L=(1<<K);
	REP(i,L){
		int v=i;
		int n=0;
		int p=0;
		while(v){
			if(v&1){
				p += 1<<mask[n];
			}
			v >>= 1;
			n++;
		}

		n=0;
		cout << p <<":";
		while(p){
			if(p&1) cout << ' ' << n;
			p >>= 1;
			n++;
		}
		cout << endl;
	}

	return 0;
}


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

int calcDigitSum(int a, int b) {
    int digitSum = 0;

    while (a) {
        digitSum += a % 10;
        a /= 10;
    }
    while (b) {
        digitSum += b % 10;
        b /= 10;
    }
    return digitSum;
}


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

    int digitSum = 100000;
    for (int i = 1; i < n ; ++i) {
        int j = n - i;
        if (digitSum > calcDigitSum(i, j)) {
            digitSum = calcDigitSum(i, j);
        }
    }
    cout << digitSum << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
int MOD = 1e9 + 7;

inline ll fpow(ll b, int p) {
    ll ret = 1;
    for (; p; p >>= 1) {
        if (p & 1) {
            ret *= b;
            ret %= MOD;
        }
        b *= b;
        b %= MOD;
    }
    return ret;
}

ll fact[200005];

ll nCk(ll n, ll k) {
    ll res = fact[n] * fpow((fact[n - k] * fact[k]) % MOD, MOD - 2);
    return res % MOD;
}

ll ways(ll n, ll k) {
    return nCk(n + k, k);
}

int main() {
    fact[0] = 1;
    for (int i = 1; i < 200005; i++)
        fact[i] = (fact[i - 1] * i) % MOD;

    ll h, w, a, b;
    scanf("%lld %lld %lld %lld", &h, &w, &a, &b);

    long long res = 0;
    long long mxr = b-1, mxD = h - a - 1;
    for(int i=0; i<=mxD; i++){
        long long r1 = b-1, d1 = i;
        long long r2 = w - b-1, d2 = h - i-1;
        res += ways(r1, d1) * ways(r2, d2);
        res %= MOD;
    }
    printf("%lld\n", res);

    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main()
{
  int m, f, r;

  while (1) {
    scanf("%d %d %d", &m, &f, &r);
    if (m == -1 && f == -1 && r == -1) break;

    if (m == -1 || f == -1) {
      printf("F\n");
      continue;
    }

    if (m + f >= 80) {
      printf("A\n");
    } else if (m + f >= 65) {
      printf("B\n");
    } else if (m + f >= 50) {
      printf("C\n");
    } else if (m + f >= 30) {
      if (r >= 50) {
        printf("C\n");
      } else {
        printf("D\n");
      }
    } else {
      printf("F\n");
    }
  }
  return 0;
}




Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>

#define say(args) cout << (args) << endl
#define rep(i, a) for (int i = 0; i < a; i++)

using namespace std;

void exec(int n) {
  int count = 0;
  string before;
  rep(i, n) {
    string tmp;
    cin >> tmp;
    if (i % 2 == 1) {
      if (before[0] != tmp[0] && before[1] == tmp[1]) {
        count += 1;
      }
    }
    before = tmp;
  }
  say(count);
}

int main() {
  int n;
  cin >> n;
  while (n != 0) {
    exec(n);
    cin >> n;
  }
}

Measured memory_bytes: 3156
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>

int main()
{
  std::string s, t;
  std::cin >> s >> t;
  std::sort(s.begin(), s.end());
  std::sort(t.begin(), t.end(), std::greater<char>());
  puts(s < t ? "Yes" : "No");
  return 0;
}

Measured memory_bytes: 256
// finish date: 2018/12/15

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>>
        vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;

bool arrayAdd(vi &tempstr, int head, int tail, int m) {
    FOR(i, tail, head) {
        if (tempstr[i] + 1 <= m) {
            FOR(j, tail, head) {
                tempstr[j]++;
                if (tempstr[j] > m) tempstr[j] = 1;
                else return true;
            }
        }
    }
    return false;
}

int main() {
    int N;
    cin >> N;
    vi A(N);
    rep(i, N) cin >> A[i];
    int ans = INT_MAX;
    N += 50;
    int m = N / 2, r = N + 1, l = 1;
    //int olm = m, olr = r, oll = l;
    while (l <= r) {
        vi tempstr(2 * N + 1, 1);
        int head = 2 * N + 1;//気を付けなはれ
        int tail = head - min(N, A[0]);
        bool flag = true;
        FOR(i, 1, N - 50) {
            if (A[i - 1] < A[i]) {
                tail--;
                tempstr[tail] = 1;
            } else if (A[i - 1] == A[i]) {
                flag = arrayAdd(tempstr, head, tail, m);
                if (!flag) break;
            } else {
                if (A[i] > N) continue;
                /*FOR(j, head - A[i], head) {
                    tempstr[j - (head - A[i])] = tempstr[head - A[i]];
                }
                head = A[i];*/
                tail = head - A[i];
                flag = arrayAdd(tempstr, head, tail, m);
                if (!flag) break;
            }
        }
        if (flag) {
            ans = min(ans, m);
            r = m - 1;
            m = (l + r) / 2;
        } else {
            l = m + 1;
            m = (l + r) / 2;
        }
      //  if (olm == m && olr == r && oll == l) break;
      //  olm = m, olr = r, oll = l;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 2564
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
using namespace std;

int main(void){
	int n, m, i = 1, b;
	cin >> n >> m;
	int ans = 1;
	for(int i = 1; i * i <= m; ++i){
		if(m % i != 0) continue;
		if((long) i * n <= m) ans = max(ans, i);
		if((long) (m/i) * n <= m) ans = max(ans, m/i);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
A,B,M = map(int,input().split())
a = [i for i in map(int,input().split())]
b = [i for i in map(int,input().split())]
xyc = [[i for i in map(int,input().split())] for j in range(M)]

ans = min(a)+min(b)
for i in range(M):
  if a[xyc[i][0]-1]+b[xyc[i][1]-1]-xyc[i][2] < ans:
    ans=a[xyc[i][0]-1]+b[xyc[i][1]-1]-xyc[i][2]
    
print(ans)

Measured memory_bytes: 32496
package main

import (
	"fmt"
)

func main() {
	var n, l int
	fmt.Scan(&n)
	fmt.Scan(&l)

	var ret int
	eat := 1000
	for i := 0; i < n; i++ {
		ret += l + i

		a := l + i
		if a < 0 {
			a = -a
		}
		b := eat
		if b < 0 {
			b = -b
		}
		if a < b {
			eat = l + i
		}
	}

	ret = ret - eat
	fmt.Println(ret)
}


Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

using namespace std;

typedef long long ll;

int main(){
  int n; cin >> n;
  int a[n];
  for(int i=0;i<n;i++) cin >> a[i];
  sort(a, a+n);
  int cnt=1;
  for(int i=0;i<n-1;i++){
    if(a[i] != a[i+1]) cnt++;
  }
  cout << cnt << endl;
}

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

int main() {
  int a;
  cin>>a;
  for(int i=1;i<=a/100;i++){
    if(0<=a-i*100&&a-i*100<=5*i){
      cout<<1<<endl;
      return 0;
    }
  }
  cout<<0<<endl;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-


def main():
    n = int(input())
    s = [input() for _ in range(2)]
    mod = 10 ** 9 + 7
    ans = 1
    i = 0

    if s[0][0] == s[1][0]:
        ans *= 3
        i = 1
    else:
        ans *= 6
        i = 2

    while i < n:
        if s[0][i] == s[1][i]:
            if s[0][i - 1] == s[1][i - 1]:
                ans *= 2

            i += 1
        else:
            if s[0][i - 1] == s[1][i - 1]:
                ans *= 2
            else:
                ans *= 3

            i += 2

        ans %= mod

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
from sys import stdin
from itertools import accumulate
n,k = map(int,stdin.readline().rstrip().split())
li = list(map(int,stdin.readline().rstrip().split()))
ma = 0
lin = []
for i in li:
    lin.append((i+1)/2)
lis = [0]+list(accumulate(lin))
ma = 0
for i in range(n-k+1):
    if i+k > n:
        break
    l = lis[i+k]-lis[i]
    ma = max(ma,l)
print(ma)

Measured memory_bytes: 80520
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <queue> //C++
#include <string> //C++
#include <iostream> //C++
#include <vector> //C++
#include <algorithm> //C++
#include <map> //C++
using namespace std; //C++
#define rep(i, a, n) for (i = (a); i < (n); i++)


//C++で提出



// string s="AAA";    s.size() =3    (sのサイズ) ...1
// vector <int> a;    配列a(サイズは0) ...2
// a.push_back(10);   配列のサイズが一つ増えて一番後ろに10を代入 ...2
// A.pop_back();   最後の要素が消去される
// sort(A.begin(),A.end());   配列Aの最初の要素から最後の要素(/.)より前までを小さい順に並び替えてa[0]から代入していく...3
// reverse(A.begin(),A.end());   配列Aの最初の要素から最後の要素(/.)までを逆の順にしてa[0]から代入していく
// s.substr(3,2)   配列s[3]から2個の文字を抜き出した文字列 (s[3]とs[4]) ...4
// strcmp(s1,s2)  文字列が等しければ0を出力　s1>s2なら1 s1<s2なら-1を出力　C言語用なので配列は、s1[100]にする...5




/*
const int MAX = 100;
int main() {
	int N, M;
	string s, t;
	map<string, int> m;
	m["apple"] = 10;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> s;
		m[s]++;
	}
	cin >> M;
	for (int i = 0; i < M; ++i) {
		cin >> t;
		m[t]--;
	}
	
	int max=0;

	for (map<string, int>::iterator i = m.begin(); i != m.end(); ++i) {
		if (max < (i->second)) max = i->second;
	}

	if (max < 0) cout << "0";
	else cout << max;

	return 0;
}

*/

int main() {

	int a, b, c;
	cin >> a >> b >> c;
	if (a == b && a != c) cout << "Yes";
	else if (a == c && a != b) cout << "Yes";
	else if (c == b && a != c) cout << "Yes";
	else cout << "No";



}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
    int a,b,i,j;
    int c[10],d[10];
    scanf("%d %d",&a,&b);
    for(i=0;i<b;i++)
        c[i]=a;
    for(j=0;j<a;j++)
        d[j]=b;
    if(a<=b){
        for(i=0;i<b;i++)
            printf("%d",c[i]);
    }
    else{
        for(j=0;j<a;j++)
            printf("%d",d[j]);
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int64_t n; cin >> n;

	int64_t aval[3]; cin >> aval[0] >> aval[1] >> aval[2];
	int64_t bval[3]; cin >> bval[0] >> bval[1] >> bval[2];

	int64_t ans = n;

	{
		vector<int64_t> dp(n + 1);
		dp[0] = n;

		FOR_LE(i, 1, n) {
			int64_t maxval = 0;
			if (i - aval[0] >= 0) {
				if (bval[0] > aval[0] && dp[i - aval[0]] != 0) {
					maxval = max(maxval, dp[i - aval[0]] + bval[0] - aval[0]);
				}
			}
			if (i - aval[1] >= 0) {
				if (bval[1] > aval[1] && dp[i - aval[1]] != 0) {
					maxval = max(maxval, dp[i - aval[1]] + bval[1] - aval[1]);
				}
			}
			if (i - aval[2] >= 0) {
				if (bval[2] > aval[2] && dp[i - aval[2]] != 0) {
					maxval = max(maxval, dp[i - aval[2]] + bval[2] - aval[2]);
				}
			}
			dp[i] = maxval;
		}

		FOR_LE(i, 0, n) {
			ans = max(ans, dp[i]);
		}
	}

	n = ans;

	{
		vector<int64_t> dp(n + 1);
		dp[0] = n;

		FOR_LE(i, 1, n) {
			int64_t maxval = 0;
			if (i - bval[0] >= 0) {
				if (aval[0] > bval[0] && dp[i - bval[0]] != 0) {
					maxval = max(maxval, dp[i - bval[0]] + aval[0] - bval[0]);
				}
			}
			if (i - bval[1] >= 0) {
				if (aval[1] > bval[1] && dp[i - bval[1]] != 0) {
					maxval = max(maxval, dp[i - bval[1]] + aval[1] - bval[1]);
				}
			}
			if (i - bval[2] >= 0) {
				if (aval[2] > bval[2] && dp[i - bval[2]] != 0) {
					maxval = max(maxval, dp[i - bval[2]] + aval[2] - bval[2]);
				}
			}
			dp[i] = maxval;
		}

		FOR_LE(i, 0, n) {
			ans = max(ans, dp[i]);
		}
	}

	cout << ans << endl;

	return 0;
}

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

ans = 0
if k>0:
  if k>a:
    ans+=a
    k-=a
  else:
    ans+=k
    k = 0

if k>0:
  if k>b:
    k-=b
  else:
    k = 0

if k>0:
  ans-=k

print(ans)

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

int main(){
    int n, i, j, k, h;
    cin >> n;
    int x[n][3];
    for(i=0; i<n; i++){
        cin >> x[i][0] >> x[i][1] >> x[i][2];
    }
    for(i=0; i<=100; i++){
        for(j=0; j<=100; j++){
            k = 0;
            while(x[k][2] == 0){
                k++;
            }
            h = x[k][2] + abs(i-x[k][0]) + abs(j-x[k][1]);
            k = 0;
            while(k < n){
                if(max(h - abs(i-x[k][0]) - abs(j-x[k][1]), 0) != x[k][2]){
                    break;
                }
                if(k == n-1){
                    cout << i << ' ' << j << ' ' <<h;
                    return 0;
                }
                k++;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
function prime(max){
   var arr=[];
   for(var i=0;i<=max;i++)arr[i]=i;
   arr[0]=false;
   arr[1]=false;
   var sqrt=Math.floor(Math.sqrt(max));
   for(var i=2;i<=sqrt;i++){
      if(arr[i]==false)continue;
         for(var j=i+i;j<=max;j+=i){
            arr[j]=false;
         }
   }
   var result=[];
   for(var i=0;i<=max;i++){
      if(arr[i]!==false)result.push(arr[i]);
   }
   return result;
}
var p=prime(999999);

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n").map(Number);
for(var i=0;i<Arr.length;i++){
   var a=Arr[i];
   for(var j=0;j<p.length;j++){
      if(p[j]>a)break;
   }
   console.log(j);
}

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

using namespace std;

typedef double Real;

Real EPS = 1e-8;

int sgn(Real a, Real b=0){return a<b-EPS?-1:a>b+EPS?1:0;}
Real sqr(Real a){return sqrt(max(a,(Real)0));}

struct Point{
  Real add(Real a, Real b){
    if(abs(a+b) < EPS*(abs(a)+abs(b)))return 0;
    return a+b;
  }
  Real x, y;
  Point(){}
  Point(Real x,Real y) : x(x) , y(y){}

  Point operator + (Point p){return Point(add(x,p.x), add(y,p.y));}
  Point operator - (Point p){return Point(add(x,-p.x), add(y,-p.y));}
  Point operator * (Real d){return Point(x*d,y*d);}
  Point operator / (Real d){return Point(x/d,y/d);}
  Real norm(){return sqr(x*x+y*y);}
  Real dist(Point a){return (*this-a).norm();}
  Real dot(Point a){return x*a.x+y*a.y;}
  Real cross(Point a){return x*a.y-y*a.x;}
};

struct circle{
  Point p;
  Real r;
  circle(){}
  circle(Point p, Real r) : p(p) , r(r){}
};

circle circumscribed_circle(Point p, Point q, Point r){
  Point a,b,c;
  circle res;
  a=(q-p)*2;
  b=(r-p)*2;
  c.x=p.dot(p)-q.dot(q);  
  c.y=p.dot(p)-r.dot(r);

  //c.x=p.x*p.x-q.x*q.x+p.y*p.y-q.y*q.y;
  //c.y=p.x*p.x-r.x*r.x+p.y*p.y-r.y*r.y;

  res.p.x=a.y*c.y-b.y*c.x;
  res.p.y=b.x*c.x-a.x*c.y;
  res.p=res.p/a.cross(b);
  return circle(res.p, p.dist(res.p));
}

int main(void){
  int n;
  cin >> n;
  while(n--){
    vector<Point>v(3);
    for(int i=0;i<3;i++)
      cin >> v[i].x >> v[i].y;

    circle res=circumscribed_circle(v[0],v[1],v[2]);
    //cout << res.p.x << " " << res.p.y << " " << res.r << endl;
    printf("%.3f %.3f %.3f",res.p.x,res.p.y,res.r);
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1276
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>

using namespace std;

vector< vector<int> > cnt(26);

int main(){
  int N;
  cin >> N;
  string S;
  cin >> S;
  for(int i = 0; i < S.length(); i++){
    cnt[S[i] - 'a'].push_back(i);
  }
  int ans = 0;
  int left;
  for(int i = 0; i < 26; i++){
    int cnt_size = cnt[i].size();

    for(int j = 0; j < cnt_size; j++){
      left = cnt[i][j];
      for(int k = cnt_size - 1, right = cnt[i][k]; k > j  && right - left > ans ; k--, right = cnt[i][k]){
        if(N - right <= ans) continue;
        int t = 0;
        for(int m = 0; left + m < right; m++){
          if(S[left+m] == S[right+m]) t++;
          else break;
        }
        if(t > ans) ans = t;

      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int m,n;
    int i,j;
    int max = 0;
    int votesum = 0;
    int undermax,maxdex;
    int a[1000] = {};
    cin >> n >> m;
    i=0;
    while(i<n){
        cin >> a[i++];
    }

    for(i=0;i<n;i++){
        votesum += a[i];
    }

    for(i=0;i<m;i++){
        max = 0;
        for(j=0;j<n;j++){
            if(max < a[j]){
                max = a[j];
                maxdex = j;
            }
        }
        a[maxdex] = 0;
        undermax = max;
    }
    if(undermax < (float)votesum/(4.0*(float)m)){
        cout << "No" << endl;
        return 0;
    }
        cout << "Yes" << endl;
}

Measured memory_bytes: 256
import math

n,m = map(int,input().split())
a = input()
b = input()
if a[0] != b[0]:
    print(-1)
    exit()

g = math.gcd(n,m)
if g == 1:
    print(n*m//g)
else:
    l = (n*m)//g
    d = {}
    for i in range(n):
        d[i*(l//n)] = a[i]
    for i in range(m):
        if i*(l//m) in d:
            if d[i*(l//m)] != b[i]:
                print(-1)
                exit()
    print(l)

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

#define FOR(i,s,e) for(int i=(s);(i)<(int)(e);++(i))
#define REP(i,e) FOR(i,0,e)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define ppb(x) pop_back(x)
#define mp make_pair
#define mt make_tuple
#define t0(t) get<0>((t))
#define t1(t) get<1>((t))
#define t2(t) get<2>((t))

typedef long long ll;
const int N = 1e6;
const int A = 1e6;
int n;
int a[N], f[A+1];

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

int main() {
  memset(f, 0, sizeof(f));
  fscanf(stdin, "%d ", &n);
  REP(i,n) {
    fscanf(stdin, "%d ", a+i);
    f[a[i]]++;
  }

  int pairwise = 1;
  FOR(i,2,A+1) {
    int cnt = 0;
    for (int j=i; j<=A; j+=i) cnt += f[j];
    if (cnt > 1) pairwise = 0;
  }
  if (pairwise) {
    puts("pairwise coprime");
    return 0;
  }

  int g = 0;
  REP(i,n) g = gcd(a[i], g);
  if (g == 1) {
    puts("setwise coprime");
    return 0;
  }

  puts("not coprime");
  return 0;
}


Measured memory_bytes: 11552
extern crate core;

use std::io::{self, Read};
use std::collections::BTreeSet;

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
    ($line:expr,$name:ident,$t:tt) => {
        let $name=value!($line,$t);
    };
    }

    macro_rules! values_def {
    ($lines:expr,$n:expr,$name:ident,$t:tt) => {
        let $name={
        let mut vec=Vec::new();
        for i in 0..$n{
            let mut next=$lines.next().unwrap().split_whitespace();
            vec.push(value!(next,$t));
        }
        vec
        };
    };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(s:#)(k:usize));
    let mut set = BTreeSet::new();
    for start in 0..s.len() {
        //len
        for len in 1..std::cmp::min(s.len() - start, k) + 1 {
            set.insert(s.chars().skip(start).take(len).collect::<String>());
        }
    }

    set.into_iter().nth(k - 1).unwrap().to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "aba\n4" => "b",
    test2: "atcoderandatcodeer\n5" => "andat",
    test3: "z\n1" => "z",
}


Measured memory_bytes: 4352
import sys
input = sys.stdin.readline
ma = lambda : map(int,input().split())
ni = lambda : int(input())
import itertools
n = ni()
l = [i+1 for i in range(n)]
P = list(ma())
Q = list(ma())
cp = 0
cq = 0
c = 0
for per in itertools.permutations(l):
    c+=1
    pf =True
    qf =True
    for i in range(n):
        if per[i] == P[i]:
            pass
        else:pf =False
        if per[i]==Q[i]:
            pass
        else:
            qf=False
    if pf:
        cp=c
    if qf:cq=c
print(abs(cp-cq))


Measured memory_bytes: 3188
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
    cin >> first;
    IN(rest...);
    return;
}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))

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; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

const int MOD = 1000000007;

int main() {
    SS(ll,N);

    rep(h,3501) rep(n,3501) {
        ll a = N * h * n;
        ll b = 4 * h * n - N * (h + n);
        if (b > 0 and a % b == 0) {
            p(h, n, a/b);
            return 0;
        }
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll N;
    cin >> N;
    ll ans = 0;
    for(ll i = 1; i <= N; i++){
        if (i % 3 != 0 && i % 5 != 0) ans += i;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3624
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int n,x;
vi a;

int main(){
  cin >> n >> x;
  a.resize(n);
  rep(i,n) cin >> a[i];
  ll ans = 0;
  rrep(i,n-1){
    if(a[i-1] + a[i] <= x) continue;
    else{
      ans += a[i-1] + a[i] - x;
      if(a[i-1]+a[i]-x <= a[i]) a[i] -= a[i-1]+a[i]-x;
      else a[i] = 0;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#define int long long
using namespace std;

signed main() {
    int n,m,c;
    int b[20];
    int sum = 0;
    int ans = 0;
    int tmp = 0;

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

    for(int i = 0; i < n; i ++){
        sum = c;
        for(int j = 0; j < m; j ++){
            cin >> tmp;
            sum += b[j]*tmp;
        }
        if(sum > 0) ans ++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3640