akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define MOD 1000000007
#define endl "\n"
#define sz(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define OTP(s) cout<<s<<endl;
#define FOR(i,j,k,l) for(int i=j;i<k;i+=l)
#define REP(i,j) FOR(i,0,j,1)
#define INF 1e15
inline ll add(ll a, ll b){a += b; if(a >= MOD)a -= MOD; return a;}
inline ll sub(ll a, ll b){a -= b; if(a < 0)a += MOD; return a;}
inline ll mul(ll a, ll b){return (ll)((ll) a * b %MOD);}
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;

ll min(ll a,ll b)
{
    return a>b?b:a;
}
ll max(ll a,ll b)
{
    return a>b?a:b;
}

ll n,ar[4000];
ll dp[3001][3001];
ll ind1,ind2;
ll lst=0;

ll value(ll x, ll y)
{
    if(dp[x][y]!=INF)
    {
        return dp[x][y];
    }
    // cnt++;
    if(x==y)
    {
        dp[x][y]=ar[x];
        return dp[x][y];
    }
    if(y-x==1)
    {
        dp[x][y] = max(ar[x],ar[y])-min(ar[x],ar[y]);
        return dp[x][y];
    }
    
    dp[x][y] = max(ar[x]-value(x+1,y),ar[y]-value(x,y-1));
    return dp[x][y];
}

int main()
{
    IOS
    cin>>n;
    REP(i,n)
    {
        cin>>ar[i];
    }
    REP(i,n)
    {
        REP(j,n)
        {
            dp[i][j]=INF;
        }
    }
    cout<<value(0,n-1)<<endl;
    // trace(cnt)
}

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

int n,ans=0,a,cnt;

int main()
{
	cin >> n;
	for(int i=1;i<=n;i++)
	{
		a=i;
		cnt=0;
		while(a)
		{
			a/=10;
			cnt++;
		}
		if(cnt%2) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  if(a>=k)
    cout<<k<<endl;
  else
  {
    if(a+b>=k)
    {
      cout<<a<<endl;
    }
    else
    {
      cout<<a-(k-(a+b))<<endl;
 
    }
  }
  return 0;
}

Measured memory_bytes: 3620
#include<iostream>
int can4;
int can2;
int N;
int main() {
	std::cin >> N;
	for (int i = 0; i < N; i++) {
		int a;
		std::cin >> a;
		if (a % 4 == 0) {
			can4++;
		}
		else if(a%2==0){
			can2++;
		}
	}
	if (can4*2+1>=N) {
		std::cout << "Yes" << "\n";
	}
	else if(can4*2+can2>=N){
		std::cout << "Yes" << "\n";
	}
	else {
		std::cout << "No" << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")  
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define endl "\n"
#define all(x) (x).begin(),(x).end()
const int MOD = 1e9+7;
const int mxN = 2e5+3;

void solve(){
	int n;
	cin >> n;
	map<string, int> mp;
	mp["AC"] = 0;
	mp["WA"] = 0;
	mp["TLE"] = 0;
	mp["RE"] = 0;
	for(int i = 0; i < n; ++i){
		string s;
		cin >> s;
		mp[s]++;
	}
	cout << "AC x " << mp["AC"] << endl;
	cout << "WA x " << mp["WA"] << endl;
	cout << "TLE x " << mp["TLE"] << endl;
	cout << "RE x " << mp["RE"] << endl;
}

int32_t main(){
	IO;
	
	int nT = 1;
	//cin >> nT;
	for(int i = 1; i <= nT; ++i)
		solve();
	return 0;
}


Measured memory_bytes: 3648
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
int main(){
  int n,s1=0,a1=0,s2=0;
  cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++){
    cin >> a.at(i);
    if(a.at(i)>s1){
      s2=s1;
      s1=a.at(i);
      a1=i;
    }
    else if(a.at(i)>s2){
      s2=a.at(i);
    }
  }
  for(int i=0; i<n; i++){
    if(i==a1){
      cout << s2 << endl;
    }
    else{
      cout << s1 << endl;
    }
  }
}

Measured memory_bytes: 2432
import java.util.*;

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

    int digitNum = calcNumDigits(N);
    
    int ans = 0;
    for (int i = digitNum; i >= 3; i--) {
      ans += solve(N, i, 0, false, false, false);
    }
    
    System.out.println(ans);
  }
  
  private static int solve(int N, int digit, int num,
                          boolean use7, boolean use5, boolean use3) {
    if (digit == 0) {
      if (use7 && use5 && use3 && num <= N) {
        return 1;
      }  else {
        return 0;
      }
    }
    
    int ans = 0;
    // 7
    ans += solve(N, digit-1, num+7*power10(digit-1), true, use5, use3);
    // 5
    ans += solve(N, digit-1, num+5*power10(digit-1), use7, true, use3);
    // 3
    ans += solve(N, digit-1, num+3*power10(digit-1), use7, use5, true);
    
    return ans;
  }

  private static HashMap<Integer, Integer> memo = new HashMap<>();
  private static int power10(int n) {
    if (n == 0) {
      return 1;
    }
    Integer cached = memo.get(n);
    if (cached != null) {
      return cached;
    }
    int val = 10 * power10(n-1);
    memo.put(n, val);
    return val;
  }
  
  private static int calcNumDigits(int n) {
    int ret = 0;
    while (n > 0) {
      ret++;
      n /= 10;
    }
    return ret;
  }
}

Measured memory_bytes: 22740
S=input()
T=input()
ans=float("inf")
for i in range(len(S)-len(T)+1):
    tmp=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            tmp+=1
    ans=min(ans,tmp)
print(ans) if ans<float("inf") else print(len(T))

Measured memory_bytes: 9120
import numpy as np

H, W = map(int, input().split())
inputs = np.array([list(input()) for _ in range(H)])
grid = inputs == '.'

# 左から右に処理を行う
vertical_1 = np.zeros((H, W), dtype=int)
vertical_1[:, 0] = grid[:, 0]
for i in range(1, W):
    vertical_1[:, i] = (vertical_1[:, i-1] + 1) * grid[:, i]

# 右から左に処理を行う
vertical_2 = np.zeros((H, W), dtype=int)
vertical_2[:, -1] = grid[:, -1]
for i in range(W-2, -1, -1):
    vertical_2[:, i] = (vertical_2[:, i+1] + 1) * grid[:, i]

# 上から下に処理を行う
down_1 = np.zeros((H, W), dtype=int)
down_1[0] = grid[0]
for i in range(1, H):
    down_1[i] = (down_1[i-1] + 1) * grid[i]

# 右から左に処理を行う
down_2 = np.zeros((H, W), dtype=int)
down_2[-1] = grid[-1]
for i in range(H-2, -1, -1):
    down_2[i] = (down_2[i+1] + 1) * grid[i]

print((vertical_1 + vertical_2 +  down_1 + down_2 - 3).max())


Measured memory_bytes: 233168
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;

void solve(){
	int n;
	cin>>n;
	vector<lli> a(n+1);
	for(int i=1;i<n+1;i++){
		cin>>a[i];
	}
	vector<lli> dp(n+1,0);
	dp[1] = 0;
	vector<lli> prefix(n+1);
	prefix[1] = a[1];
	for(int i=3;i<=n;i+=2){
		prefix[i] = prefix[i-2]+a[i];
	}
	for(int i=2;i<=n;i++){
		if(i&1){
			dp[i]=max(dp[i-1],dp[i-2]+a[i]);
		}else{
			dp[i] = a[i] + dp[i-2];
			dp[i] = max(dp[i],prefix[i-1]);
		}
	}
	cout<<dp[n];
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    solve();//checking
    return 0;
}

Measured memory_bytes: 7920
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	K, N = getlist()
	A = getlist()
	dif = 0
	for i in range(N - 1):
		dif = max(dif, A[i + 1] - A[i])

	dif = max(dif, A[0] + K - A[-1])

	print(K - dif)


if __name__ == '__main__':
	main()

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

#define foreach(i, v) for(__typeof((v).begin()) i = (v).begin(); i != (v).end(); ++ i)
#define BETWEEN(a, x, b) (a<=x&&x<b)

using namespace std;
typedef long long ll;

int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
  ll a,b,c,k;cin>>a>>b>>c>>k;
  if(k%2==0){
    cout<<a-b<<endl;
  } else {
    cout<<-a+b<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 
#define int long long
#define double long double

////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////
int n, a[310000];
signed main(){
  cin>>n;rep(i,n)cin>>a[i];
  int ans = 0, k = 1;
  rep(i,61){
    int cnt0 = 0, cnt1 = 0;
    rep(j,n){
      if(a[j]&(1LL<<i)){
        cnt1++;
        cnt1 %= MOD;
      }else{
        cnt0++;
        cnt0 %= MOD;
      }
    }
    ans = ((cnt0 * cnt1) % MOD * k % MOD + ans) % MOD;
    k = k*2 % MOD;
  }
  cout << ans << endl;
}


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

int main(void){
    int n, m, l;

    cin >> n >> m >> l;
    long long int a[n][m], b[m][l];
    
    // Matrix A
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            cin >> a[i][j];
        }
    }
    
    // Matrix B
    for(int i=0; i<m; i++){
        for(int j=0; j<l; j++){
            cin >> b[i][j];
        }
    }

    for(int i=0; i<n; i++){
        for(int j=0; j<l; j++){
            long long int sum = 0;
            for(int k=0; k<m; k++){
                sum += a[i][k] * b[k][j];
            }
            cout << sum;            
            if(j == l - 1) cout << endl;
            else cout << " ";
        }
    }
    return 0;
}



Measured memory_bytes: 3232
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	int N;
	int[] A;
	public void solve(){
		N = nextInt();
		A = new int[N];
		for(int i = 0;i < N;i++){
			A[i] = nextInt();
		}

		int ans = 0;
		int i = 0;
		for(;i < N;){
			int j = i+1;
			int k = i+1;
			while(j < N && A[j-1] <= A[j])j++;
			while(k < N && A[k-1] >= A[k])k++;

			if(j < k){
				i = k;
			}else{
				i = j;
			}
			ans++;
		}
		out.println(ans);
	}

	public static void main(String[] args) {
		out.flush();
		new Main().solve();
		out.close();
	}

	/* Input */
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out);
	private final byte[] buffer = new byte[2048];
	private int p = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (p < buflen)
			return true;
		p = 0;
		try {
			buflen = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (buflen <= 0)
			return false;
		return true;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrint(buffer[p])) {
			p++;
		}
		return hasNextByte();
	}

	private boolean isPrint(int ch) {
		if (ch >= '!' && ch <= '~')
			return true;
		return false;
	}

	private int nextByte() {
		if (!hasNextByte())
			return -1;
		return buffer[p++];
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = -1;
		while (isPrint((b = nextByte()))) {
			sb.appendCodePoint(b);
		}
		return sb.toString();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 39156
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Problem solver = new Problem();
        solver.solve(0, in, out);
        out.close();
    }

    static class Problem {

        private static final int MODULO = 1000000007;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int R = in.nextInt(), C = in.nextInt();
            char[][] grid = new char[R][C];

            for (int i = 0; i < R; i++) {
                String s = in.next();
                for (int j = 0; j < C; j++)
                    grid[i][j] = s.charAt(j);
            }

//            int[][] dp = new int[R][C];
//            int res = numWays(grid, R - 1, C - 1, dp);
            int res = numWays2(grid);
            out.println(res);
        }

        public int numWays(char[][] grid, int i, int j, int[][] dp) {
            if (grid[i][j] == '#')
                return 0;

            if (i == 0 && j == 0)
                return 1;

            if (dp[i][j] != 0)
                return dp[i][j];

            int left = (j - 1) >= 0 ? numWays(grid, i, j - 1, dp) : 0;
            int top = (i - 1) >= 0 ? numWays(grid, i - 1, j, dp) : 0;
            dp[i][j] = (left + top) % MODULO;
            return dp[i][j];
        }

        public int numWays2(char[][] grid) {
            int R = grid.length, C = grid[0].length;
            int[][] dp = new int[R + 1][C + 1];

            for (int i = 1; i <= R; i++) {
                for (int j = 1; j <= C; j++) {
                    if (i == 1 && j == 1)
                        dp[i][j] = 1;
                    else if (grid[i - 1][j - 1] == '.')
                        dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MODULO;
                    else
                        dp[i][j] = 0;
                }
            }
            
            return dp[R][C];
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 43268
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

k = int(input())
n, m = map(int, input().split())

if n%k==0:
    print('OK')
    exit()

if m%k==0:
    print('OK')
    exit()

mm= m//k
nn= n//k

if mm>nn:
    print('OK')
else:
    print('NG')

Measured memory_bytes: 9192
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)



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

	ll N, K, S;
	cin >> N >> K >> S;

	if (S <= N) {
		for (int i = 0; i < N; i++) {
			if (i < K)cout << S << " ";
			else cout << 1000000000 << " ";
		}
		cout << endl;
	}
	else {
		for (int i = 0; i < N; i++) {
			if (i < K)cout << S << " ";
			else cout << 1 << " ";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
using namespace std;
int main() {
	long long int n, dp[90] = { 2,1 };
	cin >> n;
	for (int i = 2; i <= n; i++)dp[i] = dp[i - 1] + dp[i - 2];
	cout << dp[n] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
typedef long long ll;
ll abs(ll a,ll b)
{
	if(a>b)return a-b;
	return b-a;
}
int main()
{
	ll n,k;
	while(~scanf("%lld %lld",&n,&k))
	{
		n=n%k;
		while(n>=abs(n,k))
		{
			n=abs(n,k);
		}
		printf("%lld\n",n);
	}
	return 0;
} 

Measured memory_bytes: 1720
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define STARTUP {(cin.tie(0));\
 (ios::sync_with_stdio(false));}

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define VECCIN(vec) const int size = (vec).size(); REP(i,size) cin>>(vec)[i];

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
std::istream& operator>>(std::istream& is, std::pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

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

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    STARTUP;

    string S;
    cin >> S;
    cout << S[0] << S.length() - 2 << *(S.end() - 1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <string.h>
typedef long long ll;
#define MAXS 200
int d[200000];
int n2[200000];
int n5[200000];
int sum[MAXS + 1][MAXS + 1];
int x[MAXS][MAXS];
ll min(ll x, ll y) {
	return x > y ? y : x;
}
ll max(ll x, ll y) {
	return x < y ? y : x;
}
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		char s[1001];
		scanf("%s", s);
		int len = strlen(s);
		ll num = 0;
		for (int j = 0; j < len; j++) {
			if (s[j] == '.') {
				d[i] = len - j - 1;
			} else {
				num *= 10;
				num += s[j] - '0';
			}
		}
		while (num % 2 == 0) {
			num /= 2;
			n2[i]++;
		}
		while (num % 5 == 0) {
			num /= 5;
			n5[i]++;
		}
	}
	// for (int i = 0; i < n; i++) {
	// 	printf("%lld %d %d %d\n", a[i], d[i], n2[i], n5[i]);
	// }
	for (int i = 0; i < n; i++) {
		int an2 = n2[i] - d[i];
		int an5 = n5[i] - d[i];
		// printf("%d %d\n", -an2 + (MAXS / 2), -an5 + (MAXS / 2));
		x[-an2 + (MAXS / 2)][-an5 + (MAXS / 2)]++;
	}
	for (int i = 0; i < MAXS; ++i) {
		for (int j = 0; j < MAXS; ++j) {
			sum[i + 1][j + 1] =
				sum[i][j + 1] + sum[i + 1][j] - sum[i][j] + x[i][j];
		}
	}
	// for (int i = 0; i <= MAXS; i++) {
	// 	for (int j = 0; j <= MAXS; j++) {
	// 		printf("%d ", sum[i][j]);
	// 	}
	// 	printf("\n");
	// }
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		int ne2 = d[i] - n2[i];
		int ne5 = d[i] - n5[i];
		// printf("%d\n", sum[-ne2 + (MAXS / 2) + 1][-ne5 + (MAXS / 2) + 1]);
		ans += sum[-ne2 + (MAXS / 2) + 1][-ne5 + (MAXS / 2) + 1];
		int an2 = n2[i] - d[i];
		int an5 = n5[i] - d[i];
		if (an2 >= ne2 && an5 >= ne5) {
			ans--;
		}
	}
	printf("%lld\n", ans / 2);
	return 0;
}

Measured memory_bytes: 4216
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
using namespace std;
typedef long long ll;
int main(){
  ll n,m,max=0,tmp,sum=0,b,c,pi=0,ai=0;
  cin >> n>>m;
  vector<ll> a,ans;
  vector<pair<ll,ll>> p;
  for(ll i=0;i<n;i++){
    cin >> tmp;
    a.push_back(tmp);
  }
  for(ll i=0;i<m;i++){
    cin >> b >> c;
    p.push_back(make_pair(c,b));
  }
  sort(a.begin(),a.end(),greater<ll>());
  sort(p.begin(),p.end(),greater<pair<ll,ll>>());
  for(int i=0;i<n;i++){
    ll t;
    if(ai>=a.size()||a[ai]<p[pi].first){
      t=p[pi].first;
      p[pi].second--;
      if(p[pi].second==0) pi++;
    }else{
      t=a[ai];
      ai++;
    }
    sum+=t;
  }
  cout << sum << endl;

}


Measured memory_bytes: 3188
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int D=sc.nextInt();
		int X=sc.nextInt();
		int d=1;
		int sum=0;
		int c=0;
		int A[]=new int[N];
		for(int i=0;i<N;i++) {
			A[i]=sc.nextInt();
		}
		for(int i=0;i<N;i++) {
			while(d<=D) {
				c++;
				d+=A[i];
			}
			d=1;
			sum+=c;
			c=0;
		}
		sum+=X;
		System.out.println(sum);
	}

}

Measured memory_bytes: 23124
import java.util.*;
import java.io.*;
import java.lang.*;

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

        int a = sc.nextInt();


        if (a == 0)
            System.out.println("1");
        else if (a == 1)
            System.out.println("0");

    }
}


Measured memory_bytes: 35588
// template.cpp

// Defines.
//#define DEBUG
#define NUMBER_OF_DIGITS 6

// Includes.
#include <bits/stdc++.h>

#ifdef DEBUG
#include <chrono>
#endif

// Usings.
using namespace std;

// Main function.
int main()
{
#ifdef DEBUG
	chrono::system_clock::time_point start, end;
	
	start = chrono::system_clock::now();
#endif
	
	// settings.
	ios::sync_with_stdio(false);
	
	//cout << fixed;
	//cout << setprecision(NUMBER_OF_DIGITS);
	
	// logic.
	int a, b, k;
	cin >> a >> b >> k;
	
	int counter = 0;
	int abmin = min(a, b);
	for (int i = abmin; i > 0; i--)
	{
		if (((a % i) == 0) && ((b % i) == 0))
		{
			counter++;
		}
		
		if (counter == k)
		{
			cout << i << endl;
			break;
		}
	}
	

#ifdef DEBUG
	end = chrono::system_clock::now();
	
	double elapsed = chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
	cout << elapsed << "[ms]" << endl;
#endif
	
	return 0;
}


Measured memory_bytes: 3648
fun main(args: Array<String>) {
    abc144c()
}

fun abc144c() {
    val n = readLine()!!.toLong()

    val answer = (1..Math.pow(n.toDouble(), 1 / 2.toDouble()).toLong()).map { i1 ->
        val i2 = n / i1
        if (i1 * i2 == n) i1 - 1 + i2 - 1 else Long.MAX_VALUE
    }.min()

    println(answer)
}


Measured memory_bytes: 83908
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<stack>
#include<cmath>
#include<algorithm>
#include<map>
typedef long long ll;
using namespace std;
#define INF 0x3f3f3f3f
/**
*超时有可能是输入的问题
*注意边界
*仔细读题
*没思路试试逆向思维
**加油，奥利给！！！ 
**/
map<int,int>p;
/*struct knd{
	int x,y,z;
}s[200000];*/ 
int a[200000];
int main()
{
	int m,n,i,j,t,k;
	cin>>n;
	if(n>=30) cout<<"Yes";
	else cout<<"No";
	/*for(i=1;i<=n;i++)
	{
		cin>>a[i];
	 } */
 } 

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

int main(void){
    string s1,s2;
    cin>>s1>>s2;int c=0;int n=s1.size();
    for(int i=0;i<n;i++)
    if(s1[i]!=s2[i])c++;
    cout<<c;
}


Measured memory_bytes: 3888
package main

import (
        "bufio"
        "fmt"
        "os"
        "strconv"
        "strings"
)

////////////////////////////////////////
///        templates                 ///
////////////////////////////////////////

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
        sc.Scan()
        return sc.Text()
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readBigLine() string {
        buf := make([]byte, 0, 1000000)
        for {
                l, p, e := rdr.ReadLine()
                if e != nil {
                        panic(e)
                }
                buf = append(buf, l...)
                if !p {
                        break
                }
        }
        return string(buf)
}

func strSprit(str string) []string {
        cols := strings.Split(str, " ")
        return cols
}

func parseInt(str string) int {
        n, _ := strconv.Atoi(str)
        return n
}

func intSprit(str string) []int {
        strs := strSprit(str)
        cols := make([]int, len(strs))
        for i, v := range strs {
                cols[i] = parseInt(v)
        }
        return cols
}

type SortSlice []int

func (s SortSlice) Len() int {
        return len(s)
}

func (s SortSlice) Swap(i, j int) {
        s[i], s[j] = s[j], s[i]
}

func (s SortSlice) Less(i, j int) bool {
        return s[i] < s[j]
}

func reverseString(str string) string {
        buf := []rune(str)
        for i, j := 0, len(buf)-1; i < j; i, j = i+1, j-1 {
                buf[i], buf[j] = buf[j], buf[i]
        }
        return string(buf)
}

////////////////////////////////////////
///        end templates             ///
////////////////////////////////////////

func main() {
        line := nextLine()

        spl := strSprit(line)

        A := parseInt(spl[0])
        B := parseInt(spl[1])

        add := A + B
        sub := A - B
        mul := A * B

        if add > sub {
                if add > mul {
                        fmt.Println(add)
                } else {
                        fmt.Println(mul)
                }
        } else {
                if sub > mul {
                        fmt.Println(sub)
                } else {
                        fmt.Println(mul)
                }
        }
}



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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 深さ優先探索
vector<bool> seen;
vector<int> colors;


int main() {

    string S;
    cin >> S;

    REP(i, S.length()){
        S[i] = 'x';
    }

    cout << S << endl;

    
    
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 2000000000
#define LINF 9000000000000000000
#define mod 1000000007
 
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair
#define MOD(x) (x%(mod))
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
 
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

bool debug=false;
/*---------------------------------------------------*/

int main(){
  string s;
  cin>>s;
  rep(i,26){
    bool ok=true;
    rep(j,s.size()){
      if(char('a'+i)==s[j])ok=false;
    }
    if(ok){
      cout<<char('a'+i)<<endl;
      return 0;
    }
  }
  cout<<"None"<<endl;
  return 0;
}


Measured memory_bytes: 764
import numpy as np

a=raw_input()

b=[]
for k in range(len(a)):
    b.append(a[k])

b=np.array(b)

alp='abcdefghijklmnopqrstuvwxyz'

al=[]
for k in range(len(alp)):
    al.append(alp[k])

res=[]
for aa in al:
    if aa in b:
        res.append(np.where(b==aa))

m=[]
for k in range(len(res)):
    zz=np.hstack([np.array([-1]),res[k][0],np.array([len(a)])])
    z=np.diff(zz)
    #print(zz)
    if len(z)>0:
        m.append(np.max(z))
if len(m)>0:
    ans=np.min(m)
else:
    ans=len(a)

ans=ans-1

print(ans)

Measured memory_bytes: 16352
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string n;
    cin >> n;
    if(n[0]=='7'||n[1]=='7'||n[2]=='7'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;

  int a[N], b[N];
  int c[M], d[M];
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < M; i++) {
    cin >> c[i] >> d[i];
  }

  for (int i = 0; i < N; i++) {
    int minD = INT_MAX;
    int minPoint = 0;
    for (int j = 0; j < M; j++) {
      int tmp = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (tmp < minD) {
        minPoint = j + 1;
        minD = tmp;
      }
    }

    cout << minPoint << endl;;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define p(x,y) cout<<fixed<<setprecision(y)<<x<<"\n";
#define PI 3.1415926535897
#define debug(x) cout<<" [ " << #x << " is: " << x << " ] "<<endl;
#define mod 998244353;
// pair<ll, ll>p[200005];
// ll dp[200005];
// int n ;
// int k;
// ll dfs(int i){
//     if(idx > n)return 0;
//     if(idx == n)return 1;
//     ll &res = dp[i];
//     if(~res) return res;
//     res = 0;
//     for(int i = 0; i < k; i++){
//         int l = p[i].fr, r = p[i].sc;
//         for(int j = l; j <= r; j++){
//             res += dfs(idx + j);
//         }
//     }
//     return res;
// }
int main()
{
    Fast;
//    memset(dp, -1, sizeof dp);
  int n;
    cin >> n;
    ll ans = 0;
    for (int i = 1; i <= 1000000; i++)
    {
        for (int k = 1; i * k <= n - 1; k++)
        {
            ans += (2 - 1);
        }
    }
    cout<<ans;
// cin >> n >> k;
// for(int i = 0; i < k; i++)cin >> p[i].fr >> p[i].sc;
// cout << dfs(1);


    return 0;
}


Measured memory_bytes: 3648
N = int(input())
h = list(map(int,input().split()))
if N == 1:
    print(h[0])
    exit()

cnt = 0
low = 0
for i in range(N-1):
    if h[i+1] < h[i] and cnt == 0:
        cnt += h[i]
        low = h[i+1]
    elif h[i+1] < h[i]:
        cnt += h[i] - low
        low = h[i+1]
    elif i == N-2:
        cnt += h[i+1] - low

print(cnt)

Measured memory_bytes: 3064
#include <iostream>
#include <unordered_set>

int main() {
    int q;
    std::cin >> q;

    std::unordered_set<int> S;
    for (int i = 0; i < q; i++) {
        int op, x;
        std::cin >> op >> x;
        if (op == 0) {
            S.insert(x);
            std::cout << S.size() << std::endl;
        } else if (op == 1) {
            std::cout << S.count(x) << std::endl;
        }
    }
}



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

using namespace std;


int main() {
    string s;
    cin >> s;
    int counter = 0;
    int n = s.size();
    for(int i = 0; i < n; i++) {
        if(s[i] == 'o') {
            counter++;
        }
    }
    int rest = 15- n;
    counter += rest;
    if(counter >= 8) {
        puts("YES");
    } else {
        puts("NO");
    }
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector <int> A(N);
  
  for (int i = 0 ;i < N ;i++) {
   
    cin >> A.at(i) ;
  }

  int count = 1;
    
      for (int i = 0; i < N ; i++) {
       
        count = A.at(count-1);
        
        if( count == 2){
          cout << i + 1 << endl;
           break;
        }
      }
         if ( count != 2){
          
          cout << -1 << endl;
          
         }
        }


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
const ll INF = 1LL<<61;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
  if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
  }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  string s;
  int k;
  cin >> s >> k;
  int n=s.size();

  vector<string> p;
  rep(i,n){
    p.pb(s.substr(i,1));
    if(i+1<n) p.pb(s.substr(i,2));
    if(i+2<n) p.pb(s.substr(i,3));
    if(i+3<n) p.pb(s.substr(i,4));
    if(i+4<n) p.pb(s.substr(i,5));
  }

  sort(all(p));

  if(k==1) {
    cout << p[0] << endl;
    return 0;
  }

  ll now=1;
  repo(i,p.size()){
    if(p[i]!=p[i-1]) now++;
    if(now==k) {
      cout << p[i] << endl;
      return 0;
    }
  }

}


Measured memory_bytes: 1660
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <cassert>
#include <iomanip>

using namespace std;

#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
typedef complex<int> P;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tii;
const double EPS = 1e-10;
const double PI = acos(-1.0);


const int pena = 20;

struct st{
	int id;
	int ac;	//
	int t;	//
	vector<int> ac_t;
	vector<int> wa_cnt;

	st(int p){
		ac = 0; t = 0;	//
		ac_t = vector<int>(p, -1);
		wa_cnt.resize(p);
	}
	bool operator<(const st& o) const{
		return (*this).ac == o.ac ? (*this).t > o.t : (*this).ac < o.ac;
	}
	bool operator==(const st& o) const{
		return (*this).ac == o.ac && (*this).t == o.t;
	}
	bool operator!=(const st& o) const{
		return !((*this) == o);
	}

	void calc(){
		for(int i=0;i<ac_t.size();++i){
			if(ac_t[i] == -1) continue;
			++ac;
			t += ac_t[i] + wa_cnt[i] * pena;
		}
	}
};

void debug(vector<st> team){
	for(auto& o : team){
		cerr<< o.id<< " : ";
		cerr<< o.ac<< " "<< o.t;
		cerr<< " , ";
		for(auto& p : o.ac_t) cerr<< " "<< p;
		cerr<< " , ";
		for(auto& p : o.wa_cnt) cerr<< " "<< p;
		cerr<< endl;
	}
}

bool solve(){
	int m, t, p, r;
	cin>> m>> t>> p>> r;
	if(!m && !t && !p && !r) return false;
	vector<st> team(t, st(p));
	for(int i=0;i<t;++i) team[i].id = i + 1;

	for(int i=0;i<r;++i){
		int m, t, p, j;
		cin>> m>> t>> p>> j;
		--t; --p;
		if(j == 0){
			team[t].ac_t[p] = m;
		}else{
			++team[t].wa_cnt[p];
		}
	}

	//debug(team);
	for(auto& o : team) o.calc();
	sort(rall(team));
	//debug(team);

	for(int i=0;i<team.size();++i){
		if(i) cout<< ",";
		vector<int> tmp;
		tmp.push_back(team[i].id);
		for(int j=i+1;j<team.size();++j){
			if(team[i] != team[j]) break;
			tmp.push_back(team[j].id);
		}
		sort(rall(tmp));
		for(int j=0;j<tmp.size();++j){
			if(j) cout<< "=";
			cout<< tmp[j];
		}
		i += tmp.size() - 1;
	}
	cout<< endl;

	return true;
}

int main(){
	cout.setf(ios::fixed); cout.precision(10);
	while(solve());
	return 0;
}

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

int main(){
    int n,k;cin >> n >> k;
    vector<int> p(n),c(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> c[i];
    rep(i,n) p[i]--;
    
    ll ans = -1e18;
    rep(vi,n){
        vector<int> s;
        int v = vi;
        ll total = 0;
        while(true){
            v = p[v];
            total += c[v];
            s.push_back(c[v]);
            if(v == vi) break;
        }
        int l = s.size();
        //rep(i,l) cout << s[i] << endl;
        ll sum = 0;
        rep(i,l){
            sum += s[i];
            if(i+1>k) break;
            if(total > 0){
                ll e = (k-i-1)/l;
                ans = max(ans,sum+total*e);
            }else ans = max(ans,sum);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>
#define REP(i,k,n) for(int(i)=(k);(i)<(n);++(i))
using namespace std;

int main()
{
  int count[26];
  REP(i,0,26) count[i] = 0;

  string S;
  cin >> S;
  REP(i,0, S.length()) {
    int x = S[i] - 'a';
    count[x] += 1;
  }

  // 1つでも2回以上現れていたら、false
  bool flag = true;
  REP(i,0,26) {
    if (count[i] >= 2) {
      flag = false;
      break;
    }
  }

  string ans = flag ? "yes" : "no";
  cout << ans << endl;

  return 0;
}


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

int H, W; 
vector<string> A;
bool ans;

void dfs(int h, int w, vector<vector<bool>> reach){
    reach[h][w] = true;

    int dh[2] = {0,1};
    int dw[2] = {1,0};
    for(int i=0; i<2; i++){
        int nh = h + dh[i];
        int nw = w + dw[i];
        if(0 <= nh && nh < H && 0 <= nw && nw < W && A[nh][nw] == '#'){
            dfs(nh,nw,reach);
        }
    }

    if(h == H-1 && w == W-1){
        for(int i=0; i<H; i++) for(int j=0; j<W; j++){
            if(!reach[i][j] && A[i][j] == '#') return;
        }
        ans = true;
    }
}

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

    vector<vector<bool>> reach;
    reach = vector<vector<bool>>(H, vector<bool>(W,false));
    reach[0][0] = true;

    ans = false;
    dfs(0,0,reach);

    if(ans) cout << "Possible" << endl;
    else cout << "Impossible" << endl;
}


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

struct node {
  struct node *right;
  struct node *left;
  struct node *p;
  int key;
};
typedef struct node *Node;
Node root;

void insert(int k) {
  Node x = root;
  Node y = NULL;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->right = NULL;
  z->left = NULL;

  while (x != NULL) {
    y = x;
    if (z->key < x->key) x = x->left;
    else x = x->right;
  }
  z->p = y;

  if (y == NULL) root = z;
  else if (z->key < y->key) y->left = z;
  else y->right = z;
}

void preorder(Node n) {
  if (n == NULL) return;
  printf(" %d", n->key);
  preorder(n->left);
  preorder(n->right);
}

void inorder(Node n) {
  if (n == NULL) return;
  inorder(n->left);
  printf(" %d", n->key);
  inorder(n->right);
}

int searchTree(Node n, int k) {
  if (n->key == k) return 1;
  if (n->right == NULL && n->left == NULL) return 0;
  searchTree(n->right, k);
  searchTree(n->left, k);
}

int main() {
  int n, i, k;
  char str[10];
  Node z;

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s %d\n", str, &k);
    if (str[0] == 'p') {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if (str[0] == 'f') {
      if (searchTree(root, k) == 1) printf("yes\n");
      else printf("no\n");
    } else {
      insert(k);
    }
  }

  return 0;
}

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

int main(){
    int N;
    cin >> N;
    long long ans,cnt=2;
    ans=1;
    if(N==1)
    cout << ans << endl;
    else{
        for(int i=1;i<N;i++){
            ans+=cnt;
            cnt=ans-cnt;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
n=gets.to_i
def cal(n,bits)
  return bits if n==0
  if (n%2).zero?
    bits.push("0")
  else
    bits.push("1")
  end
  n/=-2
  return cal(n,bits)
end
if n==0
  puts "0"
else
list=cal(n*-1,[])
list.reverse!
puts list.join("")
end


Measured memory_bytes: 3836
import java.util.Scanner;

public class Main {
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K=sc.nextInt();
		int ki[]=new int[]{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};
		System.out.println(ki[K-1]);

	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <math.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <map>
//#include <unordered_map>
using namespace std;
const int Size=1024;
const int mod2=998244353;
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
//std::ios::sync_with_stdio(false);
#define LINF 0x3f3f3f3f3f3f3f3f
typedef long long ll;
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lson  p<<1
#define rson  p<<1|1
#define pb  push_back
#define pii pair<int,int>
#define pII pair<int,pii>
#define pll pair<ll,ll>
#define se second
#define fi first
/*    */

const int maxn=1e6+15;
const int base=307;


int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a==b&&a!=c) printf("Yes\n");
    else if(a==c&&a!=b) printf("Yes\n");
    else if(c==b&&a!=c) printf("Yes\n");
    else printf("No\n");
    return 0;
}



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

int main()
{
  ll K, S;cin>>K>>S;
  ll ans = 0;

  rep(x, K+1) {
    rep(y, K+1) {
      int z = S-(x+y);
      if (z <= K && z >= 0) {
        if(x+y+z == S) {
          ans ++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<queue>
#include<string>
using namespace std;
using ll = long long;


int main(){
    ll n;
    cin >> n;
    ll temp=0,ans=0;
    for(ll i=0;i<n;i++){
        ll a;
        cin >> a;
        ans += (a+temp)/2;
        if(a+temp<2){
            temp=0;
        }
        else{
            temp = (a+temp)%2;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
    	int N;
    	long[] amount;
    	
        void solve(InputReader in, PrintWriter out) {
        	N = in.nextInt();
        	amount = in.nextLongArray(N);
        	
        	long ans = 0;
        	
        	for (int i = 0; i < N - 1; ++i) {
        		if (amount[i] % 2 == 1 && amount[i + 1] > 0) {
        			amount[i]--;
        			amount[i + 1]++;
        		}
        	}
        	
        	for (int i = 0; i < N; ++i) {
        		ans += amount[i]/2;
        		amount[i] %= 2;
        	}
        	
        	out.println(ans);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int size) {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        long[] nextLongArray(int size) {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }
    }
}


Measured memory_bytes: 37288
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	vector<int> v(N);
	for (int i = 0; i < N; i++) {
		cin >> v.at(i);
	}
	sort(v.begin(), v.end());

	cout << abs(v.back() - v.front()) << endl;
}

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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e1 + 5);

int n, m;

map<int, set<int>> mp;

int p[MAX_N];

int ans = 0;

int main(void) {
  // Here your code !
  scanf("%d %d", &n, &m);

  for (int i = 0; i < m; ++i) {
    int k;
    scanf("%d", &k);
    for (int j = 0; j < k; ++j) {
      int s;
      scanf("%d", &s);

      mp[i].insert(s);
    }
  }

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

  for (int i = 0; i < 1 << n; ++i) {
    map<int, int> switch_cnt;

    for (int j = 0; j < m; ++j) {
      switch_cnt[j] = 0;
    }

    for (int j = 0; j < n; ++j) {
      if (i >> j & 1) {
        for (auto e: mp) {
          if (e.second.find(j + 1) != e.second.end()) {
            switch_cnt[e.first] += 1;
          }
        }
      }
    }

    int cur_cnt = 0;
    for (auto e: switch_cnt) {
      if (e.second % 2 == p[e.first]) cur_cnt += 1;
    }

    ans += (cur_cnt == m) ? 1 : 0;
  }

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

  return 0;
}


Measured memory_bytes: 256
n, m = map(int,input().split())
grid = []
for i in range(m):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
plist = list(map(int, input().split()))


checklist = [ [int((format(i, 'b').zfill(n))[j]) for j in range(n)] for i in range(2**n)]
answer = 0

for i in range(2**n):
    light = checklist[i]
    cpoint = 0
    for j in range(m):
        switches = grid[j][1:]
        point = 0
        for k in range(len(switches)):
            point += light[switches[k]-1]
        if point % 2 == plist[j]:
            cpoint += 1
    if cpoint == m:
        answer += 1

print(answer)

Measured memory_bytes: 3316
import collections

N = int(input())

S = []
for i in range(0, N):
    S.append(input())

c = collections.Counter(S)
max = max(c.values())
answerlist = [key for key, v in c.items() if v == max]
answerlist.sort()
for answer in answerlist:
    print(answer)


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

int main() {
    vector<int> A(5);
    int B = 10;
    for (int i = 0; i < 5; i++) {
        cin >> A[i];
        if (A[i] % 10 != 0) B = min(B, A[i] % 10);
    }

    int ans = 0;
    for (int i = 0; i < 5; i++) {
        ans += (A[i] + 9) / 10 * 10;
    }
    cout << ans - 10 + B << endl;
}

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    
    int a,z;
    bool b = false;
    for(int i = 0; i < n; i++){
        if(s[i] == 'A'&&!b){
            a = i;
            b = true;
        }
        if(s[i] == 'Z'){
            z = i;
        }
    }
    
    cout << z - a + 1;
    
}



Measured memory_bytes: 640