akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int INF = (int)1e9 + 7;
template<class T> T ceil(T a, T b) { return a / b + !!(a % b); }

int main() {
    int n, goal; cin >> n >> goal;
    vector<int> cnt(n), comp(n);
    for (int i = 0; i < n; i++) cin >> cnt[i] >> comp[i];
    int ans = INF;
    for (int mask = 0; mask < 1 << n; mask++) {
        int sum = 0, num = 0, ma = -1;
        for (int i = 0; i < n; i++) {
            if (mask >> i & 1) {
                sum += 100 * (i + 1) * cnt[i] + comp[i];
                num += cnt[i];
            } else {
                ma = i;
            }
        }
        if (sum < goal) {
            int score = 100 * (ma + 1);
            int need = ceil(goal - sum, score);
            if (need >= cnt[ma]) continue;
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;
#define int long long
signed main(void){
    int n,m; cin>>n>>m;
    if(n*2 <= m){
        // cが余る
        int ans = n;
        m -= n*2;
        ans += m/4;
        cout<<ans<<endl;
    }else{
        //sが余る
        cout<<m/2<<endl;
    }
}


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

int main() {
  int AB, BC, CA;
  cin >> AB >> BC >> CA;
  
  int ans;
  if( AB >= BC && AB >= CA ){
    ans = ( BC * CA ) / 2;
  }else if( BC >= AB && BC >= CA ){
    ans = ( AB * CA ) / 2;
  }else if( CA >= AB && CA >= BC ){
    ans = ( AB * BC ) /2;
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iostream>
#include <stdio.h>
#define f(i,a,b) for(int i=a; i<b; ++i)
#define f2(j,a,b) for(int j=a; j<b; ++j)
#define F first
#define S second
#define pi 3.1415926536
#define Faast ios_base::sync_with_stdio(0);       cin.tie(0);      cout.tie(0);
#define SIZE 10
#define IN freopen("records.in","r",stdin);
const int MOD = 1e9 + 7;
const int MAX_VAL=1e6+2;
const int INF = 0x3f3f3f3f;
typedef long long ll;
using namespace std;

void file()
{
    #ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);
  //freopen("out.txt", "w", stdout);
    #else
  // online submission
    #endif
}

int main()
{
     int n,a[6]{}; cin>>n;
     while(n--)
     {
       string s; cin>>s;
       if(s=="AC") a[0]++;
       else if(s=="WA") a[1]++;
       else if(s=="TLE") a[2]++;
       else a[3]++;
     }
     cout<<"AC x "<<a[0]<<endl;
     cout<<"WA x "<<a[1]<<endl;
     cout<<"TLE x "<<a[2]<<endl;
     cout<<"RE x "<<a[3]<<endl;
      return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
	int N,D;
	string X;
	cin>>N>>X>>D;
	vector<bool>v(N);
	for(int i=0;i<N&&D;i++){
		if(X[i]=='0'){
			v[i]=true;
			X[i]='1';
			D--;
		}
	}
	for(int i=N-1;i>=0&&D;i--){
		if(!v[i]){
			X[i]='0';
			D--;
		}
	}
	cout<<X<<endl;
}

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

int main(void){
	int n, m, l, a[101][101], b[101][101];
	long long ans[101][101]={0};
	cin >>n >>m >>l;
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			cin >>a[i][j];
		}
	}
	for(int i=0; i<m; i++){
		for(int j=0; j<l; j++){
			cin >>b[i][j];
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			for(int k=0; k<l; k++){
				ans[i][k]+=a[i][j]*b[j][k];
			}
		}
	}
	for(int i=0; i<n; i++){
		for(int j=0; j<l-1; j++){
			cout <<ans[i][j] <<" ";
		}
		cout <<ans[i][l-1] <<endl;
	}
    return 0;
}

Measured memory_bytes: 1320
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;


int main()
{
    int N;
    cin >> N;
    vector<int> b(N+1);
    for( int i = 1; i <= N; ++i ) cin >> b[i];


    bool canAns = true;
    vector<int> ans(N+1);
    // 最後に挿入されるものは b[last] = last の関係を満たしていないといけない
    // ことを利用して答えを求める
    for( int i = N; i > 0; --i ){
        bool canArrange = false;
        for( int j = b.size()-1; j > 0; --j ){
            if( b[j] == j ){
                ans[i] = j;
                b.erase( b.begin()+j );
                canArrange = true;
                break;
            }
        }
        if( !canArrange ){
            canAns = false;
            break;
        }
    }
    
    if( canAns ) for( int i = 1; i <= N; ++i ) cout << ans[i] << endl;
    else cout << -1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

#define REP(i,n) for(int i=0;i<n;i++)

int cnts[4];


int main() {
  int a, b;

  REP(i, 3) {
    scanf("%d %d\n", &a, &b);
    cnts[a-1]++;
    cnts[b-1]++;
  }
  
  if (cnts[0] * cnts[1] * cnts[2] * cnts[3] == 4) printf("YES\n");  
  else printf("NO\n");

  return 0;
}


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

int main(){
    int N = 10000;
    vector<int> vh(N);
    vector<int> vw(N);
    int tmp = 0;
    for (int i = 0; i < N; i++) {
        int h,w;
        cin >> h >> w;
        if (w == 0 && h == 0) {
            tmp = i;
            break;
        }
        vh.at(i) = h;
        vw.at(i) = w;
    }

    for (int i = 0; i <= tmp; i++) {
        if (i > 0) cout << endl;
        for (int j = 0; j < vh[i]; j++) {
            for (int z = 0; z < vw[i]; z++) {
                if (j % 2 == 0) {
                    if(z % 2 == 0) {
                        cout << '#';
                    } else {
                        cout << '.';
                    }
                } else {
                    if(z % 2 == 0) {
                        cout << '.';
                    } else {
                        cout << '#';
                    }
                }
            }
            cout << endl;
        }
    }
    return 0;
}



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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;

const int N = 100010;
const double eps = 1e-6;

LL n, m, res;

int main()
{
    cin >> n >> m;
    if(n == 1 || m == 1) cout << max(n * m - 2, 1LL) << endl;
    else if(n == 2 || m == 2) cout << 0 << endl;
    else cout << 1LL * (n - 2) * (m - 2) << endl;
    return 0;
}


Measured memory_bytes: 256
fun main(arg: Array<String>) {
    val N = nextInt()
    val TA = Array(N) { listOfLong() }
    var T = 1L
    var A = 1L
    for ((t, a) in TA) {
        val d = Math.max(T.ceilDiv(t), A.ceilDiv(a))
        T = t * d
        A = a * d
//System.err.println("T:$T A:$A")
    }
    val ans = T + A
    println(ans)
}
inline fun Long.ceilDiv(n: Long) = (this + n - 1) / n

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 }


Measured memory_bytes: 37996
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}

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


  string s;cin >> s;
  vector<string> a;
  a.pb("KIHBR");
  a.pb("AKIHBR");
  a.pb("KIHABR");
  a.pb("KIHBAR");
  a.pb("KIHBRA");
  a.pb("AKIHABR");
  a.pb("AKIHBAR");
  a.pb("AKIHBRA");
  a.pb("KIHABAR");
  a.pb("KIHABRA");
  a.pb("KIHBARA");
  a.pb("AKIHABAR");
  a.pb("AKIHABRA");
  a.pb("AKIHBARA");
  a.pb("KIHABARA");
  a.pb("AKIHABARA");
  rep(i,a.size()){
    if(a[i]==s) {cout << "YES" << endl;return 0;}
  }
  cout << "NO" << endl;
  

  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
W = list(map(int, input().split()))

minSum = sum(W)
for i in range(N):
    sumS1 = sum(W[0:i:1])
    sumS2 = sum(W[i:N:1])
    temp = abs(sumS1 - sumS2)
    if temp <= minSum:
        minSum = temp
print(minSum)


Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
using namespace std;
bool f(int a,int b)
{
	if(a==b)
	{
		return true;
	}
	return false;
}

int main()
{
	long long n,k;
	long long ci=1;
	cin>>n>>k;
	ci=pow(k-1,n-1);
	ci=ci*k;
	
	cout<<ci;
	return 0;
 } 

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();  
        int b = sc.nextInt();
        int sum = 0;
        for(int i=1;i<=n;i++) {
        	int x = (i/10000)+(i%10000/1000)+(i%1000/100)+(i%100/10)+(i%10);
        if(x>=a&&x<=b){
        	sum+=i;
        }
        if(i==n){
        	System.out.println(sum);
        }
        }
        }
}

Measured memory_bytes: 21844
l = map(int,raw_input().split())

if l[0] == l[1] + l[2]:
    print 'Yes'

elif l[1] == l[0] + l[2]:
    print 'Yes'

elif l[2] == l[0] + l[1]:
    print 'Yes'
else:
    print 'No'


Measured memory_bytes: 2568
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,j;
  cin >> n;
  for(int i=0;i<=50000;i++){
    j=i*27/25;
    if(j==n){
      cout << i;
      return 0;
    }
  }
  cout << ":(";
  /*
  int n,m;
  cin >> n >> m;
  char a[n+2][m+2];
  for(int i=0;i<=n+1;i++){
    if(i==0||i==n+1){
      for(int j=0;j<m+2;j++){
        cout << "#";
      }
      cout << endl;
    }
    cout << "#";
    for(int jj=1;jj<=m;jj++){
      cin >> a[i][jj];
      cout << a[i][jj];
    }
    cout << "#" << endl;*/
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >>N;
    vector<int>vec(N);
    int X;
    cin >>X;
    for(int i=0;i<N;i++){
        cin >> vec.at(i);
    }
    sort(vec.begin(),vec.end());
    int count =0;
    for(int i=0;i<N;i++){
        X-=vec.at(i);
        if(X>=0){
            if(i==N-1&&X==0){
                count++ ;
                break;
            }
            else if(i==N-1&&X>0){
                break;
            }
            count ++;
        }
        else{
            break;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3632
N, X = map(int, input().split())

a, p = [1], [1]
for i in range(N):
  a.append(a[i] * 2 + 3)
  p.append(p[i] * 2 + 1)

def f(N, X): # X <= 0 や X > a_N を許容し解説本文から簡略化
	if N == 0:
		return 0 if X <= 0 else 1
	elif X <= 1 + a[N-1]:
		return f(N-1, X-1)
	else:
		return p[N-1] + 1 + f(N-1, X-2-a[N-1])

print(f(N, X))


Measured memory_bytes: 3064
import java.util.*;

public class Main{
	public static void main(String[] args){
		int[] height = new int[10];
		int[] rank = new int[3];
		int i;
		Scanner scanner = new Scanner(System.in);

		for(i=0;i<10;i++){
			height[i] = scanner.nextInt();
			if(height[i]>=rank[0]){
				rank[2]=rank[1];
				rank[1]=rank[0];
				rank[0]=height[i];
			}else if(height[i]>=rank[1]){
				rank[2]=rank[1];
				rank[1]=height[i];
			}else if(height[i]>=rank[2]){
				rank[2]=height[i];
			}
		}

		for(i=0;i<3;i++){
			System.out.println(rank[i]);
		}
	}
}



Measured memory_bytes: 26220
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo 1e18
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

using namespace std;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
const long double Pi=acos(-1),e=2.718;
const int N=1e5+10,mod=3e7;
int dp[N],n,m;
vector<int> G[N];
int dfs(int u){
    int mx=0;
    for(auto v:G[u]){
        if(dp[v]+1)mx=max(mx,dp[v]+1);
        else{
            mx = max(mx,dfs(v)+1);
        }
    }
    return dp[u]=mx;
}
int main()
{
    memset(dp,-1,sizeof dp);
    FASTIO
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int u,v;
        cin >> u >> v;
        G[u].pb(v);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(dp[i]==-1)dfs(i);
        ans = max(ans,dp[i]);
    }
    cout << ans << endl;
    return 0;
}
/**

*/


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

//using ll=long long;

const int MAX = 2200000;
const long long MOD = 1000000007;
long long INF = 90000000001000;


int main() {

int n,cnt=0,ans=0;cin >> n;

for (int i = 1;i<= n; ++i)
{   
    if(i%2==0) continue;
    cnt=0;
    for (int j = 1; j*j <=i ; ++j)
    {
        if(i%j!=0) continue;
        if(j!=i/j) cnt +=2;
        else cnt++;
    }
    if(cnt==8) {ans++;}
}

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




Measured memory_bytes: 256
#include <iostream>

using namespace std;

void selectionSort(int A[],int N) {
  int count = 0;
  for (int i = 0; i < N; i++) {
    int minj = i;
    for (int j = i; j < N; j++) {
      if (A[j] < A[minj]) {
        minj = j;
      }
    }
    if (i != minj) {
      swap(A[i], A[minj]);
      count++;
    }

  }

  cout << A[0];
  for (int i = 1; i < N; i++) cout << " " << A[i];

  cout << endl;

  cout << count << endl;
}

int main() {
  int N, A[100];

  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];

  selectionSort(A, N);
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long 

const int N=1e5+5;

int n, m, l=1, r=1e9;
bool vis[N];
int sign[N], val[N];
vector<pair<int, int> > g[N];
set<int> answer;

void dfs(int k)
{
	vis[k]=1;
	for(auto it:g[k])
	{
		if(vis[it.first])
		{
			int shouldbe=it.second;
			int valsum=val[k] + val[it.first];
			if(sign[k]==sign[it.first] && sign[k]==0)
			{
				int diff=shouldbe-valsum;
				if(diff>0 && diff%2==0)
				{
					answer.insert(diff/2);
				}
				else
				{
					cout<<"0";
					exit(0);
				}
			}
			else if(sign[k]==sign[it.first] && sign[k]==1)
			{
				int diff=-1*(shouldbe-valsum);
				if(diff>0 && diff%2==0)
				{
					answer.insert(diff/2);
				}
				else
				{
					cout<<"0";
					exit(0);
				}
			}
			else
			{
				if(valsum!=shouldbe)
				{
					cout<<"0";
					exit(0);
				}
			}
			continue;
		}
		sign[it.first]=sign[k]^1;
		val[it.first]=it.second-val[k];
		dfs(it.first);
	}
	if(sign[k]==0)
	{
		l=max(l, 1-val[k]);
	}
	else
	{
		r=min(r, val[k]-1);
	}
}

int32_t main()
{
	IOS;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int u, v, w;
		cin>>u>>v>>w;
		g[u].push_back({v, w});
		g[v].push_back({u, w});
	}
	dfs(1);
	if(answer.size()==1 && l<=r)
	{
		cout<<answer.size();
	}
	else
	{
		if(l<=r && answer.size()<=1)
			cout<<r-l+1;
		else
			cout<<"0";
	}
	return 0;
}   

Measured memory_bytes: 14208
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
const int M = 1000000007;

int main() {
    vector<int> msp;
    for (int i = 6; i < 300005; i += i % 7 ^ 4) {
        bool f = true;
        for (int j : msp) {
            if (i % j == 0) {
                f = false;
                break;
            }
        }
        if (f)
            msp.push_back(i);
    }
    while (1) {
        int n;
        cin >> n;
        if (n == 1) return 0;
        cout << n << ":";
        for (int i : msp) {
            if (i > n) break;
            if (n % i == 0)
                cout << " " << i;
        }
        cout << "\n";
    }
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define debug(x) cerr << #x << " = " << x << endl

int main(int qtd, char* nome[])
{
	ios::sync_with_stdio(false);
	cin.tie(0);
 
	int n, m;
	cin >> n >> m;
	function<ll(int)> sum = [&sum](int n){return n? (ll)n-1+sum(n-1): 0;};
	cout << sum(n)+sum(m) << endl;
	
	return 0;
}

Measured memory_bytes: 3572
#include <bits/stdc++.h>
typedef long long int lld;
typedef unsigned long long int llu;
#define INF (lld)(9223372036854775807)
#define IINF (int)(2147483647)

using namespace std;
int main(void) {
  lld n, k, p[100] = {}, d, a, s = 0;
  cin >> n >> k;
  for (lld i = 0; i < k; i++) {
    cin >> d;
    for (lld j = 0; j < d; j++) {
      cin >> a;
      p[a - 1] = 1;
    }
  }
  for (lld i = 0; i < n; i++) {
    if (p[i] == 0) s++;
  }
  cout << s << "\n";
}

Measured memory_bytes: 3632
import sys
N, K = map(int, input().split())
A = list(map(int, input().split()))
#A = [i for i in range(1,2)] + [i for i in range(2,1001)] * 4
A.sort()

DP = [0 for k in range(K+1)] #和がkとなる部分集合の数
DP[0] = 1
for a in A:
  for k in range(K-a,-1,-1):
    DP[k+a] += DP[k]

"""
for k in range(1,2*K+1): #累積和へ変換
  DP[k] += DP[k-1]
print(DP)
"""
"""
if sum(DP[0:K]) == 2**N:
  print(N)
  sys.exit()
"""
#print(DP)  


def det(t):
  a = A[t]
  if a >= K:
    return False
  DP_rev = [0 for _ in range(K)] #戻すDP!!!
  ans = True
  for i in range(K):
    DP_rev[i] = DP[i] 
    if i-a >= 0:
      DP_rev[i] -= DP_rev[i-a]
    if i >= K-a and DP_rev[i] > 0:
      ans = False
      break
  del DP_rev
  return ans

lt = 0
rt = N-1
if not det(lt):
  print(0)
  sys.exit()
if det(rt):
  print(rt+1)
  sys.exit()

while rt - lt > 1:
  ct = (lt + rt) // 2
  if det(ct):
    lt = ct
  else:
    rt = ct
print(rt)


Measured memory_bytes: 229896
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("section-anchors")
#pragma GCC optimize("profile-values,profile-reorder-functions,tracer")
#pragma GCC optimize("vpt")
#pragma GCC optimize("rename-registers")
#pragma GCC optimize("move-loop-invariants")
#pragma GCC optimize("unswitch-loops")
#pragma GCC optimize("function-sections")
#pragma GCC optimize("data-sections")
#pragma GCC optimize("branch-target-load-optimize")
#pragma GCC optimize("branch-target-load-optimize2")
#pragma GCC optimize("btr-bb-exclusive")
#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
// #define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1000000007;
const int MAXN = 3e5;
//const ld eps = 1e-6;
const ld eps2 = 1e-9;
const int MOD2 = 998244353;
const int dosz = 5e5;
const int SZ = (1<<18);
const ld PI = atan2l(0, -1);


void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
        // freopen("a.in", "r",stdin);
#else
       // freopen("mxnl.in", "r", stdin);
       // freopen("mxnl.out", "w", stdout);
#endif
}

int gcd(int a, int b){
    return (b?gcd(b, a%b):a);
}

void solve(){ 
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << " " << b << " " << c << endl;
}

signed main() {
    fast_io();
    int q = 1;
    // cout << fixed << setprecision(6);
    // cin >> q;
    // cout << 1 << endl;
    while(q--){
        solve();
    }
    return 0;
}



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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using edge = pair<ll, P>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

int id[1005][1005];

int toId(int x, int y) {
    if (x > y) swap(x, y);
    return id[x][y];
}

int visited[(1005 * 1004) / 2];
int dp[(1005 * 1004) / 2];

int dfs(int v, Graph &graph) {
    if (visited[v] == 2) {
        return -1;
    }
    if (visited[v] == 1) {
        return dp[v];
    }
    visited[v] = 2;
    dp[v] = 1;
    for (int u : graph[v]) {
        int tmp = dfs(u, graph);
        if (tmp == -1) {
            return -1;
        }
        dp[v] = max(dp[v], tmp + 1);
    }
    visited[v] = 1;
    return dp[v];
}

void Main() {
    int N;
    cin >> N;
    int MAX_V = (1005 - 1) * 1005 / 2;
    int cnt = 0;
    rep(i, 1005) rep(j, 1005) {
            if (i < j) {
                id[i][j] = cnt++;
            }
        }
    Graph graph(MAX_V, vector<ll>());
    rep(i, N) {
        vector<int> A(N - 1);
        rep(j, N - 1) {
            cin >> A[j];
        }
        rep(j, N - 2) {
            graph[toId(i, A[j] - 1)].push_back(toId(i, A[j + 1] - 1));
        }
    }

    int ans = 0;
    for (int i = 0; i < MAX_V; ++i) {
        int tmp = dfs(i, graph);
        if (tmp == -1) {
            cout << -1 << endl;
            return;
        } else {
            ans = max(ans, tmp);
        }
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 35584
#include<iostream>
using namespace std;
#include<string>
#include<utility>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i< (n); ++i)
typedef long long ll;

int main(){
    int N;
    cin >> N;
    int h[N]={0};
    rep(i,N){
        cin >> h[i];
    }
    h[N]=0;
    int k[N];
    rep(i,N){
        k[i]=h[i];
    }
    sort(k,k+N);
    int t[N];
    rep(i,N){
        t[i]=h[i]-k[N-1];
    }
    int res=h[0];
    int tmp=0;
    for(int i=0;i<=N-1;++i){
        if(h[i]<h[i+1]){
            res+=h[i+1];
            tmp+=h[i];
        }
        else{
            res-=tmp;
            tmp=0;
        }
    }
    cout << res;
    }

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

int main(){
    int N,X,Y; cin >> N >> X >> Y;X--,Y--;
    vector<vector<int>> dist(N,vector<int>(N,-1));
    for(int i = 0; i < N; i++){
        queue<int> que;
        que.push(i);
        dist[i][i] = 0;
       // cout << "b" << endl;
        
        while(!que.empty()){
            auto v = que.front();que.pop();
            vector<int> vec;
            if(v < N-1)vec.push_back(v+1);
            if(v > 0)vec.push_back(v-1);
            if(v == X) vec.push_back(Y);
            if(v == Y) vec.push_back(X);
            for(auto u:vec){
                if(dist[i][u]==-1){
                    dist[i][u] = dist[i][v] + 1;
                    que.push(u);
                }
            }
        }
    }
    //cout << "a" << endl;
    vector<int> ans(N,0);
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            ans[dist[i][j]]++;
        }
    }
    for(int i = 1; i < N; i++) cout << ans[i] << endl;
    
}




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

int main() {
  int N;
  cin >> N;
  if (N % 2 == 0)
  cout << 0.5 << endl;
  else
  cout << ((N + 1.0) / 2.0) / (N + 0.0) << endl; 
}


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

int main() {
	int n[5][4][11] = { {{0}} };
	int a = 0, b = 0, f = 0, r = 0, v = 0;

	cin >> a;
	for (int i = 0;i < a;i++) {
		cin >> b >> f >> r >> v;
		n[b][f][r] += v;
	}

	for (b = 1; b <= 4;b++) {
		for (f = 1;f <= 3;f++) {
			for (r = 1;r <= 10;r++) {
				cout << " " << n[b][f][r];
			}
			cout << endl;
		}
		if(b != 4)
			cout << "####################" << endl;
	}
}

Measured memory_bytes: 3076
/**   Created by: Marcos Portales
          Codeforces User: marcosportales
          Country: Cuba
          ABC093-C
                         **/
#include<bits/stdc++.h>
using namespace std;
/// Macros:
#define int long long
#define f first
#define s second
#define db(x) cerr << #x << ": " << (x) << '\n';
#define pb push_back
#define lb lower_bound
#define up upper_bound
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
#define enl '\n'
#define vi vector<int>
#define sz size
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,x,n) for(int i=x;i<(n);i++)
typedef pair<int,int> ii;
#define vii vector<ii>
typedef long double ld;
typedef unsigned long long ull;
/// Constraints:
const int maxn = 2*1e5+1;
const int mod = 1000000009;
const ld eps = 1e-9;
const int inf = ((1ll<<31ll)-1ll);
const int INF = 10000000000000000ll;
const ld pi = acos(-1);
/// Prime Numbers:
// 2, 173, 179, 181, 197, 311, 331, 737, 1009, 2011, 2027, 3079, 4001, 10037, 10079, 20011, 20089;
// 100003, 100019, 100043, 200003, 200017, 1000003, 1000033, 1000037, 1000081;
// 2000003, 2000029, 2000039, 1000000007, 1000000021, 2000000099;
/// Functions:
#define lg2(x) 31 - __builtin_clz(x)
#define lgx(x,b) ( log(x) / log(b) )
/// Red-Black Tree Template ---------------------------------
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
/// Quick Pow------------------------------------------------
int qpow(int b,int e){
    if( !e ) return 1;
    if( e & 1 ) return qpow(b,e-1) * b;
    int pwur = qpow(b,e>>1);
    return pwur * pwur;
}
int modinv(int x){
    return qpow(x,mod-2);
}
/// Criba de Eratostenes ------------------------------------
const int pr=10000;
map<int,int>isp;
void criba(){
    for(int i=0;i<=pr;i++)isp[i]=i;
    isp[0]=isp[1]=-1;
    for(int i=2;i*i<=pr;i++){
        if(isp[i]==i){
        for(int j=2*i;j<=pr;j+=i)
            isp[j]=i;
        }
    }
}
/// My Code -------------------------------------------------

int32_t main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout.setf(ios::fixed); cout.precision(0);
    srand(time(NULL));

    ///freopen("a.in","r",stdin);
    ///freopen("a.out","w",stdout);
    ///criba();
    vi v(3);
    cin>>v[0]>>v[1]>>v[2];
    sort(rall(v));
    int ans=0;
    while(v[1]+2<=v[0]){
        v[1]+=2;
        ans++;
    }
    while(v[2]+2<=v[0]){
        v[2]+=2;
        ans++;
    }
    if(v[1]==v[2]){
        if(v[1]!=v[0])ans++;
    }
    else ans+=2;
    cout<<ans<<enl;

    return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

#define REP(i,s,e) for(int i=int(s);i<=int(e);i++)
#define rep(i,n) for(int i=0;i<int(n);i++)

int a[10][10000];
int R,C;
int m=0;
void fr(int j){

rep(i,R){ if(a[i][j]==0) a[i][j]=1;
         else a[i][j]=0;
}
}

void fc(int i){

rep(j,C) {if(a[i][j]==0) a[i][j]=1;
         else a[i][j]=0;
}
}

void g(int k){

	if(k==R){
		rep(j,C){

		int p=0;
		rep(i,R) if(a[i][j]==1) p++;

		if(p>R-p) fr(j);

		}

		int c=0;
		rep(i,R) rep(j,C)
		if(a[i][j]==0) c++;

		if(m<c) m=c;

        return;
		}

	    g(k+1);

	    fc(k);
	    g(k+1);

}

int main(){

	while(true){

		cin >> R >> C;
		if(R==0 && C==0) break;

		rep(i,R) rep(j,C)
		cin >> a[i][j];

		g(0);


		cout << m << endl;

		rep(i,R) rep(j,C) a[i][j]=0;

	}

	return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


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

  ll N, M;
  cin >> N >> M;

  ll num_edge;
  if(N == 1 && M == 1){
    num_edge = 0;
  }else if(N == 1 || M == 1){
    num_edge = 2;
  }else{
    num_edge = 2 * (N + M) - 4;
  }

  cout << N * M - num_edge << endl;

  
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll x;
 ll cnt = 0;
 cin>>x;
 ll now = 100;
 while( now < x ){
  now = now + (0.01*now);
  cnt++;
 }
 cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3636
inp = input().split(" ")
num_vertex = int(inp[0])
num_edge = int(inp[1])

visited = []
def _dfs(graph, start, end):
	neighbors = graph[start]
	for i in neighbors:
		if i == end:
			return True
		elif i not in visited:
			visited.append(i)
			found = _dfs(graph, i, end)
			if found:
				return found
	return False

def dfs(graph, start, end):
	global visited
	visited = []
	return _dfs(graph, start, end)

vertices = {}
edges = []
for i in range(num_vertex):
	vertices[i+1] = []

for i in range(num_edge):
	inp = input().split(" ")
	edge = list(map(int, inp))
	vertices[edge[0]].append(edge[1])
	vertices[edge[1]].append(edge[0])
	edges.append(edge)

bridges = 0
for edge in edges:
	v = vertices.copy()
	e0 = v[edge[0]].copy()
	e1 = v[edge[1]].copy()
	e0.remove(edge[1])
	e1.remove(edge[0])
	v[edge[0]] = e0
	v[edge[1]] = e1
	if not dfs(v, edge[0], edge[1]):
		bridges += 1
print(bridges)

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define var(n) int n; scn(n)
#define F first
#define S second 
#define pb push_back
const int N=1e6+5;
// const ll M = 998244353;
const ll M=1e9+7;
const ll inf=1e18;



int main()
{
	var(n);var(k);
	int a[n],dp[n];
	rep(i,0,n)
	{		
		scn(a[i]);
		dp[i]=M;
	}
	dp[0]=0;
	for(int i=1;i<n;i++)
	{
		for(int j=max(0,i-k);j<i;j++)
		{
			dp[i] = min(dp[i],dp[j]+abs(a[i]-a[j]));
		}
	}
	pri(dp[n-1]);
}

Measured memory_bytes: 1024
// ------- PBDS ------ //
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
// ------- PBDS ------ //

#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define testcase ll tt; cin>>tt; while(tt--)
#define pb push_back
#define nn cout<<"\n"
#define MOD 1000000007
#define pi 3.1415926535
#define endl "\n"
#define vll vector<ll>
#define MULTI int T; cin >> T; while(T--)
#define all(a)      (a).begin(),(a).end()
#define here cout<<"I'm here\n";
void vout(vector<ll> ans){
    for(auto ele:ans) cout<<ele<<" "; cout<<endl;
}
vector<ll> adj[200001];
bool vis[200001];

// ------- PBDS ------ //
typedef tree<
// change this for any data-type
string,
null_type,
// change this for any data-type
less<string>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

/*
    to get the position of an element in set , do
    s.order_of_key(ele);
    this returns the number of elements strictly lesser than ele in set s
    Let us assume we have a set s : {1, 5, 6, 17, 88}, then :
    s.order_of_key(6) : Count of elements strictly smaller than 6 is 2.
    s.order_of_key(25) : Count of elements strictly smaller than 25 is 4.

    to get the element at position k
    s.find_by_order(k);
    returns an iterator to the ele counting from 0
    Let us assume we have a set s : {1, 5, 6, 17, 88}, then :
    *(s.find_by_order(2)) : 3rd element in the set i.e. 6
    *(s.find_by_order(4)) : 5th element in the set i.e. 88
*/

// ------- PBDS ------ //

clock_t time_p=clock();
void purvansh11()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

//BINARY EXPONENTIATION  -- O(log2(b))
ll power(ll a, ll b) {
    /*
        for 3^11 :
        as 11 -> 1011, we mean 3^8 * 3^2 * 3^1
        so multiply for all ones in binary rep of b
    */

    ll ans = 1;
    ll num = a;
    while (b > 0) {
        if (b & 1) ans = ((ans % MOD) * (num % MOD)) % MOD;
        num = ((num % MOD) * (num % MOD)) % MOD;
        b /= 2;
    }
    return ans;
}
ll n;
ll dp[200005];
vector<ll> v;
ll solve(ll i){
    if(i>=n) return 0;
    if(dp[i] != -1) return dp[i];

    ll a,b;
    a = 0;
    b = 0;
    
    if( i+1 <= n-1)
        a = (abs(v[i+1] - v[i]) + solve(i+1));
    
    if( i+2 <= n-1)
        b = (abs(v[i+2] - v[i]) + solve(i+2));
    else
        return dp[i] = a;

    return dp[i] = min(a,b);

}
int main() {
// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif

    SPEED;
    cout.precision(8);
    cout << fixed;
    
    cin>>n;
    for(ll i=0;i<n;i++){ll temp; cin>>temp; v.pb(temp);}
    memset(dp,-1,sizeof(dp));
    cout<<solve(0);
    
    purvansh11();
    return 0;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N, M;
    cin >> N >> M;
    vector<P> items(N);
    rep(i, N) cin >> items[i].first >> items[i].second;
    sort(items.begin(), items.end());
    priority_queue<ll> pque;
    ll idx = 0;
    ll ans = 0;
    rep2(i, 1, M + 1) {
        while (idx < N && items[idx].first <= i) {
            pque.push(items[idx].second);
            idx++;
        }
        if (!pque.empty()) {
            ans += pque.top();
            pque.pop();
        }
    }
    cout << ans << '\n';
}

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


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int x, y;
int main() {
    cin >> x >> y;
    int ans = 2e9 + 100;
    if (x <= 0 && y <= 0) {
        if (x > y) {
            //printf("%d\n", x - y + 2);
            ans = min(x - y + 2, ans);
        } else {
            //printf("%d\n", y - x);
            ans = min(y - x, ans);
        }
    } 
    if (x <= 0 && y >= 0) {
        // printf("%d\n", abs(x + y) + 1);
        ans = min(abs(x + y) + 1, ans);
    }
    if (x >= 0 && y <= 0) {
        //printf("%d\n", abs(x + y) + 1);
        ans = min(abs(x + y) + 1, ans);
    } 
    if (x >= 0 && y >= 0) {
        if (x < y) ans = min(y - x, ans);//printf("%d\n", y - x);
        else ans = min(ans, x - y + 2);//printf("%d\n", x - y + 2);
    }
    if (x < y) {
        ans = min(ans, y - x);
    } 
    printf("%d\n", ans);
}

Measured memory_bytes: 256
#include <vector> 
#include <list> 
#include <map> 
#include <set> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <bitset> 
#include <algorithm> 
#include <functional> 
#include <numeric> 
#include <utility> 
#include <sstream> 
#include <iostream> 
#include <iomanip> 
#include <cstdio> 
#include <cmath> 
#include <cstdlib> 
#include <cctype> 
#include <string> 
#include <cstring> 
#include <ctime> 

using namespace std;

#define _int64 long long

map<pair<string,int>,int> mp;

char s[100];

int main()
{
  int i,j,k,n,cnt;
  _int64 ans;
  string ss;
  scanf("%d",&n);
  scanf("%s",s);
  mp.clear();
  for (i=0;i<(1<<n);i++)
  {
    ss="";
    for (j=0;j<n;j++)
      if (((1<<j)&i)==0)
        ss.push_back(s[j]);
    cnt=ss.length();
    for (j=n-1;j>=0;j--)
      if (((1<<j)&i)!=0)
        ss.push_back(s[j]);
    mp[make_pair(ss,cnt)]++;
  }
  ans=0;
  for (i=0;i<(1<<n);i++)
  {
    ss="";
    for (j=n-1;j>=0;j--)
      if (((1<<j)&i)!=0)
        ss.push_back(s[n+j]);
    cnt=ss.length();
    for (j=0;j<n;j++)
      if (((1<<j)&i)==0)
        ss.push_back(s[n+j]);
    ans+=mp[make_pair(ss,cnt)];
  }
  printf("%lld\n",ans);
}

Measured memory_bytes: 73984
numeros = [1,2,3,4,5,6,7,8,9]
multiplicaciones = []

for x in numeros:
	for z in numeros:
		multiplicaciones.append(x*z)
		pass
	pass
entrada = int(input())
si = False
for x in multiplicaciones:
	if(x==entrada):
		si=True
		break

if(si):
	print("Yes")
else:
	print("No")

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

int main() {
  while (true) {
    int H, W;
    cin >> H >> W;
    if (H == 0 and W == 0) break;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if ((i + j) % 2) cout << '.';
        else cout << '#';
      }
      cout << endl;
    }
    cout << endl;
  }
}


Measured memory_bytes: 3096
# 2019-11-18 23:58:23(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 


def main():
    n, k, *h = [int(x) for x in sys.stdin.read().split()]
    count = 0
    for i in range(n):
        if h[i] >= k:
            count += 1
    print(count)


if __name__ == "__main__":
    main()


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

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

  vector<int> A(3);
  cin >> A[0] >> A[1] >> A[2];
  sort(A.begin(), A.end());

  if(A[2] == A[0] && A[1] == A[0]){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }



  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x); i<=(y); i++)
#define ll long long
#define N 100010
using namespace std;
int n,w[30][N]; char s[N];
int main(){
	scanf("%s",s+1); n=strlen(s+1);
	rep (i,1,n-1) if (s[i]==s[i+1]){
		printf("%d %d\n",i,i+1);
		exit(0);
	}
	rep (i,1,n-2) if (s[i]==s[i+2]){
		printf("%d %d\n",i,i+2);
		exit(0);
	}
	puts("-1 -1");
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
   ll dp[2000000];
 int gcd(int a, int b)
{
  if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b,a%b));
}
}
int main(){
  ll a;cin>>a;
  ll b=a%100,c=a/100;
  if(c*5>=b)cout<<1;
  else cout<<0;
}



Measured memory_bytes: 27012
from enum import Enum
from queue import Queue

import numpy as np

import collections
import bisect
import sys
import math

from scipy.sparse.csgraph import floyd_warshall

BIG_NUM = 200000000000
MOD = 1000000007
EPS = 0.000000001

N = int(input())
print(math.ceil(N/2)/N)


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb push_back 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)
const ll MOD=1000000007;
const ll INF=1000000000000000;

vector<ll> pw2(51,1); vector<ll> pw10(19,1);
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll mid(ll x,ll y,ll z){return x>y?y>=z?y:min(z,x):x>=z?x:min(y,z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll myceil(ll x,ll y){if(x<=y) return 1;else if(x%y==0) return x/y;else return x/y+1;}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> divisor(ll x){vector<ll> div;
	for(ll i=1;i*i<=x;i++){if(x%i==0){div.pb(i);if(i*i!=x)div.pb(x/i);}}
	sort(div.bg,div.ed);return div;}

int main(){
	//rep1(i,50) pw2[i]=2*pw2[i-1];
	//rep1(i,18) pw10[i]=10*pw10[i-1];
    ll N; cin>>N;
	vector<ll>A(N);
	rep(i,N) cin>>A[i];
	double tmp=0.0,seki=1;
	rep(i,N){
		seki*=A[i];
	}
	rep(i,N){
		tmp+=seki/A[i];
	}
	printf("%.8f",seki/tmp);
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>

#define ll long long
#define ull unsigned long long

using namespace std;

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

	vector<ll> x(N, 0);
	vector<ll> y(N, 0);
	vector<ll> z(N, 0);
	for (int i = 0; i < N; ++i){
		cin >> x[i] >> y[i] >> z[i];
	}

	ll max = 0;
	for (int xx = 0; xx < 2; ++xx){
		for (int yy = 0; yy < 2; ++yy){
			for (int zz = 0; zz < 2; ++zz){
				vector<ll> tmp(N, 0);
				for (int ii = 0; ii < N; ++ii){
					tmp[ii] = (2*xx - 1) * x[ii] + (2*yy - 1) * y[ii] + (2*zz - 1) * z[ii];
				}
				//ソートして大きい方からM個選んで和をとる
				sort(tmp.rbegin(), tmp.rend());
				ll sum = 0;
				for (int ii = 0; ii < M; ++ii){
					sum += tmp[ii];
				}
				if (max < sum){
					max = sum;
				}
			}
		}
	}

	cout << max << endl;

	return 0;
}



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

int main(){
  int a,b=0,c;
  cin>>a;
  c=a;
  
  while(a>0){
    b+=a%10;
    a/=10;
  }
  
  if(c%b==0){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <stack>
using namespace std;
#define ll int64_t
const long mod = 1e9 + 7;


const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


int main() {
  ll n;
  string s;
  cin >> n;
  cin >> s;

  vector<long> numw(n+1,0);
  vector<long> numb(n+1,0);

  long cw = 0;
  long cb = 0;
  for (ll i = 0; i < s.size() ; ++i) {
    if (s[i] == '.') {
       cb++;
    }
  }
  numb[0] = cb; //全体の白の数


  for (ll i = 0; i < s.size() ; ++i) {
    if (s[i] == '#') {
      cw++;
    }else{
      cb--;
    }
    numw[i+1] = cw;
    numb[i+1] = cb;
  }

  long ans = 1000000000;

  for (int i = 0; i < n+1; ++i){
    ans = min(ans,numw[i] + numb[i]);
  }



  cout <<ans <<endl;


}




















Measured memory_bytes: 3716
import java.util.Scanner;
public class Main{
    
    public static void main(String[] args){
    		Scanner sc = new Scanner(System.in);
        	int a =sc.nextInt();
        	int b =sc.nextInt();
        	int c =sc.nextInt();
        		if(a < b && b < c){
            		System.out.println(a+" "+b+" "+c);
            	}else if(a <= c && c <= b){
					System.out.println(a+" "+c+" "+b);
                }else if(b <= a && a <= c){
					System.out.println(b+" "+a+" "+c);
                }else if(b <= c && c <= a){
					System.out.println(b+" "+c+" "+a);
                }else if(c <= a && a <= b){
					System.out.println(c+" "+a+" "+b);
                }else{
					System.out.println(c+" "+b+" "+a);
			}
        sc.close();
    }
}



Measured memory_bytes: 26176
#include<bits/stdc++.h>
#define ll long long int 
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mp make_pair
#define pll pair<ll,ll>
#define vll vector<ll>
#define mll map<ll,ll>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define pqmin priority_queue<ll,vector<ll>,greater<ll>>
#define pqmax priority_queue<ll>
using namespace std;
ll power(ll a,ll n){
	if(n==0)
	  return 1;
	if((n%2)==0)
	  return (power((a*a),n/2));
	else
	  return (a*(power((a*a),n/2)));    
}
int main()
{
  IOS;
 ll a,b;
 cin>>a>>b;
 if(max(a,b)>=10)
 cout<<-1<<endl;
 else
 cout<<a*b<<endl;
}

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

int main(void){
    
    int rate[10] = {};

    int n; cin >> n;

    for(int i = 0; i < n; i++){
        int input;
        cin >> input;
        input = input/400;
        if(input >= 8) input = 8;

        rate[input]++;
        //cout << input << endl;
    }

    //for(int i = 0; i < 9; i++) cout << rate[i] << " ";
    //cout << endl;

    int num = 0;

    for(int i = 0; i < 8; i++){
        if(rate[i] > 0) num++;
    }

    int max = num + rate[8];
    

    int min = num;
    if(min == 0) min = 1;

    cout << min << " " << max << endl;


    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt(), y = sc.nextInt();
		int ans = 0;
		if(x==3)ans += 100000;
		else if(x==2)ans+= 200000;
		else if(x==1)ans += 300000;
		if(y==3)ans += 100000;
		else if(y==2)ans+= 200000;
		else if(y==1)ans += 300000;
		if(x==1&&y==1)ans+=400000;
		System.out.println(ans);
		sc.close();
	}
}

Measured memory_bytes: 23764
#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 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
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;}

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


Measured memory_bytes: 2420