akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		list.add(-1);
		list.add(Integer.MAX_VALUE);
		for (int i = 0; i < n; i++) {
		    int x = sc.nextInt();
		    int left = 0;
		    int right = list.size() - 1;
		    while (right - left > 1) {
		        int m = (left + right) / 2;
		        if (list.get(m) >= x) {
		            right = m;
		        } else {
		            left = m;
		        }
		    }
		    if (left == 0) {
		        list.add(1, x);
		    } else {
		        list.remove(left);
		        list.add(left, x);
		    }
		}
		System.out.println(list.size() - 2);
   }
}


Measured memory_bytes: 52508
#!/usr/bin/env pypy3
import sys
sys.setrecursionlimit(15000)
k,n = map(int,input().split())
a = list(map(int,input().split()))
d = [a[i]-a[i-1] for i in range(1,n)]+[a[0]+k-a[-1]]
#print(d)
m = max(d)
s = sum(d)
print(s-m)

Measured memory_bytes: 90572
object Main extends App {
  val s = io.StdIn.readLine
  if (s == s.reverse
      && s.substring(0, (s.length - 1) / 2) == s
        .substring(0, (s.length - 1) / 2)
        .reverse
      && s.substring((s.length + 2) / 2) == s
        .substring((s.length + 2) / 2)
        .reverse) println("Yes")
  else println("No")
}


Measured memory_bytes: 25424
/*
  Author: Hamza Hasbi
*/
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define uld unsigned long double
#define ui unsigned int
#define ud unsigned double
#define uf unsigned float
#define pi 2*acos(0.0)
#define module cin.ignore()
#define rep(i,l,r) for(auto i=l;i<=r;i++)
#define range(x,y) for(auto x:y)
//inline long long lcm(ll a,ll b) {return a*b/__gcd(a,b);}
//inline long long gcd(ll a,ll b) {return 1LL*b == 0 ? a : gcd(1LL*b, a*1LL % b*1LL);}
using namespace std;
int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    int a, b, c, x, y;
    cin >> a >> b >> c >> x >> y;
    int ans = 0;
    int curr = min(x, y);

    if(a + b <= 2 * c) {
      ans += curr * (a);
      ans += curr * (b);
      x -= curr;
      y -= curr;
    }
    else {
      ans += 2 * curr * c;
      x -= curr;
      y -= curr;
    }

    ans += min(2 * c, a) * x;
    ans += min(2 * c, b) * y;

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


Measured memory_bytes: 256
n,x,m=map(int,input().split())
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
  t+=1
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
T=t+1-l[x]
S=s[p]+x-s[x]
print(S*((n-l[x])//T)+s[l.index(l[x]+(n-l[x])%T)])

Measured memory_bytes: 14120
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
#include<deque>
#include<iomanip>
#include <random>

using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(g);(i)--)
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef deque<ll> dll;
ll mod = 1e9 + 7;


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

	int a, b, c;
	cin >> a >> b >> c;
	cout << (a + b)*c / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;
string s;
int dp[2][200002];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> s;
    int n = s.length();
    for(int i=0;i<n;i++)
    {
        dp[0][i] = dp[1][i] = -1e9;
        if(i == 0) dp[0][0] = 1;
        else
        {
            if(s[i-1] != s[i]) dp[0][i] = max(dp[0][i], 1 + dp[0][i-1]);
            if(i-1 >= 1) dp[0][i] = max(dp[0][i], 1 + dp[1][i-1]);
        }
        if(i == 0) dp[1][0] = -1e9;
        else if(i == 1) dp[1][1] = 1;
        else
        {
            dp[1][i] = 1 + dp[0][i-2];
            if(i >= 3 && (s[i] != s[i-2] || s[i-1] != s[i-3]))
            {
                dp[1][i] = max(dp[1][i], 1 + dp[1][i-2]);
            }
        }
        //cout << dp[0][i] << ' ' << dp[1][i] << '\n';
    }
    cout << max(dp[1][n-1], dp[0][n-1]);
}

Measured memory_bytes: 2196
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;}


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

int N; cin >> N;

bool ok = false;

while(N){
    if (N % 10 == 7) {
        ok = true;
        break;
    }
    N /= 10;
}


if (ok) cout << "Yes\n";
else cout << "No\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public long MOD = 1000000007;

        public void Run()
        {
            N = Input.ReadInt();
            Data[] D = new  Data[N];
            for (int i = 0; i < N; i++)
            {
                var line = Console.ReadLine().Split();
                string s = line[0];
                int x = int.Parse(line[1]);
                D[i] = new Data(i, s, x);
            }

            Array.Sort(D, Data.CompareTo);

            for (int i = 0; i < N; i++)
            {
                Console.WriteLine(D[i].i + 1);
            }
        }
    }

    // libs ----------
    // 比較のみ
    class Data
    {
        public int i;
        public string s;
        public int x;

        public Data(int i, string s, int x)
        {
            this.i = i;
            this.s = s;
            this.x = x;
        }

        // SortするときのComparerは明示的に指定する
        public static int CompareTo(Data d1, Data d2)
        {
            int result = d1.s.CompareTo(d2.s);
            if (result == 0)
                result = d1.x.CompareTo(d2.x) * (-1);
            return result;
        }
    }

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 11476
def main():
    N, K = map(int, input().split())
    R, S, P = map(int, input().split())
    T = input()
    T_ = [True for _ in range(N)]

    def play(com, player):
        if com == 'r' and player == 'p':
            return P
        elif com == 's' and player == 'r':
            return R
        elif com == 'p' and player == 's':
            return S
        else:
            return 0

    score = 0
    for n in range(N):
        if n < K:
            score += max(play(T[n], 'r'), play(T[n], 's'), play(T[n], 'p'))
        else:
            if T[n - K] == T[n] and T_[n - K]:
                score += 0
                T_[n] = False
            else:
                score += max(play(T[n], 'r'), play(T[n], 's'), play(T[n], 'p'))

    print(score)


main()


Measured memory_bytes: 4212
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(0)->sync_with_stdio(false);

	int n; cin >> n;
	string s; cin >> s;
	map<char, int> c;
	REP(i, n)
		c[s[i]]++;
	ll res = 1;
	for (auto x : c) {
		res *= x.second + 1;
		res %= MOD;
	}
	cout << res - 1 << '\n';
    return 0;
}


Measured memory_bytes: 3748
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
using namespace std;

int N,M;

struct Info{
	char from[9],to[9];
	int rank;
	bool erased;
};

struct Data{
	char from[9],to[9],message[51];
};

bool strCmp(char* base, char* comp){
	int length1 = 0,length2 = 0;
	for(int i=0;base[i] != '\0'; i++)length1++;
	for(int i=0;comp[i] != '\0'; i++)length2++;
	if(length1 != length2)return false;

	for(int i=0;base[i] != '\0'; i++){
		if(base[i] != comp[i])return false;
	}
	return true;
}


bool ambiguousCmp(char* base, char* comp){

	bool FLG = true;
	for(int i=0;base[i] != '\0'; i++){
		if(base[i] != comp[i]){
			if(base[i] == '?'){
				//Do nothing
			}else{
				FLG = false;
				break;
			}
		}
	}
	if(FLG)return true;
	else{
		return false;
	}
}

void strcpy(char* to,char* str){
	for(int i=0;str[i] != '\0';i++){
		to[i] = str[i];
		to[i+1] = '\0';
	}
}

void func(){

	int ok_index = 0,not_index = 0;
	Info OK[N],NOT[N];
	for(int i = 0; i < N; i++){
		OK[i].erased = false;
		NOT[i].erased = false;
	}

	char buf[10],from[9],to[9];
	bool FLG;

	for(int i = 0; i < N; i++){
		scanf("%s %s %s",buf,from,to);
		if(buf[0] == 'p'){

			strcpy(OK[ok_index].from,from);
			strcpy(OK[ok_index].to,to);
			OK[ok_index].rank = i;
			ok_index++;
		}else{

			strcpy(NOT[not_index].from,from);
			strcpy(NOT[not_index].to,to);
			NOT[not_index].rank = i;
			not_index++;
		}
	}

	for(int i = not_index -1; i >= 0; i--){
		for(int k = ok_index-1; k >= 0; k--){
			if(NOT[i].rank < OK[k].rank || OK[k].erased == true)continue;

			if(strCmp(NOT[i].from,OK[k].from) == true && strCmp(NOT[i].to,OK[k].to) == true){
				OK[k].erased = true;
			}
		}
	}

	for(int i = ok_index -1; i >= 0; i--){
		for(int k = not_index-1; k >= 0; k--){
			if(OK[i].rank < NOT[k].rank || NOT[k].erased == true)continue;

			if(strCmp(OK[i].from,NOT[k].from) == true && strCmp(OK[i].to,NOT[k].to) == true){
				NOT[k].erased = true;
			}
		}
	}


	queue<Data> Q;

	for(int loop = 0; loop < M; loop++){
		Data data;

		scanf("%s %s %s",data.from,data.to,data.message);

		FLG = false;

		for(int i = 0; i < ok_index; i++){
			if(OK[i].erased == true)continue;
			if(ambiguousCmp(OK[i].from,data.from) == true &&  ambiguousCmp(OK[i].to,data.to) == true){
				FLG = true;
				break;
			}
		}

		if(!FLG)continue;

		FLG = true;

		for(int i = 0; i < not_index; i++){
			if(NOT[i].erased == true)continue;
			if(ambiguousCmp(NOT[i].from,data.from) == true &&  ambiguousCmp(NOT[i].to,data.to) == true){
				FLG = false;
				break;
			}
		}

		if(FLG){
			Q.push(data);
		}
	}

	printf("%d\n",Q.size());

	while(!Q.empty()){
		printf("%s %s %s\n",Q.front().from,Q.front().to,Q.front().message);
		Q.pop();
	}

}

int main(){

	while(true){
		scanf("%d %d",&N,&M);
		if(N == 0 && M == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 2724
s = input()

arr = list(s)

alp = [chr(ord('a') + i) for i in range(26)]

for i in range(len(arr)):
    if arr[i] in alp:
        alp.remove(arr[i])

if len(alp) > 0:
    print(alp[0])
else:
    print('None')

Measured memory_bytes: 3956
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <climits>
#include <tuple>
#include <unordered_map>

using namespace std;

typedef long long ll;

int main(void) {
  int A, B, K; cin >> A >> B >> K;
  vector<int> dA, dB;
  for (int i = 1; i <= A; i++) { if (A % i == 0) dA.push_back(i); }
  for (int i = 1; i <= B; i++) { if (B % i == 0) dB.push_back(i); }

  // for (auto a : dA) { cout << a << " "; } cout << endl;
  // for (auto b : dB) { cout << b << " "; } cout << endl;

  vector<int> dAB;
  for (int i = 0; i < dA.size(); i++) {
    if (find(dB.begin(), dB.end(), dA[i]) != dB.end())
      dAB.push_back(dA[i]);
  }
  // for (auto ab : dAB) { cout << ab << " "; } cout << endl;
  cout << dAB[dAB.size() - K] << endl;
}


Measured memory_bytes: 256
from operator import itemgetter

N = int(input())
X=[]
ans=0
for i in range(N):
    H = list(map(int, input().split()))
    O=[]
    O.append(H[0]-H[1])
    O.append(H[0]+H[1])
    X.append(O)
#print(X)
X=sorted(X, key=itemgetter(1))
S=X[0][1]
ans+=1
for i in range(len(X)):
    if(X[i][0]>=S):
        ans+=1
        S=X[i][1]
"""
while(len(X)>0):
    #print(X)
    ans+=1
    S=X[0][1]
    X.remove(X[0])
    I = []
    for i in range(len(X)):
        if(X[i][0]>=S):
            I.append(X[i])
    X=I
    #print(I)
"""


print(ans)


Measured memory_bytes: 29924
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;

ll dp[2002][2002];
ll n,d,x;

ll mod_pow(ll x,ll n){
	ll res=1;
	while(n>0){
		if(n&1LL)res=res*x%MOD;
		x=x*x%MOD;
		n>>=1;
	}
	return res;
}

int main(void){
	while(1){
		scanf("%lld %lld %lld",&n,&d,&x);
		if(n+d+x==0LL)break;
		memset(dp,0,sizeof(dp));
		dp[0][0]=1;
		for(int i=0;i<n;i++){
			for(int j=1;j<=n;j++){
				dp[i+1][j]=(dp[i+1][j-1]+dp[i][j-1])%MOD;
				if(j>=x)dp[i+1][j]=(dp[i+1][j]+MOD-dp[i][j-x])%MOD;
			}
		}
		ll res=0;
		for(ll i=1;i<=min(n,d);i++){
			ll cnt=1;
			for(ll j=0;j<i;j++){
				ll g=(d-j)%MOD;
				g=g*mod_pow(i-j,MOD-2LL)%MOD;
				cnt=cnt*g%MOD;
			}
			res=(res+cnt*dp[i][n])%MOD;
		}
		printf("%lld\n",res);
	}
	return 0;
}

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

constexpr ll INF = ll(1e+18) + 1;

int main() {
    int H1, M1, H2, M2, K;

    cin >> H1>> M1>> H2>> M2>> K;

    cout << (H2*60 + M2) - (H1*60 + M1) - K << endl;
}


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

struct P2
{
int a;
int b;

	bool operator < ( const P2 &P ) const
	{
		return ( a < P.a );
	}
};

vector<P2> X( 100000 );

int main()
{
int i;
int N;
int a;
int b;
long long K;
long long c;

	cin >> N;
	cin >> K;

	for( i = 0; i < N; i++ )
	{
		cin >> X[ i ].a;
		cin >> X[ i ].b;
	}

	sort( &X[ 0 ], &X[ 0 ] + N );

	i = - 1;
	c = K;
	while( c > 0 )
	{
		i++;
		c -= X[ i ].b;
	}

	cout << X[ i ].a << endl;

	return 0;
}






Measured memory_bytes: 1024
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in = new Scanner(System.in);
		while(in.hasNext())
		{
			char a[]=in.next().toCharArray();
			if(a[0]=='#')
				return;
			int c=0;
			boolean s=false;
			boolean t=false;
			for(int i=0;i<a.length;i++)
			{
				if(a[i]=='q'||a[i]=='w'||a[i]=='e'||a[i]=='r'||a[i]=='t'||
						a[i]=='a'||a[i]=='s'||a[i]=='d'||a[i]=='f'||a[i]=='g'||
						a[i]=='z'||a[i]=='x'||a[i]=='c'||a[i]=='v'||a[i]=='b')
				{
					t=true;
					if(s&&t)
						c++;
					s=false;
				}
				else if(a[i]=='y'||a[i]=='u'||a[i]=='i'||a[i]=='o'||a[i]=='p'||
						a[i]=='h'||a[i]=='j'||a[i]=='k'||a[i]=='l'||
						a[i]=='n'||a[i]=='m')
				{
					s=true;
					if(s&&t)
						c++;
					t=false;
				}
			}
			System.out.println(c);
		}
	}
}

Measured memory_bytes: 12000
//--- pC ---//
import java.util.*;
import java.lang.*;
import java.io.*;
public class Main {
	public static void main (String[] args) throws java.lang.Exception {
		new Solution();
	}
}
class Solution {
	Reader reader;
	PrintWriter out;
	public Solution() {
		reader = new Reader();
		out = new PrintWriter(System.out);
		while (reader.hasNext()) {
			run_case();
		}
		out.flush();
	}

	private void run_case() {
		int n = reader.ni();
		Set<String> set = new HashSet<>();
		for (int i=0; i<n; i++) set.add(reader.ns());
		out.println(set.size());
		return;
	}
}


class Reader {
	BufferedReader br;
	StringTokenizer st;
	public Reader(){
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public String next() {
		if (st.hasMoreTokens()) return st.nextToken();
		try {
			st = new StringTokenizer(br.readLine());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return st.nextToken();
	}
	public boolean hasNext() {
		try {
			if (!st.hasMoreTokens() && !br.ready()) return false;
			else return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	public int ni() {return Integer.parseInt(this.next());}
	public long nl() {return Long.parseLong(this.next());}
	public String ns() {return this.next();}
}


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

using namespace std;

int main()
{
    string line;

    cin >> line; long long cnt = 0;

    char c = line[0];
    for(int i = 0; i < line.size(); i++)
     {
       if( c != line[i])
        {
            cnt++;
            c = line[i];
        }
     }
     
    cout << cnt << endl;
    return 0;

}


Measured memory_bytes: 512
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N,K;
  cin>>N>>K;
  int ans=0;
  REP(i,N){
    int x;
    cin>>x;
    ans+=min(K-x,x);
  }
  cout<<ans*2<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype

template <class T>
int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

template <class T> void max_swap(T& a, const T b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


void hoge()
{
	int a[10];
	for (int i = 0; i < 10; ++i)
		scanf("%d", a + i);
	sort(a, a + 10);
	printf("%d", accumulate(a + 7, a + 10, 0));
}
int main()
{
	hoge();
	putchar(' ');
	hoge();
	putchar('\n');
}

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

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

int N, M, Q, A[10], a[50], b[50], c[50], d[50], ans;

void dfs(int n) {
    if (n == N) {
        int res = 0;
        rep(i, Q) {
            if (A[b[i]] - A[a[i]] == c[i]) res += d[i];
        }
        chmax(ans, res);
        return;
    }

    int s = n == 0? 0 : A[n-1];
    for (int i = s; i < M; ++i) {
        A[n] = i;
        dfs(n+1);
    }
}

int main(){
    cin >> N >> M >> Q;
    rep(i, Q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--, b[i]--;
    }

    dfs(0);
    cout << ans << endl;
}

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

int main() {
    string S;
    cin >> S;
    for (int i = 0; i < S.size(); i++){
        if (i % 2 == 0){
            if (S.at(i) == 'L') {
            cout << "No" << endl;
            return 0;
            }   
        }
        else {
            if (S.at(i) == 'R') {
            cout << "No" << endl;
            return 0;
            }   
        }
        if (i == S.size() - 1){
            cout << "Yes" << endl;
        }
    }
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Debug = System.Diagnostics.Debug;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;
using StructLayoutAttribute = System.Runtime.InteropServices.StructLayoutAttribute;
using FieldOffsetAttribute = System.Runtime.InteropServices.FieldOffsetAttribute;

static class P
{
    static void Main()
    {
        var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
        if (ab[0] <= 5)
        {
            Console.WriteLine(0);
            return;
        }
        if (ab[0] <= 12)
        {
            Console.WriteLine(ab[1] / 2);
            return;
        }
        Console.WriteLine(ab[1]);
    }
}


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

int main() {
  string S;
  cin >> S;
  for (int i{1}; i < S.length(); ++i) {
    if (S[i] == S[i - 1]) {
      cout << "Bad" << endl;
      return 0;
    }
  }

  cout << "Good" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool seen[100010];
vector<int> adj[100010];
int n;
int dfs(int a)
{
	seen[a] = 1;
	int winner = 0;
	for (auto b : adj[a])
	{
		if (!seen[b]) winner ^= (dfs(b)+1);
	}
	return winner;
}
int main()
{
	scanf("%d", &n);
	for (int i = 1; i < n; i++)
	{
		int a, b;
		scanf("%d%d", &a, &b);
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	int res = dfs(1);
	if (res) printf("Alice\n");
	else printf("Bob\n");
}

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

#define SZ(x) (((int)x.size()))
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

using namespace std;

int x;

int main()
{
	cin >> x;
	cout << (x / 500) * 1000 + (x % 500) / 5 * 5;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
const int N = 1e5 + 5;
#define int long long int
 
int32_t main() {
    IOS ;
    int n, x, y, z ; cin >> n ; int dp[n][3] ; 
    cin >> x >> y >> z ; 
    dp[0][0] = x, dp[0][1] = y, dp[0][2] = z ; 
    for(int i=1; i<n; i++) {
        cin >> x >> y >> z ;
        dp[i][0] = x + max(dp[i-1][1], dp[i-1][2]) ;
        dp[i][1] = y + max(dp[i-1][0], dp[i-1][2]) ;
        dp[i][2] = z + max(dp[i-1][0], dp[i-1][1]) ;
    }

    cout << max({dp[n-1][0], dp[n-1][1], dp[n-1][2]}) ; 

    return 0 ;
}

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

using namespace std;
using ll=long long;

void solve() {
    int n; cin >> n;
    ll A,B,C = 0;
    cin >> A >> B;
    for (int i = 3; i <= n; i++) {
        ll x; cin >> x;
        C ^= x;
    }
    ll S = A + B;
    if (S<C || ((S-C)&1)) {
        cout << -1; return;
    }
    ll D = (S-C)/2;
    if (D&C) {
        cout << -1; return;
    }
    if (D > A) {
        cout << -1; return;
    }
    ll a = 0;
    for (int i = 60; i >= 0; i--) {
        if (C>>i&1) {
            if (a+(1ll<<i)+D <= A) a += 1ll<<i;
        }
    }
    ll res = A-D-a;
    if (res == A) {
        cout << -1; return;
    }
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
    double a,b;
    cin>>a>>b;
    for(double i=1; i<=10000000; i++){
        if(floor(i*0.08)==a && floor(i*0.1)==b){
            cout<<i<<endl;
            return 0;
        }
    }
    cout << "-1" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=b-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 3005;
double dp[N][N];

int main(){
	fast_io();
	int n;
	cout.precision(13);
	cin >> n;
	double d;
	cin >> d;
	dp[1][0] = 1-d;
	dp[1][1] = d;
	fu(i,2,n){
		cin >> d;
		fu(j,0,n){
			dp[i][j] = d * dp[i-1][j-1] + (1 - d) * dp[i-1][j];
		}
	}
	double ans = 0;
	fu(i,(n+1)/2,n){
		ans+=dp[n][i];	
	}
	cout << ans << '\n';
}


Measured memory_bytes: 70656
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<ctime>
const  int N = 3e5 + 5;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
typedef long long ll;
typedef long double lw;
#define  pa pair<int,int>
#define sc(n) scanf("%d",&n)
#define fo(i,a,b) for(int i=a;i<b;i++)
#define mem(a,b) memset(a,b,sizeof a)
using namespace std;
int n;
int main()
{
	int x, a;
	cin >> x >> a;
	if (x < a)
		puts("0");
	else
		puts("10");
	return 0;
}


Measured memory_bytes: 256
n=int(input())
l=[[0]]*n
for i in range(n):
  v=list(map(int,input().split()))
  l[i]=v
dp=l[0]
for m in l[1:]:
  a=max(m[0]+dp[1],m[0]+dp[2])
  b=max(m[1]+dp[0],m[1]+dp[2])
  c=max(m[2]+dp[1],m[2]+dp[0])
  dp=[a,b,c]
print(max(dp))
  
  
  

Measured memory_bytes: 31348
#include <cstdio>
#include <iostream>
#define mid ((L + R) >> 1)
using namespace std;

typedef long long LL;
const int N = 1e5 + 50;

int n, K;
LL a[N], L[N], R[N], dp[N];
int rt = 1, Sz = 1, B[N];
int lc[N << 6], rc[N << 6], tag[N << 6];

inline void Modify(int l, int r, int v, int &x = rt, int L = 0, int R = K - 1) {
  if (!x) {
    x = ++ Sz; tag[x] = 1e9;
  }
  if (l <= L && R <= r) return (void) (tag[x] = v);
  if (l <= mid) Modify(l, r, v, lc[x], L, mid);
  if (r > mid) Modify(l, r, v, rc[x], mid + 1, R);
}

inline int Query(int p, int x = rt, int L = 0, int R = K - 1) {
  if (!x) return (int)1e9;
  if (p <= mid) return min(tag[x], Query(p, lc[x], L, mid));
  if (p > mid) return min(tag[x], Query(p, rc[x], mid + 1, R));
}

template <typename T> inline void chkmin(T &x, T y) { if (x > y) x = y; }

int main() {
  tag[1] = 1e9;
  scanf("%d%d", &n, &K);
  for (int i = 1, x; i <= n; i ++) {
    scanf("%d%d", &x, &B[i]);
    a[i] = a[i - 1] + x;
    L[i] = - (a[i] << 1) + 1;
    R[i] = - (a[i - 1] << 1) - 1;
    if ((x << 1) > K && B[i] == 1) return 0 * puts("-1");
  }
  for (int i = n, l, r, nxt; i >= 1; i --) {
    l = L[i] % K; if (l < 0) l += K;
    r = R[i] % K; if (r < 0) r += K;
    nxt = Query((r + 1) % K);
    if (B[i] == 1) {
      if (l <= r) Modify(l, r, i);
      else {
        Modify(0, r, i);
        Modify(l, K - 1, i);
      }
    }
    if (nxt != 1e9) dp[i] = dp[nxt] + ((R[nxt] + 1 - (R[i] + 1)) % K + K) % K;
  }
  LL ans = 1e18;
  for (int i = 1, nxt; i <= n; i ++) {
    nxt = Query((L[i] % K - 1 + K + K) % K);
    if (nxt != 1e9) chkmin(ans, dp[nxt] + ((R[nxt] + 1 - (L[i] - 1)) % K + K) % K);
    else ans = 0;
    nxt = Query((R[i] % K + 1 + K) % K);
    if (nxt != 1e9) chkmin(ans, dp[nxt] + ((R[nxt] + 1 - (R[i] + 1)) % K + K) % K);
    else ans = 0;
  }
  printf("%lld\n", ans + a[n] + a[n]);
  return 0;
}


Measured memory_bytes: 39936
#include <iostream>
using namespace std;
char c[] = {'A', 'C', 'G', 'T'};

int main() {
    string s; cin >> s;
    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
        int cnt = 0;
        for (int j = i; j < s.size(); j++) {
            int flag = 0;
            for (int k = 0; k < 4; k++) {
                if (s[j] == c[k]) flag = 1;
            }
            if (flag) cnt++;
            else break;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())


def solve1(n: int) -> str:
    k = 0
    for i in range(len(n)):
        k += int(n[i])

    if k % 9 == 0:
        return "Yes"
    else:
        return "No"


def solve2(n: int) -> str:
    if n % 9 == 0:
        return "Yes"
    else:
        return "No"


print(solve2(n))


Measured memory_bytes: 9152
import math
N = int(input())
X = list(map(int, input().split()))
s = 0
t = 0

for x in X:
    s += x
    t += x ** 2

def check(k):
    return t - 2 * s * k + N * (k ** 2)

if check(math.floor(s / N)) < check(math.ceil(s / N)):
    print(check(math.floor(s / N)))
else:
    print(check(math.ceil(s / N)))

Measured memory_bytes: 3064
N,D=map(int,input().split())
X=[]
Y=[]
count=0
for i in range(N):
    Xi,Yi=map(int,input().split())
    X.append(Xi)
    Y.append(Yi)

for ll in range(N):
    if (X[ll]**2+Y[ll]**2<=D**2):
        count +=1

print(count)

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

string s;

int main() {
    cin >> s;
    if (s.length() % 2 != 0) {
        cout << "No\n";
        return 0;
    }
    bool works = true;
    for (int i=0; i<s.length(); i+=2) {
        if (s[i] != 'h' || s[i + 1] != 'i')
            works = false;
    }
    if (works)
        cout << "Yes\n";
    else
        cout << "No\n";
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
 
  public static void main(String args[]) {
   
    Scanner sc = new Scanner(System.in);
    int length = sc.nextInt();
    int[] data = new int[length];
    for (int a=0; a<length; a++) {
       data[a] = sc.nextInt();
    }
   
    int count = 0;
    int i = 0;
    int min = data[0];
    
    for (int b=0; b<length; b++) {
      i = data[b];
      
      if (min >= i) {
        count++;
        min = i;
      }
    }
    
    System.out.println(count);
   
 
    
  }
}

Measured memory_bytes: 60104
#include<iostream>
#include<math.h>
#define MAX 1000000
using namespace std;
int main(){
	bool p[MAX+1];
	int n,count;
	for(int i=2; i<=MAX; i++)
		p[i] = true;
	for(int i=2; i<=sqrt(MAX); i++){
		if(p[i] == true){
			for(int j=2*i; j<=MAX; j++){
				if(j%i == 0)
					p[j] = false;
			}
		}
	}
	while(cin >> n){
		count = 0;
		for(int i=0; i<=n; i++){
			if(p[i] == true)
				count++;
		}
		cout << count << endl;
	}
}

Measured memory_bytes: 1840
private class UnionFind(n: Int) {
    val parent = IntArray(n+1)
    val size = IntArray(n+1)

    init {
        repeat(n+1) {
            parent[it] = it
            size[it] = 1
        }
    }
    fun union(par: Int, chi: Int) {
        if (same(par, chi)) return
        val sz = size[root(chi)]
        parent[root(chi)] = par
        size[root(par)] += sz
    }
    fun root(r: Int): Int {
        if (r == parent[r]) return r
        val par = root(parent[r])
        parent[r] = par
        return par
    }
    fun same(a: Int, b: Int): Boolean {
        return root(a) == root(b)
    }
}

fun main(args: Array<String>) {
    val (n, m, k) = readLine()!!.split(' ').map { it.toInt() }

    val friend = IntArray(n)
    val block = IntArray(n)

    val uf = UnionFind(n)

    repeat(m) {
        val (a, b) = readLine()!!.split(' ').map { ab -> ab.toInt() }
        friend[a-1] += 1
        friend[b-1] += 1
        uf.union(a, b)
    }
    repeat(k) {
        val (c, d) = readLine()!!.split(' ').map { cd -> cd.toInt() }
        if (uf.same(c, d)) {
            block[c-1] += 1
            block[d-1] += 1
        }
    }


    val ans = arrayOfNulls<Int>(n)
    repeat(n) {
        ans[it] = uf.size[uf.root(it+1)]-friend[it]-block[it]-1
    }
    println(ans.joinToString(separator = " "))
}


Measured memory_bytes: 78060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  string s;
  cin >> s;
  int n = sz(s);

  string t = "ACGT";

  int ans = 0;
  bool acgt = false;
  rep(i,n) {
    if (t.find(s[i]) != string::npos) {
      int cnt = 0;
      while (i < n && t.find(s[i]) != string::npos) {
        cnt++;
        i++;
      }
      chmax(ans, cnt);
    }
  }

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

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<stdio.h>
#include<utility>
#include<queue>
#include<unordered_map>
#include<algorithm>
using namespace std;
string str[1000005];
char temp[1000005];
long long dir[5]={-1,0,1,0,-1};
unordered_map<long long,long long> dis;
queue<pair<long long,long long>> que;
long long ha(long long r,long long c){
	return r*1000000+c;
}
int main(){
	long long i,j,n,m,k,r,c,r2,c2;
	scanf("%lld%lld%lld%lld%lld%lld%lld",&n,&m,&k,&r,&c,&r2,&c2);
	for(i=0;i<n;i++){
		scanf(" %s",temp);
		str[i]=temp;
	}
	que.push({r-1,c-1});
	dis[ha(r-1,c-1)]=1;
	while(que.size()){
		auto z=que.front();
		que.pop();
		if(z.first==r2-1&&z.second==c2-1){
			printf("%lld\n",dis[ha(r2-1,c2-1)]-1);
			return 0;
		}
		for(i=0;i<4;i++){
			for(j=1;j<=k;j++){
				long long x=dir[i]*j+z.first,y=dir[i+1]*j+z.second;
				if(x<0||x>=n||y<0||y>=m||str[x][y]=='@')
					break;
				if(dis[ha(x,y)]==dis[ha(z.first,z.second)]+1)
					continue;
				if(dis[ha(x,y)])
					break;
				dis[ha(x,y)]=dis[ha(z.first,z.second)]+1;
				que.push({x,y});
			}
		}
	}
	puts("-1");
}

Measured memory_bytes: 64536
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define ms(s,x) memset(s,x,sizeof(s))
#define ls rt<<1
#define rs rt<<1|1
#define pb push_back
#define mp make_pair
#define inf 0x3f3f3f3f
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

const double PI = acos(-1.0);
const double eps = 1e-8;
const int MAXN = 5e5+5;
const ll MOD = 1e9+7;

int main()
{
    ll w, h;
    cin >> h >> w;
    if (h == 1 || w == 1){
        cout << "1\n";
        return 0;
    }
    ll ans = h * w;
    if (ans&1) ans = ans/2 + 1;
    else ans >>= 1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	
	public static void main(String[] args) throws IOException {
		try(final Scanner sc = new Scanner(System.in)){
			final int N = sc.nextInt();
			
			int limit = 3;
			final int A = sc.nextInt();
			final int B = sc.nextInt();
			final int C = sc.nextInt();
			
			int[] lens = new int[N];
			for(int i = 0; i < N; i++) {
				lens[i] = sc.nextInt();
			}
			
			int[] bit_lens = new int[1 << N];
			for(int bit = 0; bit < (1 << N); bit++) {
				for(int i = 0; i < N; i++) {
					if((bit & (1 << i)) != 0) {
						bit_lens[bit] += lens[i];
					}
				}
			}
			
			long answer = Integer.MAX_VALUE;
			
			for(int fst_bit = 1; fst_bit < (1 << N); fst_bit++) {
				final int fst = Math.abs(A - bit_lens[fst_bit]) + (Integer.bitCount(fst_bit) - 1) * 10;					
				
				for(int snd_bit = 1; snd_bit < (1 << N); snd_bit++) {
					if((fst_bit & snd_bit) != 0) { continue; }
					final int snd = Math.abs(B - bit_lens[snd_bit]) + (Integer.bitCount(snd_bit) - 1) * 10;					
					
					for(int thd_bit = 1; thd_bit < (1 << N); thd_bit++) {
						if((fst_bit & thd_bit) != 0) { continue; }
						if((snd_bit & thd_bit) != 0) { continue; }
						
						final int thd = Math.abs(C - bit_lens[thd_bit]) + (Integer.bitCount(thd_bit) - 1) * 10;
						
						answer = Math.min(answer, fst + snd + thd);
					}
				}
			}
			
			System.out.println(answer);
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

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

using namespace std;

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

	int n;
	cin >> n;
	vector<int> a(n, 1e9);
	for (int i = 0; i < n - 1; i++) {
		int x;
		cin >> x;
		for (int j = 0; j <= 1; j++) {
			a[i + j] = min(a[i + j], x);
		}
	}
	int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
	}
	cout << sum << '\n';

	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>

int main(void){
	std::string translated_data;
	std::getline(std::cin,translated_data);
	for(int i=0;i<translated_data.size();i++)
		translated_data[i]=toupper(translated_data[i]);
	std::cout<<translated_data<<std::endl;
	return 0;
}




Measured memory_bytes: 2988
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }

// const ll MAX_N = 500;
// const ll MAX_M = 2e2;
// const ll MAX_Q = 1e5;
// ll start[MAX_N+1]; // i 始発の電車の数
// ll end[MAX_N+1];   // i 終点の電車の数
// ll left[MAX_N+1]; // l-N区間に収まる電車の数

// // dp[L][R] L-R区間に収まる電車数
// ll dp[MAX_M+1][MAX_M+1]; 
// void rec(ll l, ll r){
// 	// if (l==0 & r==N-1) dp[l][r] = M; // 全区間->M本
// 	// else if (dp[l-1][r]!=-1) dp[l][r] = dp[l-1][r] - start_list[l-1];
// 	// else if (dp[l][r]!=-1) dp[l][r] = dp[l][r+1] - end_list[r+1];
// 	return;
// }

int main() {
	// 入力
	ll N,M,Q;
	cin >> N>>M>>Q;
	ll train[N+1][N+1] = {0}; // ２次元座標[始点][終点]
	REP(i,N){
		REP(j,N){
			train[i][j] = 0;
		}
	}
	ll s,e;
	for (ll i = 0; i < M; ++i){
		cin>>s>>e;
		s--;e--; // 0始まり
		train[s][e]++;
	}
	
	ll ruiseki[N+1][N+1] = {0}; // 累積和
	REP(i,N){
		REP(j,N){
			ruiseki[i][j] = 0;
		}
	}
	REP(i,N){
		REP(j,N){
			for (ll l = i; l <= j; ++l){
				for (ll r = l; r <= j; ++r){
					ruiseki[i][j] += train[l][r];
				}
			}
		}
	}
	ll p,q;
	for (ll i = 0; i < Q; ++i){
		cin>>p>>q;
		p--;q--;
		// printf("i: %lld, l: %lld, r: %lld ", i,p[i],q[i]);
		cout << ruiseki[p][q] << endl;
	}
}


Measured memory_bytes: 4864
#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--)

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


int main(int argc, const char * argv[]) {
    
    //Input
    int N, value, maximum, ans, tmp, minj;
    maximum = 0;
    scanf("%d", &N);
    
    int *array = NULL;
    array = (int*)malloc(sizeof(int) * N);
    
    REP(i, N){
        scanf("%d", &value);
        array[i] = value;
    }
    
    ans = 0;
    for(int i = 0; i < N; i++){
        minj = i;
        for(int j = i; j < N; j++){
            minj = array[j] < array[minj] ? j : minj;
        }
        if(i != minj){
            tmp = array[minj];
            array[minj] = array[i];
            array[i] = tmp;
            ans += 1;
        }
    }
    
    REP(i, N){
        printf("%d", array[i]);
        if(i != N-1){
            printf(" ");
        }
    }
    printf("\n");
    printf("%d\n", ans);
    
    
    
    return 0;
}

Measured memory_bytes: 1032
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from itertools import combinations

n = ni()

cnt = 2
nc2 = []

while cnt*(cnt-1)//2 <= 2*10**5:
    nc2.append(cnt*(cnt-1)//2)
    cnt += 1
    
sets = -1
if n in nc2:
    sets = nc2.index(n)+2
    
    
if sets == -1:
    print("No")

else:
    print("Yes")
    print(sets)
    anss = [[] for _ in range(sets)]
    combis = list(combinations(range(sets),2))
    
    for num, (i,j) in enumerate(combis):
        anss[i].append(num + 1)
        anss[j].append(num + 1)
        
    for ans in anss:
        print(len(ans), *ans)

Measured memory_bytes: 19824
n = int(input())
n = n % 10
if n == 2 or n == 4 or n == 5 or n == 9 or n == 7:
  print('hon')
elif n == 0 or n == 1 or n == 6 or n == 8:
  print('pon')
else:
  print('bon')

Measured memory_bytes: 9176
#include <stdio.h>

int main(void)
{
	int a, b, i;
	int max;
	int s[2];

	scanf("%d %d", &a, &b);
	
	s[0] = a * b;
	s[1] = a - b;
	max = a + b;

	//最大値を求める

	for (i = 0; i < 2; i++) {
		if (max < s[i]) {
			max = s[i];
		}
	}

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

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;

int main()
{
    unsigned long long a, b, x;
    cin >> a >> b >> x;
    unsigned long long ans ;
    if(a==0)
        ans = b / x + 1;
        else
            ans = b / x - (a - 1) / x;
        cout<< ans;

        return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = sum(map(int,input().split()))
c = list(map(int,input().split()))
for i in range(n-1):
    if (a[i] + 1) ==  a[i+1]:
        b += c[a[i]-1]
print(b)


Measured memory_bytes: 3064