akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	long long int N,A,B,ans,a,b;
	cin>>N>>A>>B;
	a=A;b=B;
	if((B-A)%2==0)ans=(B-A)/2;
	else{
		ans=min(B-1,N-A);
		ans=min(ans,A+(B-A-1)/2);
		A=N-b+1;
		B=N-a+1;
		ans=min(ans,A+(B-A-1)/2);
	}
	
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
ans = 0
for i in range(1, N+1, 2):
  count_divisor = 0
  for j in range(1, N+1, 2):
    if i % j == 0:
      count_divisor += 1
  if count_divisor == 8:
    ans += 1
print(ans)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll n;
  cin >> n;
  ll ans=10-(n/200);
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include<iostream>
using namespace std;
typedef long long ll;

int main() {
    ll K, A, B;
    cin >> K >> A >> B;
    if (K + 1 <= A) {
        cout << K + 1 << endl;
        return 0;
    }
    K++;
    ll ans = A;
    if (B - A > 2) ans += (B - A) * ((K - A) / 2);
    else ans += 2 * ((K - A) / 2);
    ans += (K - A) % 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<ctype.h>

int main(){
    char T[100], W[100];
    char eot[] = "END_OF_TEXT";//eot[11]だとおかしかった
    //char eot[] = "end_of_text";
    int cnt=0;
    int i;
    
    scanf("%s", W);
    
    while(1){
        scanf("%s", T);
        if(strcmp(T, eot) == 0) break;
        
        for(i = 0; T[i] != '\0'; i++){
            T[i] = tolower(T[i]);
        }
        
        if(strcmp(T, W) == 0) cnt++;
        
        //printf("%d\n",cnt);
    }
    
    printf("%d\n",cnt);
    
    return 0;
}


Measured memory_bytes: 2036
#include<stdio.h>
int main()
{
    int temp,sum,count=0,i,j,x[3];
    for(i=0;i<3;i++){
    scanf("%d",&x[i]);
    }
    for(i=0;i<3;i++){
        for(j=i+1;j<3;j++){
            if(x[i]>x[j]){
                temp=x[i];
                x[i]=x[j];
                x[j]=temp;
            }
        }
    }
    for(i=0;i<2;i++){
        sum=x[i+1]-x[i];
        count=count+sum;
    }
    printf("%d\n",count);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using str = string;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
const double PI = 3.141592653589793238;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define REP(i, m, n) for (int i = m; i < (int)n; i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greator<>()
#define d20 std::setprecision(20)
#define veci vector<int>
#define vecll vector<long long int>
#define vecb vector<bool>
#define vecd vector<double>
template <typename T>
T lcm(T a, T b)
{
	return a / __gcd(a, b) * b;
}

int main()
{
	int n;
	cin >> n;
	ll m, a, r, c, h;
	m = a = r = c = h = 0;
	rep(i, n)
	{
		str tmp;
		cin >> tmp;
		switch (tmp[0])
		{
		case 'M':
			m++;
			break;
		case 'A':
			a++;
			break;
		case 'R':
			r++;
			break;
		case 'C':
			c++;
			break;
		case 'H':
			h++;
			break;
		default:
			break;
		}
	}
	ll ans = 0;
	ans += m * a * r;
	ans += m * a * c;
	ans += m * a * h;
	ans += m * r * c;
	ans += m * r * h;
	ans += m * c * h;
	ans += a * r * c;
	ans += a * r * h;
	ans += a * c * h;
	ans += r * c * h;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using  namespace std;
#define ll    long long int
#define pai     pair<int,int>
#define vi      vector<int>
#define vd      vector<double>
#define mpi     map<int,int>
#define mps     map<string,int>
#define sti     stack<int>
#define stc     stack<char>
#define sei     set<int>
#define ses     set<string>
#define multii  multiset<int>

 int main()
{
  /*#ifndef ONLINE_JUDGE
  freopen("tin.txt","r",stdin);
  freopen("tout.txt","w",stdout);
  #endif*/
vi v;
 ll n;
 while(cin>>n){
    v.push_back(n);

 }
sort(v.begin(),v.end(),greater<int>());
 int c=0;
for(int i=0;i<3;i++){
   cout<<v[i]<<endl;
}
}







Measured memory_bytes: 3056
<?php
fscanf(STDIN, "%d %d",$N,$X);
$D = 0;
$C = 1;
$L = explode(" ", fgets(STDIN));

//ボールが跳ねる回数ループ
for ($i = 0; $i < $N ; $i++) {
	
	$D = $D + $L[$i];
	//ボールが跳ねる座標が指定された領域を超えたら終了
	if($X < $D){
		
		break;
	}else{
		
		$C ++;
	}
}
echo $C;
?>

Measured memory_bytes: 3704
n, k = gets.split.map &:to_i
a = gets.split.map &:to_i

if k >= Math.log2(n) * 2 + 10
  puts ([n] * n).join(" ")
else
  
  # 累積和
  b = Array.new(n)
  
  k.times do
    b.fill 0
    n.times do |i|
      l, r = [i - a[i], 0].max, [i + a[i], n-1].min
      b[l] += 1
      b[r+1] -= 1 if r+1 < n
    end

    sum = 0
   	n.times do |i|
      sum += b[i]
      a[i] = sum
    end
  end
  
  puts a.join(" ")
end


Measured memory_bytes: 36220
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define int long long
#define MOD 1000000007
#define what_is(x) cerr << #x << " is " << x << endl;
#define loop(i,a,n) for(int i=a;i<n;i++)
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, szof(x))
#define sortall(x) sort(aint(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626 
 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int, int> pt;
// vector<int> arr[100010],children[100010];
// int n,mod;
// pair<int,int> down[100010],up[100010];
// vector<pair<int,int>> downs[100010],pref[100010],suff[100010];
// pair<int,int> merge(pair<int,int> arr,pair<int,int>arr2)
// {
// 	int a=(arr.ff*arr2.ff)%mod;
// 	int b=(((arr.ss*(arr2.ff+arr2.ss))%mod)+arr.ff*arr2.ss)%mod;	
// 	return make_pair(a,b);
// }
// pair<int,int> process(pair<int,int> a)
// {
// 	return mp(a.ff,(a.ff+a.ss)%mod);
// }
// void dfs_one(int v,int par)
// {
// 	pair<int,int> res{1,0};

// 	for(auto itr:arr[v])
// 	{
// 		if(itr!=par)
// 		{
// 			//do something
// 			children[v].pb(itr);
// 			dfs_one(itr,v);
// 			res=merge(res,down[itr]);
// 			downs[v].pb(down[itr]);
// 		}
// 	}
// 	down[v]=process(res);
// }
// void dfs_two(int v,int par)
// {
// 	pair<int,int> res{1,0};
// 	for(int i=0;i<arr[v].size();i++)
// 	{

// 	}
// }

// cin>>n>>mod;
// 	for(int i=1;i<n;i++)
// 	{
// 		int x,y;
// 		cin>>x>>y;
// 		arr[x].pb(y);
// 		arr[y].pb(x);
// 	}

// 	dfs_one(1,-1);	

// 	// suffix sum and prefix sum
// 	for(int i=1;i<=n;i++)
// 	{
// 		pair<int,int> a{1,0};
// 		for(int j=0;j<downs[i].size();j++)
// 		{
// 			a=merge(a,downs[i][j]);
// 			pref.pb(a);
// 		}
// 		a={1,0};
// 		for(int j=(downs[i].size()-1);j>=0;j--)
// 		{
// 			a=merge(a,downs[i][j]);
// 			suff.pb(a);
// 		}
// 		reverse(all(suff));
// 	}
// 	dfs_two(1,-1);


// const int nax=2e5+5;
// vector<pair<int,int>> arr[nax];
	
	//https://leetcode.com/problems/word-ladder-ii/
	//https://leetcode.com/problems/sum-of-subarray-minimums/
	//https://leetcode.com/problems/subsets-ii/discuss/30168/C%2B%2B-solution-and-explanation	

	// int n,m;
	// cin>>n>>m;
	// for(int i=0;i<m;i++)
	// {
	// 	int a,b,c;
	// 	cin>>a>>b>>c;
	// 	arr[b].pb(mp(a,c));
	// }
	// for(int i=1;i<=n;i++)
	// {
		
	// }
signed main() {

	fastio();
	//#define LOCAL_DEFINE	
	#ifdef LOCAL_DEFINE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	string s;
	cin>>s;
	if(s=="Sunny")
	{
		cout<<"Cloudy";
	}else if(s=="Cloudy")
	{
		cout<<"Rainy";
	}else{
		cout<<"Sunny";
	}
 	return 0;
}


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

int main() {
	int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
	if (x1 == x2) {
		cout << x2 + (y1 - y2) << " " << y2 << " " << x2 + (y1 - y2) << " " << y1 << endl;
		return 0;
	}
	if (y1 == y2) {
		cout << x2 << " " << y2 + (x2 - x1) << " " << x1 << " " << y2 + (x2 - x1) << endl;
		return 0;
	}
	cout << x2 - (y2 - y1) << " " << y2 + (x2 - x1) << " " << x1 - (y2 - y1) << " " << y1 + (x2 - x1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#define MN 100005
using namespace std;
int n,m,c[MN],tmp[MN];
long long a[MN],v[MN],k,ans[MN],sum;
bool vis[MN];
int main(){
	scanf("%d",&n);int x;
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
		v[i]=a[i]-a[i-1],c[i]=i;
	}scanf("%d%lld",&m,&k);
	for(int i=1;i<=m;i++)scanf("%d",&x),swap(c[x],c[x+1]);
	for(int i=1,j,tt=0;i<=n;i++,tt=0)if(!vis[i]){
		for(j=i;!vis[j];j=c[j])vis[j]=1,tmp[++tt]=j;
		for(j=1;j<=tt;j++)ans[tmp[j]]=v[tmp[(j+k-1)%tt+1]];
	}
	for(int i=1;i<=n;i++)ans[i]+=ans[i-1],printf("%lld.0\n",ans[i]);
}



Measured memory_bytes: 4608
#include <bits/stdc++.h>              
using namespace std;                 
using ll = long long;               
using vl = vector<ll>;              
using vvl = vector<vl>;            
using pll = pair<ll,ll>;                 
using vb = vector<bool>;                 
const ll oo = 0x3f3f3f3f3f3f3f3fLL;      
const double eps = 1e-9;                 
#define sz(c) ll((c).size())             
#define all(c) begin(c),end(c)           
#define mp make_pair                     
#define mt make_tuple                    
#define pb push_back                     
#define eb emplace_back                  
#define xx first                         
#define yy second                       
#define has(c,i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (int i=(a); i<(b); i++)       
#define FORD(i,a,b) for (int i=int(b)-1; i>=(a); i--)
#define DB(X) ({ if(1) cerr << "DB: " << (#X) << " = " << (X) << endl; })

int main() { 
  ios::sync_with_stdio(false); 
  string s;
  cin >> s;
  FOR(i,0,12){
    if(i ==4 ) cout << ' ';
    cout << s[i];
  }
  cout << endl;
}

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

using namespace std;

long long arr[100001];

int main() {
    long long n;
    cin >> n;
    for(long long i = 0; i < n; ++i){
        long long tmp; cin >> tmp;
        arr[tmp]++;
    }
    for(long long i = 0; i < 100001; ++i){
        if(arr[i] > 2){
            if(arr[i] % 2 != 0){
                arr[i] = 1;
            }else arr[i] = 2;
        }
    }
    long long ans = 0, cnt = 0;
    for(long long i = 0; i < 100001; ++i){
        if(arr[i] == 2){
            cnt++;
        }
        if(arr[i] >= 1)ans++;
    }
    if(cnt % 2 == 0)cout << ans;
    else cout << ans - 1;
	return 0;

}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int x,a,b;
int main(){
  cin >> x >> a >> b;
  if((x-a)*(x-a) > (x-b)*(x-b))
    cout << 'B' << endl;
  else
    cout << 'A' << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()

def bisection(l,r,f,left=True,discrete=True):
    eps=1 if(discrete) else 10**-8
    if((not left)^f(r)): return r if(left) else r+1
    elif(left^f(l)): return l-1 if(left) else l
    while(r-l>eps):
        h=(l+r)//2 if(discrete) else (l+r)/2
        if((not left)^f(h)): l=h
        else: r=h
    return (l+r)/2 if(not discrete) else l if(left) else r

def resolve():
    n,q=map(int,input().split())
    S=input()
    TD=[input().split() for _ in range(q)]

    def checkleft(i):
        for t,d in TD:
            if(S[i]==t and d=='L'):
                i-=1
            elif(S[i]==t and d=='R'):
                i+=1
            if(i<0):
                return False
            elif(i>n-1):
                return True
        return True

    def checkright(i):
        for t,d in TD:
            if(S[i]==t and d=='L'):
                i-=1
            elif(S[i]==t and d=='R'):
                i+=1
            if(i<0):
                return True
            elif(i>n-1):
                return False
        return True

    i=bisection(0,n-1,checkleft,left=False)
    j=bisection(0,n-1,checkright,left=True)
    print(max(j-i+1,0))
resolve()

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


int main() {
  
  int H, W;


  while(true){
    cin >> H >> W;
    if (H == 0 && W == 0)break;

    for (int j = 0; j < H;j++){
      for(int i = 0; i < W;i++){
        cout << "#";
      }
        cout << endl;
    }

    cout << endl;
}  
  


}




Measured memory_bytes: 3084
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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()
{
  ll N; cin>>N;
  string S; cin>>S;
  
  ll ans=0;
  rep(i,1000){
    vector<ll> vec={i/100,i%100/10,i%10};
    ll next=0;
    rep(j,N){
      if(next==3) break;
      if(S[j]-'0'==vec[next]) next++;
    }
    if(next==3) ans++;
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3684
#include <bits/stdc++.h>
#include <string>
  
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)
typedef long long ll;

const ll MOD=1000000007ll;
const int MAX=5100000;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

ll fact[MAX], fact_inv[MAX];

ll power(ll a, ll b){
	ll res=1;
	while(b>0){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		b>>=1;
	}
	return res;
}

// nCr
ll comb(ll n, ll r){
	ll t=1000000;
	fact[0]=1;
	REP(i, t) fact[i+1]=fact[i]*(i+1)%MOD;
	fact_inv[t]=power(fact[t], MOD-2);
	FORR(i, 0, t) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
	return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
  
int main()
{
  ll D; cin >> D;
  int i, ans=1; ll tmp=1;
  rep(i,50){
      tmp *= 2;
      if(D < tmp){break;}
      ans++;
  }

  cout << (ll)(pow((ll)2, (ll)ans) - 1) << endl;

  return 0;
}


Measured memory_bytes: 4096
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define rep(i,x) for(int (i)=1;(i)<=(x);(i)++)
#define repp(i,x,y) for(int (i)=(x);(i)<=(y);(i)++)
#define per(i,x,y) for(int (i)=(x);(i)>=(y);(i)--)
#define forn(i,x) for(int (i)=0;(i)<(x);(i)++)
#define foreach(i,x) for(auto i:x)
using namespace std;
typedef pair<int,int>pii;
int n,m,q;
vector<int>G[100010];
int v[100010],d[100010],c[100010],col[100010];
int now;
int used[100010];
inline void read(int &x){
    int f=1;x=0;char s=getchar();
    while(s<'0'||s>'9'){s=getchar();}
    while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
}
inline void dfs(int x,int d){
	if(used[x]>=d)return;
	used[x]=d;
	if(!col[x])col[x]=now;
	foreach(to,G[x])if(d)dfs(to,d-1);
}
int main(){
	memset(used,-1,sizeof(used));
	read(n),read(m);
	for(int i=1,x,y;i<=m;i++){
		read(x),read(y);
		G[x].pb(y),G[y].pb(x);
	}
	read(q);
	rep(i,q)read(v[i]),read(d[i]),read(c[i]);
	for(int i=q;i;i--){
		now=c[i];
		dfs(v[i],d[i]);
		// rep(i,n)cout<<col[i]<<' ';
		// puts("");
	}
	rep(i,n)cout<<col[i]<<endl;
	return 0;
}
/*
7 7
1 2
1 3
1 4
4 5
5 6
5 7
2 3
2
6 1 1
1 2 2
*/

Measured memory_bytes: 8440
class Node():
    def __init__(self, key):
        self.parent = None
        self.left = None
        self.right = None
        self.key = key

class Tree():
    def __init__(self):
        self.root = None
    
    def insert(self, key):
        z = Node(key)
        y = None
        x = self.root
        
        while x:
            y = x
            if z.key < x.key:
                x = x.left
            else:
                x = x.right
        z.parent = y
        
        if y == None:
            self.root = z
        elif z.key < y.key:
            y.left = z
        else:
            y.right = z
            
    def find(self, key):
        node = self.root
        
        while node:
            if node.key == key:
                return node
            elif node.key > key:
                node = node.left
            else:
                node = node.right
        
        return None
    
    def delete(self, key):
        node = self.find(key)
        
        if node.left and node.right:
            right_min = node.right
            while right_min.left:
                right_min = right_min.left
            node.key = right_min.key
            node = right_min
        
        if node.left or node.right:
            child = node.left if node.left else node.right
            if node.parent.left == node:
                node.parent.left = child
                child.parent = node.parent
            else:
                node.parent.right = child
                child.parent = node.parent
        else:
            if node.parent.left == node:
                node.parent.left = None
            else:
                node.parent.right = None
                
    def preorder(self, node):
        print(" {}".format(node.key), end = "")
        
        if node.left:
            self.preorder(node.left)
        if node.right:
            self.preorder(node.right)
    
    def inorder(self, node):
        if node.left:
            self.inorder(node.left)
            
        print(" {}".format(node.key), end = "")
        
        if node.right:
            self.inorder(node.right)
            
    def out(self):
        self.inorder(self.root)
        print('')
        self.preorder(self.root)
        print('')

tree = Tree()
N = int(input())
for _ in range(N):
    order = input().split()
    if order[0] == 'insert':
        tree.insert(int(order[1]))
    elif order[0] == 'find':
        print('yes' if tree.find(int(order[1])) else 'no')
    elif order[0] == 'delete':
        tree.delete(int(order[1]))
    else:
        tree.out()

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

int main(){
    
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int r;
    cin >> r;
    
    cout << r * r << endl;
}



Measured memory_bytes: 256
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]


    S = input()
    case = {'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
    print(case[S])




if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#include<stdio.h>
#define MAX 100

typedef struct{
  int u;
  int k;
  int v[MAX];
}G;

void AdjacencyMatrices(int,int);
int a[MAX][MAX],n;
G graph[MAX];

int main()
{
  int i,j;

  scanf("%d",&n);
  for(i = 1;i <= n;i++){
    scanf("%d%d",&graph[i].u,&graph[i].k);
    for(j = 1;j <= graph[i].k;j++){
      if(graph[i].k == 0) break;
      scanf("%d",&graph[i].v[j]);
    }
  }

  for(i = 1;i <= n;i++){
    for(j = 1;j <= graph[i].k;j++){
      AdjacencyMatrices(i,j);
    }   
  }

  for(i = 1;i <= n;i++){
    for(j = 1;j <= n;j++){
      if(j == n) printf("%d",a[i][j]);
      else printf("%d ",a[i][j]);

    }
    printf("\n");
  }
  return 0;
}

void AdjacencyMatrices(int x,int y)
{
  int i;

    for(i = 1;i <= n;i++){
      if(graph[x].v[y] == i) a[x][i] += 1;
      else a[x][i] += 0;
    }
    i++;
}

Measured memory_bytes: 676
#include<stdio.h>
int main()
{
  char s[4][4];
  int i;
  for(i=0;i<3;i++){
    scanf("%s",s[i]);
  }
  printf("%c%c%c\n",s[0][0],s[1][1],s[2][2]);
  return 0; 
}

Measured memory_bytes: 128
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;

int main()
{
    int a,b;
    cin >> a >> b;
    if (a >= 1 && a <= 9 && b >= 1 && b <= 9)
    {
        cout << a*b << endl;
    }else{
        cout << -1 << endl;
    }
    
}
    

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
struct N {
  int now;
  ll d;
};

bool operator<(const N &l, const N &r) {
  return l.d > r.d;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll l;
  int n, m;
  cin >> n >> m >> l;
  vector<bitset<300>> v(n);
  vector<vector<pair<int, ll>>> p(n);
  ll INF = 1LL << 60;
  vector<vector<ll>> ans(n, vector<ll>(n, INF));
  for (int i = 0; i < m; i++) {
    int a, b;
    ll c;
    cin >> a >> b >> c;
    a--;
    b--;
    if (c <= l) {
      p[a].emplace_back(b, c);
      p[b].emplace_back(a, c);
    }
  }
  for (int i = 0; i < n; i++) {
    priority_queue<N> q;
    q.push(N{i, 0});
    while (q.size()) {
      auto now = q.top();
      q.pop();
      if (v[i][now.now]) continue;
      v[i][now.now] = true;
      ans[i][now.now] = 1;
      for (auto &pr : p[now.now]) {
        if (v[i][pr.first]) continue;
        if (now.d + pr.second > l) continue;
        q.push(N{pr.first, now.d + pr.second});
      }
    }
    ans[i][i] = 1;
  }
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        ans[i][j] = min(ans[i][j], ans[i][k] + ans[k][j]);
      }
    }
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    if (ans[a][b] < INF)
      cout << ans[a][b] - 1 << endl;
    else cout << "-1" << endl;
  }
  return 0;
}


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

int main(){

  int m,f,b;

  cin>>m>>f>>b;

  if ( m - b > 0 ){

    cout<<0<<endl;
  }

  else  if ( m + f - b < 0 ){

    cout<<"NA"<<endl;

  }

  else if ( m + f - b >= 0 ){

    cout<< b - m << endl;
  }

  return 0;

}


  



Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;
const int maxn = 1100;
const int maxm = 2200;
struct ed{
	int from,to,w;
};
int fa[maxn];
int getfa(int s){
	if(fa[s]==s)return s;
	return fa[s]=getfa(fa[s]);
}
bool cmp(ed a,ed b){
	return a.w<b.w;
}
void refa(int n){
	for(int i=0;i<=n;i++)fa[i]=i;
}
vector<ed> E;
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	long long X;
	scanf("%lld",&X);
	refa(n);
	for(int i=0;i<m;i++){
		int from,to,w;
		scanf("%d%d%d",&from,&to,&w);
		E.push_back((ed){from,to,w});
	}
	sort(E.begin(),E.end(),cmp);
	//for(int i=0;i<E.size();i++)printf("%d ",E[i].w);puts("");
	int num=0;
	int numbig=1;
	for(int i=1;i<m;i++){
		long long nowX=0;
		refa(n);
		nowX+=E[i].w;
		fa[E[i].from]=E[i].to;
		for(int j=0;j<m;j++){
			ed& e=E[j];
			if(getfa(e.from)==getfa(e.to))continue;
			else{
				nowX+=e.w;
				fa[getfa(e.from)]=getfa(e.to);
			}
		}
		//printf("nowX = %lld\n",nowX);
		if(nowX==X){
			num++;
		}
		if(nowX>X){
			numbig++;
		}
	}
	if(m==1 || num==0){
		printf("0\n");
		return 0;
	}
	long long ans=1;
	//printf("num = %d\n",num);
	//printf("numbig = %d\n",numbig);
	for(int i=0;i<num;i++){
		ans<<=1;
		ans%=MOD;
	}
	ans-=1;
	ans+=MOD;
	ans%=MOD;
	for(int i=0;i<numbig;i++){
		ans<<=1;
		ans%=MOD;
	}
	//if(numbig+num==m)ans--;
	ans+=MOD;
	ans%=MOD;
	//if(numbig+num!=m)ans<<=1;
	ans%=MOD;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
#define ll long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=1e6+10,M2=1e7+10,mod=1e9+7,inf=1e9+10;
vector<int>best,good,bad;
int32_t main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);	
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int tmp;
		cin>>tmp;
		if(tmp%4==0)best.pb(tmp);
		else if(tmp%2==0)good.pb(tmp);
		else bad.pb(tmp);
	}
	if(bad.size()>best.size()+1)return cout<<"No",0;
	if(bad.size()>best.size())
	{
		if(good.size())cout<<"No";
		else cout<<"Yes";
		return 0;
	}
	cout<<"Yes";
}	

Measured memory_bytes: 1020
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
using ll = long long;
ll solve() {
    string S;
    ll K;
    cin >> S >> K;
    if (all_of(S.begin(), S.end(), [&S](char c) { return c == S[0]; })) return S.size() * K / 2;
    vector<int> v;
    char prevc = S[0];
    int cnt = 0;
    for (int i = 0; i < S.size(); i++) {
        char c = S[i];
        if (c == prevc) cnt++;
        else {
            v.push_back(cnt);
            cnt = 1;
        }
        prevc = c;
    }
    if (cnt != 1) v.push_back(cnt);
    ll ans = 0;
    for (int p : v) ans += p / 2;
    ans *= K;
    if (S.front() == S.back()) {
        int a = v.front();
        int b = v.back();
        ans -= (K - 1) * (a / 2 + b / 2 - (a + b) / 2);
    }
    return ans;
}
int main() {
    cout << solve() << endl;
}


Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;

void main() {
  int times = readln.chomp.to!(int);
  foreach(t; 0..times) {
    dchar[] line = readln.chomp.dup.to!(dchar[]);
    if ( line.length >= 6) {
      for(uint i = 0; i < line.length - 6; i++) {
        if (line[i..(i + 7)] == "Hoshino") {
          line[i..(i + 7)] = "Hoshina";
        }
      }
    }
    writeln(line);
  }
}

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

struct StQuery
{
  StQuery() : m_nLeft(0), m_nRigt(0) { }

  int m_nLeft;
  int m_nRigt;
};

void fnInput(string& rsStr, vector<StQuery>& rvoQuery)
{
  int nStrSiz, nQuerySiz;
  cin >> nStrSiz >> nQuerySiz;
  rvoQuery.resize(nQuerySiz);

  cin >> rsStr;
  
  for (StQuery& roQuery : rvoQuery)
    cin >> roQuery.m_nLeft >> roQuery.m_nRigt;
}

void fnSubStrACCnt(string sStr, const vector<StQuery>& cnrvoQuery)
{
  vector<int> vnCumlSum(sStr.size() + 1);

  for (int nBgn = 0; nBgn < vnCumlSum.size() - 1; nBgn++)
  {
    vnCumlSum[ nBgn + 2 ] = vnCumlSum[ nBgn + 1 ];
    if (sStr[nBgn] == 'A' && sStr[nBgn + 1] == 'C')
      vnCumlSum[ nBgn + 2 ] = vnCumlSum[ nBgn + 1] + 1;
  }

  for (int i = 0; i < cnrvoQuery.size(); i++)
  {
    cout << vnCumlSum[ cnrvoQuery[i].m_nRigt ] - vnCumlSum[ cnrvoQuery[i].m_nLeft ];
    cout << endl; 
  }
}
 
int main()
{
  string sStr;
  vector<StQuery> voQuery;

  fnInput(sStr, voQuery);
  fnSubStrACCnt(sStr, voQuery);

  return 0;
}

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

int keta(int sum) {
	int count = 0;
	while(sum != 0){
		count += sum % 10;
		sum /= 10;
	}
	return count;
}

int main() {
	int N, A, B;
	cin >> N >> A >> B;
	int awnser = 0;
	for(int i = 1;i <= N;i++){
		if(keta(i) >= A && keta(i) <= B){
			awnser += i;
		}
	}
	cout << awnser << endl;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) {
        cin >> A.at(i);
    }

    int ans = 0;
    while (true) {
        int count = 0;
        rep(i, N) {
            if (A.at(i) % 2 == 0) {
                count++;
            }
        }
        if (count == N) {
            rep(i, N) {
                A.at(i) /= 2;
            }
            ans++;
        } else {
            break;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
from decimal import Decimal, ROUND_HALF_UP

num_of_person = int(input())
coordinates = list(map(int, input().split()))

avg = sum(coordinates) / len(coordinates)
avg = Decimal(str(avg)).quantize(Decimal('0'), rounding=ROUND_HALF_UP)

power = 0
for coordinate in coordinates:
    power = power + (coordinate - avg) ** 2

print(power)

Measured memory_bytes: 5076
import math
x = 0
y = 0
tt = 0
while True:
    d, t = map(float, input().split(','))
    y += d * math.cos(tt / 180 * math.pi)
    x += d * math.sin(tt / 180 * math.pi)
    tt += t
    if d == t ==0:
        break

print(int(x))
print(int(y))

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


int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll _,i,j,n,a,b,e,k,u,t,x=1,m,y,q,f=1,c=0,d=0,l,p,z,o,r,g;
    string ss,s;
    cin>>n;
    for0(n)
    {
        cin>>x;
        if(i>0&&x<m)
        {
            c+=(m-x);
            x=m;
        }
        m=x;
    }
    cout<<c<<endl;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define all(v) (v).begin(), (v).end()

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

    rep(i, 10001){
        if(i*8/100 == a && i/10 == b){
            cout << i;
            return 0;
        }
    }
    cout << "-1";
}

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

void maxself(ll &a, ll b)
{
    a = max(a, b);
}

void solveTLE(vector<int> &beauty, vector<int> &h)
{
    int n = h.size();
    vector<ll> dp(n);
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        dp[i] = beauty[i];
        for (int j = 0; j < i; j++)
        {
            if (h[i] > h[j] && dp[j] + beauty[i] > dp[i])
                dp[i] = dp[j] + beauty[i];
        }
        maxself(ans, dp[i]);
    }
}

const int maxn = 2e5 + 11;

int main()
{
    int n;
    scanf("%d", &n);
    vector<int> h(n);
    vector<ll> beauty(n);
    for (int &x : h)
    {
        scanf("%d", &x);
    }

    for (ll &x : beauty)
    {
        scanf("%lld", &x);
    }

    int base = 1;
    while (base <= n)
    {
        base *= 2;
    }
    vector<ll> tree(2 * base);
    //to find the maximal beauty sum of flowers such h[i] <= h[j]
    //height is monotonically increasing
    ll ans = 0;
    vector<ll> dp(n + 1);
    //dp[i] => stores the max sum of flowers such that last element was at height i

    for (int flower = 0; flower < n; flower++)
    {
        //for flower x , i want to know the max dp[i] in range[0,h[flower]-1]
        ll best = 0;
        int x = h[flower] + base;
        while (x > 1)
        {
            if (x & 1)
            {
                maxself(best, tree[x - 1]);
            }
            x >>= 1;
        }
        dp[h[flower]] = best + beauty[flower];
        for (int i = base + h[flower]; i >= 1; i >>= 1)
        {
            maxself(tree[i], dp[h[flower]]);
        }
        // for (int i = 0; i < h[flower]; i++){
        //     maxself(dp[h[flower]], dp[i] + beauty[flower]);
        // }
    }

    for (int flower = 0; flower < n; flower++)
    {
        maxself(ans, dp[h[flower]]);
    }
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 8192
#109b
n=int(input())
l=[input() for _ in range(n)]
la=l[0][-1]
flag=True

for i in range(1,n):
    if la==l[i][0]:
        la=l[i][-1]
    else:
        flag=False
        break

if len(set(l))!=n:
    flag=False
if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
N = int(input())
K = int(input())
mylist=[]
count=0
x = list(map(int, input().split()))

for i in range(N):
    if K-x[i]>=x[i]:
        count=count+x[i]*2
    else:
        count=count+(K-x[i])*2
print(count)


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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using pii=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

signed main(){
	int n=read(),x=read(),last=0;
	int ans=0;
	REP(i,n){
		int a=read();
		int dif=max(a+last-x,0LL);
		ans+=dif;
		last=a-dif;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
const std::string yes = "Yes";
const std::string no  = "No";

int main(){
    fast_io();

    int n;
    std::cin >> n;
    int k = (-1+sqrt(1+8*n))/2;

    if(k*(k+1)/2==n){
        for(int i=1; i<k+1; i++){
            std::cout << i << "\n";
        }
        return 0;
    }

    k += 1;
    while(true){
        if(n-k>0){
            std::cout << k << "\n";
            n -= k;
            k--;
        }else{
            std::cout << n << "\n";
            return 0;
        }
    }
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
using namespace std;
typedef long long int lli;

int main(){
	int n;
	cin >> n;
	lli a,b;
	cin >> a >> b;
	for(int i=0; i<n-1; i++){
		lli sa,sb;
		cin >> sa >> sb;
		lli na = (a+sa-1)/sa*sa;
		lli nb = na/sa *sb;
		if(nb>=b){
			a = na;
			b = nb;
		}else{
			b = (b+sb-1)/sb*sb;
			a = b/sb *sa;
		}
	}
	cout << a+b << endl;
	return 0;
}

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

int main(){
	int N, i, count = 0;
	scanf("%d", &N);
	map<string, int> mp;
	for(i = 0; i < N; i++){
		string sub;
		cin >> sub;
		mp[sub]++;
		count = max(count, mp[sub]);
	}
	for(pair<string, int> a : mp){
		if(a.second == count){
			cout << a.first << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 25216
#include <bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long int ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
const int MOD=1000000007;

bool isPowerOfTwo (ll x)  
{  
    return x && (!(x&(x-1)));  
}
bool isPrime(int n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
int highestPowerof2(unsigned int n) 
{ 
    // Invalid input 
    if (n < 1) 
        return 0; 
  
    int res = 1;
    for (int i=0; i<8*sizeof(unsigned int); i++) 
    { 
        int curr = 1 << i; 
        if (curr > n) 
           break; 
  
        res = curr; 
    } 
  
    return res; 
} 
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}       
////////////////////////////////////////////////////////////////////

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);  
  cout.tie(NULL);
  ll t=1;
  while(t--)
  {
    ll n,t;
    cin>>n>>t;
    ll a[n];
    REP(i,n)
    {
        cin>>a[i];
    }
    ll c=0;
    ll ans=0;
    bool flag=true;
    for(int i=1;i<n;i++)
    {
        if(a[i]>=(a[i-1]+t))
        {
            ans+=t;
        }
        else
        {
            ans+=a[i]-a[i-1];
        }
        
    }
    ans+=t;
    cout<<ans;
  }  
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)

int main()
{
    string S;
    cin >> S;
    for (size_t i = 0; i < S.size(); i++)
    {
        cout << "x";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << ((a + b >= c) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 384
import sys
sys.setrecursionlimit(2*10**5)
input = sys.stdin.readline


def calc_counts(n, edges):
    counts = [0] * n
    seen = [False] * n
    dfs(0, edges, seen, counts)
    return counts


def dfs(node, edges, seen, counts):
    count = 1
    seen[node] = True
    for to in edges[node]:
        if seen[to]:
            continue
        count += dfs(to, edges, seen, counts)
    counts[node] = count
    return count


def calc_blank(node, counts: list, edges, all, mod=10**9+7):
    n = len(counts)
    paths = edges[node]
    if len(paths) <= 1:
        return 0
    base = counts[node]
    result = all - 1
    for v in paths:
        count = counts[v]
        if count > base:
            count = n - base
        result -= pow(2, count, mod) - 1
        result %= mod

    return result


def main():
    mod = 10**9 + 7
    n = int(input())
    edges = [[] for _ in range(n)]
    for _ in range(n-1):
        a, b = map(int, input().split())
        edges[a-1].append(b-1)
        edges[b-1].append(a-1)

    counts = calc_counts(n, edges)
    all = pow(2, n-1, mod)
    blanks = 0
    for node in range(n):
        blank = calc_blank(node, counts, edges, all)
        blanks += blank
        blanks %= mod

    inv_denominator = pow(pow(2, n, mod), mod-2, mod)
    ans = blanks * inv_denominator % mod
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 175572
import java.util.Scanner;
import java.util.Arrays;
public class Main{
  public static void main(String[] args){
    // 入力
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] v = new int[n];
    int[] c = new int[n];
    for(int i=0; i<n; ++i)
      v[i] = sc.nextInt();
    for(int i=0; i<n; ++i)
      c[i] = sc.nextInt();

    // X-Yを先に計算してソートする
    for(int i=0; i<n; ++i)
      v[i] -= c[i];
    Arrays.sort(v);

    // 最大値を求める
    int ans = 0;
    for(int i=n-1; i>=0; --i){
      if(v[i] > 0 )
        ans += v[i];
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 22996
k=input().split()
W=int(k[0])
H=int(k[1])
x=int(k[2])
y=int(k[3])
r=int(k[4])

if ((x>=r)and(W-x>=r))and ((y>=r)and(H-y>=r)):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 5596
// #define STOPIT
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
using namespace std;
using ll = long long;

void debug_impl() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
    #define debug(...)\
    do {\
        cerr << boolalpha << "[" << #__VA_ARGS__ << "]:";\
        debug_impl(__VA_ARGS__);\
        cerr << std::noboolalpha;\
    } while (false)
#else
    #define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr>
istream& operator>> (istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, enable_if_t<!is_same< Container, string >::value, nullptr_t> = nullptr >
ostream& operator<< (ostream& os, Container const& v) {
  os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

const ll MOD = 1000000007;

vector<ll> primes;
void init_primes(ll N)
{
    vector<bool> is_prime(N+1, true);
    is_prime[0] = is_prime[1] = false;
    rep(i, 2, N+1)
    if (is_prime[i])
    {
        primes.push_back(i);
        for (ll j = (ll)i*i; j<=N; j += i)
            is_prime[j] = false;
    }
}

ll power_mod(ll n, ll m)
{
    ll res = 1;
    ll base = n;
    while (m > 0)
    {
        if (m&1) res = (res * base) % MOD;
        base = (base * base) % MOD;
        m >>= 1;
    }
    return res;
}

ll inv_mod(ll n)
{
    return power_mod(n, MOD-2);
}

vector<ll> factorials;
void init_factorial(int N)
{
    factorials.assign(N+1, 1);
    rep(i, 2, N+1)
    {
        factorials[i] = factorials[i-1] *i;
        factorials[i] %= MOD;
    }
}

ll comb(ll n, ll m)
{
    m = min(m, n-m);
    ll res = factorials[n];
    debug(n, factorials[n]);
    res *= inv_mod(factorials[n-m]);
    res %= MOD;
    res *= inv_mod(factorials[m]);
    res %= MOD;
    debug(n, m, res);
    return res;
}

int main()
{
    // init primes
    init_primes(200010);
    init_factorial(200010);
    debug(primes);

    // read data
    int N, M;
    cin >> N >> M;

    ll ans = 1;
    for (auto prime: primes)
    {
        // decompose
        ll cnt = 0;
        while (M%prime==0)
        {
            ++cnt;
            M /= prime;
        }
        if (cnt == 0) continue;

        // cnt 
        debug(M, prime, cnt, ans);
        ans *= comb(cnt+N-1, N-1);
        ans %= MOD;
    }
    if (M>1)
    {
        ans *= N;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2152
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repeq(i,a,b) for(int i=a;i<=(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    const int B=2*n;
    vector<vector<int>> ys(B),zs(B);
    rep(i,0,n) {
        int a,b;
        cin >> a >> b;
        ys[a].push_back(b);
    }
    rep(i,0,n) {
        int c,d;
        cin >> c >> d;
        zs[c].push_back(d);
    }
    int ans=0;
    vector<int> f(B);
    rep(i,0,B) {
        for(auto z:zs[i]) {
            for(int i=z-1;i>=0;--i) if(f[i]) {
                    --f[i];
                    ++ans;
                    break;
                }
        }
        for(auto y:ys[i]) ++f[y];
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.io.*;

class Main {

	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		int x, ans;
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        x = Integer.parseInt(br.readLine());
        
        ans = x*x*x;
		System.out.println(ans);

	}

}

Measured memory_bytes: 24392
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(void){
  int n;
  cin >> n;
  vector<int> v[3];
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 3; j++){
      int a;
      cin >> a;
      v[j].push_back(a);
    }
  }

  int p[222] = {0};
  for(int j = 0; j < 3; j++){
    for(int i = 0; i < n; i++){
      int c = -1;
      for(int k = 0; k < n; k++){
	if(v[j][i] == v[j][k]) c++;
      }
      if(!c)p[i] += v[j][i];
    }
  }
  for(int i = 0; i < n; i++){
    cout << p[i] << endl;
  }
}

Measured memory_bytes: 1220
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <complex>
#include <map>
#include<unordered_map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include<bitset>
#include<deque>
#include<string>
#include<list>
#include<iterator>
#include<sstream>
#include <algorithm>
#include <numeric>
#include <math.h>

#define user spaesk
#define lli long long int
#define ld long double
#define ff first
#define ss second
#define lower(a) transform(a.begin(),a.end(),a.begin(),::tolower);

using namespace std;

typedef vector<vector<lli> > matrix ;

const int N = 3e5 + 500;
const long long mod = 1e9 + 7;
const long long cmod = 998244353 ;
const long long inf = 1LL << 61;
const int M = 1e6 + 500;
const lli ths = 1LL << 40;
const int NN = 5e3 + 6;

void solve()
{

    lli k, a, b;
    cin>>k>>a>>b;
    lli x = ceil((ld)a / k);
    lli y = b / k;
    if(x <= y) {
        cout<<"OK";
    }
    else
        cout<<"NG";
    cout<<"\n";
    return ;
}

/*
*/

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

    int t = 1;
//    cin>>t;
    while(t --)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3640
from itertools import product
N = int(input())
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]

ans = -10**18
for p in product([0, 1], repeat = 10):
    if sum(p) == 0:
        continue
    res = 0
    for i in range(N):
        cnt = 0
        for j in range(10):
            if p[j]:
                cnt += F[i][j]
        res += P[i][cnt]
    ans = max(ans, res)
print(ans)


Measured memory_bytes: 3064
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);

		String s = stdIn.nextLine();

		if (s.length() < 5) {
			System.out.println("No");;
		} else if (s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

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

int main() {
	string s;
	int k;
	cin >> s >> k;
	vector<string> v;

	for (int i = 0;i < s.size();i++) {
		for (int j = 1;j <= k;j++) {
			string t = s.substr(i, j);
			v.push_back(t);

			if (i + j > s.size()) break;
		}
	}

	sort(v.begin(),v.end());
	v.erase(unique(v.begin(), v.end()),v.end());

	cout << v[k - 1] << endl;




	return 0;
}

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

int Function(long long N) {
    int counter = 0;
    while (N > 0) {
        N /= 10;
        ++counter;
    }
    return counter;
}

int main() {
    long long N;
    cin >> N;

    int minF = 100;
    for (long long A = 1; A * A <= N; ++A) {
        if (N % A == 0) {
            long long B = N / A;
            if (Function(B) < minF) minF = Function(B);
        }
    }

    cout << minF << endl;
}

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

int main()
{
	int W, H, N;
	scanf("%d%d%d", &W, &H, &N);
	int left{}, right{W}, top{H}, bottom{};
	for (int i{}; i < N; i++)
	{
		int x, y, a;
		scanf("%d%d%d", &x, &y, &a);
		if (a == 1) left = std::max(left, x);
		else if (a == 2) right = std::min(right, x);
		else if (a == 3) bottom = std::max(bottom, y);
		else top = std::min(top, y);
	}
	printf("%d\n", std::max(0, right - left) * std::max(0, top - bottom));

	return 0;
}

Measured memory_bytes: 256