akhauriyash/Code-Regression huggingface dataset:
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>

using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define all(t) t.begin(), t.end()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define inrange(n, lb, ub) ((lb)<=(n) && (n) <=(ub))
vector < vector<int>> imos2(vector < vector<int>> mat) {
	//imos2
	// mat = {
	//		0,1,0,2
	//		3,4,1,1
	//		0,3,1,9}
	// return = {
	//		0,1,1,3
	//		3,8,9,12
	//		3,11,13,25}
	// return[i][j] means sum of mat[k][l] ( k = 0~i, l = 0~j)

	int n = mat.size();
	int m = mat[0].size();
	for (int i = 0; i < n; i++)for (int j = 0; j < m-1; j++) mat[i][j + 1] += mat[i][j];
	for (int i = 0; i < n; i++)for (int j = 0; j < m-1; j++) mat[j + 1][i] += mat[j][i];
	return mat;

}
int imos2rectangle(const vector<vector<int>>&imos2table, int xl, int yl, int xr, int yr) {
	// a sum of the numbers included in a rectangle area of original table; rectangle area, between xl and xr, yl and yr.
	// imos2table indicates sum of originalTable[k][l] ( k = 0~i, l = 0~j)
		// imos2table = {// should be produced by function "imos2"
		//		0,1,1,3
		//		3,8,9,12
		//		3,11,13,25
		//		3,11,13,25}
		// xl = 1, yl =0, xr = 3, yr = 2
		// return = 12

	int n = imos2table.size();
	int m = imos2table[0].size();
	if (xl > xr || yl > yr) return 0;
	bool fxl = xl - 1 >= 0;
	bool fyl = yl - 1 >= 0;
	int left = fyl ? imos2table[xr][yl - 1] : 0;
	int up = fxl ? imos2table[xl - 1][yr] : 0;
	int corner = fxl&&fyl ? imos2table[xl - 1][yl - 1] : 0;
	int body = imos2table[xr][yr];
	return body - left - up + corner;


}
int main() {
	int n, k;
	cin >> n >> k;
	auto t = mat(int, 2 * k, 2 * k, 0);
	rep(i, n) {
		ll x, y;
		string c;
		cin >> x >> y >> c;
		if (c == "B") t[x % (2 * k)][y % (2 * k)]++;
		else t[(x + k) % (2 * k)][y % (2 * k)]++;
	}
	auto mos = imos2(t);
	int ma = 0;
	rep(i, k)rep(j, k) {
		int xl = i;
		int xr = i + k - 1;
		int yl = j;
		int yr = j + k - 1;
		int center = imos2rectangle(mos, xl, yl, xr, yr);
		int upleft = imos2rectangle(mos, 0, 0, xl - 1, yl - 1);
		int upright = imos2rectangle(mos, 0, yr + 1, xl - 1, 2 * k - 1);
		int lowleft = imos2rectangle(mos, xr + 1, 0, 2 * k - 1, yl - 1);
		int lowright = imos2rectangle(mos, xr + 1, yr + 1, 2 * k - 1, 2 * k - 1);
		int num = center + upleft + upright + lowleft + lowright;
		ma = max({ ma, num, n - num });
	}
	cout << ma;
	return 0;

}





Measured memory_bytes: 31616
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, colorX, colorY, D; vll path;
//***********//
int main() {
	cin >> N;
	vpll Ans;
	for (i = 1; i <= N-1; i++) {
		for (j = i+1; j <= N; j++) {
			if (N % 2 == 0) {
				if (i != j && i + j != N + 1) {
					Ans.push_back(mp(i, j));
				}
			}
			else {
				if (i != j && i + j != N) {
					Ans.push_back(mp(i, j));
				}
			}
		}
	}
	cout << Ans.size() << endl;;
	for (i = 0; i < Ans.size(); i++) {
		cout << Ans[i].first << " " << Ans[i].second << endl;
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

ll a, b, x;


ll f(ll n)
{
    if (n < 0) return 0;
    return n / x + 1;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> a >> b >> x;
    cout << f(b) - f(a - 1);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
char a[110];
int isPa(int l,int r,char *s)
{
	int i,len;
	len=r-l+1;
	 for(i=0;i<len/2;i++)
		if(s[l+i]!=s[l+len-1-i])
			return 0;
	return 1;
}
int main()
{
	int i,len;
	scanf("%s",a);
	len=strlen(a);
	 if(!isPa(0, len-1, a))
{
		printf("No\n");
		return 0;
	}
	 if(!isPa(0,len/2-1,a))
 {
		printf("No\n");
		return 0;
	}
	 if(!isPa(len/2+1, len-1,a))
{
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	return 0;
}
 

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

#define end 150
#define kurono 14106

#define ok puts( "OK" )
#define ng puts( "NG" )

#define from	weight[ i * 2 ]
#define to		weight[ i * 2 + 1 ]

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


int main( void )
{
	int N ;
	while( 1 )
	{
		scanf( "%d" ,&N ) ;

		if( N == 0 )
		{	return 0 ;	} ;

		char judge = 0 ;

		int weight[ 100 * 2 ] ;
		int m[ 100 ] ;
		int a[ 100 ] ,b[ 100 ] ;
		
		int i ,j ;
		for( i = j = 0 ; i < N ; ++i )
		{
			scanf( "%d %d %d" ,m + i ,a + i ,b + i ) ;

			from = a[ i ] ;	to = b[ i ] ;
		}

		qsort( weight ,N * 2 ,sizeof( int ) ,cmp ) ;

		for( i = 0 ; i < N * 2 ; ++i )
		{
			int sum = 0 ;
			for( j = 0 ; j < N ; ++j )
			{
				if( weight[ i ] >= a[ j ] && weight[ i ] < b[ j ] )
				{	sum += m[ j ] ;	}
			}

			if( sum > end )
			{	ng ; i = j = kurono ;	}
		}

		if( j != kurono )
		{	ok ;	}
	}
}


Measured memory_bytes: 2056
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n,m,a,b;
    cin>>n>>m;
    vector<vector<ll> > v(n,vector<ll> (n,0));
    for(int i=0;i<m;i++){
    	cin>>a>>b;
    	a--;b--;
    	v[a][b]=v[b][a]=1;
    }
    ll maki=(1LL<<n);
    vector<vector<ll> > dp(maki,vector<ll> (n,0));
    dp[1][0]=1;
    for(int bit=1;bit<maki;bit++){
    	for(int i=0;i<n;i++)if(bit>>i&1){
    		ll mask=bit-(1LL<<i);
    		for(int j=0;j<n;j++)if(mask>>j&1 && v[i][j])dp[bit][i]+=dp[mask][j];
    	}
    }
    ll ans = 0;
    for(int i=1;i<n;i++)ans+=dp[maki-1][i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
 
mod = 10 ** 9 + 7
k = k % mod
# 配列内で自身より小さい数の個数　前後別に求める
b = [[0, 0] for _ in range(n)]
for i in range(n):
    for j in range(n):
        if a[i] > a[j]:
            if i > j:
                b[i][0] += 1
            elif i < j:
                b[i][1] += 1
    b[i][0] = b[i][0] % mod
    b[i][1] = b[i][1] % mod
ans = 0
# kまでの和　後ろの数用
sigmakp = ((k * (k+1)) // 2) % mod
sigmakp = int(sigmakp)
# k-1までの和　前の数用
sigmakn = ((k * (k-1)) // 2) % mod
sigmakn = int(sigmakn)
 
for i in range(n):
    mae = (sigmakp * b[i][1]) % mod
    ushiro = (sigmakn * b[i][0]) % mod
    ans = ((mae + ushiro) % mod + ans) % mod 
print(ans)

Measured memory_bytes: 42092
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define inf 1e16
#define M 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define mx 1000010

int main(){
	IOS;
	ll a,b;cin>>a>>b;
	cout<<max(a+b,max(a-b,a*b));
	
	
	return 0;
}



Measured memory_bytes: 256
def main():
    import sys
    sys.setrecursionlimit(311111)
    # import numpy as np
    ikimasu = sys.stdin.buffer.readline
    ini = lambda: int(ins())
    ina = lambda: list(map(int, ikimasu().split()))
    ins = lambda: ikimasu().strip()
    n,k = ina()
    tmp = ina()
    x = 1<<55
    rick = 0
    used = 0
    for _ in range(55+1):
        tmp1 = 0
        for i in tmp:
            if(i&x):
                tmp1+=1
        if(tmp1>=(n-tmp1)):
            rick+=x*tmp1
        else:
            if((x+used<=k)):
                rick+=x*(n-tmp1)
                used +=x
            else:
                rick+=x*tmp1
        x>>=1
    print(rick)


    


        
        
        


    
        


        


    




















if __name__ == "__main__":
    main()


Measured memory_bytes: 85100
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "No" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll K,T; cin>>K>>T;
    vector<ll> A(T);
    rep(i,T) cin>>A[i];
    ll ma=*max_element(ALL(A));
    cout<< max(0LL,ma-1-(K-ma)) <<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


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

int main() {
    string a,b;
    cin >> a >>b;
    string s;

    int na=a.length(),nb=b.length();
    int i=0,j=0,t=1;
    while(true){
    	if(t%2!=0){
    	s+=a[i];
    	++i;
    	++t;
    	if(na>nb && i==na)break;
    }
    	else{s+=b[j];
    		++j;
    		++t;
    		if(i==na){
    			break;
    		}

    	}
    	

    }
    cout << s << endl;
    return 0;

}


Measured memory_bytes: 256
A, B, K = map(int, input().split())

for i in range(K) :
  if i % 2 == 0 :
    A -= A % 2
    B += A // 2
    A //= 2
  else :
    B -= B % 2
    A += B // 2
    B //= 2
    
print(A, B)

Measured memory_bytes: 38256
#include <iostream>

using namespace std;

int main() {
    for(int XX = 0;XX<20;XX++){
    int n;
    cin >> n;
    
    if(n==0){
        break;
    }
    
    int x[10] = {0};
    for(int i=0;i<n;i++){
        int c;
        cin >> c;
        x[c]++;
    }
    
    for(int i=0;i<10;i++){
        if(x[i]!=0){
            for(int j=0;j<x[i];j++){
                cout << "*";
            }
            cout << endl;
        }
        else{
            cout << "-" << endl;
        }
    }
    }
    return 0;
}


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

int main(){
	long long n;
    cin>>n;
    cout<<(n/10LL+n/50+n/250+n/1250+n/6250+n/31250+n/156250+n/781250+n/3906250+n/19531250
    +n/97656250+n/488281250+n/2441406250LL+n/12207031250LL+n/61035156250LL
    +n/305175781250LL+n/1525878906250LL+n/7629394531250LL+n/38146972656250LL
    +n/190734863281250LL+n/953674316406250LL+n/4768371582031250LL
    +n/23841857910156250LL+n/119209289550781250LL+n/596046447753906250LL
    +n/2980232238769531250LL)*(n&1^1)<<endl;
}


Measured memory_bytes: 256
local n = io.read("*n")
local t = {}
t[0] = 1
local ret = 0
local sum = 0
for i = 1, n do
  sum = sum + io.read("*n")
  if t[sum] then
    ret = ret + t[sum]
    t[sum] = t[sum] + 1
  else
    t[sum] = 1
  end
end
print(ret)


Measured memory_bytes: 12648
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int n, mod, cnt[200010];
map<pi, int> dp, eid;
vi lsum[200010], rsum[200010], memo[200010];
vector<vi> e;

int rec(int c, int p){
	if(dp.count(pi(c, p))) return dp[pi(c, p)];
	
	int m = e[c].size();
	vi &ls = lsum[c], &rs = rsum[c];
	
	if(cnt[c]++ >= 2){
		int i = eid[pi(c, p)];
		assert(ls.size() == m + 1 && rs.size() == m + 1);
		return dp[pi(c, p)] = ls[i] * (ll)rs[i + 1] % mod;
	}
	if(cnt[c] == 1) memo[c].resize(m);
	
	int res = 1;
	rep(i, m) if(e[c][i] != p){
		int x = rec(e[c][i], c) + 1;
		memo[c][i] = x;
		res = res * (ll)x % mod;
	}
	
	if(cnt[c] == 2){
		ls.resize(m + 1);
		rs.resize(m + 1);
		ls[0] = rs[m] = 1;
		rep(i, m) ls[i + 1] = (ll)ls[i] * memo[c][i] % mod;
		for(int i = m - 1; i >= 0; i--) rs[i] = (ll)rs[i + 1] * memo[c][i] % mod;
	}
	
	return dp[pi(c, p)] = res;
}
int main(){
	scanf("%d%d", &n, &mod);
	e.resize(n);
	rep(i, n - 1){
		int a, b; scanf("%d%d", &a, &b); a--; b--;
		e[a].pb(b); eid[pi(a, b)] = e[a].size() - 1;
		e[b].pb(a); eid[pi(b, a)] = e[b].size() - 1;
	}
	if(n == 1){
		cout << 1 << endl;
		return 0;
	}
	
	rep(i, n){
		int o = -1;
		for(int j : e[i]){
			o = j;
			break;
		}
		assert(o >= 0 && o != i);
		
		int x = rec(i, o);
		int y = rec(o, i);
		printf("%d\n", x * (y + 1ll) % mod);
	}
	return 0;
}

Measured memory_bytes: 65536
a=1000000007
n=int(input())
l=list(map(int,input().split()))
l.sort()
if n%2==1:
  if l[0]!=0:
    print(0)
    exit()
  else:
    l.remove(0)
    sh=2
    f=0
    for i in l:
      if f==0:
        if i!=sh:
          print(0)
          exit()
        else:
          f=1
      else:
        if i!=sh:
          print(0)
          exit()
        else:
          sh+=2
          f=0
  sh=(n-1)//2
  b=1
  for i in range(sh):
    b*=2
    b%=a
  print(b)
else:
  sh=1
  f=0
  for i in l:
    if f==0:
      if i!=sh:
        print(0)
        exit()
      else:
        f=1
    else:
      if i!=sh:
        print(0)
        exit()
      else:
        sh+=2
        f=0
  sh=n//2
  b=1
  for i in range(sh):
    b*=2
    b%=a
  print(b)


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

int main() {
  int s,s1,s2,s3;
  
  cin >> s;
  s1 = s / 100;
  s2 = (s - s1 * 100) / 10;
  s3 = s - s1 * 100 - s2 * 10;
  cout << s1+s2+s3;
}

Measured memory_bytes: 256
A,B = map(int, input().split(" "))

C,D = map(int, input().split(" "))

E,F = map(int, input().split(" "))


cnt1=0
cnt2=0
cnt3=0
cnt4=0

if A==1:
    cnt1 = cnt1 + 1
elif A==2:
    cnt2 = cnt2 + 1
elif A == 3:
    cnt3 = cnt3 + 1
elif A == 4:
    cnt4 = cnt4 + 1

if B==1:
        cnt1 = cnt1 + 1
elif B==2:
    cnt2 = cnt2 + 1
elif B == 3:
    cnt3 = cnt3 + 1
elif B == 4:
    cnt4 = cnt4 + 1

if C==1:
        cnt1 = cnt1 + 1
elif C==2:
    cnt2 = cnt2 + 1
elif C == 3:
    cnt3 = cnt3 + 1
elif C == 4:
    cnt4 = cnt4 + 1

if D==1:
        cnt1 = cnt1 + 1
elif D==2:
    cnt2 = cnt2 + 1
elif D == 3:
    cnt3 = cnt3 + 1
elif D == 4:
    cnt4 = cnt4 + 1

if E==1:
        cnt1 = cnt1 + 1
elif E==2:
    cnt2 = cnt2 + 1
elif E == 3:
    cnt3 = cnt3 + 1
elif E == 4:
    cnt4 = cnt4 + 1

if F==1:
        cnt1 = cnt1 + 1
elif F==2:
    cnt2 = cnt2 + 1
elif F == 3:
    cnt3 = cnt3 + 1
elif F == 4:
    cnt4 = cnt4 + 1

#print(cnt1)
#print(cnt2)
#print(cnt3)
#print(cnt4)

#print(A)
#print(B)

flg = 1

if cnt1 >=3:
    flg = 0

if cnt2 >=3:
    flg = 0

if cnt3 >=3:
    flg = 0

if cnt4 >=3:
    flg = 0

if flg ==0:
    print("NO")
else:
    print("YES")




Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		int[] number = new int[3];

		for (int i = 0; i < 3;i++) {

			number[i] = input();

		}

		if (number[0] < number[1] && number[1] < number[2]) {

			System.out.println("Yes");

		} else {

			System.out.println("No");

		}

		close();

	}

	public static int input() {

		return scanner.nextInt();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
}

Measured memory_bytes: 26268
#include <stdio.h>
#include <ctype.h>

int main (
  int argc,
  char *argv[ ]
  )
{
  for ( ; ; )
  {
    int d[ 10 ];
    int ch = 'A';
    int i, j;

    while ( ch != EOF && !isdigit ( ch ) ) ch = getchar ( );
    if ( ch == EOF )  break ;

    for ( i = 0; i < 10; ++i )
    {
      d[ i ] = ch - '0';
      ch = getchar ( );
    }

    for ( j = 9; j; --j )
    {
      for ( i = 0; i < j; ++i )
      {
        d[ i ] = ( d[ i ] + d[ i + 1 ] ) % 10;
      }
    }

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

  return ( 0 );
}

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

// GNU C Compiler
//template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }


/*
--------------------------------------------

	type

--------------------------------------------
*/
using LL = long long;
using ULL = unsigned long long;
//using pair<T1, T2> = p12;

/*
--------------------------------------------

	container

--------------------------------------------
*/
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())

/*
--------------------------------------------

	repetition

--------------------------------------------
*/
#define REP(n) for(int i=0; i<n; i++)
#define REPj(n) for(int j=0; j<n; j++)
#define REPinit(a,n) for(int i=a; i<n; i++)
#define REPinitj(a,n) for(int j=a; j<n; j++)

//algorithm
//#define SORT(c) sort((c).begin(),(c).end())

/*
--------------------------------------------

	constant

--------------------------------------------
*/
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

/*

	Optimizer

*/
//#pragma GCC optimize("Ofast")


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

  int N;
  cin >> N;

  int l,r;
  int ans = 0;
  REP(N) {
    cin >> l >> r;
    ans += (r-l+1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
	
int main(){
	double a,b,c,d,e,f,g;
	
	while(EOF != scanf("%lf %lf %lf %lf %lf %lf", &a, &b, &c, &d, &e, &f)){
		g = a*e-b*d;
		printf("%.3lf %.3lf\n",(c*e-b*f)/g+0, (a*f-c*d)/g+0);
	}
	
	return 0;
}

Measured memory_bytes: 652
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
int main(void){

	int n;
	cin>>n;
	for(int i=0;i<n;i++){
        int s;
        cin>>s;
        cout<<"Case "<<i+1<<":"<<endl;
        for(int j=0;j<10;j++){

            s*=s;
            //cout<<s<<endl;
            s%=1000000;
            //cout<<s<<endl;
            s-=s%100;
            //cout<<s<<endl;
            s/=100;
            cout<<s<<endl;
        }
	}



	return 0;
}

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

#define ios ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"
#define ll long long

int main()
{
    ios;


    int n,k,a,sum=0;
    cin>>n>>k;

    vector<int>v;

    for(int i=0; i<n ; i++)
    {
        cin>>a;
        v.push_back(a);
    }
    sort(v.begin(), v.end());



        //sum = accumulate(v.begin(), v.end()-k,0);
        //cout<<sum<<endl;

    for(int i=0; i<k; i++)
    {
        sum  += v[i];
    }
    cout<<sum<<endl;

    return 0;
}



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

using namespace std;
const int maxn=1e5+5;
int pre[maxn];
int n,m;
int findd(int x)
{
    return x==pre[x]?x:findd(pre[x]);
}
void combine(int x,int y)
{
    int fx=findd(x);
    int fy=findd(y);
    if(fx<fy)
        pre[fy]=fx;
    else
        pre[fx]=fy;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        pre[i]=i;
    for(int i=1;i<=m;i++)
    {
        int x,y,z;
        scanf("%d%d%d",&x,&y,&z);
        if(findd(x)!=findd(y))
            combine(x,y);
    }
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        if(pre[i]==i)
            ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using G = vector<vector<int>>;
    
int main(){
    int h1, h2, m1, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int ans;
    
    ans = (h2 - h1) * 60;
    ans = ans + m2 - m1 - k;
    cout << ans << endl; 
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
//#include <numeric>
#include <vector>
	#include<math.h>
	//#include <algorithm>
	//#include <functional>
	//#include <numeric>
	//#include<cmath>
//#include <stdio.h> 
#include <cstdint>
	#include <string>
	//#include <cstdlib>
	//#define pi 3.14159265359
using namespace std;


int main() {

	string s;
	cin >> s;
	int a;
	a = s.length();
	for (int i = 0; i < a; i++) {
		cout << "x";
	}

	return 0;

}


Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		int A = sc.nextInt();
		int B = sc.nextInt();
		boolean flg = false;
		for (int i = 1; i < 1269; i++) {
			if (Math.floor(i * 0.08) == A && Math.floor(i * 0.10) == B) {
				System.out.println(i);
				flg=true;
				break;
			}
		}
		if (flg == false) {
			System.out.println("-1");
		}
	}
}

Measured memory_bytes: 25044
#include <bits/stdc++.h>
using namespace std;
map<int,int>m;
multiset<int>s; 
int main() {
	int H,W;
	scanf("%d%d",&H,&W);
	for(int i=1;i<=W;++i) {
		m[i]=i;
		s.insert(0); 
	}
	for(int i=1;i<=H;++i) {
		int A,B;scanf("%d%d",&A,&B);
		auto it=m.lower_bound(A);
		int mx=0;
		while(it!=m.end()&&it->first<=B) {
			mx=max(mx,it->second);
			int dis=it->first-it->second;
			s.erase(s.find(dis));
			m.erase(it++);
		}
		if(mx!=0&&B<W&&m.find(B+1)==m.end()) {
			m[B+1]=mx;
			s.insert(B+1-mx);
		}
		printf("%d\n",s.empty() ? -1:(*s.begin()+i));
	}
	return 0;
} 

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

const ll max_n = 100010;
ll n, c[max_n];
vector<pair<ll, ll>> t[max_n];

void dfs(ll v, ll previous=-1) {
    for (auto it: t[v]) {
        ll u = it.first;
        ll w = it.second % 2;
        if (u != previous) {
            c[u] = c[v] ^ w;
            dfs(u, v);
        }
    }
}

int main() {
    cin >> n;
    for (int i = 0; i < n - 1; ++i) {
        ll u, v, w;
        cin >> u >> v >> w;
        t[u].push_back({v, w});
        t[v].push_back({u, w});
    }
    dfs(1);
    for(int i = 1; i <=n; ++i) {
        cout << c[i] << endl;
    }
}

Measured memory_bytes: 10240
import sys
sys.setrecursionlimit(200000)
N = int(input())
h = [int(i) for i in input().split()]
cost = [-1]*N
def jump_min(n):
    if n == 1:
        v = 0
    elif n == 2:
        v = abs(h[1]-h[0])
    else:
        if cost[n-1] != -1:
            v = cost[n-1]
        else:
            x = jump_min(n-2)+abs(h[n-1]-h[n-3])
            y = jump_min(n-1)+abs(h[n-1]-h[n-2])
            v = min(x,y)
    cost[n-1] = v
    return v
print(jump_min(N))
        

Measured memory_bytes: 50860
#include<stdio.h>
#include<string.h>
int main()
{
    char ch[100],ch1[100],ch2[100];
    scanf("%s %s %s",ch,ch1,ch2);
    printf("%c%c%c\n",ch[0]-32,ch1[0]-32,ch2[0]-32);
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    int x[n];
    for(int i = 0; i < n; ++i){
        cin >> x[i];
    }
    int min = 0;
    int out = 1000000;
    for(int i = 0; i <= 100; ++i){
        for(int j = 0; j < n; ++j){
            min += (x[j] - i) * (x[j] - i);
        }
        if(out > min) out = min;
        min = 0;
    }
    cout << out << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

struct joi{
	int j, o, i;
};

int main(){
	int r, c, n;
	cin >> r >> c >> n;
	
	string s[r+1];
	vector<vector<joi> > m(r+1, vector<joi>(c+1, (joi){0, 0, 0}));
	FOR(i, 1, r+1){
		cin >> s[i];
		FOR(j, 1, c+1){
			m[i][j]=m[i][j-1];
			if(s[i][j-1]=='J') m[i][j].j++;
			else if(s[i][j-1]=='O') m[i][j].o++;
			else if(s[i][j-1]=='I') m[i][j].i++;
		}
	}
	
	REP(i, n){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		
		int J, O, I=O=J=0;
		FOR(j, a, c+1){
			J+=(m[j][d].j-m[j][b-1].j);
			O+=(m[j][d].o-m[j][b-1].o);
			I+=(m[j][d].i-m[j][b-1].i);
		}
		
		cout << J << " " << O << " " << I << endl;
	}
}

Measured memory_bytes: 13924
'use strict';

function main(arg) {
    const origin = arg.split("\n")[0];
    let   target = arg.split("\n")[1].split("");
    
    for(let i=0; i<target.length; i++) {
        if(origin == target.join("")) {
            console.log("Yes");
            return;
        }
        
        target.unshift(target[target.length-1]);
        target.pop();
    }
    
    console.log("No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 11340
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
typedef long long ll;
using namespace std;

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

    string s;
    cin >> s;

    int month = s[6] - '0' + (s[5] - '0') * 10;
    if (month > 4) {
        cout << "TBD" << endl;
    } else {
        cout << "Heisei" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
A = [None] * (44 + 1)
A[0] = 1
A[1] = 1


def fibonacci(n: int) -> int:
	if A[n] == None:
		A[n] = fibonacci(n - 1) + fibonacci(n - 2)
	return A[n]


if __name__ == "__main__":
	n = int(input())
	print(fibonacci(n))


Measured memory_bytes: 5596
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007

using namespace std;

char str[100005];

int main(int argc, char* argv[])
{
    long n,a,b;
    scanf("%ld%ld%ld", &n, &a, &b);
    scanf("%s", str);

    vector<long> ans(n);
    long cnt=0, cnta=0, cntb=0;
    long i;
    for(i=0; i<n; i++) {
        if(str[i]=='a') {
            if(cnt<a+b) {
                ans[i]=1;
                cnt++;
            }
            cnta++;
        }
        else if(str[i]=='b') {
            if(cnt<a+b && cntb<b) {
                ans[i]=1;
                cnt++;
            }
            cntb++;
        }
    }
    for(i=0; i<n; i++) {
        if(ans[i]) printf("Yes\n");
        else       printf("No\n");
    }
    return 0;
}


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

#ifndef LOCAL
#define fprintf if(false) fprintf
#endif
#define debug_int(x) fprintf(stderr, "%s = %d\n", #x, x)
#define debug_double(x) fprintf(stderr, "%s = %llf\n", #x, x)
#define debug_array(v,n) fprintf(stderr, "%s = [ ", #v); for(int i=0; i<n; i++) fprintf(stderr, "%d ", v[i]); fprintf(stderr, "]\n")
#define forr(i,start,end) for(int i=start; i<end; i++)

using lli = long long int;
using ii = pair<int, int>;

const int MAXN = 100010;

int main() {
    int n;
    scanf("%d", &n);

    int last = n%10;
    if(last == 3) {
        printf("bon\n");
    }
    else if(last == 0 or last == 1 or last == 6 or last == 8) {
        printf("pon\n");
    }
    else {
        printf("hon\n");
    }
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
inline LL calc(int x){return 1ll*x*(x+1)/2;}
int main(){
	int n;scanf("%d",&n);
	printf("%lld",calc(n)-calc(n/3)*3-calc(n/5)*5+calc(n/15)*15);
	return 0;
}

Measured memory_bytes: 3828
#include <bits/stdc++.h>
using namespace std;
 
#define endl "\n"
#define int long long
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
#define mem(a,b) memset((a),(b),sizeof (a))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF long long(1e18)
#define MOD 1000000007


void solve(){
	int k,n;
	cin>>k>>n;
	int arr[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	int sum=0,maxm=k-arr[n-1]+arr[0];
	sum=maxm;
	for(int i=1;i<n;i++){
		sum+=arr[i]-arr[i-1];
		maxm=max(maxm,arr[i]-arr[i-1]);
	}
	cout<<sum-maxm<<endl;
}

int32_t main(){
    int t=1;
    while(t--)
        solve();
    return 0;
}




Measured memory_bytes: 5136
#define _CRT_SECURE_NO_WARNINGS
#include <iterator>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <map>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
#include <time.h>
#include <unordered_set>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define FILL(A,val) memset(A,val,sizeof(A))
#define ITER(it,a) for(__typeof(a.begin()) it=a.begin();it!=a.end();++it)
#define DBG1(a) cerr<<#a<<"="<<(a)<<"\n"
#define DBG2(a,b) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"

#define ALL(V) V.begin(),V.end()
#define SZ(V) (int)V.size()
#define PB push_back
#define MP make_pair
#define y1 frgrwegreg

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;

const double PI = acos(-1.0);
const int MOD = 1000 * 1000 * 1000 + 7;
const int MAX = 131072;

string s;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	//ios::sync_with_stdio(0);

	cin >> s;
	cout << s.substr(0,4)<<" "<<s.substr(4,12) << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main(){
	int q, num1, num2;
	string str, str2, str3;//str1=最初の文字列 str2=条件当てはめる
	cin >> str >> q;

	for (int i = 0; i < q; i++){
		cin >> str2 >> num1 >> num2;
		if (str2 == "replace"){
			cin >> str3;
			str = str.replace(num1, num2-num1+1, str3);
		}

		else if (str2 == "reverse"){
			while (num1<=num2){
				char tmp;
				tmp = str[num1];
				str[num1] = str[num2];
				str[num2] = tmp;
				num1++;
				num2--;
			}
		}

		else if (str2 == "print"){
			cout << str.substr(num1, num2-num1+1) << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3204
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
using int64 = long long int;
const int64 INF = 1LL << 60;

// first - second
int W, H; int64 dp[1010][1010];
vector< vector<int> > rows;
vector< vector<int> > cols;

int64 solve(int r, int c) {
  // fprintf(stderr, "r = %d, c = %d\n", r, c);
  int64 &res = dp[r][c];
  if(res != INF) return res;
  if(r == H and c == W) return res = 0;
  bool is_second = (r + c) % 2 == 1;
  
  res = (is_second ? INF : -INF);
  // second
  if(is_second) {
    if(r + 1 <= H) {
      int64 val = rows[r][W] - rows[r][c];
      int64 fs = solve(r+1, c);
      fs += val;
      res = min(res, fs);
    }
    if(c + 1 <= W) {
      int64 val = cols[c][H] - cols[c][r];
      int64 fs = solve(r, c+1);
      fs -= val;
      res = min(res, fs);
    }
  }
  // first
  else {
    if(r + 1 <= H) {
      int64 val = rows[r][W] - rows[r][c];
      int64 fs = solve(r+1, c);
      fs += val;
      res = max(res, fs);
    }
    if(c + 1 <= W) {
      int64 val = cols[c][H] - cols[c][r];
      int64 fs = solve(r, c+1);
      fs -= val;
      res = max(res, fs);
    }
  }
  return res;
}

int main() {
  cin >> W >> H;
  rows.resize(H);
  cols.resize(W);
  for(int i=0; i<H; i++) rows[i].emplace_back(0);
  for(int i=0; i<W; i++) cols[i].emplace_back(0);

  for(int i=0; i<H; i++) {
    for(int j=0; j<W; j++) {
      int val; cin >> val;
      rows[i].emplace_back(rows[i].back() + val);
      cols[j].emplace_back(cols[j].back() + val);
    }
  }

  fill(dp[0], dp[H+1], INF);
  cout << abs(solve(0, 0)) << endl;
  return 0;
}



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

#define forn(i,n) for(int i = 0;i<n;i++)
#define forne(i,j,n) for(int i = j;i<n;i++)
const ll mod = 1e9+7;
const ll INF = 1000000001;
const ll N = 1000001;
#define F first
#define pb(a) push_back(a)
#define S second
#define pii pair<int,int>
typedef pair<ll,ll> pll;

ll powm(ll base,ll exp) {
	ll ans=1;
	while(exp){
		if(exp&1) ans=(ans*base)%mod;
		exp>>=1,base=(base*base)%mod;
	}
	return ans;
}
// int maxdepth = INT_MAX;
// vector<int> edgeVector[100000];
// ll minans = 1;
// printf("1 %d D\n",abs(r));
// priority_queue<ll,vector<ll>,greater<ll>> pq;
ll A[N],B[N];
// vector<vector<ll>> adj(N);
// vector<set<ll>> adjs(N);
// ll adj[1001][1001];
// vector<vector<ll>> ans(1001);
// bool visited[N];
// ll cnt[1001];
// ll h,c,t;
// vector<pair<int, pair<int, int> > > g[300043];

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


ll a,b;
cin>>a>>b;
ll ans = a*b;
cout<<ans<<endl;






}

Measured memory_bytes: 3640
#include<iostream>
using namespace std;
int main(){
    int H,W,i,j;
    while(1){
        cin >> H >> W;
        if(H == 0 && W == 0)break;
        i = 0;
        while(i < H){
            for(j = 0; j < W;j++){
                cout<<'#';
            }
            cout << endl;
            i++;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3088
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define SF scanf
#define PF printf
#define MAXN 1010
#define MAXM 200010
using namespace std;
int n,m,u,v;
int id[MAXN][MAXN],ans1[MAXN][MAXN],ans2[MAXN][MAXN],q[MAXN][2];
int ans[MAXM];
vector<int> a[MAXN];
void dfs(int x,int fa){
    ans1[fa][x]=1;
    for(int i=0;i<a[x].size();i++)
        if(ans1[fa][a[x][i]]==0)
            dfs(a[x][i],fa);
}
void dfs1(int x,int tag,int flag){
    q[x][flag]=tag;
    for(int i=0;i<a[x].size();i++)
        if(!q[a[x][i]][flag])
            dfs1(a[x][i],tag,flag);
}
int main(){
    SF("%d%d",&n,&m);
    for(int i=0;i<m;i++){
        SF("%d%d",&u,&v);
        u--;
        v--;
        id[u][v]=i+1;
        a[u].push_back(v);
    }
    for(int i=0;i<n;i++)
        dfs(i,i);
    for(int i=0;i<n;i++){
        memset(q,0,sizeof q);
        q[i][0]=q[i][1]=-1;
        for(int j=0;j<a[i].size();j++)
            if(!q[a[i][j]][0])
                dfs1(a[i][j],j+1,0);
        for(int j=a[i].size()-1;j>=0;j--)
            if(!q[a[i][j]][1])
                dfs1(a[i][j],j+1,1);
        for(int j=0;j<a[i].size();j++)
            if(q[a[i][j]][0]!=j+1||q[a[i][j]][1]!=j+1)
                ans2[i][a[i][j]]=1;
    }
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            if(ans1[j][i]==ans2[i][j]&&id[i][j])
                ans[id[i][j]]=1;
    for(int i=1;i<=m;i++){
        if(ans[i]==1)
            PF("same\n");
        else
            PF("diff\n");
    }
}

Measured memory_bytes: 15360
#include<bits/stdc++.h>
using namespace std;
#define maxn 300005
#define ll long long

int n,m,k;
int a[maxn];

int main()
{
	cin>>n>>m>>k;
	int maxx=0;
	maxx=max(n,m);
	maxx=max(maxx,k);
	printf("%d",n+m+k-maxx);
	return 0;
}

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

const int N = 110;

struct edge{
	int next, to, w;
};

edge e[N * N];
bool mat[N][N];
int e_cnt = 1, n, m, first[N];

void addedge(int u, int v, int w){
	e[++ e_cnt] = {first[u], v, w};
	first[u] = e_cnt;
	e[++ e_cnt] = {first[v], u, w};
	first[v] = e_cnt;
}

std::vector <int> pre[N];
std::queue <int> q;
bool inque[N];
int dis[N];

void spfa(int s){
	for (int i = 0; i < n; ++ i){
		pre[i].clear();
	}
	memset(dis, 0xf, sizeof(dis));
	q.push(s);
	inque[s] = true;
	dis[s] = 0;
	while (!q.empty()){
		int i = q.front();
		q.pop();
		inque[i] = false;
		for (int j = first[i]; j; j = e[j].next){
			int x = e[j].to;
			if (dis[x] > dis[i] + e[j].w){
				pre[x] = {i};
				dis[x] = dis[i] + e[j].w;
				q.push(x);
				inque[x] = true;
			}
			else if (dis[x] == dis[i] + e[j].w){
				pre[x].push_back(i);
			}
		}
	}
}

int main(){
	scanf("%d%d", &n, &m);
	for (int i = 0, u, v, w; i < m; ++ i){
		scanf("%d%d%d", &u, &v, &w);
		addedge(u - 1, v - 1, w);
		mat[u - 1][v - 1] = mat[v - 1][u - 1] = 1;
	}
	for (int i = 0; i < n; ++ i){
		spfa(i);
		for (int j = 0; j < n; ++ j){
			if (j == i){
				continue;
			}
			for (int k = 0; k < pre[j].size(); ++ k){
				int x = pre[j][k];
				mat[x][j] = mat[j][x] = 0;
			}
		}
	}
	int cnt = 0;
	for (int i = 0; i < n; ++ i){
		for (int j = 0; j < n; ++ j){
			cnt += mat[i][j];
		}
	}
	return printf("%d\n", cnt >> 1), 0;
}

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

int main(){
  int i,c=0,n=1,N;
  cin>>N;
  vi A(N);
  for(i=0;i<N;i++){
    cin>>A[i];
    if(A[i]==n)n++;
    else c++;
  }
  if(n==1)c=-1;
  cout<<c<<endl;
}


Measured memory_bytes: 4032
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], D = l[1];

            var array = new int[N][];
            for (var i = 0; i < N; i++)
                array[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var count = 0;
            for (var i = 0; i < N; i++)
            {
                for (var j = i + 1; j < N; j++)
                {
                    double tmp = 0;
                    for (var k = 0; k < D; k++)
                        tmp += Math.Pow(Math.Abs(array[i][k] - array[j][k]), 2);

                    var x = Math.Sqrt(tmp);
                    var y = 0;
                    if (int.TryParse(x.ToString(), out y)) count++;
                }

            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13396
n = input()
l = list(map(int, input().split()))

n = len(l)

lm = 0
ls = 0
for i in range(0, n):
  if lm < l[i]:
    lm = l[i]
  ls = ls + l[i]
ls = ls - lm

if lm < ls:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
from itertools import product

def dif(abc):
    return abs(A-abc[0]) + abs(B-abc[1]) + abs(C-abc[2])

N,A,B,C,*l=map(int,open(0).read().split())

_min=10**6
for i in product([0,1,2,3],repeat=N): #3=竹を使わない
    abc=[0,0,0] #各竹の現在値
    cnt=0 #合成回数
    for ii,ll in zip(i,l): #要素番号対応させる。
        if ii != 3:
            abc[ii]+=ll #指定の竹をll分伸ばす
            cnt+=1 
    if 0 in abc:
        continue #ABCは必ず最低1回は含まれないといけない
    _min=min(_min,cnt*10 - 30 + dif(abc))        
print(_min)

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

using P = pair<int,int>;

int main() {
    int N;
    cin >> N;
    vector<vector<P> > v(N);
    for(int i=0;i<N;i++){
        int A;
        cin >> A;
        for(int j=0;j<A;j++){
            int x, y;
            cin >> x >> y;
            v[i].push_back(P(x-1,y));
        }
    }
    int ans = 0;
    for(int S=0; S<(1<<N); S++){  // S : iビットが1のとき人iが正直、0のとき不親切
        bool ok = true;
        for(int i=0;i<N;i++){
            if(((S>>i)&1) == 0) continue;
            for(int j=0;j<int(v[i].size());j++){
                int x = v[i][j].first, y = v[i][j].second;
                int h = (S>>x)&1;  // xビット目の値
                if(h != y) ok = false;
            }
        }
        if(ok){
            int cnt = 0;
            for(int i=0;i<N;i++){
                if((S>>i)&1) cnt++;
            }
            ans = max(ans, cnt);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
di = {0:1}
accu = 0
for i in a:
    accu += i
    if accu in di:
        di[accu] += 1
    else:
        di[accu] = 1
ans = 0
for i in di.values():
    ans += i*(i-1)//2
print(ans)

Measured memory_bytes: 38676
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        n: usize,
        a_vec: [usize; n],
    }

    let flag = a_vec.iter().filter(|&x| x % 2 == 0).all(|x| x % 3 == 0 || x % 5 == 0);

    if flag {
        println!("APPROVED");
    } else {
        println!("DENIED");
    }
    
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int n,m,q;
    cin >> n >> m >> q;
    vector<int> a(q),b(q),c(q),d(q);
    rep(i,q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;b[i]--;
    }
    queue<vector<int>> st;
    rep(i,m) st.push({i});
    int sum_max = 0;
    while(!st.empty()) {
        vector<int> A = st.front();
        st.pop();
        if(A.size() == n) {
            int sum = 0;
            rep(i,q) if(A[b[i]]-A[a[i]] == c[i]) sum+=d[i];
            chmax(sum_max,sum);
        } else {
            A.push_back(A.back());
            for(int i = A.back(); i < m; i++) {
                A.back() = i;
                st.push(A);
            }
        }
    }
    cout << sum_max << endl;
}


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

int n, m;
int e[200000];

int main() {
	int i;
	
	cin >> n >> m;
	for (i = 0; i < m; i++) { cin >> e[i]; }
	
	bool used[200001] = {false};
	for (i = m - 1; i >= 0; i--) {
		if (used[e[i]]) continue;
		used[e[i]] = true;
		cout << e[i] << endl;
	}
	for (i = 1; i <= n; i++) {
		if (!used[i]) {
			cout << i << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3672
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long int ll;

ll n,m,a,b,c,x,y,aa[100010],ba[100010];
bool r,br,ar;
string s;
char ca,cb;


int main(){
    cin>>n>>m;
    a=0;
    if(m%2==1){
        a=n/m;
        a=a*a*a;
    }
    else{
        a+=(n/m)*(n/m)*(n/m);
        if(n*3>=m)a+=((n-m/2)/m+1)*((n-m/2)/m+1)*((n-m/2)/m+1);
    }

    printf("%lld\n",a);
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rep1(i, n) for(int i=1; i<=n; i++)
#define repr(i, n) for(int i=n-1; i>=0; i--)
#define repr1(i, n) for(int i=n; i>=1; i--)
#define all(v) v.begin(),v.end()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    ll a, b, n;
    cin >> a >> b >> n;

    ll x, s, t;
    if (a < b) {
        if (n >= b) x = b - 1;
        else x = n;
        s = (a * x) / b;
        t = a * (x / b);
        cout << s - t << endl;
    } else if (a % b == 0) {
        cout << (a / b) * min(n, b-1) << endl;
    } else {
        if (n < b) {
            x = n;
        } else {
            ll y = (n + 1) / b;
            x = b * y - 1;
        }
        s = (a * x) / b;
        t = a * (x / b);
        cout << s - t << endl;
    }
}


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

int main() {
  const int64_t mod = 1000000007;
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a.at(i);
  vector<int64_t> taken(k + 1), taken_new(k + 1);
  taken.at(0) = 1;
  for (int i = 0; i < n; i++) {
    taken_new.at(0) = taken.at(0);
    for (int j = 1; j <= k; j++) {
      taken_new.at(j) = taken_new.at(j - 1) + taken.at(j);
      if (j > a.at(i)) taken_new.at(j) -= taken.at(j - 1 - a.at(i));
      taken_new.at(j) += mod;
      taken_new.at(j) %= mod;
    }
    for (int j = 0; j <= k; j++) taken.at(j) = taken_new.at(j);
  }
  cout << taken.at(k) << endl;
}


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

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

    int B[M];
    rep(i, M) cin >> B[i];

    int ans = 0;

    rep(i, N){
        int a;
        int cal = C;
        rep(j, M) {
            cin >> a;
            cal += a * B[j];
        }
        if (cal > 0) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256