akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define MOD (int) (1e9+7)
#define INF (int) 2e9

int main(){
    int n;
    cin >> n;
    vector<int> l(n);
    rep(i, n){
        cin >> l[i];
    }

    sort(l.begin(), l.end());

    ll ans = 0;
    rep(i, n){
        rep(j, n){
            if(i>=j) continue;
            int ma = l[i] + l[j];
            int mi = abs(l[i]-l[j]);

            int a = lower_bound(l.begin()+j, l.end(), ma) - lower_bound(l.begin()+j, l.end(), mi) -1;
            // printf("%d\n", a);
            ans += a;
        }
    }
    
    cout << ans << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
#!python3

import sys

iim = lambda: map(int, input().rstrip().split())

def popcnt2(n):
    a = (
        0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
        4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
    )
    ans = 0
    while n:
        ans += a[n&0xff]
        n >>= 8
    return ans

def resolve():
    N = int(input())
    S = list(input())
    Q = int(input())

    ln = N.bit_length() + 1
    c0 = ord('a')
    smap = [1<<(i-c0) for i in range(c0, ord('z')+1)]

    T = [None] * ln

    T[0] = [smap[ord(S[i])-c0] for i in range(N)]
    if N&1:
        T[0].append(0)
        N += 1

    t0, n2 = T[0], N
    for i in range(1, ln):
        n1 = n2 = n2 >> 1
        if n2 & 1:
            n2 += 1
        ti = T[i] = [0] * n2
        for j in range(n1):
            j2 = j << 1
            d1, d2 = t0[j2], t0[j2+1]
            ti[j] = d1 | d2
        t0 = ti

    #for ti in T:
    #    print(len(ti), ti)
    ans = []
    for cmd, i, j in (line.split() for line in sys.stdin):
        i = int(i) - 1
        if cmd == "1":
            if S[i] == j:
                continue

            S[i] = j

            t0 = T[0]
            t0[i] = smap[ord(j)-c0]
            for i1 in range(1, ln):
                ti = T[i1]
                j1 = i >> 1
                ti[j1] = t0[i] | t0[i^1]
                i, t0 = j1, ti
            #for ti in T:
            #    print(len(ti), ti)
        elif cmd == "2":
            j = int(j) - 1

            d1 = 0
            for i1 in range(ln):
                ti = T[i1]
                if not i < j :
                    if i == j:
                        d1 |= ti[i]
                    break
                if i & 1:
                    d1 |= ti[i]
                    i += 1
                if j & 1 == 0:
                    d1 |= ti[j]
                    j -= 1

                i >>= 1; j >>=1

            ans.append(popcnt2(d1))

    print(*ans, sep="\n")

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 31624
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
ll n,a,b,c,ans=1e9,l[10];
bool f=0;
void dfs(ll now,ll na,ll ca,ll nb,ll cb,ll nc,ll cc){
    if(now==n+1)return;
    if(ca&&cb&&cc)ans=min(ans,abs(a-na)+abs(b-nb)+abs(c-nc)+10ll*(max(0ll,ca-1)+max(0ll,cb-1)+max(0ll,cc-1)));
    dfs(now+1,na+l[now],ca+1,nb,cb,nc,cc);
    dfs(now+1,na,ca,nb+l[now],cb+1,nc,cc);
    dfs(now+1,na,ca,nb,cb,nc+l[now],cc+1);
    dfs(now+1,na,ca,nb,cb,nc,cc);
}
int main(){
  cin>>n>>a>>b>>c;
  for(int i=0;i<n;i++)cin>>l[i];
  dfs(0,0,0,0,0,0,0);
  cout<<ans<<endl;
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repi(i, a, b) for (int i = (a); i < int(b); i++)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;
using i32 = int;
using i64 = long long;
using f64 = double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf64 = vector<f64>;
using vstr = vector<string>;

template<typename T, typename S> void amax(T &x, S y) { if (x < y) x = y; }
template<typename T, typename S> void amin(T &x, S y) { if (y < x) x = y; }

template<int mod> struct modint {
  int x;
  modint(): x(0) {}
  modint(int a) { x = a % mod; if (x < 0) x += mod; }
  modint &operator+=(modint that) { x = (x + that.x) % mod; return *this; }
  modint &operator-=(modint that) { x = (x + mod - that.x) % mod; return *this; }
  modint &operator*=(modint that) { x = (i64) x * that.x % mod; return *this; }
  modint &operator/=(modint that) { return *this *= that.inverse(); }
  modint operator-() { return modint(-this->x); }
  friend ostream& operator<<(ostream &out, modint m) { return out << m.x; }
  modint inverse() {
    int a = x, b = mod, u = 1, v = 0;
    while (b) { int t = a / b; a -= t * b; u -= t * v; swap(a, b); swap(u, v); }
    return modint(u);
  }
  #define op(o, p) modint operator o(modint that) { return modint(*this) p that; }
    op(+, +=) op(-, -=) op(*, *=) op(/, /=)
  #undef op
  #define op(o) bool operator o(modint that) const { return x o that.x; }
    op(==) op(!=) op(<) op(<=) op(>) op(>=)
  #undef op
};

using mint = modint<1000000007>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  int n, m;
  cin >> n >> m;
  vector<mint> x(n), y(m);
  rep(i, n) { int t; cin >> t; x[i] = t; }
  rep(i, m) { int t; cin >> t; y[i] = t; }
  mint xx = 0, yy = 0;
  rep(i, n) xx += x[i] * (i - (n - i - 1));
  rep(i, m) yy += y[i] * (i - (m - i - 1));
  cout << xx * yy << endl;
  return 0;
}


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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

int cnt2(int n) {
  int res = 0;
  while(n % 2 == 0) {
    res++;
    n /= 2;
  }
  return res;
}

vi coef;
void make_coef(int n) {
  int ue = 0;
  int sita = 0;
  coef.push_back(1);
  for(int i=1;i<=n;++i) {
    ue += cnt2(n-i+1);
    sita += cnt2(i);
    coef.push_back(ue == sita);
  }
  return;
}

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

  int n; cin >> n;
  string s; cin >> s;
  vi a(n);
  bool one = false, two = false, thr = false;
  for(int i=0;i<n;++i) {
    a[i] = s[i] - '0';
    one |= a[i] == 1;
    two |= a[i] == 2;
    thr |= a[i] == 3;
  }
  
  map<int, int> mp;
  if(!one) {
    mp[2] = 0;
    mp[3] = 1;
  } else if(!two) {
    mp[1] = 0;
    mp[3] = 1;
  } else if(!thr) {
    mp[1] = 0;
    mp[2] = 1;
  } else {
    mp[1] = 0;
    mp[3] = 0;
    mp[2] = 1;
  }

  make_coef(n-1);
  int ans = 0;
  for(int i=0;i<n;++i) {
    if(coef[i]) ans ^= mp[a[i]];
  }
  if(!two) cout << 2 * ans << endl;
  else cout << ans << endl;
  

}


Measured memory_bytes: 12056
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(ll (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(ll (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define Rall(a) (a).rbegin(), (a).rend()
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
const ll MOD=1e9+7;
const ll INF=1e10+1;
using namespace std;
#define NOT_EXIST -1

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

int main(){
	int N;
	string s,t;
	cin >> N >> s >> t;
	ll ans = 0;
	for(int i=1;i<=s.size();i++){
		string a = s.substr(s.size()-i,i);
		string b = t.substr(0,i);
		//cout << a << " " << b << endl;
		if(a==b){
			ans = a.size();
		}
	}
	cout << 2*N-ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Maximize
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ABC = Console.ReadLine().Split(' ');

            int A = int.Parse(ABC[0]);
            int B = int.Parse(ABC[1]);
            int C = int.Parse(ABC[2]);

            List<int> num = new List<int>();

            num.Add(A);
            num.Add(B);
            num.Add(C);

            num.Sort();

            Console.WriteLine(10 * num[2] + num[1] + num[0]);
        }
    }
}


Measured memory_bytes: 13140
def main():
    N, C = list(map(int, input().split(' ')))
    sushi = [list(map(int, input().split(' '))) for _ in range(N)]
    cr = [0 for _ in range(N + 1)]
    cr_rt = [0 for _ in range(N + 1)]
    for i in range(N):
        move = sushi[i][0] if i == 0 else (sushi[i][0] - sushi[i-1][0])
        cr[i+1] = cr[i] + sushi[i][1] - move
        cr_rt[i+1] = cr_rt[i] + sushi[i][1] - 2 * move
    cl = [0 for _ in range(N + 1)]
    cl_rt = [0 for _ in range(N + 1)]
    for i in range(N):
        move = (C - sushi[N-1-i][0]) if i == 0 else (sushi[N-i][0] - sushi[N-1-i][0])
        cl[i+1] = cl[i] + sushi[N-1-i][1] - move
        cl_rt[i+1] = cl_rt[i] + sushi[N-1-i][1] - 2 * move
    cr_rt_max = [0 for _ in range(N + 1)]
    cl_rt_max = [0 for _ in range(N + 1)]
    for i in range(N):
        cr_rt_max[i+1] = max([cr_rt_max[i], cr_rt[i+1]])
        cl_rt_max[i+1] = max([cl_rt_max[i], cl_rt[i+1]])
    # explore
    ans = 0
    for i in range(N+1):
        ans = max([ans, cr[i] + cl_rt_max[N-i]])
        ans = max([ans, cl[i] + cr_rt_max[N-i]])
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 47468
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0

for i in range(len(a)):
  if i == 0:
    ans += b[a[i]-1]
  elif a[i] - a[i-1] == 1:
    ans += b[a[i]-1] + c[a[i-1]-1]
  else:
    ans += b[a[i]-1]

print(ans)

Measured memory_bytes: 3064
/* ex3_3
   YSK722 */

#include <stdio.h>
#include <math.h>

int main(void){
    int number, base, count;
    scanf("%d %d", &number, &base);
    if(number < 1 || pow(10, 9) < number
       || base < 2 || 10 < base){         // number,baseが定義域外のとき
        return 1;                         // 処理終了
    }
    count = 0;
    while(pow(base, count) <= number){  // base^(桁数-1)<=number<base^(桁数)を探す
        count++;
    }
    printf("%d\n", count);  // 桁数を出力
    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  
  int ans = 999999999;
  int sum = 0;
  int sum2;
  
  for(int i = 0;i<n;++i) cin >> a.at(i);
  
  for(int i = 0; i < n; ++i){
	  sum += a.at(i);
	  
	  sum2 = 0;  
	  
	  for(int j = i+1; j < n;++j){
		  sum2 += a.at(j);
	  }
	  
	  ans = min(ans,abs(sum2 - sum));
	  
  }
  
  cout << ans << endl;

  return 0;
}
		
		

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

int ans[510][510];

int main(void){
    int K;
    cin >> K;
    if(K==1){
        cout << 1 << endl << 1 << endl;
        return 0;
    }
    int N=((K+3)/4)*2, p=K%4;
    if(p) p=4-p;
    for(int i=0; i<N; ++i){
        for(int j=0; j<N; ++j){
            if(j<p || i%2==0) ans[i][(i+j)%N]=j+1;
            else ans[i][(i+j)%N]=j-p+N+1;
        }
    }
    cout << N << endl;
    for(int i=0; i<N; ++i){
        cout << ans[i][0];
        for(int j=1; j<N; ++j) cout << ' ' << ans[i][j];
        cout << endl;
    }
    return 0;
}


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

int main(){
  string s;
  cin >> s;
  int len=s.size();
  
  string out((len+1)/2, '-');
  rep(i,(len+1)/2) out[i] = s[2*i];
  
  cout << out << endl;
  
  return 0;
}

Measured memory_bytes: 512
S = input()
T = input()

if T in S:
    print("0")
else:
    slen = len(S)
    tlen = len(T)
    ansCnt = tlen

    for i in range(slen-tlen+1):
        cnt = 0
        for j in range(tlen):
            if T[j]!=S[i+j]:
                cnt += 1
        
        if ansCnt>cnt:
            ansCnt = cnt

    print(ansCnt)

Measured memory_bytes: 8988
//
// Created by kuroneko on 2019-07-06.
//

using namespace std;

#include <iostream>
#include <vector>
#include <cmath>

typedef long long ll;
int INF = 1000000007;

int main() {
    int A, P; cin >> A >> P;
    P += A * 3;
    cout << P / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int d, n;
	scanf("%d%d", &d, &n);
	printf("%d\n", (n + (n / 100)) * (int)pow(100, d));

	Please AC;
}


Measured memory_bytes: 256
//40分
import java.util.Arrays;
import java.util.Scanner;

public class Main {
//java11
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] n = new int[N];
		int[] P = new int[N];
		int[] Q = new int[N];

		for(int i=0; i<N; i++) {
			n[i] = i+1;
			P[i] = sc.nextInt();
		}

		for(int i=0; i<N; i++) {
			Q[i] = sc.nextInt();
		}

		int a = 0;
		//順列全探索
		for(int i=0; i<factorial(N); i++) {
			boolean allMatch = true;
			for(int j=0; j<N; j++) {
				if(n[j] != P[j]) {
					allMatch = false;
					break;
				}
			}
			if(allMatch) {
				a = i+1;
				break;
			}
			next_permutation(n, 0, n.length);
		}

		for(int i=0; i<N; i++) {
			n[i] = i+1;
		}
		int b = 0;
		for(int i=0; i<factorial(N); i++) {
			boolean allMatch = true;
			for(int j=0; j<N; j++) {
				if(n[j] != Q[j]) {
					allMatch = false;
					break;
				}
			}
			if(allMatch) {
				b = i+1;
				break;
			}
			next_permutation(n, 0, n.length);
		}

		System.out.println(Math.abs(a-b));
	}

	//階乗
	static int factorial(int n) {
		if(n == 1)
			return 1;

		return n * factorial(n-1);
	}

	//次の順列を生成する
	static boolean next_permutation(int[] array, int start, int end) {

		if(array == null || start > end || start < 0 || end > array.length) {
			System.out.println("Error: 引数が正しくありません。");
			return false;
		}

		for(int i=end-2; i>=start; i--) {
			if(array[i] < array[i+1]) {
				int j = end - 1;
				while(array[i] >= array[j]) {
					j--;
				}

				//swap
				int tmp = array[j];
				array[j] = array[i];
				array[i] = tmp;

				Arrays.sort(array, i+1, end);

				return true;
			}
		}

		return false;
	}

}


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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

a, b = input().split()

x = a * int(b)
y = b * int(a)
if x <= y:
    print(x)
else:
    print(y)


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

int main() {
    int N;
    string W[1000];
    cin >>N;
    for(int i=0;i<N;i++){
        cin >>W[i];
    }
    for(int i=0;i<N-1;i++){
        if(W[i].at(W[i].size()-1)!=W[i+1].at(0)){
            cout <<"No";
            return 0;
        }
    }
    sort(W,W+N);
        for(int i=0;i<N-1;i++){
        if(W[i]==W[i+1]){
            cout <<"No";
            return 0;
        }
    
    }
    cout<<"Yes";
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int a,b,c;
	scanf("%d %d",&a,&b);
	c=a-b;
	printf("%d\n",c);
    scanf("%d %d",&a,&b);
    c=a-b;
    printf("%d\n",c);
    scanf("%d %d",&a,&b);
    c=a-b;
    printf("%d\n",c);
    scanf("%d %d",&a,&b);
    c=a-b;
    printf("%d\n",c);
    scanf("%d %d",&a,&b);
    c=a-b;
    printf("%d\n",c);
    scanf("%d %d",&a,&b);
    c=a-b;
    printf("%d\n",c);
    scanf("%d %d",&a,&b);
    c=a-b;
    printf("%d\n",c);
	return 0;
}

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

int main(){
    string s;
    cin >> s;
    vector<vector<int>> a(26);
    for(int i=0; i<s.size(); i++){
        a[s[i]-'a'].push_back(i);
    }
    for(int i=0; i<26; i++){
        for(int j=0; j<a[i].size(); j++){
            for(int k=j+1; k<a[i].size(); k++){
                if((a[i][k]-a[i][j]+1)<(k-j+1)*2){
                    cout << a[i][j]+1 << ' ' << a[i][k]+1 << endl;
                    return 0;
                }
            }
        }
    }
    cout << -1 << ' ' << -1 << endl;
    return 0;
}


Measured memory_bytes: 1148
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author RiaD
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <algorithm>

template <typename T>
void updateMin(T& oldValue, const T& newValue) {
	if (newValue < oldValue) {
		oldValue = newValue;
	}
}

template <typename T>
void updateMax(T& oldValue, const T& newValue) {
	if (oldValue < newValue) {
		oldValue = newValue;
	}
}


using namespace std;

class TaskA {
public:
	void solve(std::istream& in, std::ostream& out) {
		int a, b;
		in >> a >> b;


		int ans = 2000000010;
		if (a <= b) {
			updateMin(ans, b - a);
		}
		if (-a <= b) {
			updateMin(ans, 1 + b - (-a));
		}

		if (a <= -b) {
			updateMin(ans, 1 + (-b) - a);
		}
		if (-a <= -b) {
			updateMin(ans, 2 + (-b) - (-a));
		}

		out << ans << "\n";
	}
};


int main() {
	std::ios_base::sync_with_stdio(false);
	TaskA solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(nullptr);
	out << std::fixed;
	out.precision(20);
	solver.solve(in, out);
	return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;

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

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int main(void)
{
  int N;
  string S;

  cin >> N >> S;

  int ans = 0;
  for (int i = 0; i < N; i++) {
    set<char> sa;
    for (int j = 0; j <= i; j++) sa.insert(S[j]);
    set<char> sb;
    for (int j = i + 1; j < N; j++) sb.insert(S[j]);

    set<char> res;
    set_intersection(sa.begin(), sa.end(), sb.begin(), sb.end(),
                     inserter(res, res.end()));
    ans = max(ans, (int)res.size());
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;

template <typename T> inline void Read(T &x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}

template <typename T> inline bool CheckMax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}

template <typename T> inline bool CheckMin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}

const int N = 100005;

int n, m, ans, a[N], b[N], c[N], f[N];

int main() {
#ifdef wxh010910
  freopen("d.in", "r", stdin);
#endif
  Read(n);
  for (int i = 1, x, y, w; i < n; ++i) {
    Read(x), Read(y), Read(w);
    a[x] ^= w, a[y] ^= w;
  }
  for (int i = 0; i < n; ++i) {
    ++c[a[i]];
  }
  for (int i = 1; i < 16; ++i) {
    ans += c[i] >> 1;
    if (c[i] & 1) {
      b[m++] = i;
    }
  }
  for (int i = 1; i < 1 << m; ++i) {
    int s = 0;
    for (int j = 0; j < m; ++j) {
      if (i >> j & 1) {
        s ^= b[j];
      }
    }
    if (s) {
      f[i] = m;
    } else {
      f[i] = __builtin_popcount(i) - 1;
    }
    for (int j = s = i; j; j = j - 1 & s) {
      CheckMin(f[i], f[j] + f[i ^ j]);
    }
  }
  printf("%d\n", ans + f[(1 << m) - 1]);
#ifdef wxh010910
  Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
using namespace std;
int main() {
    long long width, height;
    do {
        cin >> height >> width;
        if ((height == 0) && (width == 0)) {
            break;
        }
        for (long long j = 0; j < height; j++) {
            for (long long i = 0; i < width; i++) {
                if ((i == 0) || (j == 0) || (i == width - 1) || (j == height - 1)) {
                    cout << "#";
                } else {
                    cout << ".";
                }
            }
            cout << "\n";
        }
        cout << "\n";
    } while (true);
}


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

int main(){
  int n,k;
  while(cin>>n>>k,n+k!=0){
    long long htoohtoo[n];
    for(int i=0;i<n;i++)
      cin>>htoohtoo[i];
    long long htoo=0;
    long long max=0;
    for(int i=0;i<n-k+1;i++){
      htoo = 0;
      for(int j=0;j<k;j++){
	htoo+=htoohtoo[i+j];
      }
      if(max<htoo){
	max=htoo;
      }
    }
    cout<<max<<endl;
  }
  return 0;
}

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

def main():
    N = int(input())
    S = input()
    T = input()

    ret = 2*N
    for i in range(N):
        if S[i:]==T[:N-i]:
            ret = 2*N-(N-i)
            break
    print(ret)



if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#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;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;

int main() {
    string s,t;
    cin >> s >> t;
    int ss = s.size();
    int tt = t.size();
    set<string> A;
    if(ss<tt) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    rep(i,1+ss-tt){
        bool flag = true;
        rep(j,tt){
            if(s[ss-1-i-j]!=t[tt-1-j]&&s[ss-1-i-j]!='?') flag = false;
        }
        if(flag){
            string tmp="";
            rep(j,ss){
                if(s[j]=='?'){
                    tmp += 'a';
                } else {
                    tmp += s[j];
                }
            }
            rep(j,tt){
                tmp[ss-1-i-j] = t[tt-1-j];
            }
            A.insert(tmp);
        }
    }
    auto l = A.begin();
    if(A.empty()) cout << "UNRESTORABLE" << endl;
    else cout << *l << endl;
}

Measured memory_bytes: 3600
# include <bits/stdc++.h>
# define fi first
# define se second
# define ll long long
# define pb push_back
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define time cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"

using namespace std;

const int mod = 1e9;
const int N = 1e5 + 7;
const int INF = 1e7;

vector < int > adj[N];
int n, m, d[N], used[N];

void dfs( int v )
{
    if ( used[v] ) return;
    used[v] = 1;
    for ( auto u: adj[v] ) {
        dfs( u );
        d[v] = max( d[v], d[u] + 1 );
    } 
}

int main()
{
    speed; 
    cin >> n >> m;
    for ( int i = 0; i < m; i++ ) {
        int x, y;
        cin >> x >> y;
        adj[x].pb(y);
    }
    int mx = 0;
    for ( int i = 1; i <= n; i++ ) {
        dfs(i);
        mx = max( mx, d[i] );
    }
    cout << mx << endl;
}



Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
//void chmin(int &a, int b) { if (a > b) a = b; }
//void chmax(int &a, int b) { if (a < b) a = b; }

const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

const int MAX = 1000010;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll x,y;
    cin >> x >> y;
    COMinit();
    ll m,n;
    m = (2*y-x)/3;
    n = (2*x-y)/3;
    if((2*y-x)%3 == 0 && (2*x-y)%3 == 0) cout << COM(m+n,n) << endl;
    else cout << 0 << endl;
    return 0;
}


Measured memory_bytes: 23680
A,B,C,D,E,F=list(map(int, input().split()))

from fractions import gcd

highest_concentration=-1

for a in range(F//(100*A) +1):
  for b in range((F-100*A*a)//(100*B) +1):
    water = 100*A*a + 100*B*b
    if not water:
      continue
      
    max_sugar = min(E*(A*a+B*b), F-water)
    
    for c in range(min(D,(max_sugar//C)+1)):
      d = (max_sugar -c*C)//D
      sugar = c*C + d*D
      if sugar/(water+sugar) > highest_concentration:
        highest_concentration = sugar/(water+sugar)
        #print(a,b,c,d, 100*a*A+100*b*B, sugar)
        #print(water,water+sugar, sugar)
        answer = (water+sugar, sugar)
        
print(*answer)


Measured memory_bytes: 5048
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

int A,B,Q;
vector<long long> s;
vector<long long> t;

inline bool cmp(long long a, long long b)
{
	return a>b;
}

int main()
{
	cin >> A >> B >> Q;
	for (int i=1; i<=A; i++)
	{
		long long tmp;
		cin >> tmp;
		s.push_back(tmp);
	}
	for (int i=1; i<=B; i++)
	{
		long long tmp;
		cin >> tmp;
		t.push_back(tmp);
	}
	while (Q--)
	{
		long long x;
		cin >> x;
		vector<long long>::reverse_iterator ls=lower_bound(s.rbegin(),s.rend(),x,cmp),lt=lower_bound(t.rbegin(),t.rend(),x,cmp);
		vector<long long>::iterator rs=lower_bound(s.begin(),s.end(),x),rt=lower_bound(t.begin(),t.end(),x);
		long long ans=LLONG_MAX;
		if (ls!=s.rend()&&lt!=t.rend()) ans=min(ans,x-min(*ls,*lt));
		if (rs!=s.end()&&rt!=t.end()) ans=min(ans,max(*rs,*rt)-x);
		if (ls!=s.rend()&&rt!=t.end()) ans=min(ans,*rt-*ls+min(x-*ls,*rt-x));
		if (lt!=t.rend()&&rs!=s.end()) ans=min(ans,*rs-*lt+min(x-*lt,*rs-x));
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>

using ull = unsigned long long;

auto gcd(ull x, ull y) {
	
	std::pair<ull,ull> mm = std::minmax(x, y);

	while (mm.second%mm.first != 0) {
		mm = std::minmax(mm.first, mm.second%mm.first);
	}

	return x > 0 && y > 0 ? mm.first : 1;
}


int main() {
	ull N, X;
	std::cin >> N >> X;

	std::set<ull> su;
	for (ull i{}; i < N; i++) {
		ull tmp{}; std::cin >> tmp;
		auto mm = std::minmax(tmp, X);
		su.insert(mm.second - mm.first);
	}

	if (su.size() == 1) {
		std::cout << *su.begin() << "\n";
		return 0;
	}

	//auto it = su.begin();
	auto r = gcd(*su.begin(), *++su.begin());
	for (auto it = ++++su.begin(); it != su.end(); ++it) {
		r = gcd(r, *it);
	}
	
	std::cout << r << "\n";
	return 0;
}




Measured memory_bytes: 4864
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <string.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;


int main()
{
//回答が整数の場合
long long int ans=0;
long long int a1=0;
long long int b1=0;
//整数値の入力
int n,k;
cin >> n >> k;

a1=n/k;
b1=(n+k/2)/k;

if(k%2==1){ans=(a1)*(a1)*(a1);}
else{
    ans=(a1)*(a1)*(a1)+(b1)*(b1)*(b1);
}

//回答
cout << ans << endl;
return 0;
}



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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SP << " " 

using namespace std;

void PV(vector<int> pvv) {
	rep(i, pvv.size()) cout << pvv[i] SP;
	cout << endl;
}

long long int modinv(long long int a, long long int m) {
    long long int b = m, u = 1, v = 0;
    while (b) {
        long long int t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

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

int main(){

	long long int n, m, k, ans=0, tmp, div=998244353;
	vector<long long int> con(1);

	cin>> n >> m >> k;

	con[0]=1;
	rep(i, n){
		tmp=con[i];
		tmp*=n-1-i;
		tmp=tmp%div;
		tmp*=modinv(i+1, div);
		tmp=tmp%div;
		con.push_back(tmp);

		//cout<< con[i+1] <<endl;
	}
	//cout<< endl;

	rep(i, k+1) {
		tmp=m;
		tmp*=modpow(m-1, n-1-i, div);
		tmp=tmp%div;
		tmp*=con[i];
		tmp=tmp%div;

		ans+=tmp;
		ans=ans%div;
		//cout<< ans << endl;
	}

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

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

#define sz(x) int(x.size())
#define Task "abc"
#define For(i, a, b) for(int i = (a), _b = (b); i <= b; ++i)
#define All(x) (x).begin(), (x).end()
#define mp make_pair

typedef unsigned long long ull;
typedef long long ll;

const int maxn = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const ll mod = 1e9 + 7;

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
//  freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int turn_a = (a - 1) / d + 1, turn_b = (c - 1) / b + 1;
  if (turn_b > turn_a) cout << "No";
  else cout << "Yes";
}



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

struct seg {
  int balance, min;
};
bool operator<(seg a, seg b) {
  return a.min > b.min;
}

bool check(vector<seg> plus) {
  sort(plus.begin(), plus.end());
  int balance = 0;
  for (seg s : plus) {
    if (balance+s.min < 0) return 1;
    balance += s.balance;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n;
  cin >> n;
  vector<seg> plus, minus;
  int total = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int balance = 0, mi = 0;
    for (char c : s) {
      balance += (c == '(')-(c == ')');
      mi = min(mi, balance);
    }
    total += balance;
    if (balance >= 0)
      plus.push_back({balance, mi});
    else
      minus.push_back({-balance, mi-balance});
  }
  if (total || check(plus) || check(minus)) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 18904
h,w=gets.split.map &:to_i
s=[]
for i in 0...h
  s<<gets.chomp
end
a=Array.new(h,false)
b=Array.new(w,false)
for i in 0...h
  for j in 0...w
    if s[i][j]=='#'
      a[i]=true
      b[j]=true
    end
  end
end
for i in 0...h
  if !a[i];next;end
  u=""
  for j in 0...w
    if b[j]
      u+=s[i][j]
    end
  end
  puts u
end

Measured memory_bytes: 1916
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<set>
#include<tuple>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int main(void) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    ll count = 0;
    for (int i = 0; i < 1000; i++) {
        int c[3] = { (i / 100) % 10,(i / 10) % 10,i % 10 };
        int f = 0;
        for (int j = 0; j < s.size(); j++) {
            if (s[j] - '0' == c[f]) {
                f++;
            }
            if (f == 3) {
                break;
            }
        }
        if (f == 3) {
            count++;
        }
    }
    cout << count << endl;
}



Measured memory_bytes: 3664
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;

int main(void){
	int N,M,a[200005],b[200005],ok[200005]={};
	cin>>N>>M;
	rep(i,M){
		cin>>a[i]>>b[i];
		if(a[i]==1)ok[b[i]]=1;
		if(b[i]==1)ok[a[i]]=1;
	}
	bool ans=false;
	rep(i,M){
		if(a[i]==N && ok[b[i]]==1){
			ans=true;
			break;
		}
		if(b[i]==N && ok[a[i]]==1){
			ans=true;
			break;
		}
	}
	if(ans){
		cout<<"POSSIBLE"<<endl;
	}else{
		cout<<"IMPOSSIBLE"<<endl;
	}
	return 0;
}

Measured memory_bytes: 2560
#include <cmath>
#include <vector>
#include <map>
#include <functional>
#include <queue>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <cstdint>
#include <climits>
#include <unordered_set>
#include <sstream>

using namespace std;

#define ll long long int

int main()
{
    ll n, k;
    cin >> n >> k;
    
    ll d = (n-2) / 11;
    ll sum = 5LL * d;
    ll m = (n-2) % 11;
    
    for(ll i = 1;i <1 + m;i++)
    {
        for(int j = 2;j <= 6;j++)
        {
            ll a = (9 * (7 * i + j)) % 11;
            if(a == k)
            {
                //cout << i << "," << j << endl;
                sum++;
            }
        }
    }
    cout << sum << endl;
    return 0;
}


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

int main(){
	int n;
	cin >> n;
	int a[n+1];
	for(int i=1; i<=n; i++){
		cin >> a[i];
		if(a[i]%2==0) if(a[i]%3!=0 && a[i]%5!=0){
			cout << "DENIED";
			return 0;
		}
	}
	cout << "APPROVED";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
//ll INF = 21474836470000000;
ll INF = 100100100100100100;
long double EPS = 1;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<ll>>;

ll con(ll n,ll r){
    if(r > n) return 0;
    ll res = 1;
    ll b = 1;
    FOR(i,n-r+1,n+1){
        res *= i;
        if(res % b == 0 && b <= r){
            res /= b;
            b++;
        }
    }
    return res;
}

int main(){
    ll N,A,B;
    cin >> N >> A >> B;
    vector<ll> V(N),sum(N+1);
    map<ll,ll> mp;
    rep(i,N){
        cin >> V[i];
        mp[V[i]]++;
    }
    sort(ALL(V));
    rep(i,N) sum[i+1] = V[i] + sum[i];
    ll num = 0,den = 1;
    rep(i,N) FOR(j,i+1,N+1){
        if(A <= j-i && j-i <= B && num * (j-i) < (sum[j]-sum[i]) * den){
            num = sum[j] - sum[i];
            den = j-i;
        }
    }
    ll ans = 0;
    map<pair<ll,ll>,bool> mmpp;
    rep(i,N) FOR(j,i+1,N+1){
        if(A <= j-i && j-i <= B){
            if((sum[j]-sum[i]) * den == (j-i) * num){
                ll res = 1;
                map<ll,ll> MP;
                FOR(k,i,j){
                    MP[V[k]]++;
                }
                bool Q = 1;
                FOR(k,i,j){
                    if(V[k] != V[i]) Q = 0;
                }
                if(Q){
                    if(mmpp.count(make_pair(V[i],j-i))) continue;
                    else mmpp[make_pair(V[i],j-i)] = 1;
                }
                for(auto itr = MP.begin(); itr != MP.end();itr++){
                    ll key = itr -> first;
                    ll cnt = mp[key];
                    res *= con(cnt,MP[key]);
                }
                ans += res;
            }
        }
    }
    cout << setprecision(20) << fixed;
    cout << (double)num / den << endl;
    cout << ans << endl;
}


Measured memory_bytes: 256
S=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
i=gets.to_i
puts S[i-1]


Measured memory_bytes: 3836
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n;
    cin>>s;

    for(auto x:s)
    {
        x-='A';
        x+=n;
        x%=26;
        x+='A';
        cout<<x;
    }

}   aryanc403();
    return 0;
}

Measured memory_bytes: 256
x0,y0,x,y,v,w,S;
main(i,n){
	for(;scanf("%d",&n)*n;){
		S=0;
		scanf("%d%d",&x0,&y0);
		v=x0,w=y0;
		for(;--n;){
			scanf("%d%d",&x,&y);
			S+=(x-v)*(y+w);
			v=x,w=y;
		}
		S+=(x0-v)*(y0+w);
		printf("%d %.1f\n",i++,S/2.);
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, a) for (int i = (int)0; i < (int)a; ++i)
#define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define popcount __builtin_popcount
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
template <class T>
inline bool chmin(T &a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
template <class T>
inline bool chmax(T &a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

ll gcd(ll n, ll m)
{
	ll tmp;
	while (m != 0)
	{
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m)
{
	return abs(n) / gcd(n, m) * abs(m); //gl=xy
}

using namespace std;
//using namespace atcoder;

void solve(){
	int x;
	cin>>x;
	x^=1;
	cout<<x;
}


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3608
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <memory.h>
#include <list>
#include <numeric>
#include <functional>
#include <complex>
#include <unordered_set>
#include <cctype>
#include <cassert>


using namespace std;

typedef long long ll;
typedef long double ld;

const int nax = (int)1e5 + 5;

ll dp[nax];

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("angle2.in", "r", stdin);
	//freopen("angle2.out", "w", stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int n, W;
	cin >> n >> W;

	for (int i = 0; i < nax; i++) {
		dp[i] = 2e9;
	}

	dp[0] = 0;
	for (int i = 0; i < n; i++) {
		int x, c;
		cin >> x >> c;
		for (int j = nax - c - 1; j >= 0; j--) {
			dp[j + c] = min(dp[j + c], dp[j] + x);
		}
	}

	for (int i = nax - 1; i >= 0; i--) {
		if (dp[i] <= W) {
			cout << i;
			return 0;
		}
	}
 	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
vector<string> ptn;
string gen(long i, string c){
	string s = "";
  if(i == 0){
    ptn.push_back(c);
    //cout << c << endl;
    return "";
  }
  s = gen(i - 1, c + "x");
  s = gen(i - 1, c + "o");
  //cout << s << endl;
  return s;
}

long subsum(string s, string ptn){
  //cout << "subsum";
  long lastPt = 0;
  long result = 0;
  long len = 1;
  for(long i = 0; i < ptn.size(); i++){
    if(ptn.at(i) == 'o'){
      result += stol(s.substr(lastPt, len));
      //cout << s.substr(lastPt, len) << "+";
      lastPt = i+1;
      len = 0;
    }
    len++;
  }
  if(lastPt <= ptn.size()){
  	result += stol(s.substr(lastPt, ptn.at(ptn.size()-1)));
  }
  
  return result;
}
  
int main(){
  string S;
  cin >> S;
  if(S.size() <= 1){
    cout << S <<endl;
    return 0;
  }
  gen(S.size()-1,"");
  long total = 0;
 
  for(long i = 0; i < ptn.size(); i++){
    total += subsum(S,ptn.at(i));
  }
  cout << total << endl;
  return 0;
}
    
    



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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  sort( vec.begin(), vec.end());
  reverse( vec.begin(), vec.end());
  int A = 0;
  int B = 0;
  for (int i = 0; i < N; i += 2) {
    A += vec.at(i);
  }
  for (int i = 1; i < N; i += 2) {
    B += vec.at(i);
  }
  cout << A - B << endl;
}

Measured memory_bytes: 256
//#include "pch.h"
#include <iostream>
#include<vector>
#include<string>
#include<algorithm>

using namespace std;


int main()
{
	int N,length[210];
	cin >> N;

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


	sort(length,length+2*N);

	int answer = 0;

	for (int i = 0; i < N; i++) {
		answer += length[2*i];
	}

	cout << answer<< endl;

}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <list>
#include <iomanip>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(),z.end())
#define eerase(z) z.erase(unique(z.begin(),z.end()),z.end())


void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}

string gen(int num) {
	string str="";
	for (int i = 0; i < num; i++) str += ".";
	return str;
}
Int fact(int num) {
	if (num == 0) return 1;
	else return num * fact(num - 1);
}

int main() {
	Int x; cin >> x;
	Int num = x / 11;
	if (x - num * 11 == 0) {
		cout << num*2;
	}
	else if (x - num * 11 <= 6) {
		cout << num*2 + 1;
	}
	else cout << num*2 + 2;
	


	cout << endl;
	return 0;
}

Measured memory_bytes: 256