akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << (x) << endl

int main() {
    int a, b, k;
    while (cin >> a >> b >> k) {
        int cnt = 0;
        for (int i = 100000; i >= 0; --i) {
            if (a % i == 0 && b % i == 0) ++cnt;
            if (cnt == k) {
                cout << i << endl;
                break;
            }
        }
    }
}



Measured memory_bytes: 256
use std::io::BufRead;

fn main() {
    let stdin = std::io::stdin();
    let n: usize = stdin.lock().lines().next().unwrap().unwrap()
        .parse().unwrap();
    let line = stdin.lock().lines().next().unwrap().unwrap();
    let mut length: Vec<u32> = line.split(' ').map(|x| x.parse().unwrap())
        .take(n * 2).collect();
    length.sort();
    let sum: u32 = length.chunks(2).map(|pair| pair[0]).sum();
    println!("{}", sum);
}


Measured memory_bytes: 4352
s = list(input())
s = sorted(s)
a_z = list('abcdefghijklmnopqrstuvwxyz')
flag = 1
for x in range(len(a_z)):
    if a_z[x] in s:
        flag = 1
    else:
        print(a_z[x])
        flag = 0
        break
if flag:
    print("None")

Measured memory_bytes: 5104
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a) = min((a), (b)))
#define chmax(a, b) ((a) = max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double pi = acos(-1);
const double eps = 1e-10;

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

int main(){
    int n; cin>>n;
    vector<P> point(n);
    for(int i=0; i<n; i++) cin>>point[i].fs>>point[i].sc;

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

    map<P, int> cnt;
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            cnt[P(point[j].fs - point[i].fs, point[j].sc - point[i].sc)]++;
        }
    }

    int maxcnt = 0;
    for(auto i:cnt){
        maxcnt = max(maxcnt, i.second);
    }

    cout << n - maxcnt << endl;
}

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

int main(void) {
  int a, b, c, k;
  
  cin >> a >> b >> c >> k;
  
  int result = 0;
  if(k <= a) {
    result = k;
  } else if(k <= a+b) {
    result = a;
  } else {
    result = 2*a + b-k;
  }
  
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
	int H, W;
	cin >> H >> W;
	vector<string> S(H);
	for (int i = 0; i < H; i++) {
		cin >> S[i];
	}

	int vy[] = { -1, 1, 0, 0, -1, -1, 1, 1 };
	int vx[] = { 0, 0, -1, 1, -1, 1, -1, 1 };
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '.') {
				int count = 0;
				for (int k = 0; k < 8; k++) {
					int y = i + vy[k];
					int x = j + vx[k];
					if (y < 0 || y >= H || x < 0 || x >= W) {
						continue;
					}
					if (S[y][x] == '#') {
						count++;
					}
				}
				S[i][j] = '0' + count;
			}
		}
	}

	for (int i = 0; i < H; i++) {
		cout << S[i] << endl;
	}

	return 0;
}

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

namespace ConsoleApplication13
{
    class Program
    {
        const int MaxValue = 255;

        struct Color
        {
            public string Name;
            public int Red;
            public int Green;
            public int Blue;

            public Color(string name, int red, int green, int blue)
            {
                this.Name = name;
                this.Red = red;
                this.Green = green;
                this.Blue = blue;
            }
        }


        static void Main(string[] args)
        {
            List<Color> colorList = new List<Color>();
            colorList.Add(new Color("black", 0, 0, 0));
            colorList.Add(new Color("blue", 0, 0, MaxValue));
            colorList.Add(new Color("lime", 0, MaxValue, 0));
            colorList.Add(new Color("aqua", 0, MaxValue, MaxValue));
            colorList.Add(new Color("red", MaxValue, 0, 0));
            colorList.Add(new Color("fuchsia", MaxValue, 0, MaxValue));
            colorList.Add(new Color("yellow", MaxValue, MaxValue, 0));
            colorList.Add(new Color("white", MaxValue, MaxValue, MaxValue));

            
            while(true){
                string input = Console.ReadLine();

                if (input == "0")
                    break;

                int red = Convert.ToInt32(input.Substring(1,2),16);
                int green = Convert.ToInt32(input.Substring(3,2),16);
                int blue = Convert.ToInt32(input.Substring(5,2),16);

                double minDk = 3 * MaxValue * MaxValue;
                Color minColor = colorList[0];

                foreach(Color color in colorList){
                    double dk = Math.Pow((color.Red - red), 2) + Math.Pow((color.Green - green), 2) + Math.Pow((color.Blue - blue), 2);
                    if (minDk > dk)
                    {
                        minDk = dk;
                        minColor = color;
                        if (dk == 0)
                        {
                            break;
                        }
                    }
                }


                Console.WriteLine(minColor.Name);
               
            }


        }
    }
}

Measured memory_bytes: 5600
N = int(input())
A = list(map(int,input().split()))

right = 0
SUM = 0
ans = 0
for left in range(N):
    while right < N and SUM | A[right] == SUM + A[right]:
        SUM += A[right]
        right += 1
    
    ans += right - left
    
    if right == left:
        right += 1
    else:
        SUM -= A[left]
print(ans)

Measured memory_bytes: 24840
#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 int 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 << " ";
  }
}

int f(int a) {
  return (a * a + 4) / 8;
}

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

  string s; cin >> s;
  map<char, bool> mp;
  for(int i=0;i<SZ(s);++i) {
    mp[s[i]] = true;
  }
  for(char i='a';i<='z';++i) {
    if(!mp[i]) {
      cout << i << endl;
      return 0;
    }
  }
  cout << "None" << endl;

}


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


int main()
{

    int N, K;
    cin >> N >> K;
    int ans =0;
    rep(i, N) {
        int h;
        cin >> h;
        if (h >= K) ans++;
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
a = int(input())
count = 0
if a == 10**5:
    count += 90909
elif a >= 10000:
    count += a - 9999 +909
elif a > 999:
    count += 909
elif a >= 100:
    count += a - 99 + 9
elif a > 9:
    count += 9
else:
    count += a
print(count)

Measured memory_bytes: 3060
s = input()
t = input()
maxCnt = 0
len_s = len(s)
len_t = len(t)
for i in range(len_s - len_t + 1):
    cnt = 0 
    s_str = s[i:i+len_t]
    for j in range(len(t)):
        if t[j] == s_str[j]:
            cnt += 1
        else:
            pass
    maxCnt = max(maxCnt, cnt)
ans = len_t - maxCnt
print(ans)



Measured memory_bytes: 9116
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

/*
*/

ll n,a[310][310],ans=0;
pair<ll,pair<ll,ll>> p[90010];
bool ok=true;

void init(){
	cin>>n;
	rep(i,n)rep(j,n)cin>>a[i][j];
}

int main(void){
	init();
	rep(i,n)rep(j,i){
		ll d=1e18;
		rep(k,n){
			if(k==i || k==j)continue;
			d=min(d,a[i][k]+a[k][j]);
		}
		if(d<a[i][j]){  // 構築不可能
			ok=false;
			break;
		}
		if(d>a[i][j]){
			ans+=a[i][j];
		}
	}
	cout<<(ok?ans:-1)<<endl;
	return 0;
}

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

int main(){
  int N,M;
  cin >> N;
  set<string> c;
  vector<string> s(N);
  rep(i,N){
    cin >> s.at(i);
    if(!(c.count(s.at(i)))){
      c.insert(s.at(i));
    }
  }
  cin >> M;
  vector<string> t(M);
  rep(i,M){
    cin >> t.at(i);
    if(!(c.count(t.at(i)))){
      c.insert(t.at(i));
    }
  }
  int ans = 0;
  for(auto p : c){
    int num = 0;
    rep(j,N){
      if(p==s.at(j)){
        ++num;
      }
    }
    rep(j,M){
      if(p==t.at(j)){
        --num;
      }
    }
    ans = max(num,ans);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve(args);
    }

    public void solve(String[] args) {
        MyScanner scanner = new MyScanner();
        int r = scanner.nextInt();
        int g = scanner.nextInt();
        int b = scanner.nextInt();

        System.out.println(Integer.parseInt("" + r + g + b) % 4 == 0 ? "YES" : "NO");
    }

    private class MyScanner {
        String[] s;
        int i;
        BufferedReader br;
        String reg = " ";

        MyScanner () {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {
            try {
                if (i < s.length) return s[i++];
                String line = br.readLine();
                while (line.equals("")) {
                    line = br.readLine();
                }
                s = line.split(reg, 0);
                i = 0;
                return s[i++];
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public int nextInt() {
            try {
                return Integer.parseInt(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public double nextDouble() {
            try {
                return Double.parseDouble(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }

        public long nextLong()  {
            try {
                return Long.parseLong(next());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return -1;
        }
    }
}


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

//-----------------------------------LIBRARY OF INPUT-----------------------------------
void reader(int *x) {
	int k = getchar_unlocked(); *x = k - '0';
	while (true) {
		k = getchar_unlocked();
		if (k < '0' || k > '9') break;
		*x = ((*x) << 1) + ((*x) << 3) + k - '0';
	}
}

#pragma warning(disable:4996)
int n, m, q, dist[110000], mark[110000], u[210000], v[210000];
vector<pair<int, int>>x[110000], y[110000], z[110000]; bool used[210000];
inline bool isgood(int f) {
	for (int i = 0; i < z[f].size(); i++) {
		if (mark[z[f][i].first] == 0 && used[z[f][i].second] == false)return true;
	}
	return false;
}
int main() {
	reader(&n); reader(&m); reader(&q); queue<int>Q;
	for (int i = 0; i < m; i++) {
		int a = 0, b = 0;
		reader(&a);
		reader(&b);
		u[i + 1] = a; v[i + 1] = b;
		x[a].push_back(make_pair(b, i + 1)); x[b].push_back(make_pair(a, i + 1));
	}
	Q.push(1); for (int i = 1; i <= n; i++)dist[i] = 999999; dist[1] = 0;
	while (!Q.empty()) {
		int a1 = Q.front(); Q.pop();
		for (int i = 0; i < x[a1].size(); i++) {
			if (dist[x[a1][i].first] > dist[a1] + 1) { dist[x[a1][i].first] = dist[a1] + 1; Q.push(x[a1][i].first); }
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j < x[i].size(); j++) {
			if (dist[i] < dist[x[i][j].first]) { y[i].push_back(x[i][j]); }
			if (dist[i] > dist[x[i][j].first]) { z[i].push_back(x[i][j]); }
		}
	}
	int cnt = 0;
	for (int i = 0; i < q; i++) {
		int a = 0;
		reader(&a);
		used[a] = true;
		int E1 = u[a], E2 = v[a];
		if (dist[E1] == dist[E2]) { cnt += 0; }
		else {
			int a1 = 0; if (dist[E1] < dist[E2])a1 = E2; else a1 = E1;
			if (isgood(a1) == false && mark[a1] == 0) {
				queue<int>Q; Q.push(a1); cnt++; mark[a1] = 1;
				while (!Q.empty()) {
					int a2 = Q.front(); Q.pop();
					for (int j = 0; j < y[a2].size(); j++) {
						if (mark[y[a2][j].first] == 0 && isgood(y[a2][j].first) == false) {
							mark[y[a2][j].first] = 1; Q.push(y[a2][j].first); cnt++;
						}
					}
				}
			}
		}
		printf("%d\n", cnt);
	}
	return 0;
}

Measured memory_bytes: 25748
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <string>
#include <bitset>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define print(x) cout<<(x)<<endl
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define INF10 1001001001 
#define INF5 100000
#define EPS 1e-10



int main() {
	int N, K; cin >> N >> K;
	vector<int>x(N);
	REP(i, N)cin >> x[i];
	int left = 0;
	int right = K - 1;
	int mn = 10001001000;
	while (right < N) {
		if (x[left] >= 0 && x[right] >= 0) {
			mn = min(mn, x[right]);
		}
		else if (x[left] < 0 && x[right] < 0) {
			mn = min(mn, -x[left]);
		}
		else {
			mn = min(mn, x[right] * 2 - x[left]);
			mn = min(mn, x[right] - 2 * x[left]);
		}

		left++;
		right++;
	}
	print(mn);


	return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl '\n'
#define INF 1000000007
#define MAXN 100100
using namespace std;

vector<int> saida[MAXN];
vector<int> chega[MAXN];

int best[MAXN];

int go(int v){
	if(best[v]!=-1)return best[v];
	int res=0;
	for(int i=0;i<saida[v].size();i++){
		int u = saida[v][i];
		res=max(res,1+go(u));
	}		 			
	return best[v]=res;
}


int32_t main(){
	int n,m;
	cin>>n>>m;
	int a,b;
	memset(best,-1,sizeof(best));
	for(int i=0;i<m;i++){
		cin>>a>>b;
		saida[a].push_back(b);
		chega[b].push_back(a);
	}
	
	for(int i=1;i<=n;i++){
		if(saida[i].size()==0)best[i]=0;
	}
	for(int i=1;i<=n;i++){
		go(i);
	}
	int res=0;
	for(int i=1;i<=n;i++){
		res=max(res,best[i]);
	}
		   cout<<res<<endl;	   	
}

Measured memory_bytes: 14080
#include "bits/stdc++.h"
using namespace std;    

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))    
#define OUT(P) cout << (P) << endl    
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl    
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;    
#define PRINT_ARRAY_INLINE(P) do { for(int i=0; i<P.size(); i++) cout << P[i] << " "; cout << endl; } while(0)    
#define PRINT_ARRAY_WITH_LABEL(L, P) do { cout << L << ": "; PRINT_ARRAY_INLINE(P); cout << endl; } while(0)    
typedef long long ll;    
const long DIVIDE = 1e9+7;

int sum_digits(int num);    
template <class T>    
vector<T> copy_vector(vector<T> vec);    
long gcd(long a, long b);    
long lcm(long a, long b);
vector<vector<long>> comb(long n, long r);
// ****** print functions ****** //
template <class T, class U>
void print_pairs(const vector<pair<T, U>> pairs);
template <class K, class V>
void print_map(const map<K, V> m);



int main() {    
    long l, r;
    const long MOD = 2019;
    cin >> l >> r;

    long ans = l * r % 2019;
    for(long i=l; i<r; i++) {
        bool break_flg = false;
        for(long j=i+1; j<=r; j++) {
            long x = i*j % MOD;
            ans = min(x, ans);
            if(ans == 0) {
                break_flg = true;
                break;
            }
        }
        if(break_flg) break;
    }
    cout << ans << endl;
    



    return 0;    
}    

/******************************/    
/***** DECRARED FUNCTIONS *****/    
/******************************/    

int sum_digits(int num) {    
    int rtn = 0;    
    while(num != 0) {    
        int tmp = num % 10;    
        rtn += tmp;    
        num /= 10;    
    }    
    return rtn;    
}    

// vectorのコピー    
template <class T>    
vector<T> copy_vector(vector<T> vec) {    
    vector<T> rtn;    
    rtn.reserve(vec.size());    
    copy(vec.begin(), vec.end(), back_inserter(rtn));    
    return rtn;    
}    

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

long lcm(long a, long b) {
    long gcd_ = gcd(a, b);
    return (a * b) / gcd_;
}

vector<vector<long>> comb(long n, long r) {                                                                             
    vector<vector<long>> v(n+1, vector<long>(n+1, 0));    
    for(int i=0; i<v.size(); i++) {    
        v[i][0] = 1;    
        v[i][i] = 1;    
    }    
    for(int i=1; i<v.size(); i++) {    
        for(int j=1; j < i; j++) {    
            v[i][j] = (v[i-1][j-1] + v[i-1][j]) % DIVIDE;    
        }    
    }    
    return v;    
} 

template <class T, class U>
void print_pairs(const vector<pair<T, U>> &pairs) {
    for(int i=0; i<pairs.size(); i++) { 
        cout << "(" << pairs[i].first << ", " << pairs[i].second << ")" << " "; 
    } 
    cout << endl;
}

template <class K, class V>
void print_map(const map<K, V> &m) {
    for(auto it=m.cbegin(); it!=m.cend(); it++) {
        cout << it->first << ": " << it->second << endl;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

#define MAXN 50000

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

	long long n, ans;
	cin >> n;
	ans = n * (n - 1) / 2;
	cout << ans << "\n";


	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; ++i)
#define RREP(i,n) for(int i = 0; i >= n; ++i)
typedef priority_queue <int> pi;
typedef priority_queue <int, vector<int>, greater<int>> pg;
typedef unsigned long long int ulli;


int main()
{
    string N;
    cin >> N;
    int ans = 0;
    bool temp = true;
    REP(i,N.size())
    {
        if(temp == true)
        {
            if (N[i + 1] != '9' && i + 1 != N.size())
            {
                N[i] = (char)((int)N[i] - 1);
                temp = false;
            }
            else if (N[i] != '9' && i + 1 == N.size())
            {
                N[i - 1] = (char)((int)N[i] - 1);
                N[i] == '9';
            }
        }
        else
        {
            N[i] = '9';
        }
    }

    REP(i,N.size()) ans += (int)N[i] - 48;
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

	int K = sc.nextInt();
	int X = sc.nextInt();

	if (500 * K >= X)
	    System.out.println("Yes");
	else
	    System.out.println("No");
    }
}

Measured memory_bytes: 23252
const AC_EXEC_TIME: i32 = 100;
const WA_EXEC_TIME: i32 = 1900;

fn read_line() -> String {
  let mut tmp = String::new();
  std::io::stdin().read_line(&mut tmp).unwrap();
  tmp.trim().to_string()
}

fn solve(ac: i32, wa: i32) -> i32 {
  let tmp = WA_EXEC_TIME * wa + (AC_EXEC_TIME * (ac - wa));
  tmp * 2i32.pow(wa as u32)
}

fn main() {
/*
  let tests = vec![
    vec![1, 1, 3800],
    vec![10, 2, 18400],
    vec![100, 5, 608000],
  ];
  for v in &tests {
    let ans = solve(v[0], v[1]);
    assert_eq!(ans, v[2]);
  }
*/
  let nums: Vec<i32> 
    = read_line().split(" ").map(|x| x.parse().unwrap()).collect();
  let (ac, wa) = (nums[0], nums[1]);
  let ans = solve(ac, wa);
  println!("{}", ans);
}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 200005

const int INF = 1e9+7;



int main(){

    ll n;
    cin >> n;
    vector<ll> a(ARRAY_MAX,0),t(ARRAY_MAX,0);

    for(int i = 1;i <= n;i++){
        cin >> a[i];
    }
    for(int i = 1;i <= n;i++){
        cin >> t[i];
    }
    ll ans = 1;
    for(int i = 1;i <= n;i++){

        if((a[i-1] < a[i] && t[i] < a[i]) || (t[i] > t[i+1] && t[i] > a[i])){//矛盾しているケース
            ans = 0;
        }else if(a[i-1] == a[i] && t[i] == t[i+1]){//高さは任意の部分(最小の高さを取ればいい)
            ans *= min(a[i],t[i]);
            ans %= MOD;
        }
    }
    cout << ans << endl;



    return 0;
}

Measured memory_bytes: 3328
n,d = map(int,input().split())
X = [list(map(int,input().split())) for i in range(n)]
number = [i for i in range(1,200)]
square = list(map(lambda i: i**2, number))
count = 0
for i in range(0,n):
  for j in range(0,n):
    distance = 0
    for p in range(0,d):
      distance += (X[j][p]-X[i][p])**2
    if square.count(distance) == 1 and i < j:
      count += 1
print(count)

Measured memory_bytes: 3064
arr=[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]
t=int(input())
print(arr[t-1])

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		
		int count = 0;
		boolean flag = true;
		for(int i = 0; i < x + 1; i++) {
			count = 2 * i + 4 * (x - i);
			if(count == y) {
				System.out.println("Yes");
				flag = false;
				break;
			}
		}
		
		if(flag) System.out.println("No");
		
		
	}

}


Measured memory_bytes: 35624
#include <iostream>
using namespace std;
int main()
{
    int a, b, k;
    cin >> a >> b >> k;
    for (int i = min(a, b); i >= 1; --i)
    {
        if (a % i == 0 && b % i == 0)
        {
            --k;
        }
        if (k == 0)
        {
            cout << i << '\n';
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>
using namespace std;
int bubbleSort(int A[], int N) {
	int counter = 0;
	bool flag = true;
	while (flag) {
		flag = false;
		for (int j = N - 1; j > 0; j--) {
			if (A[j - 1] > A[j]) {
				int v = A[j];
				A[j] = A[j - 1];
				A[j - 1] = v;
				flag = true;
				counter++;
			}
		}
	}
	for (int i = 0;i < N;i++) {
		if (i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
	return counter;
}
int main() {
	int N,i;
	int A[100];
	scanf("%d", &N);
	for (i = 0;i < N;i++)
		scanf("%d", &A[i]);
	printf("%d\n",bubbleSort(A, N));
}


Measured memory_bytes: 2748
#include <iostream>
#include <iomanip>

using namespace std;

int n;
double pb[3000];
double dp[3000][3000];
double ans = 0;

int main()
{
	cin >> n;

	for (int i = 1; i <= n; i++)
	{
		cin >> pb[i];
	}

	dp[0][1] = 1;

	for (int i = 1; i <= n; i++)
	{
		for (int j = i + 1; j >= 1; j--)
		{
			dp[i][j] = dp[i - 1][j] * (1 - pb[i]) + dp[i - 1][j - 1] * pb[i];
		}
	}

	for (int i = n + 1; i > (n + 1) / 2; i--)
	{
		ans += dp[n][i];
	}

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

	return 0;
}

Measured memory_bytes: 68864
/*input

*/


// assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pii         pair<ll ,ll >
#define vpii        vector< pii >
#define vi          vector<ll >
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define debug(x)     cout << #x << " " << x << endl;
#define debug_p(x)   cout << #x << " " << x.F << " " << x.S << endl;
#define debug_v(x)   {cout << #x << " "; for (auto ioi : x) cout << ioi << " "; cout << endl;}
#define debug_vp(x)  {cout << #x << " "; for (auto ioi : x) cout << '[' << ioi.F << " " << ioi.S << ']'; cout << endl;}
#define debug_v_v(x) {cout << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cout << ioi2 << " "; cout << '\n';} cout << "*/" << #x << endl;}

const ll N = 2e3+3;
ll n;
vpii a;
ll dp[N][N];

ll fun(ll pos,ll l)
{
	if(pos>=n) return 0;
	if(dp[pos][l]!=-1) return dp[pos][l];

	ll r = n-1-(pos-l);
	ll i = pos;

	ll ans = fun(pos+1,l+1) + a[i].F*abs(a[i].S-l);
	ans=max(ans,fun(pos+1,l) + a[i].F*abs(a[i].S-r));
	return dp[pos][l] = ans;
}


int solve()
{
	cin>>n;
	a.assign(n,mp(-1,-1));

	rep(i,0,n)
	{
		ll x;
		cin>>x;
		a[i] = mp(x,i);
	}

	sort(a.begin(), a.end(),greater<pii> ());

	memset(dp,-1,sizeof dp);

	cout<<fun(0,0);
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	//cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

Measured memory_bytes: 35236
N, K = map(int, input().split())
p = list(map(int, input().split()))

# 「和の期待値」は「期待値の和」なので、期待値を求めておく
for i in range(N):
  p[i] = (1+p[i])/2

# すると結局[(p_1+1)/2,...,(p_N+1)/2]の配列から、隣接するK個の和の最大値を求めればよい
# N=10^5なので、O(N)で解く
# 2重ループはO(NK)で間に合わない
# 累積和を用いるとO(N)で解ける！（累積和とは、配列上の区間の総和を求める処理を高速化する手法）
S = [0]*(N+1)
for i in range(N):
  S[i+1] = S[i] + p[i]
'''
S[0] = 0
S[1] = p[0]
S[2] = p[0] + p[1]
S[N] = p[0] + ... + p[N-1]
 
S[K]-S[0] = p[K-1] + ... + p[0]
S[K+1]-S[1] = p[K] + ... + p[1]
S[K+2]-S[2] = p[K+1] + ... + p[2]
S[N]-S[N-K] = p[N-1] + ... + p[N-K]
'''
 
ans = 0 # ans = max(S[K]-S[0],S[K+1]-S[1],...,S[N]-S[N-K])
for i in range(N-K+1):
  ans = max(ans, S[i+K] - S[i])
  
print(ans)

Measured memory_bytes: 32708
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
vll gdata(50);
//* prime factorization in O(sqrt(n))
map<ll, ll> prime_factor(ll n){
    map<ll, ll> res;
    for(ll i=2; i*i <= n; i++){ //* n shrinks during the for-loop!
        while(n % i == 0){
            ++res[i];
            n /= i;
        }
    }
    if(n != 1) {
        ++res[n];
    }
    return res;
}

ll getNum(ll x){
    ll res = upper_bound(ALL(gdata), x) - gdata.begin();
    //res++;
    return res;
}

void solve(long long N){
    auto R = prime_factor(N);
    REP(i, 50) gdata[i] = i+1;
    REP(i, 49) gdata[i+1] += gdata[i];
    ll ans = 0;
    for(auto x: R){
        ans += getNum(x.second);
    }
    cout<<ans<<endl;
}
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


Measured memory_bytes: 3256
N,K=map(int,input().split())
c = [0]*(10**5)
for x in range(N):
    a,b=map(int,input().split())
    c[a-1]+=b

for i in range(10**5):
    if c[i]>=K:
        print(i+1)
        break
    else: # c[i]<K
        K -=c[i]


Measured memory_bytes: 5748
/*
 * author :Sadik Hassan(_sad_)
 *
*/
#include "bits/stdc++.h"
using namespace std;
using   ll =          long long;
using   ld =          long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(15);

typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = (int)1e6+1;
const int MOD =(int)1e9+7;
const ll INF = (ll)1e18+5;
vi aa(N,0);

int main()
{
    _SAD()
    string s,t;
    cin>>s>>t;
    int cnt=0;
    for(int i=0;i<SZ(s);i++)
    {
    	if(s[i]!=t[i])cnt++;
    }
    cout<<cnt<<nl;
    return 0;
}


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

using namespace std;
#define LL long long
#define mst(a, b)	memset(a, b, sizeof a)
#define REP(i, x, n)	for(int i = x; i <= n; ++i)
const int qq = 2e5 + 10;
int num[15];

int main(){
	int n;	scanf("%d", &n);
	int dif = 0;
	memset(num, 0, sizeof num);
	int x;	
	for(int i = 1; i <= n; ++i){
		scanf("%d", &x);
		if(x < 400)			num[1]++;
		else if(x < 800)	num[2]++;
		else if(x < 1200)	num[3]++;
		else if(x < 1600)	num[4]++;
		else if(x < 2000)	num[5]++;
		else if(x < 2400)	num[6]++;
		else if(x < 2800)	num[7]++;
		else if(x < 3200)	num[8]++;
		else	dif++;
	}
	int color = 0;
	for(int i = 1; i <= 8; ++i)
		if(num[i] > 0)	color++;
	int maxn = max(color, 1), minx = color + dif;
	printf("%d %d\n", maxn, minx);
	return 0;
}

Measured memory_bytes: 256
/*
	ABC A - Between Two Integers
*/
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;

double EPS = 1e-10;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define int(x) int x; cin >> x;
#define lint(x) long long x; cin >> x;
#define vint(v,n) vector<int> v(n); REP(i,n) cin >> v[i];
#define vlint(v,n) vector<lint> v(n); REP(i,n) cin >> v[i];
#define double(x) double x; cin >> x[i];
#define vdouble(v,n) vector<double> v(n); REP(i,n) cin >> v[i];
#define string(x) string x; cin >> x;

int main()
{
	int(a);
	int(b);
	int(c);

	if (a <= c && b >= c)
		cout << "Yes" << endl;
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
using namespace std;
typedef pair<int, int> P;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n;
  cin >> n;
  map<int, int> even_mp, odd_mp;
  bool flg = 0;
  rep(i, n) {
    int a;
    cin >> a;
    if(flg)
      even_mp[a]++;
    else
      odd_mp[a]++;
    flg ^= 1;
  }
  priority_queue<P> eq, oq;
  for(auto ex : even_mp) {
    eq.emplace(make_pair(ex.second, ex.first));
  }
  for(auto ox : odd_mp) {
    oq.emplace(make_pair(ox.second, ox.first));
  }
  P ep = eq.top();
  eq.pop();
  P op = oq.top();
  oq.pop();
  int ans = n - ep.first - op.first;
  if(ep.second == op.second) {
    if(eq.empty()) {
      if(oq.empty())
        ans = n / 2;
      else {
        P nop = oq.top();
        ans = n - ep.first - nop.first;
      }
    } else if(oq.empty()) {
      P nep = eq.top();
      ans = n - nep.first - op.first;
    } else {
      P nop = oq.top();
      P nep = eq.top();
      ans = min(n - ep.first - nop.first,
                n - nep.first - op.first);
    }
  }
  cout << ans << endl;
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  ll n;cin>>n;
  vector<ll>hash(10001);
  for(i=2;i<=n;i++){
    buf=i;
    for(j=2;j<=i;j++){
      if(buf%j==0){
        for(o=0;buf%j==0;o++){
          buf/=j;
        }
        hash[j]+=o;
      }
      if(buf==1)break;
    }
  }
  res=1;
  for(i=2;i<=n;i++){
    qmod(res,hash[i]+1);
    //cout<<res<<endl;
  }
  cout<<res<<endl;
  
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include<unordered_map>
/*
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*    ▀▀       ▀▀▀▀▀▀    ▀     ▀▀▀▀▀▀      ▀    ▀
*   ▀  ▀      ▀         ▀     ▀            ▀  ▀
*  ▀    ▀     ▀ ▀ ▀     ▀     ▀ ▀ ▀         ▀
* ▀ ▀▀▀▀ ▀    ▀         ▀     ▀             ▀
*▀        ▀   ▀         ▀     ▀             ▀
*▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
*/
using namespace std;
void afify()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
#define ll long long
#define ld long double
#define loopi(i,intial,n)  for(int i=int(intial);i<n;i++)
#define loopj(j,intial,n) for(int j=int(intial);j<n;j++)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define all(v) v.begin(),v.end()
///////////////////////////////////////
#define SCD(a) scanf("%d",&a)
#define SCD2(a,b) scanf("%d %d",&a,&b)
#define SCLL(a) scanf("%lld",&a)
#define SCLL2(a,b) scanf("%lld %lld",&a,&b)
#define PRD(a) printf("%d\n",a)
#define PRLL(a) printf("%lld\n",a)
///////////////////////////////////////
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <vi> vvi;
typedef vector <vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<vpii> vvpii;
typedef stringstream ss;
const ll oo = (ll) 1e13;
const double EPS = 1e-4;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//ifstream ifs("input.txt");
//ofstream ofs("output.txt");
int main()
{  
	afify();
	string a,b,c;
	cin>>a>>b>>c;
	a[0]=toupper(a[0]);
		b[0]=toupper(b[0]);
	c[0]=toupper(c[0]);
	cout<<a[0]<<b[0]<<c[0]<<endl;



return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		
		int count = 0;
		for (int i=1; i<=N; i++){
			int a = sc.nextInt();
			if ((i%2 == 1) && (a%2 == 1)){
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 35472
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    a,b=map(int,input().split())
    print(-(-(a+b)//2))

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
n = int(input())
w = list(map(int, input().split()))
ans = 1e9
s = [0 for i in range(n)]
s[0] = w[0]
for i in range(1, n):
  s[i] = s[i-1]+w[i]
for i in range(n):
  ans = min(ans, abs((s[-1]-s[i])-s[i]))
print(ans)

Measured memory_bytes: 3064
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

ll a, b, c;

int main() {
    cin >> a >> b >> c;
    if (c <= a + b + 1) cout << b + c << endl;
    else cout << a + 2 * b + 1 << endl;
}

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

const int INF = 1e9 + 5; 

int main () {
    ios::sync_with_stdio(0); 
    int n; cin >> n;
    vector<int> h(1e5+10); 
    for (int i = 1; i <= n; i++) cin >> h[i]; 
    vector<int> dp(n+1, INF); 
    dp[1] = 0; 
    for (int i = 1; i <= n; i++) {
        for (int j : {i+1, i+2}) {
            dp[j] = min(dp[j], dp[i] + abs(h[i]-h[j])); 
        }
    }

    cout << dp[n] << "\n";

}

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


int main() {
    const int MAX_N = 1e5;
    const int INF = 2e9;
    int N, K, h[MAX_N], dp[MAX_N];
	cin >> N >> K;
    for (int i = 0; i < N; ++i){
        cin >> h[i];
    }

    dp[0] = 0;
    for (int i = 1; i < N; ++i){
        int m = INF;
        for (int j = max(0, i-K); j < i; ++j){
            m = min(m, dp[j] + abs(h[i]-h[j]) );
        }
        dp[i] = m;
    }

    cout << dp[N-1] << endl;

}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
int f[555][555],tms=0;
string Mat;
int query(string s){
	assert(s.length()<=128);
	assert(s.length()>=1);
	++tms;
  	cout<<"? "<<s<<endl;
	fflush(stdout);
	int x;
	#ifdef zyy
		int l1=Mat.length();
		int l2=s.length();
		memset(f,30,sizeof(f));
		f[0][0]=0;//f[0][1]=f[1][0]=0;
		For(i,0,l1) For(j,0,l2){
			if (i) f[i][j]=min(f[i][j],f[i-1][j]+1);
			if (j) f[i][j]=min(f[i][j],f[i][j-1]+1);
			if (i&&j) f[i][j]=min(f[i][j],f[i-1][j-1]+1-(Mat[i-1]==s[j-1])); 
		}
		//cout<<f[l1][l2]<<endl;
		return f[l1][l2];
	#else
		scanf("%d",&x);
		if (!x){
			cout<<"! "<<s<<endl;
			exit(0);
		} 
		return x;
	#endif
}
string chr,ans;
int arr[555],len;
void divide(int l,int r,int vl,int vr,char id){
	//cout<<l<<' '<<r<<' '<<vl<<' '<<vr<<' '<<id<<endl;
	if (l>r) return;
	int mid=(l+r)/2;
	string tmp;
	For(i,mid,ans.length()-1) tmp=tmp+ans[i];
	For(i,1,vl) tmp=id+tmp;
	int vm=vl;
	for (;vm<vr;vm++){
		tmp=id+tmp;
		if (query(tmp)!=len-tmp.length()) break;
	}
	arr[mid]=vm;
	divide(l,mid-1,vl,arr[mid],id);
	divide(mid+1,r,arr[mid],vr,id);
}
int main(){
	srand(time(NULL));
	For(i,'a','z') chr=chr+(char)(i); 
	For(i,'A','Z') chr=chr+(char)(i); 
	For(i,'0','9') chr=chr+(char)(i); 
	random_shuffle(chr.begin(),chr.end());
	For(i,1,128) Mat=Mat+chr[rand()%62];
	int l=0,r=chr.length()-1;
	while (l<r){
		int len=(r-l+2)/2;
		string tmp1,tmp2;
		For(j,l,l+len-1) tmp1=tmp1+chr[j];
		For(j,r-len+1,r) tmp2=tmp2+chr[j];
		if (query(tmp1)<=query(tmp2))
			r=l+len-1;
		else l=r-len+1;
	}
	
	string tmp;
	tmp=tmp+chr[l];
	len=query(tmp)+1;
	for (auto i:chr){
		string tmp;
		For(j,1,128) tmp=tmp+i;
		int sum=128-query(tmp);
		memset(arr,0,sizeof(arr));
		arr[ans.length()]=sum;
		divide(0,ans.length()-1,0,sum,i);
		tmp="";
		For(j,0,ans.length()){
			int v=arr[j]-(j?arr[j-1]:0);
			For(k,1,v) tmp=tmp+i;
			if (j!=ans.length()) tmp=tmp+ans[j];
		}
		ans=tmp;
	}
	#ifdef zyy
		assert(ans==Mat);
		cout<<tms<<endl;
	#endif
	cout<<"! "<<ans<<endl;
}

Measured memory_bytes: 3800
#include <iostream>
using namespace std;
class dice
{
public:
	int l[6];//label
	void in()
	{
		for(int i=0;i<6;i++)cin>>l[i];
	}
	void r(char a)//roll
	{
		if(a=='S')
		{
			int sto=l[0];
			l[0]=l[4];
			l[4]=l[5];
			l[5]=l[1];
			l[1]=sto;
		}
		else if(a=='N')
		{
			int sto=l[0];
			l[0]=l[1];
			l[1]=l[5];
			l[5]=l[4];
			l[4]=sto;
		}
		else if(a=='E')
		{
			int sto=l[0];
			l[0]=l[3];
			l[3]=l[5];
			l[5]=l[2];
			l[2]=sto;
		}
		else if(a=='W')
		{
			int sto=l[0];
			l[0]=l[2];
			l[2]=l[5];
			l[5]=l[3];
			l[3]=sto;
		}
		else if(a=='R')
		{
			r('N');r('E');r('S');
		}
		else if(a=='L')
		{
			r('N');r('W');r('S');
		}
		return;
	}
	void r_tf(int t,int f)
	{
		int i;for(i=0;i<6;i++)if(l[i]==t)break;
		if(i==1)r('N');
		else if(i==2)r('W');
		else if(i==3)r('E');
		else if(i==4)r('S');
		else if(i==5)r('N'),r('N');
		
		for(i=1;i<5;i++)if(l[i]==f)break;
		if(i==2)r('L');
		else if(i==3)r('R');
		else if(i==4)r('L'),r('L');
		
		return;
	}
};

int main() {
	dice d[2];bool flag=true;
	d[0].in();d[1].in();int i;
	for(i=1;d[0].l[0]==d[0].l[1]&&i<5;i++)d[0].r('R');
	if(d[0].l[0]==d[0].l[1])for(flag=false,i=1;d[0].l[5]==d[0].l[1]&&i<5;i++)d[0].r('R');
	if(!flag)d[0].r_tf(d[0].l[5],d[0].l[1]);flag=true;
	d[1].r_tf(d[0].l[0],d[0].l[1]);
	for(int i=2;i<6;i++)if(d[0].l[i]!=d[1].l[i])flag=false;
	if(flag)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3112
import std.stdio, std.string, std.array, std.conv, std.algorithm.iteration, std.functional;

void main()
{
    auto x = readln.chomp.to!long;
    if (x < 7) {
        writeln(1);
    } else if (x < 12) {
        writeln(2);
    } else {
        auto ret = (x / 11) * 2;
        writeln(ret + (x%11 == 0 ? 0 : x%11 > 6 ? 2 : 1));
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
long long int t=1e9+7;
long long int cnt[1000000],ara[1000000];
using namespace std;
int main()
{
    long long int num,i,flag=1,d,ans=1;
    scanf("%lld",&num);
    flag=1;
    for(i=0;i<num;i++)
    {
        scanf("%lld",&ara[i]);
        cnt[ara[i]]++;
    }
    sort(ara,ara+num);
    if(num%2)
    {
        if(cnt[0]!=1)
        {
            printf("0\n");
            flag=0;
        }
        else
        {
            for(i=1;i+1<num;i++)
            {
                if(i%2)
                {
                    if(ara[i]==ara[i+1])
                    {
                        continue;
                    }
                    else
                    {
                        printf("0\n");
                        flag=0;
                        break;
                    }
                }
                else
                {
                    d=ara[i+1]-ara[i];
                    if(d==2)
                    {
                        continue;
                    }
                    else
                    {
                        printf("0\n");
                        flag=0;
                        break;
                    }
                }
            }
        }
    }
    else
    {
        if(cnt[1]!=2)
        {
            printf("0\n");
            flag=0;
        }
        else
        {
            for(i=1;i+1<num;i++)
            {
                if(i%2)
                {
                     d=ara[i+1]-ara[i];
                    if(d==2)
                    {
                        continue;
                    }
                    else
                    {
                        printf("0\n");
                        flag=0;
                        break;
                    }
                }
                else
                {
                    if(ara[i]==ara[i+1])
                    {
                        continue;
                    }
                    else
                    {
                        printf("0\n");
                        flag=0;
                        break;
                    }
                }
            }
        }

    }
    if(flag==1)
    {
        for(i=0;i<num/2;i++)
        {
            ans=(ans*2)%t;
        }
        printf("%lld\n",ans);
    }
    return  0;
}

Measured memory_bytes: 4992
#include<stdio.h>

int N, M, k[11], s[11][11], p[11];
int ans = 0;

int main(){
	scanf("%d%d", &N, &M);
	for(int i=0; i<M; i++){
		scanf("%d", k+i);
		for(int j=0; j<k[i]; j++){
			scanf("%d", &s[i][j]);
			s[i][j]--;
		}
	}
	for(int i=0; i<M; i++)scanf("%d", p+i);
	for(int S=0; S<(1<<N); S++){
		int cnt = 0;
		for(int i=0; i<M; i++){
			int P = 0;
			for(int j=0; j<k[i]; j++){
				P ^= (S>>s[i][j])&1;
			}
			cnt += P==p[i];
		}
		ans += cnt==M;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
#define ref(i,n) for(int i=1;i<=n;i++)
using namespace std;
typedef pair<int,int> P;

int n,k;


int main()
{
    cin>>n;
    int ans=0;
    ref(i,n){
        cin>>k;
        if((k%2)&&(i%2)) ans++;
    }
    cout<<ans;

}


Measured memory_bytes: 3632