akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;
template <typename T>
using GPQ = priority_queue<T, vector<T>, greater<T>>;
using P = pair<int, int>;

int main() {
    int n, c;
    cin >> n >> c;
    vector<GPQ<P>> v(c), v2(c);
    for (int i = 0; i < n; ++i) {
        int ss, tt, cc;
        scanf("%d%d%d", &ss, &tt, &cc);
        v[cc-1].emplace(ss, tt);
    }
    vector<int> imos(100001, 0);
    for (auto &Q: v) {
        P p;
        if(!Q.empty()) {
            p = Q.top(); Q.pop();
            if(Q.empty()) {
                imos[p.first-1]++; imos[p.second]--;
            }
        }
        while (!Q.empty()){
            P p2 = Q.top(); Q.pop();
            if(p.second == p2.first) {
                p.second = p2.second;
                if(Q.empty()){
                    imos[p.first-1]++; imos[p.second]--;
                }
            }
            else{
                imos[p.first-1]++; imos[p.second]--;
                p = p2;
            }
        }
    }
    int sum = 0, ans = 0;
    for (int i = 0; i < 100001; ++i) {
        sum += imos[i];
        ans = max(ans, sum);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 1920
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSData *stdinData = [[NSFileHandle fileHandleWithStandardInput] availableData];
        NSString *s = [[NSString alloc] initWithData:stdinData encoding:NSUTF8StringEncoding];
        NSArray *arr = [s componentsSeparatedByString:@" "];
        NSInteger A = [[arr objectAtIndex:0] integerValue];
        NSInteger B = [[arr objectAtIndex:1] integerValue];
        NSString *answer = [NSString stringWithFormat:@"%ld",MAX(A+B,MAX(A-B,A*B))];
        
        NSFileHandle *fileHandle = [NSFileHandle fileHandleWithStandardOutput];
        [fileHandle writeData:[answer dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle writeData:[@"\n" dataUsingEncoding:NSUTF8StringEncoding]];
        [fileHandle closeFile];
    }
    
    return 0;
}


Measured memory_bytes: 2404
n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in range(n):
    if a[i] in dic:
        dic[a[i]] += 1
    else:
        dic[a[i]] = 1
st = 0
for i in dic.values():
    st += i*(i-1)//2
for i in range(n):
    j = a[i]
    if dic[j] == 1:
        print(st)
    else:
        d = dic[j]
        print(st-d*(d-1)//2 + (d-1)*(d-2)//2)


Measured memory_bytes: 26268
import math
s=input()
l=len(s)
a="g"*math.ceil(l/2)+"p"*(l//2)
ans=0
for i in range(l):
  if a[i]==s[i]:
    pass
  elif a[i]=="g" and s[i]=="p":
    ans-=1
  else:
    ans+=1
print(ans)

Measured memory_bytes: 40336
#include <iostream>
using namespace std;
int main(){
    int a, b;
    cin >> a >> b;
    if((a + b) % 2 == 0)
    cout << (a + b) / 2 << endl;
    else 
    cout << (a + b) / 2 + 1 << endl;
    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  int n,m,r;
  while(cin>>n>>m>>r,n||m||r){
    double sum=0;
    vector<int>in(n);
    rep(i,n){cin>>in[i];sum+=in[i];}
    sum*=(100-r);
    if(in[m-1])cout<<(int)(sum/in[m-1])<<endl;
    else cout<<0<<endl;
  }


}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
using Int = int64_t;

int main() {
  string S;
  cin >> S;
  Int N = S.size();
  S = ' ' + S;

  Int j=N;
  for(Int i=1; i<=N; i++) {
	if (S[i] != S[j--]) {
      cout << "No" << endl;
      return 0;
    }
  }
  
  j=(N-1)/2;
  for(Int i=1; i<=(N-1)/2; i++) {
	if (S[i] != S[j--]) {
      cout << "No" << endl;
      return 0;
    }
  }
  
  j=N;
  for(Int i=(N+3)/2; i<=N; i++) {
	if (S[i] != S[j--]) {
      cout << "No" << endl;
      return 0;
    }
  }

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


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import itertools

n, k =map(int, input().split())
A = []
for i in range(k):
    d = int(input())
    A.append(list(map(int, input().split())))
A = list(itertools.chain.from_iterable(A))
print(n-len(set(A)))

Measured memory_bytes: 9292
#include <bits/stdc++.h>
using namespace std;
int main() {
   int N;
   double T;
   int A;
   cin >> N >> T >> A;
   vector<double> vec(N);
   for (int i = 0; i < N; i++) {
   cin >> vec.at(i);
   }
   
   double sa;
   if((T-vec.at(0)*0.006)>=A) {
               sa = (T-vec.at(0)*0.006)-A;
   }
   else sa = A-(T-vec.at(0)*0.006);
   
   int number=0;
  
   for(int j = 0;j < N;j++){
       if((T-vec.at(j)*0.006)>=A){
           if((T-vec.at(j)*0.006-A)<sa) {
               sa = (T-vec.at(j)*0.006)-A;
               number = j;
           }
       }
       else {
           if((A-(T-vec.at(j)*0.006))<sa) {
               sa= A-(T-vec.at(j)*0.006);
               number = j;
           }
       }
   }
   
    cout << number+1 << endl;
}

Measured memory_bytes: 256
S=str(input())
K=int(input())
S_list=list(S)
J=[]
for i in range(len(S)):
  for j in range(i+1,min(i+6,len(S)+1)):
    J += [''.join(S[i:j])]
J=sorted(list(set(J)))
print(J[K-1])

Measured memory_bytes: 5068
#include <iostream>
using namespace std;
int main(){
   int a,b,c;
   int yakusu=0;
   cin >> a >> b >>c;
  for(int i=1;i<(c+1);i++){
    if((c%i==0)&&((a<=i)&&(i<=b))){
      yakusu++;
    }
  }
    cout <<yakusu<<endl;
    return 0;
}


Measured memory_bytes: 3092
N,M,X=map(int,input().split())
CA=[list(map(int,input().split())) for i in range(N)]
kotae=[]
def saiki(A):
    if len(A)==N:
        goukei=[0]*M
        onedan=0
        for i in range(N):
            if A[i]==1:
                for j in range(M):
                    goukei[j]+=CA[i][j+1]
                onedan+=CA[i][0]
        #print(goukei)
        if min(goukei)>=X:
            kotae.append(onedan)
        return
    for i in range(2):
        A.append(i)
        saiki(A)
        A.pop()
saiki([])
if len(kotae)==0:
    print(-1)
    exit()
print(min(kotae))

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

typedef long long ll;


int main () {
	bool e[100000];
	int h[100000] = {0};
	int N, M;
	cin >> N >> M;
	for (int i=0; i<N; i++) {
		int tmp;
		cin >> tmp;
		h[i] = tmp;
		e[i] = true;
	}
	for (int i=0; i<M; i++) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		if (h[a] >= h[b]) {
			e[b] = false;
		}
		if (h[b] >= h[a]) {
			e[a] = false;
		}
	}

	int cnt = 0;
	for (int i=0; i<N; i++) {
		if (e[i])
			cnt ++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 4108
#include <bits/stdc++.h> 
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define int long long
#define ld double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD =1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1LL;}return res%p;}
const int N=2*1e5+2,M=20;
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ordered_set s;
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	// freopen("out10.txt","w",stdout);
	#endif
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=1;i<n;i++) a[i]+=a[i-1];
	s.insert({0-(-1)*k,-1});
	int ans=0;
	for(int i=0;i<n;i++)
	{
		int x=a[i]-k*i;
		int get=s.order_of_key({x+1,-1e12});
		ans+=get;
		// cout<<get<<" ";
		s.insert({x,i});
	}
	cout<<ans;
}
// i, j
// (10-0)/(1)>=26
// (sum[j]-sum[i])/(j-i)>=k
// sum[j]-sum[i]>=k*j-k*i
// sum[j]-k*j>=sum[i]-k*i
// 

Measured memory_bytes: 14336
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

constexpr ll infl = 10000000000000007LL;
constexpr int inf = 1000000007;

// 最大公約数
template <typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

int main() {
    int n, k;
    cin >> n >> k;
    int g;
    cin >> g;
    int ma = g;
    for (int i = 0; i < n - 1; ++i) {
        int a;
        cin >> a;
        g = gcd(g, a);
        ma = max(ma, a);
    }

    cout << (k % g == 0 && k <= ma ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    return 0;
}

Measured memory_bytes: 256
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
c=gets.split.map(&:to_i)

a.sort!.reverse!
c.sort!
ans=0
n.times do |i|
  k=a.bsearch_index{|x| x<b[i]}
  next if k.nil?
  l=c.bsearch_index{|x| x>b[i]}
  next if l.nil?
  ans+=(n-k)*(n-l)
end
puts ans


Measured memory_bytes: 26072
#スイッチと電球の番号はすべて1下げる
import numpy as np

N, M = map(int, input().split())
T = [[0 for i in range(M)] for j in range(N)]
for i in range(M):
        S = list(map(int, input().split()))
        for k in range(S[0]):
                T[S[k+1]-1][i] = 1


P = list(map(int, input().split()))

ans = 0
for k in range(2**N):
        Q = np.array([0 for val in range(M)])
        for j in range(N):
                if bin(k >> j)[-1] == '1':
                        Q += np.array(T[j])
                        Q = Q % 2

        if list(Q) == P:
                ans += 1

print(ans)

Measured memory_bytes: 12508
//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int D;

	cin >> D;
	if (D == 22)
	{
		cout << "Christmas Eve Eve Eve" << endl;
	}

	if (D == 23)
	{
		cout << "Christmas Eve Eve" << endl;
	}

	if (D == 24)
	{
		cout << "Christmas Eve" << endl;
	}

	if (D == 25)
	{
		cout << "Christmas" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
var a,b,l,p,x:longint;
s,c,d:string;
begin
    readln(s);
    l:=length(s);
    p:=pos('+',s);
    if p=0 then p:=pos('-',s);
    c:=copy(s,1,p-2);
    d:=copy(s,p+2,l-p);
    val(c,a,x);
    val(d,b,x);
    if s[p]='+' then writeln(a+b)
    else writeln(a-b);
end.


Measured memory_bytes: 128
"use strict";

const main = (arg) => {
  const input = arg.trim().split(" ");
  const a = parseInt(input[0]);
  const b = parseInt(input[1]);
  let answer = a * b;
  if (answer % 2 == 0) {
    console.log("Even");
    return;
  }
  console.log("Odd");
};
main(require("fs").readFileSync("/dev/stdin", "utf8"));
// main("1 21");


Measured memory_bytes: 7372
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
#define ll long long
//#define local

using namespace std;

const int MOD = 1e9+7;
const int inf = 0x3f3f3f3f;
const int maxn = 1e5+100;
const double PI = acos(-1.0);

int a[maxn];
map <int, int> odd;
map <int, int> even;

struct Node {
    int val, cnt;
} c[maxn], d[maxn];

bool cmp (Node n1, Node n2) {
    return n1.cnt > n2.cnt;
}

int main() {
#ifdef local
    if(freopen("/Users/Andrew/Desktop/data.txt", "r", stdin) == NULL) printf("can't open this file!\n");
#endif
    int n;
    int mx = -inf;
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        mx = max(mx, a[i]);
    }
    for (int i = 0; i < n; i = i+2) {
        if (!even.count(a[i])) {
            even[a[i]] = 0;
        }
        even[a[i]]++;
    }
    for (int i = 1; i < n; i = i+2) {
        if (!odd.count(a[i])) {
            odd[a[i]] = 0;
        }
        odd[a[i]]++;
    }
    int count = 0;
    for (int i = 1; i <= mx; ++i) {
        c[count].val = i;
        c[count++].cnt = odd[i];
    }
    sort(c, c+mx, cmp);
    count = 0;
    for (int i = 1; i <= mx; ++i) {
        d[count].val = i;
        d[count++].cnt = even[i];
    }
    sort(d, d+mx, cmp);
    if (c[0].val != d[0].val) printf("%d\n", n-c[0].cnt-d[0].cnt);
    else {
        if (n == 2) printf("1\n");
        else printf("%d\n", min(n-c[0].cnt-d[1].cnt, n-c[1].cnt-d[0].cnt));
    }
#ifdef local
    fclose(stdin);
#endif
    return 0;
}












Measured memory_bytes: 11520
# include <iostream>
# include <algorithm>

using namespace std;

int main() 
{	
	int cnt1[100010];
        int cnt2[100010];
		
        string s , t;
        cin >> s >> t;

	int i , length = s.length();
		
		for (i = 0;i < length;i ++) {
			char ch = s[i];
			if (ch == 'A') {
				if (i == 0) {
					cnt1[i] = 1;
				} else {
					cnt1[i] = cnt1[i - 1] + 1;
				}
			} else {
				if (i > 0) {
					cnt1[i] = cnt1[i - 1] - 1;
				} else 
					cnt1[i] = - 1;
			}
		}
		
		length = t.length();
		for (i = 0;i < length;i ++) {
			char ch = t[i];
			if (ch == 'A') {
				if (i == 0) {
					cnt2[i] = 1;
				} else {
					cnt2[i] = cnt2[i - 1] + 1;
				}
			} else {
				if (i > 0) {
					cnt2[i] = cnt2[i - 1] - 1;
				} else {
					cnt2[i] = - 1;
				}
			}
		}
		
		int total;
                cin >> total;

		for (i = 0;i < total;i ++) {
			int l1 , r1 , l2 , r2;
                        cin >> l1 >> r1 >> l2 >> r2;
                        l1 --;
			r1 --;
			l2 --;
			r2 --;
			
			int result1 = cnt1[r1];
			if (l1 - 1 >= 0) {
				result1 -= cnt1[l1 - 1];
			}
			int result2 = cnt2[r2];
			if (l2 - 1 >= 0) {
				result2 -= cnt2[l2 - 1];
			}
			
			int diff = abs(result1 - result2);
			if (diff % 3 == 0) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}

} 

Measured memory_bytes: 1792
a, b = map(int, input().split())
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
flag = False
if a in A and b in A:
  flag = True
if a in B and b in B:
  flag = True
  
if flag :
  print("Yes")
else :
  print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x.size())
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return ((a%md)*(b%md))%md;}
int addmod(int a, int b, int md) {return (a+b)%md;}
int submod(int a, int b, int md) {return (((a-b)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}


signed main(void)
{
	IOS;
	int h; cin>>h;
	int a; cin>>a;
	int ans=h/a;
	if(h%a) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, d int
	fmt.Scanf("%d %d", &n, &d)
	result := n / (2*d + 1)
	if n%(2*d+1) == 0 {
		fmt.Println(result)
	} else {
		fmt.Println(result + 1)
	}
}


Measured memory_bytes: 512
// Gaurav Aggarwal
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii > vii;
typedef vector<pll > vll;
#define pb push_back
#define mp make_pair 
#define mod 1000000007
#define F first
#define S second
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define For(i, a, b) for(__typeof (a) i=a; i<=b; i++)
#define inp_arr(a,n) for(__typeof (n) i=0; i<n; ++i) {cin>>a[i];}
#define debug_arr(a,n) {{for(__typeof (n) i=0; i<n; ++i) {cout<<a[i]<<" ";}cout<<"\n";}}
 
ll power(ll x, ll y) 
{ 
    ll res = 1;   
    while (y > 0) { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1;
        x = (x*x)%mod; 
    } 
    return res%mod; 
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout); 
    // #endif  

    int a,b;
    cin>>a>>b;

    if(a < 1 or a > 9 or b < 1 or b > 9) cout<<-1;
    else cout<<a*b;

    return 0;
}

Measured memory_bytes: 256
import java.lang.reflect.Array;
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    static class pair {
        int a, b;

        pair(int a, int b) {
            this.a = a;
            this.b = b;
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) throws Exception {
        FastReader in = new FastReader();
        int n=in.nextInt();
        String str=n+"";
        int ans=0;
        
        for (int i = 0; i <str.length(); i++) {
            if(str.charAt(i)=='2'){
                ans++;
            }
        }
        System.out.println(ans);
    }
}

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

int main() {
  int n;
  cin >> n;
  
  if (n%10 == 2 || n%10 == 4 || n%10 == 5 || n%10 == 7 || n%10 == 9){
    cout << "hon";
  }
  if (n%10 == 0 || n%10 == 1|| n%10 == 6 || n%10 == 8){
    cout << "pon";
  }
   if (n%10 == 3){
     cout << "bon";
   }
}


Measured memory_bytes: 3628
module directed_graph_mod
    use,intrinsic :: iso_fortran_env
    implicit none
    type node
        integer(int32), allocatable:: to(:)
        integer(int32):: i
    end type
contains
    subroutine init_dg(n)
        type(node):: n
        allocate(n%to(0))
        n%i=0
    end subroutine

    subroutine regist(n,i)
        type(node):: n
        integer(int32):: i
        if (n%i+1 > size(n%to))call add(n)
        n%i=n%i+1
        n%to(n%i) = i
    end subroutine

    subroutine add(n)
        type(node):: n
        integer(int32), allocatable:: tmp(:)
        integer(int32):: l

        l=size(n%to)
        allocate(tmp(l))
        tmp(:) = n%to(:)
        deallocate(n%to)
        allocate(n%to(max(1,2*l)))
        n%to(1:l) = tmp(:)
        deallocate(tmp)
    end subroutine
end module directed_graph_mod

program name
    use,intrinsic :: iso_fortran_env
    use:: directed_graph_mod
    implicit none

    integer(int32):: n,m,i,ans=0
    integer(int32), allocatable:: dp(:)
    type(node),allocatable:: g(:)

    read*, n,m
    allocate(g(n))
    initialized_graph : do i = 1, n
        call init_dg(g(i))
    end do initialized_graph
    allocate(dp(n),source=-1)
    block
        integer(int32):: x,y
        do i=1,m
            read*, x,y
            call regist(g(x),y)
        end do
    end block
    
    do i=1,n
        ans=max(ans,dfs(i))
    end do

    ! print*, dp(:)
    print'(i0)', ans

contains
    recursive function dfs(num) result(ret)
        integer(int32):: num,ret
        integer(int32):: i, dst
        ret=0
        if (dp(num) /= -1) then
            ret = dp(num)
            return
        end if

        i=1
        do i=1,g(num)%i
            dst = g(num)%to(i)
            ret=max(ret,dfs(dst)+1)
        end do
        dp(num) = ret
    end function
end program name

Measured memory_bytes: 11904
# https://atcoder.jp/contests/m-solutions2020/tasks/m_solutions2020_d

N = int(input())
A = list(map(int, input().split()))
total = 1000

for k in range(N - 1):
    if A[k] <= A[k + 1]:
        kabu = total // A[k]
        total -= kabu * A[k]
        total += kabu * A[k + 1]

print(total)

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

const int N = 100005;
int n, ans, a[N]; map <int, int> ap;
int main () {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
		ap[a[i]] = i;
	}
	sort(a + 1, a + 1 + n);
	for (int i = 1; i <= n; ++i) {
		if ((i & 1) != (ap[a[i]] & 1)) ++ans;
	}
	cout << (ans >> 1) << endl;
	return 0;
}

Measured memory_bytes: 5376
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

if a<40:
    a=40
if b<40:
    b=40
if c<40:
    c=40
if d<40:
    d=40
if e<40:
    e=40
lst=[a,b,c,d,e]
print(int(sum(lst)//5))




Measured memory_bytes: 5596
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=1000005*2;
int n;
char s[N];
int a[N];
int pre[N],nxt[N];
int del[N];
int cnt[3];
void erase(int x){
	pre[nxt[x]]=pre[x];
	nxt[pre[x]]=nxt[x];
	del[x]=1;
	cnt[a[x]]--;
}
struct Node{
	int x,y,z;
	Node(){}
	Node(int _x,int _y,int _z){
		x=_x,y=_y,z=_z;
	}
};
queue <Node> q0[3],q1[3][3];
void Ins(int i){
	if (i==0||i==n+1)
		return;
	int x=pre[i],y=i,z=nxt[i];
	if (x==0||z==n+1||a[x]!=a[z])
		q0[a[y]].push(Node(x,y,z));
	else
		q1[a[y]][a[x]].push(Node(x,y,z));
}
int main(){
	cin>>(s+1);
	n=unique(s+1,s+1+strlen(s+1))-s-1;
	nxt[0]=1,pre[n+1]=n;
	a[n+1]=-1;
	For(i,1,n)
		nxt[i]=i+1,pre[i]=i-1;
	For(i,1,n)
		cnt[a[i]=s[i]-'A']++;
	for (int i=nxt[0];i!=n+1;i=nxt[i])
		Ins(i);
	while (1){
		int id[3]={0,1,2};
		sort(id,id+3,[&](int a,int b){return cnt[a]>cnt[b];});
		int c0=id[0],c1=id[1];
		if (cnt[0]==cnt[1]&&cnt[0]==cnt[2])
			break;
		if (!q0[c0].empty()){
			Node now=q0[c0].front();
			q0[c0].pop();
			if (del[now.x]||del[now.y]||del[now.z])
				continue;
			erase(now.y);
			Ins(now.x);
			Ins(now.z);
		}
		else {
			assert(!q1[c0][c1].empty());
			Node now=q1[c0][c1].front();
			q1[c0][c1].pop();
			if (del[now.x]||del[now.y]||del[now.z])
				continue;
			int w=pre[now.x];
			erase(now.x);
			erase(now.y);
			Ins(w);
			Ins(now.z);
		}
	}
    int cnt = 0;
	for (int i=nxt[0];i!=n+1;i=nxt[i])
		putchar('A'+a[i]);
	puts("");
	return 0;
}

Measured memory_bytes: 48896
#include<iostream>
    #include<cctype>
    #include<cstdio>
    using namespace std;
    int main(){
    char inp;
    int count[26];
    for(int i=0;i<26;i++) count[i]=0;
    while(cin >> inp){
    if(isupper(inp)) inp=tolower(inp);
    if(!islower(inp)) continue;
    count[inp-'a']++;
    }
    for(int i=0;i<26;i++){
    printf("%c : %d\n",(i+'a'),count[i]);
    }
    return 0;
    }
     

Measured memory_bytes: 1124
n,m,q=map(int,raw_input().split())
lrs=[map(int,raw_input().split()) for _ in range(m)]
a=[[0 for j in range(n)] for i in range(n)]
for l,r in lrs:a[l-1][r-1]+=1
cnt=[[0 for j in range(n)] for i in range(n)]
for y in range(n):
 v = 0
 for x in range(y,-1,-1):
  v+=a[x][y]
  cnt[x][y]=cnt[x][y-1]+v
for _ in range(q):
 l,r=map(int,raw_input().split())
 print cnt[l-1][r-1] 

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

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(){
    cin>>n>>m;
    bool flag=IsPrime(m);
    while(true){
        if(flag){
            m=n;
            break;
        }
        if(m%n==0) break;
        n++;
    }
    cout<<m/n<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(){
  int N,Y;
  cin>>N>>Y;
  int f=0;
  rep(i,Y/10000+1){
    rep(j,(Y-i*10000)/5000+1){
      int k=(Y-i*10000-j*5000)/1000;
      if(i+j+k==N){
        cout<<i<<" "<<j<<" "<<k<<endl;
        f=1;
        break;
      }
    }
    if(f) break;
  }
  if(!f) cout<<"-1 -1 -1"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
using Graph = vector<vector<ll>>;

int main(){
  int n;cin>>n;
  vector<int> a(n);for (auto &&i : a)
  {
    cin >> i;
  }
  
  vector<int> b(n);for (auto &&i : b)
  {
    cin >>i;
  }
  
  vector<int> c(n);for (auto &&i : c)
  {
    cin >>i;
  }
  ll ans = 0;
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  for (int i = 0; i < n; i++)
  {
    ll tmp = 1;
    auto aitr = lower_bound(a.begin(),a.end(),b.at(i));
    tmp *= distance(a.begin(),aitr);
    auto citr = upper_bound(c.begin(),c.end(),b.at(i));
    tmp *= distance(citr,c.end());
    ans += tmp;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define testing 0
#define FOR(ii, ss, ee) for(ll ii = (ss); ii <= (ll)(ee); ++ii)
#define DEC(ii, ss, ee) for(ll ii = (ss); ii >= (ll)(ee); --ii)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << endl
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<endl
#define dbv(v) cerr << #v << ":"; for (auto i : v) cerr << i << ' '; cerr << endl
#define dbvp(v) cerr << #v << ":"; for (auto i : v) cerr << "{"  << i.f << ',' << i.s << "} "; cerr << endl
#define dba(a,ss,ee) cerr << #a << ":"; FOR(i,ss,ee) cerr << a[i] << ' '; cerr << endl
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define ll long long 
#define pb push_back
#define inf (int)1e9
#define oo (ll)1e18
#define all(x) (x).begin(), (x).end()
#define f first
#define s second
#define reach cerr << "hi\n";
typedef pair <int, int> pi;
typedef pair <ll,ll> pl;
typedef pair <pi, int> pii;
typedef tuple<int,int,int> ti3;
string lts(ll x) {stringstream s; s << x; return s.str(); }
ll stl(string x) {stringstream s(x); ll temp; s >> temp; return temp; }
string cts(char x) {string s(1,x); return s;}
const int MOD = 1e9 + 7;
template <typename T> void maxself(T& a, T b) {
	a = max(a, b);
}
template <typename T> void minself(T& a, T b) {
	a = min(a, b);
}
#define MAXN (100005);
#if !testing
	#define cerr if(0)cout
#endif

int32_t main() {
	IAMSPEED
	ll x,a,b; cin >> x >> a >> b;
	x-=a;
	x%=b;
	cout << x;
}


Measured memory_bytes: 256
n, m = map(int,input().split())
ab = []
for i in range(n):
    ai,bi = map(int,input().split())
    ab.append([ai,bi])
ab.sort(key=lambda x:x[0])

cost = 0
count = 0
i = 0
while True:
    if count + ab[i][1] <= m:
        cost += ab[i][0]*ab[i][1]
        count += ab[i][1]
    else:
        cost += (m-count)*ab[i][0]
        break
    if count == m:
        break
    i+=1
print(cost)

Measured memory_bytes: 62552
n = int(input())
a = list(map(int,input().split()))
a.sort()
N = a[-1]
ans = float('inf')
r = a[0]
for i in range(len(a)-1):
    if ans > abs(a[i]-N/2):
        ans = abs(a[i]-N/2)
        r = a[i]
print(str(N) +' '+ str(r))


Measured memory_bytes: 84688
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#define llong long long
#define fr(i,l,r) for(i=(l);i<(r);i++)
#define min(p,q) ((p)<(q)?(p):(q))
#define max(p,q) ((p)>(q)?(p):(q))
#define INF 1000000000000//10^12

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void)
{
	//変数の宣言
	int n,m;
	int h[100010];
	
	//よく使う変数
	int i,j,k,l;
	int flag=0;
	llong int ans=0;
	int count=0;
	int temp,temp1,temp2;
	llong int max,min;
	int len;
	int sum=0;
	//データの読み込み
	scanf("%d %d",&n,&m);
	
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	qsort(h, n, sizeof(int), compare_int);
	
	for(i=0;i<=n-m;i++){
//		printf("l=%d,r=%d\n",h[i],h[i+k-1]);
		if(i==0){
			min=h[m-1]-h[0];
		}else{
			min=min(min,h[i+m-1]-h[i]);
		}
	}
	
//	printf("計算部分終了\n");
	//出力
	
	printf("%d",min);
	
//	printf("結果の出力終了\n");
	
	return 0;
	
}



Measured memory_bytes: 892
import heapq
from sys import exit
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = sorted([tuple(map(int, input().split())) for _ in range(M)], key=lambda x: x[1], reverse=True)
heapq.heapify(A)

ans = sum(A)
for b, c in BC:
    for _ in range(b):
        if len(A) == 0:
            print(ans)
            exit()
        a = heapq.heappop(A)
        if a < c:
            ans += c - a
        else:
            print(ans)
            exit()
print(ans)


Measured memory_bytes: 96280
#abc106_b.py
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    #divisors.sort()
    return divisors

def has_eight_div(N):
#    print(len(make_divisors(N)) )
    if 8 == len(make_divisors(N)) and N%2==1:
        return 1
    return 0

N = int(input())
ans = 0
for i in range(N+1):
    ans += has_eight_div(i)
print(ans)


Measured memory_bytes: 3060
// C++ 14
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(ll __x = __start; __x < __end; __x++)

/*
bit全探索. 正直か無視か
正直の場合に正直ものとその証言をすべてチェックして矛盾しなければ正直の人数を更新.
*/
typedef pair<int, int> P;
int nth(ll S, int n) {
  return (S>>n)&1;
}
int main() {
  int n; cin >> n;
  vector<P> A[20];
  loop(i,0,n) {
    int a; cin >> a;
    loop(j,0,a) {
      int x, y; cin >> x >> y;
      x--;
      A[i].emplace_back(x, y);
    }
  }
  
  int max_ = 0;
  for (ll S=0; S<1<<n; S++) {
    bool ok = true;
    loop(i,0,n) {
      if (nth(S, i) == 0) continue;
      for (auto &&a: A[i]) {
        ok &= nth(S, a.first) == a.second;
      }
    }
    if (ok) max_ = max(max_, __builtin_popcount(S));
  }
  cout << max_ << endl;
  return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SORT(i) sort((i).begin(),(i).end())
constexpr int INF = 2000000000;
constexpr int mod = 1000000007;

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() {
	int N, K; cin >> N >> K;
	vector<ll>h(N);
	rep(i, N)cin >> h[i];
	vector<ll>dp(N, INF);
	dp[0] = 0;
	REP(i, 0, N) {
		REP(j, 1, K + 1) {
			if (i + j >= N)continue;
			ll next = dp[i] + abs(h[i] - h[i + j]);
			chmin(dp[i + j], next);
		}
	}
	cout << dp[N - 1] << "\n";

	return 0;
}

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

int n, m, a[1000], b[1000], c[1000], d[100][100], ans = 0;

int main() {
	cin >> n >> m;
	fill(d[0], d[n], 1e5);
	for (int i = 0; i < m; i++) {
		cin >> a[i] >> b[i] >> c[i];
		a[i]--, b[i]--;
		d[a[i]][b[i]] = c[i];
		d[b[i]][a[i]] = c[i];
	}
	for (int i = 0; i < n; i++)
		d[i][i] = 0;

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			for (int k = 0; k < n; k++)
				d[j][k] = min(d[j][k], d[j][i] + d[i][k]);

	for (int i = 0; i < m; i++)
		if (d[a[i]][b[i]] != c[i])
			ans++;
	cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define mod 1000000007
#define PI 3.1415926535
using namespace std;
ll power(ll x, ll y)
{
	if (y == 0)
		return 1;
	else if (y % 2 == 0)
		return power(x, y / 2) * power(x, y / 2);
	else
		return x * power(x, y / 2) * power(x, y / 2);
}
ll modExpo(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)
        return modExpo((x*x)%mod,n/2);
    else                            
        return (x*modExpo((x*x)%mod,(n-1)/2))%mod;
}
ll sum(ll n)
{
	ll s=0;
	while(n)
	{
		s+=n%10;
		n/=10;
	}
	return s;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	auto start_time = clock();
	cerr << setprecision(3) << fixed;
#endif
	ll n;
	cin>>n;
	ll all=modExpo(10,n);
	ll no=modExpo(9,n);
	ll both=modExpo(8,n);
	ll ans= (all%mod - (2*no)%mod + both%mod) %mod;
	if(ans<0)
		ans+=mod;
	cout<<ans<<endl;
#ifdef LOCAL
	auto end_time = clock();
	cerr << "Execution time: " << (end_time - start_time) * (int)1e3 / CLOCKS_PER_SEC << " ms\n";
#endif
}

Measured memory_bytes: 3636
import java.util.*;

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

	int a = sc.nextInt();
	int b = sc.nextInt();
	
	if(a<b){
	System.out.println("a < b");
	}else if(a>b){
	System.out.println("a > b");
	}else if(a==b){
	System.out.println("a == b");
	}
  }
}

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

ans = - 10**7
for i in range(min(N,K)+1):
  for j in range(min(N,K)+1-i):
    if j == 0:
      st = A[:i]
    else:
      st = A[:i]+ A[-j:]
    st.sort(reverse = 1)
    for suteru in range(K - i - j+1):
      ans = max(ans, sum(st[:i+j-suteru]))
    
print(ans)

Measured memory_bytes: 3064
#include <bits/stdint-intn.h>
#include<cstdint>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<iterator>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>
#include<utility>
#include<initializer_list>


#define repi(i,start,end)for(int64_t (i)=(start);(i)<(end);++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x, v) for(auto& (x) : (v))
#define iterate(itr, v) for(auto (itr)=(v).begin();(itr)!=(v).end();++(itr))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vin(v) rep(i,(v).size()) cin >> (v)[i];
#define vpin(v) rep(i,(v).size()) cin >> (v)[i].first >> (v)[i].second

using namespace std;
using Int = int64_t;
using pint = pair<Int, Int>;
using vint = vector<Int>;
using vvint = vector<vint>;
using vpint = vector<pint>;
using vstr = vector<string>;

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; }
template<class T>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<"\n";}
template<class T>void println(T a){cout << a << "\n";}
template<class T>void put_line(T &v){iterate(itr,v){cout<<*itr<<((itr==--v.end())?"\n":" ");}}
// auto [x, y] = make_tuple(3, 4); => let (x, y) = (3, 4);

int main(void) {
    int n, k; cin >> n >> k;
    set<int> s;
    rep(i, k) {
        int d; cin >> d;
        rep(j, d) {
            int a; cin >> a;
            s.insert(a);
        }
    }
    println(n - s.size());
    return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<utility>
#include<tuple>
#include<cmath>

using namespace std;
typedef long long ll;

int main(){
    int n;cin >> n;
    bool ans = false;
    for(int i=1;i<=9;i++){
        if(n%i == 0){
            int j=n/i;
            if(j/10 == 0){
                ans = true;
            }
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i=a;i<n;i++)
#define ll long long
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    cout<<((n*(n-1))+(m*(m-1)))/2;
    return 0;
}


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

const int MAX = 510000;
const int MOD = 1000000007;
const int MAX_N = 200000;



int main(int argc, const char * argv[]) {
  int N;cin >> N;
  vector<ll> P(N);
  for(int i=0;i<N;i++){
    cin >> P[i];
  }
  vector<ll> P_min(N);

  P_min[0] = P[0];
  for(int i=1;i<N;i++){
    P_min[i] = min(P_min[i-1], P[i]);
  }
  
  ll cnt = 0;
  for(int i=0;i<N;i++){
    if(P[i]<=P_min[i]) cnt++;
  }
  
  cout << cnt << endl;

   return 0;
}


Measured memory_bytes: 3328
package main

import (
	"fmt"
)

// main is ...
func main() {
	var a int
	fmt.Scan(&a)

	// var listA = make([]int, 10)
	// listA := []int{1,2,3,4,5,6,7,8,9}
	listA := []int{9, 8, 7, 6, 5, 4, 3, 2, 1}

	for _, value := range listA {
		divide := a / value
		if 9 < divide {
			continue
		}
		mod := a % value

		// if 0 < mod && mod < 10 {
		// 	fmt.Print("Yes")
		// 	return
		// }
		if 0 == mod {
			fmt.Print("Yes")
			return
		}
		for _, value2 := range listA {
			multiple := value * value2
			if a == multiple {
				fmt.Print("Yes")
				return
			}
		}

	}

	fmt.Print("No")
}



Measured memory_bytes: 512
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int n;
  cin >> n;
  int T;
  cin >> T;
  int c[n], t[n];;
  for(int i = 0; i < n; i++){
    cin >> c[i] >> t[i];
  }
  int Min = 100000;
  for(int i = 0; i < n; i++){
    if(t[i]<=T)Min = min(Min, c[i]);
  }
  if(Min == 100000)cout << "TLE" << endl;
  else cout  << Min << endl;
}

Measured memory_bytes: 256
// Unit Fraction Partition
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1131&lang=jp

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

struct Fraction {
    int nume;
    int deno;
    Fraction(int _nume = 0, int _deno = 0) {
        nume = _nume;
        deno = _deno;
    }

    Fraction operator+(const Fraction &f) { 
        int nn = (nume * f.deno) + (f.nume * deno);
        int nd = deno * f.deno;
        return Fraction(nn, nd); 
    }
    bool operator<(const Fraction &f) const { return (nume*f.deno) < (f.nume*deno); }
    bool operator==(const Fraction &f) const { return ((nume*f.deno) == (f.nume*deno)); }
    bool operator!=(const Fraction &f) const { return !(*this == f); }
};

int P, Q, A, N;
Fraction root;

int dfs(int step, int prev, Fraction sum) {
    if (root == sum) return 1;
    
    if (step == N) return 0;
    if (root < sum) return 0;

    int res = 0;
    for (int i = prev; sum.deno*i <= A; ++i) {
        Fraction unit = Fraction(1, i);
        res += dfs(step + 1, i, sum + unit); 
    }
    return res;
}

int main() { 
    while (cin >> P >> Q >> A >> N) {
        if (P == 0) break;
        root = Fraction(P, Q);
        int ans = dfs(0, 1, Fraction(0, 1));
        cout << ans << endl;
    }
    return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 100
i64 N;
i64 X[MAX_N];

void solve() {
  i64 minv = 1000000;
  REPS(p, 100) {
    i64 s = 0;
    REP(i, N) {
      s += (X[i] - p) * (X[i] - p);
    }
    chmin(minv, s);
  }
  cout << minv << endl;
}

int main() {
  cin >> N;
  REP(i, N) cin >> X[i];

  solve();

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = int64_t;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define all(v)    begin(v), end(v)
#define in        []{lint n; cin>>n; return n;}()

template<typename T> struct SegmentTree {
    int size;
    vector<T> data;
    function<T(T,T)> op;

    SegmentTree( vector<T> v, function<T(T,T)> op ) :op(op) {
        int n = v.size();
        size = 1;
        while( size < n ) size <<= 1;
        data.resize( size*2, v[0] );
        rep( i, n ) data[size+i] = v[i];
        for( int i=size-1; i>0; i-- ) data[i] = op( data[2*i], data[2*i+1] );
    }

    void update( int k, T x ) {
        k += size;
        data[k] = x;
        while(k >>= 1) data[k] = op( data[2*k], data[2*k+1] );
    }

    T query( int a, int b ) {
        a += size; b += size;
        T L = data[a++], R = data[--b];
        for( ; a < b; a>>=1, b>>=1 ) {
            if(a & 1) L = op( L, data[a++] );
            if(b & 1) R = op( data[--b], R );
        }
        return op(L, R);
    }
};


int main() { cin.tie(0); ios::sync_with_stdio(false);
    int N = in, Q = in;
    vector<int> v(N, pow(2,31)-1);
    SegmentTree<int> st( v, [](int x, int y){return min(x,y);} );
    rep( i, Q ) {
        int com = in, x = in, y = in;
        if( com == 0 ) {
            st.update(x,y);
        } else {
            cout << st.query(x,y+1) << "\n";
        }
    }
}



Measured memory_bytes: 4744
import sys, math
from functools import lru_cache
from collections import defaultdict
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    L = list(mi())
    cnt = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            for k in range(j+1, N):
                if L[i] != L[j] and L[j] != L[k] and L[k] != L[i] \
                    and abs(L[j]-L[k]) < L[i] < L[j]+L[k]:
                    cnt += 1

    print(cnt)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9596
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (1..n).map { sc.nextLong() }
    val count = mutableMapOf<Long,Int>()
    count[0] = 1
    var sum = 0L
    var ans = 0L
    for (i in a.indices) {
        sum += a[i]
        val countTmp = count.getOrElse(sum, {0})
        ans += count.getOrElse(sum, {0})
        count[sum] = countTmp + 1
    }
    println(ans)
}

Measured memory_bytes: 79192
#include<cstdio>
int main(){
	bool fl=0;char ch=getchar();
	while(ch>='A'&&ch<='Z'){
		if(ch=='C')fl=1;
		if(ch=='F'&&fl){
			puts("Yes");
			return 0;
		}
		ch=getchar();
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 128
let () = Scanf.scanf "%d %d %d\n" @@ fun n m q ->
  let dp = Array.make_matrix (n + 1) (n + 1) 0 in
  for i = 0 to m - 1 do
    Scanf.scanf "%d %d\n" @@ fun l r ->
      dp.(l).(r) <- dp.(l).(r) + 1
  done;
  for i = 0 to n do
    for j = 0 to n - 1 do
      dp.(i).(j + 1) <- dp.(i).(j) + dp.(i).(j + 1)
    done
  done;
  for i = n downto 1 do
    for j = 0 to n do
      dp.(i - 1).(j) <- dp.(i).(j) + dp.(i - 1).(j)
    done
  done;
  for i = 0 to q - 1 do
    Scanf.scanf "%d %d\n" @@ fun p q ->
      Printf.printf "%d\n" dp.(p).(q)
  done


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

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		while(true) {
			int t = s.nextInt();
			if(t == 0) {
				break;
			}
			int n = s.nextInt();
			int[] a = new int[n];
			int[] b = new int[n];
			for(int i = 0; i < n; i++) {
				a[i] = s.nextInt();
				b[i] = s.nextInt();
			}
			int c = 0;
			for(int i = 0; i < n; i++) {
				c += b[i] - a[i];
			}
			if(c >= t) {
				System.out.println("OK");
			}
			else {
				System.out.println(t-c);
			}
		}
	}
}

Measured memory_bytes: 23424
n = gets.chomp.to_i
uvw = []
(n - 1).times do
  uvw.push gets.split.map(&:to_i)
end
d = []
d[1] = 0
h = Array.new(n + 1) { [] }
uvw.each do |e|
  u = e[0]
  v = e[1]
  w = e[2]
  h[u].push [v, w]
  h[v].push [u, w]
end
color = []
color[1] = 0
stack = []
stack.push [1, 0]
uv = [1, 0]
until stack.empty? && uv != [1, 0]
  while uv.last >= h[uv.first].size
    uv = stack.pop
  end
  u = uv.first
  i = uv.last
  e = h[u][i]
  v = e.first
  if d[v]
    i += 1
    uv = [u, i]
    next
  end
  d[v] = d[u] + e.last
  color[v] = d[v].even? ? 0 : 1
  stack.push [u, i + 1]
  uv = [v, 0]
end
puts color[1..n]


Measured memory_bytes: 33020