akhauriyash/Code-Regression huggingface dataset:
def examA():
    N = LI()
    N.sort()
    if N==[1,4,7,9]:
        print("YES")
    else:
        print("NO")
    return

def examB():
    S = SI()
    K = "keyence"
    for i in range(7):
        if S[:i]+S[-7+i:]==K:
            print("YES")
            return
    if S[:7]==K:
        print("YES")
        return
    print("NO")
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math,random
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examB()

"""

"""

Measured memory_bytes: 4804
#include <stdio.h>

int main(void) {
  int l;
  int r;
  int d;
  scanf("%d", &l);
  scanf("%d", &r);
  scanf("%d", &d);
  int ans = 0;

  for(int x = l ; x <= r ; x++){
    if (x%d == 0) ans++;
    else;
  }

  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 1736
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using static System.Console;
using static System.Math;

class Program
{
    void Solve()
    {
        var A = io.Int;
        var B = io.Int;

        WriteLine(f(A, B));
    }

    int f(int age, int price)
    {
        if (age <= 5) return 0;
        if (6 <= age && age <= 12) return price / 2;
        return price;
    }

    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) => new Program().Stream();

    private void Stream()
    {
        //var exStdIn = new System.IO.StreamReader("stdin.txt");
        //SetIn(exStdIn);
        Solve();
        io.Flush();
    }
}

class SimpleIO
{
    string[] _nextBuffer;
    int _bufferCnt;
    char[] cs = new char[] {' ', '"', ','};

    StreamWriter sw = new StreamWriter(OpenStandardOutput())
    {
#if DEBUG
        AutoFlush = true
#else
        AutoFlush = false
#endif
    };

    public SimpleIO()
    {
        _nextBuffer = new string[0];
        _bufferCnt = 0;
        SetOut(sw);
    }

    string Next()
    {
        if (_bufferCnt < _nextBuffer.Length) return _nextBuffer[_bufferCnt++];
        var st = ReadLine();
        while (st == string.Empty) st = ReadLine();
        _nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        _bufferCnt = 0;
        return _nextBuffer[_bufferCnt++];
    }

    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void Flush() => Out.Flush();
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
using namespace std;
int main(void) {

    long long k,x,y,ans=0;
        cin>>k>>x>>y;
	if(x%k==0){
        cout<<"OK";
	}
	else{
        ans=x/k+1;
        if((ans*k)<=y){
            cout<<"OK";
        }
        else{
            cout<<"NG";
        }
	}
}


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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n;
// string s;

int main() {
    cin >> n;
    VVi a(n, Vi(n));
    REP(i, n) REP(j, n) cin >> a[i][j];

    VVi b(a);
    V<V<bool>> isDirect(n, V<bool>(n, true));
    REP(k, n) REP(i, n) REP(j, n) {
        b[i][j] = min(b[i][j], a[i][k] + a[k][j]);
        if (k != i && k != j) {
            isDirect[i][j] = isDirect[i][j] && (b[i][j] < a[i][k] + a[k][j]);
        }
    }

    bool f = true;
    REP(i, n) REP(j, n) f &= a[i][j] == b[i][j];
    if (!f) {
        std::cout << -1 << '\n';
        return 0;
    }

    ll res = 0;
    REP(i, n) REP2(j, i+1, n) {
        if (isDirect[i][j]) res += a[i][j];
    }
    std::cout << res << '\n';

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
const long long int INF=1000000000000000009;
const int mod=1000000007;
const int inf=1000000009;
using namespace std;
ll N;
int n;
int T[100005],S[100005],Z[100005],P[100005],D[600005];
ll I[200005];
int suma=1;
void dodaj(int u,int c)
{
    D[u]+=c;
    while(u!=1)
    {
        u/=2;
        D[u]=D[2*u]+D[2*u+1];
    }
}
int getsum(int a,int b,int lo,int hi,int u)
{
    if(b<=a)
        return 0;
    if(a==lo&&b==hi)
        return D[u];
    int mid=(lo+hi)/2;
    int L=getsum(a,min(b,mid),lo,mid,2*u);
    int P=getsum(max(a,mid),b,mid,hi,2*u+1);
    return L+P;
}
bool funkcja(int x)
{
    for(int i=1;i<=n;i++)
    {
        if(T[i]<=x)
        {
            Z[i]=0;
            S[i]=S[i-1]+1;
        }
        else
        {
            Z[i]=1;
            S[i]=S[i-1]-1;
        }
       // printf("%d\n",S[i]);
        dodaj(S[i]+suma/2,1);
    }
    ll wynik=0;
    int ile=n;
    for(int i=1;i<=n;i++)
    {
        wynik+=getsum(ile+1,suma/2+2,1,suma/2+2,1);
      //  printf("%d %lld\n",ile,wynik);
        if(Z[i]==0)
            ile++;
        else
            ile--;
        dodaj(S[i]+suma/2,-1);
    }
   // printf("%lld\n",wynik);
    for(int i=1;i<=2*n;i++)
        I[i]=0;
    for(int i=1;i<=suma;i++)
        D[i]=0;
    if(wynik>=N)
        return true;
    return false;
}
int main()
{
    scanf("%d",&n);
    while(suma<2*n+1)
        suma*=2;
    suma*=2;
    suma--;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&T[i]);
        P[i]=T[i];
    }
    sort(P+1,P+n+1);
    N=(ll)n*(n+1)/2;
    N/=2;
    N++;
   // printf("%lld\n",N);
    int p=0,k=n;
    S[0]=n;
    while(p+1<k)
    {
        int sr=(p+k)/2;
        if(funkcja(P[sr]))
            k=sr;
        else
            p=sr;
    }
    printf("%d",P[k]);

    return 0;
}


Measured memory_bytes: 5760
n,m = map(int,input().split())
x = list(map(int,input().split()))

x.sort()
sub = [0] * (m - 1)
tmp = x[0]
for i in range(1,m):
    sub[i-1] = x[i] - tmp
    tmp = x[i]
sub.sort(reverse=True)

ans = sum(sub[:n-1])
print(x[-1]-x[0]-ans)


Measured memory_bytes: 13964
N, C, K = map(int,input().split())
T = [int(input()) for i in range(N)]
T.sort(reverse = True)
counter = 1
i = 0           #### whileの中のカウント（バス乗車数）
A = T.pop()     #####先頭
while T:
  a = T.pop()
  i+=1
  if i>=C or a>A+K:
    i=0
    A=a
    counter += 1
  
print(counter)

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

int main() {
    int n, t; cin >> n >> t;
    int ans = 1e9;
    for (int i=0; i<n; ++i) {
        int c, ti;
        cin >> c >> ti;
        if (ti <= t) ans = min(ans, c);
    }
    cout << (ans == 1e9 ? "TLE" : to_string(ans)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define  mes(a, b)  memset(a, b, sizeof a)
#define pb push_back
typedef unsigned long long int ull;
typedef long long int ll;
const int    maxn = 1e3 + 20;
const int    maxm = 1e5 + 10;
const ll     mod  = 1e9 + 7;
const ll     INF  = 1e18 + 100;
const int    inf  = 0x3f3f3f3f;
const double pi   = acos(-1.0);
const double eps  = 1e-8;
using namespace std;
int main(){
    int n;cin >> n;
    int ans = 0;
    int num = n / 500;n -= 500 * num;ans += 1000 * num;
    ans += n / 5 * 5;
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	char input[8][8];
	int line;
	int zero;
	int tmp;
	bool flag;
	bool is,end;
	while(gets(input[0])){
		for(int i=1;i<8;i++)
			gets(input[i]);
		line=0;
		zero=0;
		flag=false;
		end=false;
		for(int i=0;i<8;i++){
			is=false;
			for(int j=0;j<8;j++){
				if(input[i][j]=='1'){
					is=true;
					flag=true;
					if(zero)
						end=true;
				}
				if(flag&&!end){
					if(input[i][j]=='0')
						zero++;
				}	
			}
			if(is)
				line++;
		}
		if(line==4)
			cout<<"B"<<endl;
		else if(line==1)
			cout<<"C"<<endl;
		else if(line==2){
			if(zero==6)
				cout<<"A"<<endl;
			else if(zero==7)
				cout<<"E"<<endl;
			else if(zero==5)
				cout<<"G"<<endl;
		}else{
			if(zero==7)
				cout<<"F"<<endl;
			else
				cout<<"D"<<endl;
		}
		getchar();
	}
} 

Measured memory_bytes: 1120
/*
 ***
 Question Name:
 ***
 Question Link:
 
 ***
 Idea:
 */

#include <memory.h>
#include <iomanip>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>

#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))

using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<LL> vL;
typedef vector<bool> vb;
typedef unordered_set<int> ui;
typedef pair<LL,LL> pLL;


class NotSubsequence{
    vi dp;
    vector<char> to;
    vector<vi> next;
    string S;
    int N;
    void init(string &s){
        S = s;
        N = (int)s.size();
        dp = vi(N+1,-1);
        dp[N] = 1;
        to = vector<char>(N+1,'a');
        next = vector<vi>(26,vi(N,N));
        for(int i=N-1;i>=0;--i) for(int j=0;j<26;++j){
            if(S[i] == char((int)'a' + j)) next[j][i] = i;
            else next[j][i] = (i<N-1? next[j][i+1]:N);
        }
        return;
    }
    
    int minLength(int i){
        if(i>N) return 0;
        if(dp[i] >= 0) return dp[i];
        dp[i] = N+1;
        to[i] = 'z';
        for(int j=0;j<26;++j){
            int tmpl = 1 + minLength(next[j][i]+1);
            if(tmpl < dp[i]){
                dp[i] = tmpl;
                to[i] = (char)((int)'a' + j);
            }
        }
        return dp[i];
    }
public:
    string solution(string s){
        if(s.empty()) return "a";
        init(s);
        int L = minLength(0), j = 0;
        assert(L > 0);
        string ans;
        while(true){
            ans += to[j];
            j = next[(int)(to[j]-'a')][j]+1;
            if(j>=N) break;
        }
        return ans;
    }
};





int main(){
    string s;
    cin>>s;
    cout<<NotSubsequence().solution(s)<<endl;
    return 0;
}

Measured memory_bytes: 22660
#include<iostream>
#include<set>
#include<vector>
using namespace std;
bool prime(int x)
{
	for(int i=2;i*i<=x;i++)
    {
		if(x%i==0)
		   return false;
	}
	return true;
}
int main()
{
     string str;
     cin>>str;
     set<char> s;
     for(char x='a';x<='z';x++)
       s.insert(x);
     if(str.size()<26)
     {
		 for(char x:str)
		 {
			 auto it=s.find(x);
			 s.erase(x);
		 }
		 cout<<str;
		 cout<<*(s.begin())<<endl;
	 }
	 else
	 {
		 if(str=="zyxwvutsrqponmlkjihgfedcba")
		    cout<<-1<<endl;
		 else
		 {
			 int j,l=str.size();
			 for(j=l-1;j>=0;j--)
			 {
				 set<char> temp;
				 for(int i=j+1;i<l;i++)
				 {
					 if(str[i]>str[j])
					   temp.insert(str[i]);
				 }
				 if(temp.size()!=0)
				 {
					 for(int ptr=0;ptr<j;ptr++)
					 {
						 cout<<str[ptr];
					 }
					 cout<<*(temp.begin())<<endl;
					 exit(0);
				 }
			 }
		 }
	 }
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int64, n+1)
	var sum int64
	for i := 0; i <= n; i++ {
		fmt.Scan(&a[i])
		sum += a[i]
	}

	inner := make([]int64, n+1)
	for i := n; i > 0; i-- {
		inner[i-1] = (inner[i] + a[i] + 1) / 2
	}

	min := func(a, b int64) int64 {
		if a < b {
			return a
		}
		return b
	}

	var ans int64
	c := 1 - a[0]
	for i := 0; i <= n; i++ {
		if c < inner[i] {
			ans = -1
			break
		}
		ans += c + a[i]
		sum -= a[i]
		if i != n {
			c = min(2*c-a[i+1], sum-a[i+1])
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 7120
#include<algorithm>
#include<array>
#include<climits>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int main()
{
	int n;
	cin >> n;
	vector<int> a;
	a.resize(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	reverse(a.begin(), a.end());
	int alice = 0;
	int bob = 0;
	for (int i = 0; i < n; ++i) {
		if (i % 2 == 0) alice += a[i];
		if (i % 2 == 1) bob += a[i];
	}
	cout << alice - bob << endl;
}


Measured memory_bytes: 256
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao Twitter/QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}

//---------------------------------------------------------------------------
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
         if (n & 1) res = res * a % MOD;
         a= a * a % MOD;//次の準備
         n >>= 1;
      }
 return res;
}
ll waru(ll a,ll b){
    return a*modpow(b,MOD-2)%MOD;
}
//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    ll n,k;cin>>n>>k;
    vector<Pll>ab;
    for(ll i=0;i<n;i++){
        ll a,b;cin>>a>>b;
        ab.pb(mp(a,b));
    }
    sort(all(ab));
    for(ll i=0;i<n;i++){
        k-=ab[i].se;
        if(k<=0){
            cout<<ab[i].fi<<endl;
            return 0;
        }
    }
    
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------









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

int main(){
    int A,B,C,D;
    cin >> A >> B >> C;
    D = A;
    A = B;
    B = D;
    D = A;
    A = C;
    C = D;
    cout << A << " " << B << " " << C << endl;
    
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define fo(i,a,b) for((i)=(a);i<=(b);i++)
#define rfo(i,a,b) for((i)=(a);i>=(b);i--)
#define inrange(x,y,z) (((x)>=(y))&&((x)<=(z)))
#define ALL(vec) (vec).begin(),(vec).end()
#define SOR(vec) sort(ALL(vec))
#define UNI(vec) (vec).erase(unique(ALL(vec)),(vec).end())
using namespace std;
int n,a[200100],x,y,res[200100],dp[200100],inf;
vector<int> ga[200100],vec;
void dfs(int u,int p){
	int prv=lower_bound(dp,dp+n,a[u])-dp;
	int rrr=dp[prv];
	dp[prv]=a[u];
	res[u]=lower_bound(dp,dp+n,inf)-dp;
	for(int i=0;i<ga[u].size();i++){
		int v=ga[u][i];
		if(v==p) continue;
		dfs(v,u);
	}
	dp[prv]=rrr;
}
int main(){
	#ifdef FILIN
		#ifndef DavidDesktop
			freopen(FILIN,"r",stdin);
			freopen(FILOUT,"w",stdout);
		#endif
	#endif
	ios::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	memset(dp,63,sizeof(dp));
	inf=dp[0];
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i],vec.push_back(a[i]);
	for(int i=1;i<n;i++){
		cin>>x>>y;
		ga[x].push_back(y);
		ga[y].push_back(x);
	}
	SOR(vec);
	UNI(vec);
	for(int i=1;i<=n;i++)
		a[i]=lower_bound(vec.begin(),vec.end(),a[i])-vec.begin();
	dfs(1,-1);
	for(int i=1;i<=n;i++)
		cout<<res[i]<<endl;
	cout<<endl;
	return 0;
}


Measured memory_bytes: 31624
#include<iostream>
#include<cmath>
using namespace std;
int n,t,x,y,nt,nx,ny;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>t>>x>>y;
        if((((int)abs(nx-x)+(int)abs(ny-y))%2==0 &&(t-nt)%2==1)||(((int)abs(nx-x)+(int)abs(ny-y))%2==1 &&(t-nt)%2==0)||(abs(nx-x)+abs(ny-y)>t-nt))
        {
            cout<<"No";
            return 0;
        }
        nx=x;ny=y;nt=t;
	}
	cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int h,w; cin >> h >> w;
  vector<string> a(h);
  for(int i=0;i<h;i++) cin >> a[i];
  vector<bool> row(h,false);
  vector<bool> col(w,false);
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(a[i][j]=='#'){
        row[i]=true; col[j]=true;
      }
    }
  }
  for(int i=0;i<h;i++){
    if(row[i]){
      for(int j=0;j<w;j++){
        if(col[j]) cout << a[i][j];
      }
      cout << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
read = sys.stdin.read

import numpy as np
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import csr_matrix

n, m = map(int, input().split())
ABC = np.array(read().split(), dtype=np.int64).reshape(m, 3)
A, B, C = ABC.T
csr = csr_matrix((C, (A, B)), shape=(n+1, n+1))
F = floyd_warshall(csr, directed=False)
ans = 0
for a, b, c in ABC:
  if c != F[a, b]:
    ans += 1
print(ans)

Measured memory_bytes: 26996
#include <bits/stdc++.h>
#include <iomanip>
#define ll long long int
#define lld double
#define vi vector<int>
#define pii pair<int,int>
#define piii pair<pii, ll>
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define ppb pop_back
#define d0(x) cout<<x<<" "
#define d1(x) cout<<x<<"\n"
#define d2(x,y) cout<<x<<" "<<y<<"\n"
#define d3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define d4(x,y,z,w) cout<<x<<" "<<y<<" "<<z<<" "<<w<<"\n"
#define d5(x,y,z,w,s) cout<<x<<" "<<y<<" "<<z<<" "<<w<<" "<<s<<endl
using namespace std;
const ll mod = 1e9+7;
 

void init();
void solve(int T);
int main(int argc, char* argv[])
{
    ios_base::sync_with_stdio ( false );cin.tie(0);cout.tie(0);
    int t1=1;
    init();
    //cin>>t1;
    for(int T=1;T<=t1;T++)
    {
        solve(T);
    }
}



void init()
{

}

ll x[101],N;

ll f(ll p)
{
    ll ret = 0;
    for(int i=0;i<N;i++)
        ret+=((x[i]-p)*(x[i]-p));
    return ret;
}
void solve(int T)
{
    cin>>N;
    for(int i=0;i<N;i++)cin>>x[i];

    ll ans = 1e7;
    for(ll p=1;p<=100;p++)
        ans = min(ans,f(p));

    d1(ans);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main() {
int A;
  int B;
  int C;
  cin >>A>>B>>C;
  if(A+B>=C) {
    cout <<"Yes" << endl;
  }
else {
cout << "No" << endl;
}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int d = scanner.nextInt();
		int x = scanner.nextInt();
		// i nin me
		for(int r = 0; r < n; r++) {
			int a = scanner.nextInt();
		// choco + 
			for(int i = 0; i < d; i += a) {
				x++;
			}
		}
		System.out.println(x);
	}

}

Measured memory_bytes: 21844
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#if __cplusplus >= 201103L
#include <chrono>
using namespace std::chrono;
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pb push_back
#define fi first
#define se second
#ifdef LOCAL
#define prl puts("\n------------------\n")
#define prln(x) (cout << #x << ' ' << x << endl)
#define pr(x) (cout << #x << ' ' << x << ' ' )
#define prv(x) (cout << x << ' ')
#else
#define prl 
#define prln(x) 
#define pr(x)
#define prv(x)
#endif
#define clr(x) memset((x), 0, sizeof((x)))
#define clr1(x) memset((x), -1, sizeof((x)))
#define endl "\n"
#define pi acos(-1)
#define rep(i, st, ed) for (int i = (st); i <= (ed); ++i)
#define rep0(i, st, ed) for (int i = (st); i < (ed); ++i)
#define per(i, st, ed) for (int i = (st); i >= ed; --i)
template<class T> void _sf(T &x) {cin >> x;}
void _sf(int &x) {scanf("%d", &x);}
void _sf(ll &x) {scanf("%lld", &x);}
void _sf(double &x) {scanf("%lf", &x);}
void _sf(char &x) {scanf(" %c", &x);}
void _sf(char *x) {scanf("%s", x);}
void sf() {}
template <class T, class...U> void sf(T & head, U&... tail) { _sf(head); sf(tail...);}
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;

int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    }
    return x * f;
}
const int maxn = 1e5 + 6;
vector<int> g[maxn];
ll dp[maxn][2];

void dfs(int u, int prev) {
    dp[u][0] = dp[u][1] = 1;
    for (auto i : g[u]) {
        if (i != prev) {
            dfs(i, u);
            dp[u][0] = (dp[u][0] *(dp[i][1] + dp[i][0])) % mod;
            dp[u][1] = (dp[u][1] * (dp[i][0])) % mod;
        }
    }
    // cout << dp[u][0] << endl;
    return ;
}

int main(){
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        #if __cplusplus >= 201103L
        auto start = steady_clock::now();
        #endif
    #endif
    int n = read();
    rep0(i, 0, n - 1) {
        int a = read(), b = read();
        g[a].pb(b);
        g[b].pb(a);
    }
    dfs(1, -1);
    cout << (dp[1][0] + dp[1][1]) % mod << endl;

    #ifdef LOCAL
        #if __cplusplus >= 201103L
        auto end = steady_clock::now();
        duration<double> time_span = duration_cast<duration<double>>(end - start);;
        printf("Total time: %.6fs\n", time_span.count());
        #endif
    #endif
    return 0;
}

Measured memory_bytes: 10880
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> PII;
LL MOD = 1000000007;

LL power(LL x, LL k) {
	if(x == 0) return 0;
	if(k == 0) return 1;
	LL ret = power(x, k/2);
	ret *= ret;
	ret %= MOD;
	if(k % 2 == 1 ) {
		ret *= x;
		ret %= MOD;
	}
	return ret;
}

LL frac(LL x) {
	return power(x, MOD-2);
}

vector<LL> kaijo;
vector<LL> inv_kaijo;

void init(int N) {
	kaijo.push_back(1);
	for(int i=1; i<=N; i++)
		kaijo.push_back(kaijo.back() * (LL)i % MOD);
	for(int i=0; i<N; i++) {
		inv_kaijo.push_back(frac(kaijo[i]));
	}
	
}
LL comb(LL m, LL n) {
	LL tmp = kaijo[m];
	tmp = tmp * inv_kaijo[n] % MOD;
	tmp = tmp * inv_kaijo[m-n] % MOD;
	return tmp;
}

LL calc(int x1, int x2, int y1, int y2) {
	assert(x1<=x2);
	assert(y1<=y2);
	x2++; y2++;
//	cout << x1 << " " << x2 << " " << y1 << " " << y2 << endl;
	LL p = comb(x2+y2, x2);
	LL q = comb(x2+y1, x2);
	LL r = comb(x1+y2, x1);
	LL s = comb(x1+y1, x1);
//	cout << p << " " << q << " " << r << " " <<s << endl;
	return (p - q - r + s) % MOD;
}

 

int main() {
	init(5000006);
	vector<int> x(6);
	vector<int> y(6);
	for(int i=0; i<6; i++) cin >> x[i];
	for(int i=0; i<6; i++) cin >> y[i];
	
	
	LL ans = 0;
	for(int i=x[2]; i<=x[3]; i++) {
		int j = y[3];
		LL p = calc(i-x[1], i-x[0], j-y[1], j-y[0]);
		LL q = calc(x[4]-i, x[5]-i, y[4]-j-1, y[5]-j-1);
		ans += p * q % MOD * ((LL) i + j+1) % MOD;
		//cout << p << " " << q << endl;
	}
	for(int j=y[2]; j<=y[3]; j++) {
		int i = x[3];
		LL p = calc(i-x[1], i-x[0], j-y[1], j-y[0]);
		LL q = calc(x[4]-i-1, x[5]-i-1, y[4]-j, y[5]-j);
		ans += p * q % MOD * ((LL)i + j + 1) % MOD;
	}
	
	for(int i=x[2]; i<=x[3]; i++) {
		int j = y[2];
		LL p = calc(i-x[1], i-x[0], j-y[1]-1, j-y[0]-1);
		LL q = calc(x[4]-i, x[5]-i, y[4]-j, y[5]-j);
		ans -= p * q % MOD * ((LL) i + j) % MOD;
		//cout << p << " " << q << endl;
	}
	for(int j=y[2]; j<=y[3]; j++) {
		int i = x[2];
		LL p = calc(i-x[1]-1, i-x[0]-1, j-y[1], j-y[0]);
		LL q = calc(x[4]-i, x[5]-i, y[4]-j, y[5]-j);
		ans -= p * q % MOD * ((LL)i + j) % MOD;
	}
	ans %= MOD;
	ans += MOD;
	ans %= MOD;
	cout <<  ans << endl;
	
	return 0;	
}





Measured memory_bytes: 108892
#include <iostream>
#include <vector>
#include <algorithm>
 
using namespace std;
typedef pair<int, int> P;
 
void solve()
{
    int n;
    while(cin >> n, n)
    {
        vector<P> doll;
        for(int i = 0; i < n; ++i)
        {
            int h, r;
            cin >> h >> r;
            doll.push_back(P(h, r));
        }
        int m;
        cin >> m;
        for(int i = 0; i < m; ++i)
        {
            int h, r;
            cin >> h >> r;
            doll.push_back(P(h, r));
        }
        sort(doll.begin(), doll.end());
        int N = doll.size();
        vector<int> dp(N, 1);
        int ans = 1;
        for(int i = 0; i < N; ++i)
        {
            for(int j = 0; j < i; ++j)
            {
                if(doll[j].first < doll[i].first && doll[j].second < doll[i].second)
                {
                    dp[i] = max(dp[i], dp[j] + 1);
                }
            }
            ans = max(ans, dp[i]);
        }
        cout << ans << endl;
    }
}
 
int main()
{
    solve();
    return(0);
}

Measured memory_bytes: 3088
#include<stdio.h>
int MakeM(int,int);
int n,A[20];
int main(){
	int m,q,i;


	//input
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}

	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&m);
		if(MakeM(0,m)==1){
			printf("yes\n");
		}
		else{
			printf("no\n");
		}
	}

	return 0;
}


int MakeM(int num,int data){

	if(num==n)return 0;
	if(A[num]==data)return 1;
	if(A[num]>data)return MakeM(num+1,data);
	return MakeM(num+1,data-A[num]) || MakeM(num+1,data);
}



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

using namespace std;

namespace {

#define VEVE(i, a, b) for (ll i = a, __##i = b; i < __##i; ++i)
#define DYDY(i, a, b) for (ll i = a, __##i = b; i > __##i; --i)
#define RARA(x, seq) for (auto &x : seq)
#define SIZE(x) ((ll)(x.size()))
#define ALL(x) x.begin(), x.end()

typedef int64_t ll;
typedef double dd;

void Solve(ll) {
  ll n;
  if (not(cin >> n))
    return;
  vector<ll> seq(n);
  RARA(s, seq) cin >> s;
  ll res = 0;
  DYDY(i, n - 1, -1) {
    if (seq[i] > i or (i > 0 and seq[i - 1] < seq[i] - 1)) {
      cout << "-1\n";
      return;
    }
    if (i == n - 1 or seq[i] >= seq[i + 1]) {
      res += seq[i];
    }
  }
  cout << res << endl;
}

void Init() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}
}

int32_t main() {
#ifdef AZN
  freopen("input.txt", "r", stdin);
#endif
  Init();
  ll tests = 11;
  VEVE(test, 1, tests + 1) Solve(test);
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=105;
int n;
char s[max_n];
int main(){
    scanf("%d %s",&n,s+1);
    if(n&1)printf("No\n");
    else{
        n/=2;
        for(int i=1;i<=n;i++)if(s[i]!=s[i+n])return printf("No\n"),0;
        printf("Yes\n");
        return 0;
    }
}

Measured memory_bytes: 256
import collections
import copy
N = int(input())
As = [int(input()) for _ in range(N)]
As.sort()
As = collections.deque(As)
small1 = collections.deque()
small2 = collections.deque()
big1 = collections.deque()
big2 = collections.deque()
A1 = copy.copy(As)
A2 = copy.copy(As)
s = A1.popleft()
b = A2.pop()
small1.append(s)
small2.append(s)
big1.append(b)
big2.append(b)
cnt1 = 0
cnt2 = 0
while A1:
    if cnt1%4 == 0:
        b = A1.pop()
        small1.append(b)
        small2.appendleft(b)
        cnt1 += 1
    elif  cnt1%4 == 1:
        b = A1.pop()
        small2.append(b)
        small1.appendleft(b)
        cnt1 += 1
    elif cnt1%4 == 2:
        s = A1.popleft()
        small1.append(s)
        small2.appendleft(s)
        cnt1 += 1
    else:
        s = A1.popleft()
        small2.append(s)
        small1.appendleft(s)
        cnt1 += 1
while A2:
    if cnt2%4 == 0:
        s = A2.popleft()
        big1.append(s)
        big2.appendleft(s)
        cnt2 += 1
    elif  cnt2%4 == 1:
        s = A2.popleft()
        big2.append(s)
        big1.appendleft(s)
        cnt2 += 1
    elif cnt2%4 == 2:
        b = A2.pop()
        big1.append(b)
        big2.appendleft(b)
        cnt2 += 1
    else:
        b = A2.pop()
        big2.append(b)
        big1.appendleft(b)
        cnt2 += 1
anss1 = 0
anss2 = 0
ansb1 = 0
ansb2 = 0
for i in range(N-1):
    anss1 += abs(small1[i+1]-small1[i])
    anss2 += abs(small2[i+1]-small2[i])
    ansb1 += abs(big1[i+1]-big1[i])
    ansb2 += abs(big2[i+1]-big2[i])
print(max(anss1, anss2, ansb1, ansb2))

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

int main(void){
    int a[4];
    rep(i, 3){
        cin >> a[i];
    }
    sort(a, a+3);
    cout << a[2]-a[0] << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final String s = scanner.next();
        final List<Integer> list = IntStream.range(0, s.length())
                .mapToObj(i -> s.charAt(i) - '0')
                .collect(Collectors.toList());

        System.out.println(calc(0, list, 0));
    }

    private static long calc(final int begin, final List<Integer> list, final long fixed) {
        if (begin >= list.size()) {
            return fixed;
        }

        long sum = 0;
        long tmp = 0;
        for (int i = begin; i < list.size(); i++) {
            tmp = tmp * 10 + list.get(i);
            sum += calc(i + 1, list, fixed + tmp);
        }

        return sum;
    }
}


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

int main()
{
    int n;
    cin>>n;
    int* r=new int[n];
    for(int i=0; i<n; i++)
        cin>>r[i];

    int min=r[0], maxv=r[1]-r[0];


    for(int i=1; i<n; i++){
        maxv=(maxv < r[i]-min)? r[i]-min : maxv;
        min=(min>r[i])? r[i] : min;
        }
    cout<<maxv<<endl;
}

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

vector<ll> divisor(ll n) {
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    return (ret);
}

int main() {
    int n;
    cin >> n;
    vector<ll> a(n), cnt(1000005);
    rep(i, n) {
        cin >> a[i];
        cnt[a[i]]++;
    }

    ll ans = 0;
    rep(i, n) {
        vector<ll> div = divisor(a[i]);

        bool flag = true;
        for (ll &d : div) {
            if (d == a[i]) {
                if (cnt[d] >= 2) {
                    flag = false;
                    break;
                }
            } else if (cnt[d] != 0) {
                flag = false;
                break;
            }
        }

        ans += flag;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 12696
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		
		int A = scanner.nextInt();
		int a = 0;
		int b = 0;
		int B = scanner.nextInt();
		
		String string = scanner.next();
		
		for (int i = 0; i < string.length(); i++) {
			char c = string.charAt(i);
			if (c == 'c') {
				System.out.println("No");
				continue;
			}
			
			if (c == 'a' ) {
				if ((a + b) < (A + B)) {
					System.out.println("Yes");
					a++;
				} else {
					System.out.println("No");
				}
			}
			
			if (c == 'b') {
				if ((a + b) < (A + B) && b < B) {
					b++;
					System.out.println("Yes");
				} else {
					System.out.println("No");
				}
			}
			
		}
	}

}

Measured memory_bytes: 23120
n=int(input())
t=list(map(int,input().split()))
ans=[]
s=sum(t)
m=int(input())
for i in range(m):
    p,x=map(int,input().split())
    ans.append(s-t[p-1]+x)
for i in range(m):
    print(ans[i])


Measured memory_bytes: 9176
#include <iostream>
#include <cassert>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
// #include <queue>

#define INF 922337203685477580
typedef long long ll;

using namespace std;

struct List_t {
  ll key;
  struct List_t* prev;
  struct List_t* next;
};
typedef struct List_t List;
List *head;

void insert(ll x) {
  List *l = (List*)malloc(sizeof(List));

  l->prev = head;
  l->next = head->next;
  l->next->prev = l;
  head->next = l;
  l->key = x;
}
List* find(ll x) {
  for (List* i = head->next; i != head; i = i->next) {
    if (i->key == x) {
      return i;
    }
  }
  // assert(0);
  return NULL;
}
void del(List* l) {
  if (l == NULL) return;
  // List *l = find(x);
  l->prev->next = l->next;
  l->next->prev = l->prev;

  free(l);
}
void deleteLast() {
  del(head->prev);
}
void deleteFirst() {
  del(head->next);
}

int main() {
  head = (List*)malloc(sizeof(List));
  head->prev = head;
  head->next = head;


  int n;
  cin >> n;

  for (int i = 0; i < n; i++) {
    // string cmd;
    char cmd[100];
    // cin >> cmd;
    scanf("%s", cmd);
    // if (cmd == "insert") {
    if (strcmp("insert", cmd) == 0) {
      ll key;
      // cin >> key;
      scanf("%lld", &key);

      insert(key);
    // } else if (cmd == "delete") {
    } else if (strcmp("delete", cmd) == 0) {
      ll key;
      // cin >> key;
      scanf("%lld", &key);

      List* t = find(key);
      del(t);
    } else if (strcmp("deleteFirst", cmd) == 0) {
      deleteFirst();
    } else if (strcmp("deleteLast", cmd) == 0) {
      deleteLast();
    } else {
      assert(0);
    }
  }

  for (List* i = head->next; i != head; i = i->next) {
    if (i != head->next) {
      cout << " ";
    }
    cout << i->key;
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 34436
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF = 1LL << 60;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int i,j,n,k;
	cin>>n>>k;
	long long dp[n],h[n];
	for(i=0;i<n;i++){cin>>h[i];dp[i]=INF;}
	dp[0]=0;
//	for(i=0;i<n;i++)cout<<dp[i]<<" ";
//	cout<<endl;
	for(i=0;i<n;i++){
		for(j=1;j<=k&&i+j<n;j++){
//			cout<<dp[i+j]<<" "<<dp[i]+abs(h[i+j]-h[i])<<endl;
			chmin(dp[i+j],dp[i]+abs(h[i+j]-h[i]));
		}
	}
//	for(i=0;i<n;i++)cout<<dp[i]<<" ";
	cout<<dp[n-1]<<endl;
	
	
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){
    long long N;
    cin>>N;
    
    for(long long i=N;i>0;i--){
        if(i == (long long)sqrt(i) * (long long)sqrt(i)){
            cout<<i<<endl;
            return 0;
        }
    }
}



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

int main(){
  char a;
  cin>>a;
  if(a=='A'){
    cout << "T";
  }else if(a=='T'){
    cout << "A";
  }else if(a=='C'){
    cout << "G";
  }else if(a=='G'){
  cout << "C";
  }
}


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

int main() {
  int k, x;
  cin >> k >> x;
  
  for (int i = 0; i < k * 2 - 1; i++) {
    if (i != k * 2 - 2) {
      cout << x - k + i + 1 << " ";
    } else {
      cout << x - k + i + 1 << endl;
    }
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main() {
	int m, a, o, i[10], n;
	for (a = 1; a <= 4; a++) {
		scanf("%d %d",&m,&o);
		if (m == 1) {
			i[a] = o * 6000;
		}
		if(m==2){
			i[a] = o * 4000;
		}
		 if (m == 3) {
			i[a] = o * 3000;
		}
		 if (m == 4) {
			 i[a] = o * 2000;
		 }
	}
	for (a = 1; a <= 4; a++) {
		printf("%d\n", i[a]);
	}
	return 0;
}


Measured memory_bytes: 2752
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define LL long long
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;void re(int& x)
{
	while(ch=getchar(),ch<33);x=ch-48;
}
using namespace std;
int a,b[4],w[2]={1,-1};
char e[2]={'+','-'};
int main()
{
	re(a),re(b[1]),re(b[2]),re(b[3]);
	for(int i=0;i<8;++i)
	{
		int sum=a;
		for(int j=1,c=i;j<=3;++j,c>>=1)
			sum+=w[c&1]*b[j];
		if(sum==7)
		{
			printf("%d",a);
			for(int j=1,c=i;j<=3;++j,c>>=1)
				printf("%c%d",e[c&1],b[j]);
			printf("=7");
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int i, j, k;
    int b, f, r, v;
    int count[4][3][10] = {0};
    scanf("%d", &i);
    for(j = 0; j < i; j++){
        scanf("%d %d %d %d\n", &b, &f, &r, &v);
        count[b-1][f-1][r-1] += v;
    }
    for(i = 0; i < 4; i++){
        for(j = 0; j < 3; j++){
            for(k = 0; k < 10; k++){
                printf(" %d", count[i][j][k]);
            }
            putchar('\n');
        }
        if(i != 3)
            printf("####################\n");
    }
    return 0;
}


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

int main(void) {
	int i, j, n;
	cin >> n;
	for (i = 1; i <= n; i++) {
		if (i % 3 == 0)
			cout << ' ' << i;
		else {
			for (j = i; j != 0; j /= 10) {
				if (j % 10 == 3) {
					cout << ' ' << i;
					j = 0;
				}
			}
		}
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 3096
import scala.collection.mutable
import scala.io.StdIn

/**
  * AOJ
  */
object Main {

  def main(args: Array[String]): Unit = {

    while (true) {

      val in = StdIn.readLine().split(" ").map(_.toInt)
      if (in(0) == 0 && in(1) == 0) { return }

      var count = 0
      for(i <- 1 to in(0); j <- i + 1 to in(0); k <- j + 1 to in(0)){
        if(i + j + k == in(1)){
          count += 1
        }
      }
      println(count)
    }
  }
}

Measured memory_bytes: 46576
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
// clang-format on

main {
  vi a(3);
  rep(i, 3) cin >> a[i];
  sort(all(a));
  cout << a[0] + a[1] << endl;
}


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

Measured memory_bytes: 14396
from collections import defaultdict
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
n,k,l = map(int,input().split())
road = [list(map(int,input().split())) for i in range(k)]
train = [list(map(int,input().split())) for i in range(l)]
rg = [[] for i in range(n+1)]
rv = [0 for i in range(n+1)]
tg = [[] for i in range(n+1)]
tv = [0 for i in range(n+1)]
def connect(road,rg,rv):
  for a,b in road:
    rg[a].append(b)
    rg[b].append(a)
  cnt = 0
  for i in range(1,n+1):
    if rv[i] == 0:
      cnt += 1
      stack = [i]
      while stack:
        x = stack.pop()
        rv[x] = cnt
        for y in rg[x]:
          if rv[y] == 0:
            stack.append(y)
            rv[y] = cnt
connect(road,rg,rv)
connect(train,tg,tv)
condc = defaultdict(list)
for i in range(1,n+1):
  cr = rv[i]
  ct = tv[i]
  condc[(cr,ct)].append(i)
ans = []
for i in range(1,n+1):
  cr = rv[i]
  ct = tv[i]
  ans.append(len(condc[(cr,ct)]))
print(*ans)

Measured memory_bytes: 144980
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0].split(" ")[0]);
  var k = parseInt(input[0].split(" ")[1]);
  var ans =0;
  if(k<=n){
    if(k%2==0){
      ans=Math.pow(Math.floor(n/k),3)+Math.pow(Math.floor(n/(k/2))-Math.floor(n/k),3);
    }else{
      ans=Math.pow(Math.floor(n/k),3);
    }
  }else if(k%2==0&&n>=k/2){
    ans=1;
  }
  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main(void) {
	vector<int> a(5);

	for (int i = 0; i < 5; ++i) {
		cin >> a[i];
	}

	std::vector<std::pair<int, int>>b(5);
	for (int i = 0; i < 5; ++i) {
		if (a[i] % 10 > 0) {
			b[i] = make_pair(a[i] % 10, a[i]);

		}
		else {
			b[i] = make_pair(999, a[i]);

		}
	}
	sort(b.begin(), b.end());
	int ans = b[0].second;
	for (int i = 1; i < 5; ++i) {
		if (b[i].second % 10 == 0) {
			ans += b[i].second;
		}
		else {
			ans += (b[i].second / 10) * 10 + 10;
		}
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 256
A, B, M = map(int, input().split())
a = list(input().split())
b = list(input().split())
l = []
for i in range(M):
  x, y, c = map(int, input().split())
  l.append(int(a[x-1])+int(b[y-1])-c)
l.sort()
n = int(min(a)) + int(min(b))
print(min(l[0], n))

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

int main() {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    
    int l= (int)(s.length());
    
    int dp[l][2];
    int a = s[0] - '0';
    dp[0][0] = a;
    dp[0][1] = 10 - a;

    for (int i=1; i<l; i++){
        a = s[i] - '0';
        dp[i][0] = min(dp[i-1][0] + a, dp[i-1][1] + a+1);
        dp[i][1] = min(dp[i-1][0] + 10 - a, dp[i-1][1] + 10 - (a+1));
    }


    cout << min(dp[l-1][0], dp[l-1][1]+1) << endl;

  }

Measured memory_bytes: 9220
#include<stdio.h>


int main()
{
	int i, j, N, M, A[100]={0}, fscore[100]={0}, num;

	scanf("%d%d", &N, &M);
	for(i=0; i<M; i++){
		scanf("%d", &A[i]);
	}
	for(i=0; i<M; i++){
		for(j=0; j<N; j++){
			scanf("%d", &num);
			if(num == A[i])
				fscore[j]++;
			else
				fscore[A[i]-1]++;
		}
	}

	for(i=0; i<N; i++){
		printf("%d\n", fscore[i]);
	}

	return 0;
}

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

int main()
{
	int A, B, K;
	cin >> A >> B >> K;
	int ans = max(A, B) + 1;
	while (K > 0)
	{
		ans--;
		if (A % ans == 0 && B % ans == 0)
			K--;
	}
	cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
int main(){
    int n;
    cin >> n;
    int ans;
    long long a;
    for(int i = 0;i<n;i++){
        cin >> a;
        if(a%2 == 1){
            ans++;
        }
    }
    if(ans % 2 == 0){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef unsigned long long ul;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, V, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;

string S;
ll K;

int main() {
    cin >> S >> K;
    REP(i, K) {
        if(S[i] != '1') {
            cout << S[i] << "\n";
            return 0;
        }
    }
    cout << 1 << "\n";
}


Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  int a, b;
  scanf("%d %d", &a, &b);
  int i, f=0;
  for(i=1;i<1252; i++){
    if((int)(i*0.08) == a && (int)(i*0.1) ==b){
      f=1;break;
    }
  }
  
  if(f==1) printf("%d", i);
  else printf("-1");
    
  return 0;
}

Measured memory_bytes: 128