akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define all(v) (v).begin(),(v).end()
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using int32 = int32_t; using str = string; using cstr = const str;
using ll = long long; using ull = unsigned long long; using cint = const int; using cll = const ll;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using psl = pair<string, ll>;
using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7;
static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
#define FASTCIN() cin.tie(0);ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
#define DEBUG_IMPORT(file) vs args(argv, argv+argc);str sample = make_sample(args, file);ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#else
#define DEBUG_IMPORT(file)
#endif
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}




int32 main(int32 argc, char* argv[]) {
    FASTCIN();
    DEBUG_IMPORT("sample-1");


    int D, G; cin>>D>>G;
    vi P(D), C(D); REP(i,D) cin>>P[i]>>C[i];

    int ans = INF;

    REP(p, 1<<D) {
        int ptn = p;  // コンプリートパターン
        int scr = 0;  // スコア
        int cnt = 0;  // 解いた問題数
        for(int i = D-1; i >= 0; i--) {  // 問題の難しさ
            if (ptn & 0b01) {  // 難しさ d 問題をすべて解く
                scr += (i+1) * 100 * P[i] + C[i];
                cnt += P[i];
                if (scr >= G) ans = min(ans, cnt);
            } else {  // 難しさ d 問題を [0, P[i]) 問解く
                for(int j = P[i]-1; j >= 0; j--) {
                    if (scr + (i+1) * 100 * j >= G) {
                        ans = min(ans, cnt + j);
                    } else {
                        break;
                    }
                }
            }
            ptn >>= 1;
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
c = 0
ans = 0
 
for i in range(0, n-1):
  if h[i] >= h[i+1]:
    c += 1
    if c > ans:
      ans = c
  else:
      c = 0
      
print(ans)

Measured memory_bytes: 15020
#include<stdio.h>

int main(void){
	int n;
	int a[100];
	int i,j;
	int box;
	int count=0;
	
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(i = 0;i < n-1;i++){
		for(j = 0;j < n-1-i;j++){
			if(a[j] > a[j+1]){
				box = a[j];
				a[j] = a[j+1];
				a[j+1] = box;
				count += 1;
			}
		}
	}
	
	for(i = 0;i < n;i++){
		if(i) printf(" ");
		printf("%d",a[i]);
	}
	
	printf("\n%d\n",count);
	return 0;
}

Measured memory_bytes: 1852
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    intmax_t N, A, B;
    intmax_t ans = 0;

    scanf("%jd%jd%jd", &N, &A, &B);

    ans = N * A < B ? N * A : B;

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

    return 0;
}


Measured memory_bytes: 128
N = int(input())
S = list(input())
r = []
g = []
b = []
s = len(S)
for i in range(s):
    if S[i] == 'R':
        r.append(i)
    elif S[i] == 'G':
        g.append(i)
    else:
        b.append(i)
lr = len(r)
lg = len(g)
lb = len(b)
cnt = lr * lg * lb
for i in range(lr):
    for j in range(lg):
        r0 = r[i]
        g0 = g[j]
        up = max(r0,g0)+abs(r0-g0)
        dw = min(r0,g0)-abs(r0-g0)
        if up < s and S[up] == 'B':
            cnt -= 1
        if dw >= 0 and S[dw] == 'B':
            cnt -= 1
        if abs(r0-g0)%2 == 0:
            half = min(r0,g0) + abs(r0-g0)//2
            if 0 <= half < s and S[half] == 'B':
                cnt -= 1
print(cnt)

Measured memory_bytes: 70756
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int k = scn.nextInt();
        int[] a = new int[n];

        for(int i=0;i<n;i++){
            a[i]=scn.nextInt();
        }

        for(int i=k;i<n;i++){
            if(a[i]>a[i-k]){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }
        }



        scn.close();

    }


}


Measured memory_bytes: 50504
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define N 1000000007
typedef long long ll;
#define all(v) (v).begin(),(v).end()
#define sz(x) int(x.size())
int main(){
	int n;
	cin>>n;
	vector<int> an(n);
	vector<int> bn(n);
	vector<int> cn(n);
	int c=0;
	ll sum=0;
	rep(i,n){
	cin>>an.at(i);
	}
	rep(i,n){
	cin>>bn.at(i);
	sum+=bn.at(i);
	}
	rep(i,n-1){
	cin>>cn.at(i);
	}
	rep(i,n-1){
		if((an.at(i)+1)==an.at(i+1)){
			sum+=cn.at(an.at(i)-1);
		}
	}
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
char a[110];
bool check(int l,int r){
    while(l<=r){
        if(a[l++]!=a[r--]){
            return 0;
        }
    }
    return 1;
}
int main(){
    scanf("%s",a+1);
    int d=strlen(a+1);
    if(check(1,d)&&check(1,(d-1)/2)&&check((d+3)/2,d)){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>

#ifdef _MSC_VER
#include <Windows.h>
#else
#include <unistd.h>
#endif

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD=(LL)1e9+7;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

#define INF 1LL << 50


LL A[(int)1e5+3];
int main(){
    LL N,K;
    cin>>N>>K;
    set<LL>st;
    REP(i,N){
        cin>>A[i];
    }
    sort(A,A+N);
    bool flag=false;
    if(N==1){
        if(A[0]==K)flag=true;
        if(flag){
            cout<<"POSSIBLE"<<endl;
        }else{
            cout<<"IMPOSSIBLE"<<endl;
        }
        return 0;
    }
    REP(i,N-1){
        if(A[i+1]!=A[i])st.insert(abs(A[i+1]-A[i]));
    }
    REP(i,N){
        if(A[i]==K){
            flag=true;
            break;
        }else if(A[i]>K){
            for(auto s:st){
                if((A[i]-K)%s==0){
                    flag=true;
                    break;
                }
            }
            if(flag)break;
        }
    }
    if(flag){
        cout<<"POSSIBLE"<<endl;
    }else{
        cout<<"IMPOSSIBLE"<<endl;
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> t(n);
  int total = 0;
  for(int i=0; i<n; i++) {
    cin >> t.at(i);
    total += t.at(i);
  }
  int m;
  cin >> m;
  for(int i=0; i<m; i++) {
    int p, x;
    cin >> p >> x;
    int tt = total + x - t.at(p-1);
    cout << tt << endl;
  }
}

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


int main() {
	// violinista forever xd
	ios::sync_with_stdio(0),cin.tie(0);
	
	int n,x,t,rta;
	cin>>n>>x>>t;
	rta=n/x;
	if(n%x)rta++;
	rta*=t;
	cout<<rta<<endl;
	
	return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <stdio.h>

using namespace std;

int main(){
 
  int numInput;
  
  cin >> numInput;
  
  numInput = numInput % 10;
  
  string res;
  
  if(numInput == 3){
    res = "bon";
  }
  else if(numInput == 0 || numInput == 1 || numInput == 6 || numInput == 8){
  	res = "pon";
  }
  else{
    res = "hon";
  }
  
  cout << res << endl;
 
  return 0;
}

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

int main (){
	int a,b;
	std::cin >> a >> b;
	if (a>=13)std::cout << b << '\n';
	else if (a>=6&&a<=12)std::cout << b/2 << '\n';
	else std::cout << 0 << '\n';
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,k;
  cin>>n>>m>>k;
  vector<int64_t> sa(n+1,0);
  vector<int64_t> sb(m+1,0);
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    sa.at(i+1)=sa.at(i)+a;
  }
  for(int i=0;i<m;i++){
    int b;
    cin>>b;
    sb.at(i+1)=sb.at(i)+b;
  }
  int x=0;
  for(int i=n,j=0;i>=0;i--){
    if(sa.at(i)>k)
      continue;
    while(j+1<=m&&sa.at(i)+sb.at(j+1)<=k)
      j++;
    x=max(x,i+j);
  }
  cout<<x<<endl;
}

Measured memory_bytes: 6420
import java.util.*

fun <T> calcPermutationList(sortedList: Array<T>): List<List<T>> {
    val permutationList = mutableListOf<List<T>>()
    val queue = ArrayDeque<List<T>>().apply { addLast(listOf()) }
    while (queue.isNotEmpty()) {
        val p = queue.removeLast()

        if (p.size == sortedList.size) {
            permutationList.add(p)
        } else {
            sortedList.filterNot { p.contains(it) }
                .forEach { queue.addLast(p + it) }
        }
    }

    return permutationList
}

fun main(args: Array<String>) {
    val n = readInteger()
    val p = readIntegerList()
    val q = readIntegerList()

    calcPermutationList((1..n).toList().toTypedArray())
        .let { it.indexOf(p) - it.indexOf(q) }
        .let(Math::abs)
        .let(::println)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)


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

int main()
{
	char me[1000 + 10];

	int len;

	int in;

	int i;

	cin >> me;

	//printf("%d\n", me[0]);


	
	len = strlen(me) ;

	for (i = 0; i < len; i++)
	{
		in = me[i] - 3;

		if (in < 65)
		{
			in += 26;
		}

		me[i] = in;

	}

	cout << me << endl;
	
	return 0;
}

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

int main(void){
    int n,count = 0;
    cin >> n;
    
    for(int i = 1;i <= n;i++){
        if(i % 2 == 0)continue;
        int a = 0;
        for(int j = 1;j <= i;j++){
            if(i % j == 0)a++;
        }
        if(a == 8)count++;
        //cout << a << endl;
    }
    
    cout << count << endl;
}

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

#include <boost/algorithm/string/classification.hpp>  // is_any_of
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/math/tools/minima.hpp>
#include <boost/multi_array.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/optional.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/irange.hpp>

const int MOD = 1e9 + 7;
#define rep(i, n) for (int i = 0; i < (n); ++i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::replace_all;
using boost::algorithm::split;
using boost::math::tools::brent_find_minima;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void Main()
{
	vector<ll> V(3);
	rep(i, 3)
	{
		ll x;
		cin >> x;
		if (x % 2 == 0)
		{
			cout << 0 << endl;
			return;
		}
		V.at(i) = x;
	}
	sort(V.begin(), V.end());
	cout << V.at(0) * V.at(1) << endl;
}
// END

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define PI 3.141592653589793238462
typedef long long ll;
typedef double db;
//ll qpow(ll a,ll b){ll res=1;while(b){if(b&1) res=res*a%mod;a=a*a%mod;b/=2;}return res%mod;}
ll a[100005],b[100005],c[100005],p[100005];
int main(){
    ll n,m,sum=0;cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];p[a[i]]++;
        sum+=a[i];
    }
    cin>>m;
    for(int i=1;i<=m;i++){
        cin>>b[i]>>c[i];
        sum-=p[b[i]]*b[i];
        sum+=p[b[i]]*c[i];
        p[c[i]]+=p[b[i]];p[b[i]]=0;
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 6716
import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque, defaultdict
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np    # cumsum
# from bisect import bisect_left, bisect_right

def solve():
    N = II()
    A = LI()
    dct = defaultdict(lambda: 0)

    for a in A:
        dct[a] += 1

    ans = 0
    for key, val in dct.items():
        if key == val:
            continue
        elif key < val:
            ans += val - key
        else:
            ans += val

    print(ans)


if __name__ == '__main__':
    solve()



Measured memory_bytes: 22304
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	    int x = sc.nextInt();    	
        int y = sc.nextInt();
        if(x==1||x==3||x==5||x==7||x==8||x==10||x==12){
      	    if(y==1||y==3||y==5||y==7||y==8||y==10||y==12){
      	        System.out.println("Yes");
      	    }else{
      	        System.out.println("No");
      	    }
      	}if(x==2||x==6||x==9||x==11){
      	    if(y==2||y==6||y==9||y==11){
      	        System.out.println("Yes");
      	    }else{
      	        System.out.println("No");
      	    }
      	}
    }
}


Measured memory_bytes: 35680
#include <iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i=0;i< int (n);i++)

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

    B = A / 2;
    B += A % 2;

    cout << B << endl;
}

Measured memory_bytes: 256
n,m=[int(x) for x in input().rstrip().split()]
temp=[0 for i in range(m)]
# ans=[0 for i in range(n)]
ans=0
l=[]
for i in range(m):
  ks=[int(x) for x in input().rstrip().split()]
  l.append(ks)
p=[int(x) for x in input().rstrip().split()]

for i in range(2**n):
  flag=1
  for j in range(n):
    if i>>j & 1:
      for s in range(m):
        for k in range(1,l[s][0]+1):
          if (j+1)==l[s][k]:
            temp[s]+=1

  for t in range(m):
    if temp[t]%2!=p[t]:
      flag=0
      break
  
  if flag==1:
    ans+=1
  temp=[0 for ini in range(m)]

print(ans) 

Measured memory_bytes: 3064
N = input()
l = len(N)

if l == 1:
    print(int(N[0]))
    exit()

if all([c == '9' for c in N[1:]]):
    ans = 9 * (l - 1) + int(N[0])
else:
    ans = 9 * (l - 1) + int(N[0]) - 1

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF (1<<31)-1
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
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; }
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

int n;
ll m;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> m;
    vector<pair<ll, ll> > p;
    rep(i, 0, n) {
        ll a, b;
        cin >> a >> b;
        p.pb(mp(a, b));
    }
    sort(all(p));
    int itr = 0;
    rep(i, 0, n) {
        m -= p[i].second;
        if (m <= 0) {
            cout << p[i].first << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 2420
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
#define chmax(a,b) a=max(a,b)
ll n,a[510],k;
bool solve(ll p){
    ll sum=0;
    for(int i=0;i<n;i++){
	sum+=a[i]%p;
    }
    ll x=sum/p;
    vector<ll> v;
    for(int i=0;i<n;i++){
	ll t=a[i]%p;
	if(t==0)continue;
	else{
	    v.push_back((p-t)-t);
	}
    }
    if(v.size()<x)return 0;
    sort(v.begin(),v.end()); //cout<<"#"<<p<<endl;
    ll cnt=0;
    for(int i=0;i<x;i++){
	cnt+=v[i]; //cout<<v[i]<<" ";
    }//cout<<sum<<" "<<cnt<<endl;
    return (sum+cnt<=k*2);
}
int main(){
  cin>>n>>k;
  ll sum=0;
  for(int i=0;i<n;i++){
      cin>>a[i];
      sum+=a[i];
  }
  ll ma=-1;
  for(ll i=1;i*i<=sum;i++){
      if(sum%i==0){
	  if(solve(i))chmax(ma,i);
	  if(solve(sum/i))chmax(ma,sum/i);
      }
  }
  cout<<ma<<endl;
  return 0;
}


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



int main(){
	int n;
	cin>>n;
	int a[n];
	
	for(int i= 0; i < n; i++){
		cin>>a[i];
	}
	bool encontro = false;
	int cont = 0;
	
	for(int i = 0; i < n; i++){
		encontro == false;
		for(int j = 0; j < i && encontro == false; j++){
			if(a[i] < a[j]){
				encontro = true;
			}
	    }
	    if(encontro == false){
	    	cont++;
		}
	    encontro = false;
	}
	
	cout << cont;
	return 0;
}

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

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF (long long)(1e18)
#define MOD (int)(1e9+7)

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

#define MAX 12
#define MAX_T 110000

int n, d, x;
int p[MAX][MAX];
int dp[MAX], dp2[MAX_T];

int hoge(int z, int y){
	int re = 0;
	fill(dp2,dp2+MAX_T,0);
	for(int i = 1; i <= n; i++){
		for(int j = 0; j <= dp[z]; j++){
			if(j-p[z][i] >= 0)dp2[j] = max(dp2[j],dp2[j-p[z][i]]+p[y][i]);
		}
	}
	
	for(int i = 0; i <= dp[z]; i++) re = max(re,dp2[i]+dp[z]-i);
	
	return re;
}

int solve(){
	dp[1] = x;
	
	for(int i = 1; i <= d; i++){
		for(int j = i+1; j <= d; j++){
			dp[j]  = max(hoge(i,j),dp[j]);
		}
		// cout<<i<<" "<<dp[i]<<endl;
	}
	return dp[d];
}

signed main(){
	cout<<fixed<<setprecision(7);
	
	cin>>n>>d>>x;
	
	
	for(int i = 1; i <= d; i++){
		for(int j = 1; j <= n; j++){
			cin>>p[i][j];
		}
	}
	
	cout<<solve()<<endl;
	
	return 0;
}


Measured memory_bytes: 3968
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
typedef long long ll;

int main(){
  int N,A,B,C;
  cin >> N >> A >> B >> C;
  vector<int> ABC={A,B,C};
  vector<int> l(N);
  int mp=1e9;
  rep(i,N)cin >> l[i];
  rep(i,pow(4,N)){
    vector<int> use(N);
    int preans=0;
    rep(j,N){
      use[j]=(i>>(2*j))&3;
    }
    vector<int>cnt(4);
    vector<int>lng(4);
    rep(j,4) cnt[j]=lng[j]=0;
    rep(j,N){
      cnt[use[j]]++;
      lng[use[j]]+=l[j];
    }
    if(cnt[1]*cnt[2]*cnt[3]==0)continue;
    rep(j,3){
      preans+=(10*(max(0,cnt[j+1]-1))+abs(ABC[j]-lng[j+1]));
    }
    mp=min(mp,preans);
  }
  cout << mp << endl;
}


Measured memory_bytes: 256
// Example program
#include <iostream>
#include <string>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b&&a!=c)cout<<c<<endl;
  else if(a==c&&a!=b)cout<<b<<endl;
  else if(b==c&&b!=a)cout<<a<<endl;
  return 0;
}



Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	X,Y = inputMap()

	if X == 0 and Y > 0:
		print("No")

	if Y % 2 == 1:
		print("No")
	else:
		if Y > X*4:
			print("No")
		else:
			if Y < X*2:
				print("No")
			else:
				print("Yes")


#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 77240
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<limits.h>
#define M 10000
char map[M][M];
int  ans[M][M];
using namespace std;

int main(){
  int n,i,j,xmax=0;
  while(1){
    xmax=0;
    cin >> n;
    if(n == 0)break;
    
    
    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	cin >> map[i][j];
	ans[i][j] = (map[i][j] == '.') ? 1 : -1;
      }
    }
    
     
    
    
    for(i=1;i<n;i++){
      for(j=1;j<n;j++){
	if(ans[i][j] == -1){}
	else{
	  if(ans[i-1][j-1]>0 && ans[i-1][j]>0 && ans[i][j-1]>0)ans[i][j]=min(ans[i-1][j-1],min(ans[i-1][j],ans[i][j-1]))+1;
	  else if(ans[i-1][j-1]<0 || ans[i-1][j]<0 || ans[i][j-1]<0){}

}
	if(ans[i][j] != INT_MAX)xmax=max(ans[i][j],xmax);

      }
    }
    /*    
 for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	cout << ans[i][j]  ;
      }
      cout << " " << endl;
      }
    */

    cout << xmax << endl;
    
  }
}

Measured memory_bytes: 0
#include <stdio.h>
 
int main() {
    int a, b, r, tmp;
    double c;

    while ( scanf("%d %d", &a, &b) != EOF) {
        c = (double)a * (double)b;
        if ( a < b ) {
            tmp = a;
            a = b;
            b = tmp;
        }
        
        r = a % b;
        while ( r != 0 ) {
            a = b;
            b = r;
            r = a % b;
        }
        printf("%d %.0f\n", b, c/(double)b);
    }
 
  return 0;
}


Measured memory_bytes: 2048
#include <iostream>
 
using namespace std;
 
int main()
{
    long long int sum=0;
    int n;cin>>n;
    for(int i=1;i<=n;i++)
    {
        if(i%3!=0 && i%5!=0)
        sum+=i;
    }
    cout<<sum;
  return 0;
}

Measured memory_bytes: 3532
a = list(map(int,input().split()))
count = 0
a.sort()
sub = a[0]
for i in range(3):
	a[i] -= sub
while a[0] < a[1]-1:
	count += 1
	a[0] += 2
if a[0] == a[1]:
	count += a[2]-a[1]
else:
	count += 2 + a[2] - a[1]
print(count)

Measured memory_bytes: 3064
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
using namespace std;
using i64 = int64_t;
#define rep(i, n) for(int i=0;i<n;++i)
#define rep2(i, x, n) for(int i=x;i<n;++i)

int main()
{   
    int n,m;
    cin >> n >> m;

    int t = 1900*m + 100*(n-m);
    cout << t * pow(2,m) << endl; 
    return 0;
}

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

//#define getchar getchar_unlocked
//#define putchar putchar_unlocked
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define ff first
#define ss second
#define err stderr
#define out stdout

typedef long long int ll;
typedef long double ld;
typedef short int sh;

inline void readI(int *i)
{
	register int t=0;
	register char z=getchar();
	int znak=1;
	if (z=='-')
	{
		znak=-1;
	}
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
		if (z=='-')
		{
			znak=-1;
		}
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*i=(t*znak);
}
inline void readUI(int *i)
{
	register int t=0;
	register char z=getchar();
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*i=t;
}
inline void readL(ll *l)
{
	register ll t=0;
	register char z=getchar();
	int znak=1;
	if (z=='-')
	{
		znak*=-1;
	}
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
		if (z=='-')
		{
			znak=-1;
		}
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*l=(t*znak);
}
inline void readUL(ll *l)
{
	register ll t=0;
	register char z=getchar();
	while ((z<'0') || ('9'<z))
	{
		z=getchar();
	}
	while (('0'<=z) && (z<='9'))
	{
		t=(t<<3)+(t<<1)+z-'0';
		z=getchar();
	}
	*l=t;
}
inline void writeL(ll l)
{
	if (l==0)
	{
		putchar(48);
	}
	else
	{
		if (l<0)
		{
		   l*=-1;
		   putchar(45);
		}
		int _tab[21];
		int wsk=0;
		while (l>0)
		{
			++wsk;
			_tab[wsk]=(l%10)+48;
			l/=10;
		}
		for (int j=wsk; j>=1; --j)
		{
			putchar(_tab[j]);
		}
	}
}
inline void writeS(string s)
{
	int l=s.length();
	for (int i=0; i<l; ++i)
	{
		putchar(s[i]);
	}
}
inline void space()
{
	putchar(32);
}
inline void endl()
{
	putchar(10);
}

#define debug if(1)
#define debug2 if(1)
#define debug3 if(1)
#define debug4 if(1)
#define MAXN 3005

int n;
ld tab[MAXN];
ld dp[MAXN][MAXN];
ld odp;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	dp[0][0]=dp[0][1]=1;
	for (int i=1; i<=n; ++i)
	{
		cin >> tab[i];
		for (int j=i; j>=1; --j)
		{
			dp[i][j]+=dp[i-1][j-1]*tab[i];
		}
		for (int j=i-1; j>=0; --j)
		{
			dp[i][j]+=dp[i-1][j]*((ld)1-tab[i]);
		}
	}
	for (int i=(n>>1)+1; i<=n; ++i)
	{
		odp+=dp[n][i];
	}
	fprintf (out, "%0.12Lf\n", odp);
	return 0;
}
/*
*/




Measured memory_bytes: 139392
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define repf(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define repr(i, a, b) for (ll i = (ll)a; i > (ll)b; i--)
#define repv(x, arr) for (auto &x : arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a, b) make_pair(a, b)
#define pb(x) push_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int infi = 2147483600;
const ll infl = 1e17;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int Q;
    cin >> Q;
    rep(q,Q){
        int k;
        cin >> k;
        ll dmc = 0;
        ll d = 0, m = 0, dm = 0;
        rep(i,n){
            if (s[i]=='D'){
                d++;
            }
            if (s[i]=='M'){
                m++;
                dm += d;
            }
            if (i-k>=0){
                if (s[i-k]=='D'){
                    d--;
                    dm -= m;
                }
                if (s[i-k]=='M'){
                    m--;
                }
            }
            if (s[i]=='C'){
                dmc += dm;
            }
        }
        cout << dmc << endl;
    }
}


Measured memory_bytes: 1412
import java.util.*
import kotlin.math.*

fun str() = readLine()!!
fun int() = str().toInt()
fun long() = str().toLong()

fun read(d: String = " ") = str().split(d)
fun <T> list(d: String = " ", f: String.() -> T) = read(d).map { f(it) }
fun list() = list { toInt() }

fun <T> MutableList<T>.removeLast() = this.removeAt(this.lastIndex)

const val mod = 1000000007L

fun main() {
    abc000X()
}

fun abc000X() {
    val s = str()
    println(s + if (s.endsWith("s"))
        "es" else "s")
}


Measured memory_bytes: 37376
#include <iostream>
using namespace std;
int n,a,b,sum;
int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++){
		int j=i,s=0;
		while(j){
			s+=j%10;
			j/=10;
		}
		if(s>=a&&s<=b)sum+=i;
	}
	cout<<sum;
	return 0;
}

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

ans = 'No'
cnt = 0
for _ in range(n):
   d1, d2 = map(int, input().split())
   if d1 == d2:
      cnt += 1
   elif cnt > 0 and d1 != d2:
      if cnt >= 3:
         ans = 'Yes'
      cnt = 0

if cnt >= 3:
   ans = 'Yes'
print(ans)


Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define F first
#define S second
#define all(a) a.begin(),a.end()
#define setDP(arr) memset(arr,-1,sizeof arr)
#define Clear(arr) memset(arr,0,sizeof arr)
#define oo 2000000000
#define inf 1000000000000000000
#define P1 31
#define P2 37
#define M  1000000007
#define M2 1000000009
#define pii pair<ll,ll>
typedef long long ll;
using namespace std;
const int N = 255001;
const int SQRTN = 320;
const int LOGN = 20;
const long double PI = acos(-1);
const long double TAU = 2*PI;

int h,w,cost[1111][1111];
char g[1111][1111];
queue<pair<int,int> > q;
int dx[]={0,0,1,-1};
int dy[]={1,-1,0,0};
pair<int,int> tmp;
int ans;

void bfs(){
    while(!q.empty()){
        tmp=q.front();
        q.pop();
        for(int i = 0 ; i < 4 ; i++){
            if(tmp.F+dx[i]<0)continue;
            if(tmp.S+dy[i]<0)continue;
            if(tmp.F+dx[i]>=h)continue;
            if(tmp.S+dy[i]>=w)continue;
            if(cost[tmp.F+dx[i]][tmp.S+dy[i]]!=oo)continue;
            q.push(make_pair(tmp.F+dx[i],tmp.S+dy[i]));
            cost[tmp.F+dx[i]][tmp.S+dy[i]]=cost[tmp.F][tmp.S]+1;
            ans=max(ans,cost[tmp.F+dx[i]][tmp.S+dy[i]]);
        }
    }
}

signed main(){
    cin >> h >> w;
    for(int i = 0 ; i < h ; i++){
        scanf(" %s",g[i]);
        for(int j = 0 ; j < w ; j++){
            cost[i][j]=oo;
            if(g[i][j]=='.')continue;
            cost[i][j]=0;
            q.push(make_pair(i,j));

        }
    }
    bfs();
    cout << ans << endl;







}


Measured memory_bytes: 13840
#include<iostream>

using namespace std;

int main()
{
	int n;
	while(cin>>n)
	{
		int cont = 0;
		for(int i = 0; i < 10; i++){
			for(int j = 0; j < 10; j++){
				for(int k = 0; k < 10; k++){
					for(int l = 0; l < 10; l++){
						if(i+j+k+l == n){
							cont++;
						}
					}
				}
			}
		}
		
		cout << cont << endl;
	}
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
#define REP(i,n) for(int i=0;i< (n);i++)
#define REPR(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) std::sort(v, v+n);
#define VSORT(v) std::sort(v.begin(), v.end());
#define VRSORT(v) std::sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define ALL(obj) (obj).begin(),(obj).end()

using namespace std;

const int INF = 99999999;
const ll LINF = 9999999999999;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

ll n, m;
multimap<ll, ll> a;
ll cou = 0;
vector<int> v;

bool findroot(ll key,ll goal) {
	auto range = a.equal_range(key);

		
		// 取得したイテレータの範囲をループで回します。

		for (auto iterator = range.first; iterator != range.second; iterator++)

		{

			// ここで、"key1" をキーに持つキーと値のセットをひとつひとつ処理します。

			auto target = *iterator;
			if (target.second == goal) return true;

		}
		return false;
}

int main() {


		std::ios::sync_with_stdio(false);
		std::cin.tie(0);
	
		
		cin >> n >> m;
		v.resize(n - 1);
		REP(i, m) {
			ll b, c;
			cin >> b >> c;
			a.insert(make_pair(b, c));
			a.insert(make_pair(c, b));
		}
		
		iota(v.begin(), v.end(), 2);       // v に 2, ... N を設定
		do {
			//for (auto x : v) cout << x << " "; cout << "\n";    // v の要素を表示
			//まず、1からv[0]にいくルートがあるか探す
			if (findroot(1, v[0])==false) {
				//なかったら打ち切り
				continue;
			}
			else {
				//打ち切りにはならず、サイズが極端に小さければすでにおｋ
				if (v.size() <= 1) {
					cou++;
				}
			}
			//次にv[0]からv[1]...v[n-2]にまでルートがあるか探す。
			REP(i, n - 2) {
				//もしルートが合ったら
				if (findroot(v[i], v[i + 1])==true) {
					//これがラストならカウントをふやす
					if (i == n - 3) cou++;
				}
				else {
					//なかったら打ち切り
					i=999;
				}
			}
		} while (next_permutation(v.begin(), v.end()));     // 次の順列を生成

		cout << cou << endl;

	return 0;
}

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

using namespace std;
using ll = long long;

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

  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  for (int i = 0; i < n; i++)
    cin >> a[i] >> b[i] >> c[i];

  vector<vector<int>> dp(n + 1, vector<int>(3, -1e9));
  dp[0][0] = 0;
  dp[0][1] = 0;
  dp[0][2] = 0;

  for (int i = 0; i < n; i++) {
    dp[i+1][0] = max({dp[i+1][0], dp[i][1]+a[i], dp[i][2]+a[i]});
    dp[i+1][1] = max({dp[i+1][1], dp[i][0]+b[i], dp[i][2]+b[i]});
    dp[i+1][2] = max({dp[i+1][2], dp[i][0]+c[i], dp[i][1]+c[i]});
  }

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

  return 0;
}


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

using namespace std;

typedef long long int lli;

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

    int n, c, grid[3][31] = { 0 }, d[31][31];

    cin >> n >> c;
    for (int i=0; i<c; i++) {
        for (int j=0; j<c; j++) {
            cin >> d[i+1][j+1];
        }
    }

    int t;
    for (int i=1; i<=n; i++) {
        for (int j=1; j<=n; j++) {
            cin >> t;
            grid[(i+j)%3][t]++;
        }
    }

    int ans = 1e+9;
    for (int c0=1; c0<=c; c0++) {
        for (int c1=1; c1<=c; c1++) {
            for (int c2=1; c2<=c; c2++) {
                if (c0==c1 || c1==c2 || c2==c0) continue;
                int tmp = 0;
                for (int i=1; i<=c; i++) {
                    tmp += grid[0][i] * d[i][c0];
                    tmp += grid[1][i] * d[i][c1];
                    tmp += grid[2][i] * d[i][c2];
                }
                // cout << c0 << c1 << c2 << " " << tmp << endl;
                ans = min(ans, tmp);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		int n;
		int[] d;

		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();

		d = new int[n];

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

		int sum = 0;

		for (int i = 0; i < n; i++) {
			for (int j = i+1; j < n; j++) {
				sum += d[i] * d[j];
		  }
		}

		System.out.println(sum);
        return;
	}
}

Measured memory_bytes: 35836
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

using Graph = VVI;
vector<bool> seen;
void dfs(const Graph &G, int v){
	seen[v] = true;
	for(auto next_v : G[v]){
		if(seen[next_v]) continue;
		dfs(G,next_v);
	}
}



signed main(){
	int n,m; cin>>n>>m;
	Graph G(n);
	rep(i,m){
		int x,y,z; cin>>x>>y>>z; x--; y--;
		G[x].PB(y); G[y].PB(x);
	}

	int cnt = 0;
	seen.assign(n,false);
	rep(v,n){
		if(seen[v]) continue;
		dfs(G,v); cnt++;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 10496
#pragma GCC optimize(2)
#pragma GCC optimize(3)   
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector < ll > vl;
typedef vector < vl > vvl;
typedef pair < ll, ll > pll;
typedef vector < pair < ll, ll > > vpll;
#define kill freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define pb push_back
#define fo(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(c) c.begin(), c.end()
#define go(c,it) for(auto it=(c).begin(); it!=(c).end(); it++)
#define back(c,it) for(auto it=(c).rbegin(); it!=(c).rend(); it++)
#define fi first
#define se second
#define MOD 998244353
#define Boost() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD1 1000000007
ll power(ll a, ll b){ll res=1;a=a%MOD;while(b>0){if(b&1){res=(res*a)%MOD;}a=(a*a)%MOD;b>>=1;}return res;}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
#define oo LLONG_MAX
const ll N = 1e5;

void solve(){
    ll l,r,d;
    cin>>l>>r>>d;
    ll ans = r/d;
    ll ans2 = (l-1)/d;
    cout<<ans-ans2;
}

int main(){
    Boost();
    #ifndef ONLINE_JUDGE 
    kill
    #endif
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}
 
 
 
 
 

Measured memory_bytes: 3636
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long ans = 0;
		ans += 2*(x/11);
		x = x%11;
	//	System.out.println(ans);
	//	System.out.println(x);
		if(x>=1) {
			ans += 1;
			x -= 6;
		}
		if(x>=1) {
			ans += 1;
			x -= 5;
		}
		System.out.println(ans);
	}

}

Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <cmath>
#include <cstdio>
using namespace std;

#define PI 4*atan(1);

int main(){
  int p[3], j[2];
  int sum[6];
  for(int i = 0; i < 3; i++){
    cin >> p[i];
  }
  for(int i = 0; i < 2; i++){
    cin >> j[i];
  }
  sum[0] = p[0] + j[0] - 50;
  sum[1] = p[1] + j[0] - 50;
  sum[2] = p[2] + j[0] - 50;
  sum[3] = p[0] + j[1] - 50;
  sum[4] = p[1] + j[1] - 50;
  sum[5] = p[2] + j[1] - 50;
  sort(sum, sum + 6);
  cout << sum[0] << endl;
}

Measured memory_bytes: 1180
//https://onlinejudge.u-aizu.ac.jp/challenges/sources/JOI/Prelim/0578?year=2013

#include <bits/stdc++.h>

using namespace std;

vector<int> find_all(const string &s, char &sub_str) {
    vector<int> result;

    auto pos = s.find(sub_str);
    while (pos != string::npos) {
        result.emplace_back(pos);
        pos = s.find(sub_str, pos + 1);
    }
    return result;
}

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

    string signboard;
    cin >> signboard;

    string s[110];
    for (int i = 0; i < n; ++i) {
        cin >> s[i];
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {//古看板
        auto fa = find_all(s[i], signboard[0]);
        for (auto pos:fa) {//1文字目の位置
            for (int sp = 1; pos + 2 * sp < s[i].size(); ++sp) {//文字の間隔
                string tmp;
                for (int r = 0; pos + r < s[i].size() and
                                tmp.size() < signboard.size(); r += sp) {//文字を拾う
                    tmp += s[i][pos + r];
                }
                if (tmp == signboard) {
                    ans++;
                    goto to_break;
                }
            }
        }
        to_break:;
    }

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

/*
 * 全検索。
 * 部分文字列の出現箇所をすべて調べる関数を流用した。
 * 多重ループを一気に抜けるため，goto文を使用。
 *
 */


Measured memory_bytes: 3172
#include<stdio.h>
int main(void)
{
    int i,j,k,pas[3],jui[2],min=2000,cen=2000,min2=2000;
    for(i=0;i<3;i++){
        scanf("%d",&pas[i]);
        if(min>pas[i]){
            min=pas[i];
        }

    }
    for(i=0;i<2;i++){
        scanf("%d",&jui[i]);
        if(min2>jui[i]){
            min2=jui[i];
        }
    }

    printf("%d\n",min+min2-50);

    return 0;
}

Measured memory_bytes: 1844
#include <iostream>
#include <queue>

using ll = long long;
using namespace std;
int n, p, A[100][100];
int d[100], P[100], c[100];
/* initialize */

int bfs(){
    int u, minv;
    int sum;
    for (int i = 0; i < n; ++i) {
        d[i] = 1<<30;
        P[i] = -1;
        c[i] = 0;
    }
    d[0] = 0;
    
    while(true) {
        minv = 1 << 30;
        u = -1;
        for (int i = 0; i < n; ++i) {
            if (minv > d[i] && c[i] != 2) {
                u = i;
                minv = d[i];
            }
        }
        if (u == -1)break;
        c[u] = 2;
        for (int j = 0; j < n; ++j) {
            if (c[j] != 2 && A[u][j] != 1 << 30) {
                if (d[j] > A[u][j]) {
                    d[j] = A[u][j];
                    P[j] = u;
                    c[j] = 1;
                }
            }
        }
    }
        sum = 0;
        for (int i = 0; i < n; ++i) {
            if (P[i] != -1) sum += A[i][P[i]];
        }
    return sum;
}
/* main */
int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cin >> p;
            if (p == -1) A[i][j] = 1<<30;
            else A[i][j] = p;
        }
    }
    cout << bfs() << "\n";
}


Measured memory_bytes: 3112
"""
NTC here
"""


#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase

profile = 0
pypy = 1


def iin(): return int(input())


def lin(): return list(map(int, input().split()))



def main():
    T = 1
    while T:
        T -= 1
        n = iin()
        mx = 10**4+1
        ans = [0]*(mx)
        for i in range(1, 100):
            for j in range(1, 100):
                for k in range(1, 100):
                    sm = i*i + j*j + k*k + i*j + j*k + k*i
                    if sm<mx:
                        ans[sm] += 1
        print(*ans[1:n+1], sep='\n')



    
        










    




                

        

 
 
 
 
 
 
# region fastio
 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
    newlines = 0
 
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
 
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
 
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
 
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
 
if pypy:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
    input = lambda: sys.stdin.readline().rstrip("\r\n")
 
# endregion
 
if __name__ == "__main__":
    if profile:
        import cProfile
        cProfile.run('main()')
    else:
        main()


Measured memory_bytes: 68204
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<deque>
#include<cmath>
#include<stack>
#include<string.h>
#include <iomanip>
#define rep(i,n) for(int i = 0;i<n;i++)
using ll = long long; 
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    string s,t;
	cin >> s >> t;
	vector<int>S(26,-1);
	vector<int>T(26,-1);
	rep(i,s.size()) {
		int a = s[i] - 'a';
		int b = t[i] - 'a';
		if(S[a] != -1 || T[b] != -1) {
			if(S[a] != b || T[b] != a) {
				cout << "No" << endl;
				return 0;
			}	
		}
		S[a] = b;
		T[b] = a;
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 776
fun main(arg: Array<String>) {
    val (N, K) =  listOfInt()
    val D = BooleanArray(10)
    listOfInt().forEach { D[it] = true }
    fun isOK(N: Int): Boolean {
        var n = N
        while (n > 0) {
            if (D[n % 10]) return false
            n /= 10
        }
        return true
    }
    var ans = N
    while (!isOK(ans)) ans += 1
    println(ans)
}

fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)
fun listOfLong() = listOfString().map(String::toLong)
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }

//10000


Measured memory_bytes: 37992
import java.util.Scanner;

public class Main {
    private static Integer[][] memo;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        for (int i = 0; i < n; i++) {
            String x = in.next();
            String y = in.next();
            memo = new Integer[x.length()][y.length()];
            System.out.println(lcsLength(x, y));
        }
    }

    private static int lcsLength(String x, String y) {
        return lcs(x, y, x.length() - 1, y.length() - 1);
    }

    private static int lcs(String x, String y, int xi, int yi) {
        if (xi < 0 || yi < 0) {
            return 0;
        } else if (memo[xi][yi] == null) {
            if (x.charAt(xi) == y.charAt(yi)) {
                memo[xi][yi] = lcs(x, y, xi-1, yi-1) + 1;
            } else {
                memo[xi][yi] = Math.max(lcs(x, y, xi, yi-1), lcs(x, y, xi-1, yi));
            }
        }
        return memo[xi][yi];
    }
}



Measured memory_bytes: 132520
import collections

n = int(input())


d = collections.defaultdict(lambda:0)

for i in range(n):
    s = input()
    d[s] += 1

d = dict(d)

a = collections.Counter(d).most_common()

most = a[0][1]
ans = []

for k, v in a:
    if v == most:
        ans.append(k)
    else:
        break

ans.sort()

for i in ans:
    print(i)

Measured memory_bytes: 57704