akhauriyash/Code-Regression huggingface dataset:
macro_rules! get {
    (Vec<$t:ty>) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}


fn main() {
    let S = get!(String);

    // 先頭から貪欲に分割する
    let (ans, _, _) = S.chars().fold(
        (0, "".to_string(), "".to_string()),
        |(res, t, prev), c| {
            let x = format!("{}{}", t, c);
            if x == prev {
                (res, x, prev)
            } else {
                (res + 1, "".to_string(), x)
            }
        }
    );

    println!("{}", ans);
}


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

int main()
{
	int n,c,i;
	int pre[12],now[12],cnt[12];
	while(cin >> n,n)
	{
		map<int,int> m;
		for(i=0; i<n; i++)
		{
			cin >> pre[i];
			m[pre[i]] = i+1;
		}
		for(i=0; i<n; i++)
			now[i] = m[pre[i]];	

		for(c=0; ; c++)
		{
			for(i=0; i<n; i++)
				cnt[i] = 0;

			for(i=0; i<n; i++)
				cnt[now[i]-1]++;		

			for(i=0; i<n; i++)
				now[i] = cnt[now[i]-1];

			for(i=0; i<n; i++)
				if(now[i]!=pre[i])
					break;

			if(i==n) break;

			for(i=0; i<n; i++)
				pre[i] = now[i];
		}

		cout << c << endl << now[0];
		for(i=1; i<n; i++)
			cout << " " << now[i];
		cout << endl;


	}
	return 0;
}

Measured memory_bytes: 644
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

template<typename V>
constexpr string join(const V &v, const string &sep) {
  stringstream ss;
  if (v.size()) ss << v[0];
  loop(i, 1, v.size()) ss << sep << v[i];
  return ss.str();
}

void solve() {
  string s;
  getline(cin, s);
  s = regex_replace(s, regex("[,.]"), " ");
  istringstream ss(s);
  vs v;
  while (ss >> s)
    if (3 <= s.size() && s.size() <= 6) v.pb(s);
  cout << join(v, " ") << endl;
}

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

using namespace std;
typedef long long ll;

struct edge {
  int from, to; ll cost;
  edge(int f = 0, int t = 0, ll c = 0): from(f), to(t), cost(c) {}
};

const ll INF = 1e18;
int n, m;
ll d[1001];
edge G[2001];
bool negLoop = false;

void bellmanFord(int s) {
  fill(d, d + n, INF);
  d[s] = 0;

  for (int i = 0; i < n; i++) {
    bool update = false;
    for (int j = 0; j < m; j++) {
      edge e = G[j];
      if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost) {
        d[e.to] = d[e.from] + e.cost;
        update = true;
        if (i == n - 1) negLoop = true;
      }
    }
    if (!update) break;
  }
}

int main(void) {
  cin >> n >> m;
  
  for (int i = 0; i < m; i++) {
    int a, b; ll c;
    cin >> a >> b >> c;
    G[i] = edge(b - 1, a - 1, -c);
  }

  bellmanFord(n - 1);

  if (negLoop) {
    cout << "inf\n";
  } else {
    cout << -d[0] << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <cassert>
using namespace std;

#define GET_ARG(a,b,c,F,...) F
#define REP3(i,s,e) for (i = s; i <= e; i++)
#define REP2(i,n) REP3 (i,0,(int)(n)-1)
#define REP(...) GET_ARG (__VA_ARGS__,REP3,REP2) (__VA_ARGS__)
#define RREP3(i,s,e) for (i = s; i >= e; i--)
#define RREP2(i,n) RREP3 (i,(int)(n)-1,0)
#define RREP(...) GET_ARG (__VA_ARGS__,RREP3,RREP2) (__VA_ARGS__)
#define DEBUG(x) cerr << #x ": " << x << endl

string a[500], red[500], blue[500];

int main(void) {
    int i, j, h, w;
    cin >> h >> w;
    REP (i,h) {
        cin >> a[i];
        red[i].resize(a[i].size());
        blue[i].resize(a[i].size());
    }
    REP (i,h) REP (j,w) {
        if (i % 2) {
            red[i][j] = '.';
            blue[i][j] = '#';
        }
        else {
            red[i][j] = '#';
            blue[i][j] = '.';
        }
        if (j == 0) {
            red[i][j] = '.';
            blue[i][j] = '#';
        }
        else if (j == w-1) {
            red[i][j] = '#';
            blue[i][j] = '.';
        }
        if (a[i][j] == '#') {
            red[i][j] = '#';
            blue[i][j] = '#';
        }
    }
    REP (i,h) cout << red[i] << endl;
    cout << endl;
    REP (i,h) cout << blue[i] << endl;
    return 0;
}


Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 1;i!=n;i++) 
using namespace std;


int main(){
  string s;
  cin >> s;
  bool nowW=false;
  if(s[0]=='W'){
    nowW=true;
  }
  int ans=0;
  REP(i,s.size()){
    if(s[i]=='W'){
      if(nowW==false){
        nowW=true;
        ans++;
      }
    }
    if(s[i]=='B'){
      if(nowW==true){
        nowW=false;
        ans++;
      }
    }
  }
  if(ans==0){
    cout << 0 << endl;
    return 0;
  }
  ans++;
  cout << ans-1 << endl;
}


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

int main(){

int  i , j;

for( int i = 1 ; i < 10 ; i++ ){
    for( int j = 1 ; j < 10 ; j++ ){
       cout << i << "x" << j << "=" << i*j << endl;
    }
}

return 0;
}

Measured memory_bytes: 1116
#include <stdio.h>
#include <string.h>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

typedef long long ll;

//printf("%d", n);
//printf("%d", sum);
//scanf("%d", &n);
//scanf("%c", &c);
//scanf("%lf", &d);

#define NUM (101)

int main(int argc, char** argv){
    char str[NUM];
    scanf("%s", str);

    char* p1 = str;
    char* p2 = str + strlen(str) - 1;
    int n = 0;

    while(p1 < p2){
        if(*p1 != *p2){
            *p1 = *p2;
            n++;
        }
        p1++;
        p2--;
    }
    printf("%d\n", n);

    return 0;
}




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

using namespace std;

int main()
{
    int n;
    cin >> n;
    deque <int> dq;
    int a;
    for (int j = 0; j < n; j++) {
        cin >> a;
        if (j % 2)
            dq.push_front(a);
        else
            dq.push_back(a);
    }
    if (n % 2) {
        while (!dq.empty()) {
            cout << dq.back() << " ";
            dq.pop_back();
        }
    }
    else {
        while (!dq.empty()) {
            cout << dq.front() << " ";
            dq.pop_front();
        }
    }
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
 
int n, a, b, c, d; char s[1005];
int main () {
	scanf("%s", s), n = strlen(s);
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'N') ++a; else
		if (s[i] == 'S') ++b; else
		if (s[i] == 'W') ++c; else
		if (s[i] == 'E') ++d;
	}
	if (a && b && !c && !d || !a && !b && c && d || a && b && c && d) puts("Yes"); else puts("No");
	return 0;
}

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

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

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
const long long MOD=(long long)1e9+7;


int main() {
    int N,M;
    cin>>N>>M;
    vector<bool> ok(N+1,true);
    for(int i=0;i<M;++i){
        int tmp; cin>>tmp;
        ok[tmp]=false;
    }

    vector<long long> dp(N+1,0);
    dp[0]=1;
    for(int i=1;i<=N;++i){
        if(!ok[i]) continue;
        else if(i==1) dp[i]=1;
        else dp[i]=(dp[i-2]+dp[i-1])%MOD;
    }
    cout<<dp[N]<<endl;

    return 0;
}



Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        long M = scan.nextLong();
        List<Long> A = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(scan.nextLong());
        }
        A.sort(Comparator.reverseOrder());
        long[] sumA = new long[N+1];
        for (int i = 0; i < N; i++) {
            sumA[i+1] = sumA[i] + A.get(i);
        }

        long left = 0;
        long right = 20000000000L;
        while (left + 1 != right) {
            long mid = (left + right) / 2;
            long count = count(N, mid, A);
            if (M <= count) {
                left = mid;
            } else {
                right = mid;
            }
        }
        long ans = sum(N, M, left, A, sumA);
        System.out.println(ans);
    }

    private long sum(int N, long M, long threshold, List<Long> A, long[] sumA) {
        long sum = 0;
        long total = 0;
        for (int i = 0; i < N && 0 < M; i++) {
            int c = lower_bound(N, A, threshold - A.get(i));
            total += c;
            sum += A.get(i) * (long) c;
            sum += sumA[c];
        }
        sum -= Math.max(0, (total-M) * threshold);
        return sum;
    }
    private long count(int N, long threshold, List<Long> A) {
        long count = 0;
        for (int i = 0; i < N; i++) {
            count += lower_bound(N, A, threshold - A.get(i));
        }
        return count;
    }
    private int lower_bound(int N, List<Long> A, long threshold) {
        if (threshold > A.get(0)) {
            return 0;
        }
        if (A.get(N-1) > threshold) {
            return N;
        }
        int left = -1;
        int right = N;
        while (left + 1 < right) {
            int mid = (left + right) / 2;
            if (threshold <= A.get(mid)) {
                left = mid;
            } else {
                right = mid;
            }
        }
        return right;
    }
}


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

int main() {
  int N;
  cin >> N;
  int a = N/1000;
  int b = N/100-a*10;
  int c = N/10-a*100-b*10;
  int d = N-a*1000-b*100-c*10;
  if ((a==b&&b==c) || (b==c&&c==d)){
    cout << "Yes"<< endl;
  }
  else{
    cout << "No" << endl;
}
}


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



int main() {
  long long int H;
  cin >>H;
  long long int P=H;
  long long int g[50];
  int memo;
  for(int i=0;i<50;i++){
  	g[i]=P;
    P/=2;
    if(P==0){memo=i;break;}
  }
  if(H==1){cout <<'1'<<endl;}
  else{g[memo]=1;
    for(long long int j=memo-1;j>=0;j--){
    	g[j]=2*g[j+1]+1;
    }
  cout<<g[0]<<endl;
  }
}

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

int isPrime(int n)
{
    if(n == 2)
    {
        return 1;   
    }

    if(n % 2 == 0 || n < 2)
    {
        return 0;
    }

    int i;
    for(i = 3; i <= sqrt(n); i += 2)
    {
        if(n % i == 0)
        {
            return 0;
        }
    }

    return 1;
}

int main(void)
{
    int n;
    scanf("%d", &n);
    
    int count = 0;
    int i;
    for(i = 0; i < n; ++i)
    {
        int x;
        scanf("%d", &x);
        count += isPrime(x);
    }

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

    return 0;
}

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

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define int long long 

using namespace std;

int32_t main()
{
	fio;
	int x;
	cin>>x;
	bool found=false;
	for(int a=0;a<=200 and !found;a++)
	{
		for(int b=-200;b<=a and !found;b++)
		{
			if(pow(a,5)-pow(b,5)==x)
			{
				cout<<a<<" "<<b<<endl;
				found=true;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 4112
s=gets.chomp
a=[*?a..?z]
b=[]
ss=s
min=10**9
26.times do |i|
  g=a[i]
  ss=ss.split("").map{|e|e==g ? true : false}
  c=0
  while !ss.all?{|w|w==true} do
    if !ss.any?{|w|w}
      ss=""
      c=10**9
      break
    end
    sss=[]
    (ss.length-1).times do |i|
      sss << (ss[i]||ss[i+1])
    end
    ss=sss.dup
    c+=1
  end
  min = [min,c].min
  ss=s
end
p min
  
  

Measured memory_bytes: 2172
#include <iostream>
using namespace std;
int main(){
  int h[30];
  int v[30];
  int n,c;
  for (int i=0; i<20; i++)
    v[i]=1;
  cin >> n;
  for (int i=0; i<n; i++)
    cin >> h[i];
  for (int j=1;j<n; j++){
    for (int i=0; i<j; i++){
      if (h[i] > h[j]){
        v[j] = 0;
        break;
      }
    }
  }
  c=0;
  for(int i=0; i<n; i++)
    c+=v[i];
  cout << c << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string x,s;
  cin>>s>>x;
  for(int i=0;i<s.size();i++){
    if(s[i]!=x[i]){
      cout<<"No"<<endl;
      return 0;
	}
  }
  cout<<"Yes"<<endl;
  return 0;
}

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
	
	public static final long MOD = 1000000007;
	
	public static long memoized(int deep, int n, long[] memo){
		//System.out.println(deep);
		
		if(deep >= n){
			return 1;
		}else if(memo[deep] >= 0){
			return memo[deep];
		}else{
			long ret = 0;
			
			for(int i = n - deep + 1; i >= 1; i--){
				final int next_deep = deep + i;
				
				ret += memoized(next_deep, n, memo);
				ret %= MOD;
				
				if(next_deep <= n && i >= 2){
					ret += n - 1;
					ret %= MOD;
				}
			}
			
			return memo[deep] = ret;
		}
	}
	
	public static void main(String[] args) throws IOException {
		try(Scanner sc = new Scanner(System.in)){
			
			final int n = sc.nextInt();
			final long n_value = n;
			
			long[] memo = new long[n + 1];
			memo[0] = (n) % MOD;
			memo[1] = ((long)(n) * (long)(n)) % MOD;
			
			long sum = 0;
			for(int i = 2; i <= n; i++){
				memo[i] += memo[i - 1];
				memo[i] %= MOD;
				
				memo[i] += sum + (n_value - (i - 1));
				memo[i] %= MOD;
				
				memo[i] += (n_value - 1) * (n_value - 1);
				memo[i] %= MOD;
				
				sum += memo[i - 2];
				sum %= MOD;
				
				//System.out.println(memo[i]);
			}
			
			//System.out.println(Arrays.toString(memo));
			
			System.out.println(memo[n - 1]);
			//System.out.println(memoized(0, n, memo));
		}
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}
		
		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 29780
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n)     for (ll i = 0; i < (n); ++i)
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
#define repin(a, n)  \
    vector<ll> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
    vector<string> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
    vector<double> a(n); \
    rep(i, n) { cin >> a[i]; }
#define in(a) \
    ll a;     \
    cin >> a;
#define ins(a) \
    string a;  \
    cin >> a;
#define ind(a) \
    double a;  \
    cin >> a;
template <class T>
inline void out(T a) {
    cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x)  (x).begin(), (x).end()    //昇順
#define rall(x) (x).rbegin(), (x).rend()  //降順
#define yes     out("Yes");
#define no      out("No");

int main() {
    in(n);
    ins(c);
    ll s = count(all(c), 'R');
    ll t = count(c.begin(), c.begin() + s, 'R');
    out(s - t);
}

Measured memory_bytes: 3760
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<bool> vbool;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(int a, int b) {
	return a > b;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

int main() {
	vbool table(52, true);
	int n;
	cin >> n;
	rep(i, n) {
		char c;
		int x;
		cin >> c >> x;
		x--;
		if (c == 'H')x += 13;
		if (c == 'C')x += 26;
		if (c == 'D')x += 39;
		table[x] = false;
	}
	char m[4] = { 'S','H','C','D' };
	rep(i, 52) {
		if (table[i]) {
			cout << m[i / 13] << " " << i % 13 + 1 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3092
CP = 4
DP = 7

N = gets.strip.to_i

def dfs(c, d, p)
  return c + d if p == 0
  return 0 if p < 0 

  res = 0
  res += dfs(c + 1, d, p - CP)
  # res += dfs(c, d + 1, p - DP) if res == 0
  res += dfs(c, d + 1, p - DP)
  return res
end

res = dfs(0, 0, N)
puts res > 0 ? 'Yes' : 'No'


Measured memory_bytes: 1788
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7

mono = sorted(set(a))
dic = Counter(a)

if n % 2 == 1:
    last = 0
else:
    last = 1

res = 0
Cond = True
for x in mono:
    if x == 0 and a.count(0) == 1: last = 2
    elif x == last and dic[x] == 2:
        res += 1
        last += 2
    else: Cond = False

if Cond:
    print(2**res % MOD)
else:
    print(0)

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int a[] = new int[n];
        for(int i = 0; i < n; i++){
            a[i] = Integer.parseInt(sc.next());
        }

        Sort(a);

        int alice = 0;
        int bob = 0;

        for (int i = 0; i < n; i++) {
            if(i % 2 == 0){
                alice += a[i];
            }else{
                bob += a[i];
            }
        }

        System.out.println(alice - bob);

        sc.close();
    }

    static void Sort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            for (int j = array.length - 1; j > i; j--) {
                if (array[i] < array[j]) {
                    int tem = array[i];
                    array[i] = array[j];
                    array[j] = tem;
                }
            }
        }
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int N;
    cin>>N;
    vector<int> d(N);
    rep(i,N) cin>>d[i];
    sort(d.begin(),d.end());
    cout<<d[N/2]-d[N/2-1]<<endl;
}

Measured memory_bytes: 640
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=2e5+50;
const ll mod=1e9+7;
using namespace std;
int n,i;
ll k,a[nmax],l,r,mid;
int ok(ll x)
{
    int i;
    ll tot=0;
    for(i=1;i<=n;i++)tot+=(a[i]-1)/x;
    return tot<=k;
}
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
    cin>>n>>k;
    for(i=1;i<=n;i++)cin>>a[i];
    l=1,r=1e9;
    while(l<=r)
    {
        mid=(l+r)/2;
        if(!ok(mid))l=mid+1;
        else r=mid-1;
    }
    cout<<l<<'\n';
	return 0;
}


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

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

    int n, m;
    cin >> n >> m;
    char C[n][m], D[n][m];
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> C[i][j];
        }
    }

    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            cin >> D[i][j];
            if(C[i][j] != D[i][j]) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 10920
/// kazuki08
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,a[202020],p2[402020];

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
  
  cin >> n;
  for(int i=1;i<=n;i++){
    cin >> a[i];
  }
  sort(a+1,a+n+1);
  p2[0]=1;
  for(int i=1;i<=2*n+10;i++){
    p2[i] = p2[i-1]*2%mod;
  }
  int ans = 0;
  for(int i=1;i<=n;i++){
    int p = n-i;
    int cur = p2[2*(i-1)]*(p+2)%mod*(p2[p+p])%mod*a[i]%mod;
    ans = (ans+cur)%mod;
  }
  cout << ans << endl;
  


return 0;
}
///....


Measured memory_bytes: 4992
import sys
input = sys.stdin.readline
def print_ans(A, B):
    """Test Case
    >>> print_ans(5, 3)
    9
    >>> print_ans(3, 4)
    7
    >>> print_ans(6, 6)
    12
    """
    ans = sorted([A, B, A - 1, B - 1])
    print(ans[-1] + ans[-2])

if __name__ == '__main__':
    A, B = map(int, input().rstrip().split())
    print_ans(A, B)


Measured memory_bytes: 3060
import math
a, b , n = map(int, input().split())
score = 0
max_score = 0
if b-1 <= n:
  score = math.floor(a*(b-1)/b) - a*math.floor((b-1)/b)
  if score > max_score:
    max_score = score
else:
  score = math.floor(a*n/b) - a*math.floor(n/b)
  if score > max_score:
    max_score = score

print(max_score)

Measured memory_bytes: 62044
#include<iostream>

using namespace std;

int main(){
    int N;
    string S;
    cin >> N >> S;
    if (N%2==1)
    {
        cout << "No" << endl;
    }else
    {
        
        for (int i = 0; i < (N/2); i++)
        {
            if (S[i]!=S[N/2+i])
            {
                cout << "No" << endl;
                return 0;
            }
            
        }

        cout << "Yes" << endl;
        
    }
    
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <queue>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()

int main() {
    int n,l,p;
    cin>>n;
    vector<int>waru;
    vector<int>sosu(1000);
    for(int i=n;i>1;i--)waru.push_back(i);
    l=waru.size();
    while(l){
        p=waru[l-1];
        if(p>1){
            rep(i,l){
                while(waru[i]%p==0){
                    waru[i]/=p;
                    sosu[p]++;
                }
            }
        }
        waru.pop_back();
        l--;
    }
    rep(i,1000)sosu[i]++;
    long long ans=1;
    rep(i,1000){
        ans*=sosu[i];
        ans%=1000000007;
    }
    cout<<ans;
	return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,a;
    cin >> N;
    if(N%2==0){
        cout << N/2 << "\n";
    }else if(N%2==1){
        a=N/2;
        cout << a+1 << "\n";
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

template<class T> void swap(T *a, T *b ){
    T temp;
    temp = *a;
    *a = *b;
    *b = temp;   
}

int main(){
    int M,D;
    int i;
    int d_10,d_1;
    int count;
    cin >> M >> D;
    count = 0;
    for(i=1;i<=M;i++){
        d_10 = 2;
        for(; d_10 <= D/10; d_10++){
            if( (i % d_10) == 0 ){
                d_1 = i / d_10;
                if( d_10 * d_1 == i && d_1 >= 2 && d_1 <= 9 && d_1 + d_10 * 10 <= D ){
                    count++;
                }
            }
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>

using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define itn int
using ll = long long;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
///                →,↑,←,↓,↗,↖,↙,↘
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };


signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	bool can = false;
	int i;
	rep(i, b) {
		if (a * i % b == c) {
			can = true;
			break;
		}
	}
	if (can)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 384
using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] dataline = Console.ReadLine().Split(' ');
            int a = int.Parse(dataline[0]);
            int b = int.Parse(dataline[1]);
            int c = int.Parse(dataline[2]);
            if ((b-a)==(c-b))
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    REP(i, N){
        char c;
        cin >> c;
        if(c == 'Y'){
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VV = vector<VI>;
using VS = vector<string>;

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,b) FOR(i, 0, b)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl

const ll mod = 1e9 + 7;
const ll inf = 1e18;

const int N_MAX = 205;
ll N; 
ll d[N_MAX][N_MAX]; // 隣接行列　ワーシャルフロイド用
VV G; // 隣接グラフ　dfs用

// 二部グラフかどうか
// 蟻本 p94
int color[N_MAX];
bool dfs(int v, int c){
  color[v] = c;
  for(ll to : G[v]){
    if(color[to]==c) return false;
    // 隣接している頂点がまだ塗られていないなら-cで塗る
    if(color[to]==0 && !dfs(to, -c)) return false;
  }
  // すべての頂点を正しく塗れたらtrue
  return true;
}
bool is_bipartite(){
  if(dfs(0, 1)==true){
    return true;
  }else{
    return false;
  }
}

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

    // input
    cin >> N;
    G.resize(N);
    rep(i, N){
      string s; cin >> s;
      
      // 隣接行列
      rep(j, N){
        if(i==j){
          d[i][j] = 0;
        }
        else if(s[j]=='1'){
          d[i][j] = 1;
        }
        else{
          d[i][j] = inf;
        }
      }

      // 隣接グラフ
      rep(j, N){
        if(s[j]=='1'){
          G[i].push_back(j);
        }
      }
    }

    // 二部グラフじゃないなら構成不可
    if(!is_bipartite()){
      p(-1);
      return 0;
    }

    // 直径を求めたい
    FOR(i, 0, N){ // 経由点
        FOR(j, 0, N){ // 始点
            FOR(k, 0, N){ // 終点
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
            }
        }
    }
    ll ma = 0; // 直径
    rep(i, N){
      rep(j, N){
        chmax(ma, d[i][j]);
      }
    }
    p(ma+1);
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n; cin>>n;
    long long a[n]; rep(i,n) cin>>a[i];
    sort(a,a+n);
    int l=1,r=n-1;
    int ll=a[0],rr=a[0],cnt=n-1;
    long long ans=0;
    while(cnt--){
        long long lm=abs(ll-a[l]),rm=abs(rr-a[l]),lmm=abs(ll-a[r]),rmm=abs(rr-a[r]);
        long long ma=max({lm,rm,lmm,rmm});
        if(ma==lm){
            ans+=lm;
            ll=a[l];
            l++;
        }else if(ma==rm){
            ans+=rm;
            rr=a[l];
            l++;
        }else if(ma==lmm){
            ans+=lmm;
            ll=a[r];
            r--;
        }else{
            ans+=rmm;
            rr=a[r];
            r--;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll   = long long;
using pll  = pair<ll,ll>;
using vll  = vector<pll>;
using vvll = vector<vll>;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define dmax(a,b) a=max(a,b)

int main() {
    int n; cin >> n;
    vvll dp(1<<n, vll(2));
    rep(i,1<<n) {
        scanf("%ld", &dp[i][0].first);
        dp[i][0].second = i;
    }
    rep(b,1<<n) {
        rep(i,n) {
            int nb = b | (1<<i);
            if (nb == b) continue;
            if (dp[b][0].first > dp[nb][0].first) {
                if (dp[b][1].first > dp[nb][0].first) {
                    dp[nb][1] = dp[b][1];
                } else {
                    dp[nb][1] = dp[nb][0];
                }
                dp[nb][0] = dp[b][0];
            } else if (
                dp[b][0].first > dp[nb][1].first and
                dp[b][0].second != dp[nb][0].second
            ) {
                dp[nb][1] = dp[b][0];
            }
        }
    }
    ll ans = 0;
    rng(i,1,1<<n) {
        dmax(ans, dp[i][0].first + dp[i][1].first);
        printf("%ld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 21504
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int a;
    cin >> a;
    cout << 3 * a * a << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;

const int N=55;

int n;
ll ans;
bool tag;
int f[N][N],a[N],b[N],g[N][N];

void floyd(){
	int i,j,k;
	for (k=0;k<=50;k++)
		for (i=0;i<=50;i++) if (f[i][k])
			for (j=0;j<=50;j++) if (f[k][j])
				f[i][j]=1;
}

int main(){
	int i,j,k;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	for (i=1;i<=n;i++) scanf("%d",&b[i]);
	for (i=0;i<=50;i++) g[i][i]=1;
	for (i=50;i>=1;i--){
		for (j=0;j<=50;j++)
			for (k=0;k<=50;k++) f[j][k]=g[j][k];
		for (j=i-1;j>=1;j--)
			for (k=0;k<=50;k++) f[k][k%j]=1;
		floyd();
		tag=1;
		for (j=1;j<=n;j++)
			if (!f[a[j]][b[j]]){
				tag=0;
				break;
			}
		if (!tag){
			ans+=(1ll<<i);
			for (k=0;k<=50;k++) g[k][k%i]=1;
		}
	}
	for (j=0;j<=50;j++)
		for (k=0;k<=50;k++) f[j][k]=g[j][k];
	floyd();
	for (i=1;i<=n;i++)
		if (!f[a[i]][b[i]]){
			printf("-1\n");
			return 0;
		}
	printf("%lld\n",ans);
	return 0;
}

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

int main(void){
    double a[9][7] = {
        1,0,0,1,0,0,0,
        1,0,0,0,1,0,0,
        1,0,0,0,0,1,0,
        0,1,0,1,0,0,0,
        0,1,0,0,1,0,0,
        0,1,0,0,0,1,0,
        0,0,1,1,0,0,0,
        0,0,1,0,1,0,0,
        0,0,1,0,0,1,0
    };
    for(long i=0; i<9; i++){
        cin >> a[i][6];
    }
    long c;
    for(c=0; c<6; c++){
        long pivot=c;
        double max=0;
        for(long i=c; i<9; i++){
            if(fabs(a[i][c])>max){
                max = fabs(a[i][c]);
                pivot = i;
            }
        }
        if(max<1e-6){
            /*
            for(long i=0; i<9; i++){
                for(long j=0; j<7; j++){
                    printf("%4.1f ", a[i][j]);
                }
                cout << endl;
            }
            cout << endl;
            cout << c << endl;
            */
            break;
        }
        if(pivot!=c){
            for(long i=0; i<7; i++){
                double t=a[pivot][i];
                a[pivot][i]=a[c][i];
                a[c][i]=t;
            }
        }
        double b = a[c][c];
        for(long i=0; i<7; i++){
            a[c][i]/=b;
        }
        for(long r=c+1; r<9; r++){
            double b = a[r][c];
            for(long i=0; i<7; i++){
                a[r][i] -= b*a[c][i];
            }
        }
    }
    for(long i=c; i<9; i++){
        //cout << a[i][6] << endl;
        if(fabs(a[i][6])>1e-6){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N=I()
P=LS()
Q=LS()

l = ["".join([str(n) for n in list(i)]) for i in itertools.permutations(range(1,N+1),N)]

ans = abs(l.index("".join(P)) - l.index("".join(Q)))
print(ans)


Measured memory_bytes: 14832
// author: tarang 
#include<bits/stdc++.h>
#define ll long long
#define endl  '\n'
#define fastio  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD=1000000007;
#define PI acos(-1)
using namespace std;
int vis[1000000+7];
int gcd(int x, int y)
{                     
        return (x==0)? y : gcd(y % x, x);
}
int main(){
    int n ; cin >> n ;
    int a[n] ; cin >> a[0];
    int ans = a[0] ;
    for(int i = 1 ; i < n  ; i++){
       cin >> a[i];
       ans = gcd(ans,a[i]);
 }
 for(int i = 0 ; i < n ; i++){
    int x = a[i];
    for(int j = 2 ; j*j <= x ; j++){
       if(x%j==0){
        while(x%j==0){
            x/=j;
     }
     vis[j]++;
    }
    }
    if(x > 1){
     vis[x]++;
    }
 }
 bool flag = 0;
 for(int i = 2 ; i <= 1000000 ; i++){
   if(vis[i] > 1){
    flag = 1;
    break;
   }
 }
 if( ans == 1){
  if(flag != 0){ 
     cout << "setwise coprime " << endl;
  }
  else cout << "pairwise coprime " << endl;
 }
 else cout << "not coprime" << endl;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;

int main()
{
    int k, s;
    cin >> k >> s;

    int ans = 0;
    rep(x, k + 1)
    {
        rep(y, k + 1)
        {
            int z = s - x - y;
            if (0 <= z && z <= k)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3592
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
using ll = int64_t;
using ull = uint64_t;
using PLL = pair<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

const ll MOD = 2019;

ll calc_mod(ll right, ll mod) {
    ll ret = right / MOD;
    if(ret * MOD + mod < right) ret++;
    return ret;
}

int main() {
    ll L, R;
    cin >> L >> R;
    R++;
    ll cnt[MOD] = {};
    for(ll i = 0; i < MOD; i++) {
        cnt[i] = calc_mod(R, i) - calc_mod(L, i);
    }
    ll ans = MOD;
    for(ll i = 0; i < MOD; i++) {
        for(ll j = 0; j < MOD; j++) {
            if(i == j && cnt[i] < 2) continue;
            if(cnt[i] < 1 || cnt[j] < 1) continue;
            chmin(ans, i * j % MOD);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_sum = [0]
for i in range(N):
    A_sum.append(A_sum[i] + A[i])
B_sum = [0]
for i in range(M):
    B_sum.append(B_sum[i] + B[i])
B_sum.append(10**10)

res = 0
for i in range(len(A_sum)):
    low = 0
    high = len(B_sum)
    while high - low > 1:
        mid = (low + high) // 2
        if A_sum[i] + B_sum[mid] <= K:
            low = mid
        else:
            high = mid
    if A_sum[i] + B_sum[low] <= K:
        res = max(res, i + low)

print(res)


Measured memory_bytes: 47520
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <math.h>
 
using namespace std;
 
int main(void){
  unsigned long A, B;
  unsigned long C, D;
 
  cin >> A >> B >> C >> D;
 
  unsigned long ell = (C*D)/__gcd(C,D);
  
  unsigned long numBC = B/C;
  unsigned long numBD = B/D;
  unsigned long numBCD = B/ell;
  
  unsigned long numAC = (A-1)/C;
  unsigned long numAD = (A-1)/D;
  unsigned long numACD = (A-1)/ell;
  
  unsigned long count = (B-numBC-numBD+numBCD) - ((A-1)-numAC-numAD+numACD);
  
  cout << count << endl;
 
  return 0;
}

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

using namespace std;

int main() {
	int p, q, r, maxi, sum;
	scanf("%d %d %d", &p, &q, &r);
	maxi = max(p, max(q, r));
	sum = p + q + r - maxi;
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <ctime>
#include <cstring>
using namespace std;

int n;
int MAX = 15;
int p[16][16];
bool up[16][16];
bool ri[16][16];
int matatabi;

int main(void){

	cin >> n;
	for(int i = 0; i < n; i++){
		int x_g, y_g;
		cin >> x_g >> y_g;
		for(int j = 0; j <= x_g; j++){
			for(int k = 0; k <= y_g; k++){
				p[j][k] = 0;
				up[j][k] = true;
				ri[j][k] = true;
			}
		}

		p[0][0] = 1;

		cin >> matatabi;
		for(int j = 0; j < matatabi; j++){
			int x1, y1, x2, y2;
			cin >> x1 >> y1 >> x2 >> y2;
			if(x1 == x2){
				if(y1 > y2){
					up[x1][y2] = false;
				}else{
					up[x1][y1] = false;
				}
			}else if(x1 > x2){
				ri[x2][y1] = false;
			}else{
				ri[x1][y1] = false;
			}
		}

		for(int j = 0; j <= x_g; j++){
			for(int k = 0; k <= y_g; k++){
				if(j + k != 0){
					if(j == 0){
						if(up[j][k - 1]){
							p[j][k] += p[j][k - 1];
						}
					}else if(k == 0){
						if(ri[j - 1][k]){
							p[j][k] += p[j - 1][k];
						}
					}else{
						if(up[j][k - 1]){
							p[j][k] += p[j][k - 1];
						}
						if(ri[j - 1][k]){
							p[j][k] += p[j - 1][k];
						}
					}
				}
			}
		}



		if(p[x_g][y_g] == 0){
			cout << "Miserable Hokusai!" << endl;
		}else{
			cout << p[x_g][y_g] << endl;
		}
		


	}

    return 0;
}

Measured memory_bytes: 1160
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int T = sc.nextInt();
		
		int InTime[];
		InTime= new int[N];
		
		int wark_cost;
		int wark_time;
		int flag = 0;
		int i = 0;
		int count = 0;
		
		for(i = 0; i < N; i++){  // N回くりかえす
			wark_cost = sc.nextInt();
			wark_time = sc.nextInt();
			
			if(wark_time <= T){
				InTime[i] = wark_cost;
				flag = 1;
			}else{
				InTime[i] = 1000;
			}
			
		}
		int min = 1000;
		
		for(i = 0; i < N; i++){
			if(min > InTime[i]){
				min = InTime[i];
			}
			
			
		}
		
		if(flag == 0){
			System.out.println("TLE");
		}
		else{
			System.out.println(min);
		}
	}
}


Measured memory_bytes: 23252
#include <stdio.h>

int main(void) {                                                                
    int car, index = 0;                                                         
    int stack[10] = {};                                                         
                                                                                
    while (scanf("%d", &car) != EOF) {                                          
        if (car == 0) {                                                         
            printf("%d\n", stack[--index]);                                     
        } else {                                                                
            stack[index++] = car;                                               
        }                                                                       
    }                                                                           
    return 0;                                                                   
}

Measured memory_bytes: 600