akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

LL N, D, X;
LL dp[2010][2010];
LL inv_[2010];

LL powm(LL x, LL y){
  if(y == 0) return 1;
  return powm(x*x%MOD, y/2) * (y%2?x:1) % MOD;
}

LL inv(LL x){
  if(inv_[x] >= 0) return inv_[x];
  return inv_[x] = powm(x, MOD-2);
}

LL C(LL x, LL y){
  LL res = 1;
  for(LL i=0;i<y;++i){
	res = res * ((x-i) % MOD) % MOD;
	res = res * inv(y-i) % MOD;
  }
  return res;
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  fill(inv_, inv_+2010, -1);

  while(cin>>N>>D>>X,N){
	fill((LL*)dp, (LL*)dp+2010*2010, 0);
	
	dp[0][0] = 1;
	for(int d=0;d<N;++d){
	  for(int x=d;x<N;++x){
		dp[d+1][x+1] = (dp[d+1][x] + dp[d][x]) % MOD;
		if(x+1 >= X)
		  dp[d+1][x+1] = (dp[d+1][x+1] - dp[d][x+1-X]+MOD) % MOD;
	  }
	}
	LL ans = 0;
	for(int d=1;d<=min(N,D);++d){
	  ans += dp[d][N] * C(D,d) % MOD;
	  ans %= MOD;
	}
	cout << ans << endl;
  }

  return 0;
}

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

int main(){
	int n, k;
	cin >> n >> k;
	bool d[10] = {};
	while(k--){
		int dd;
		cin >> dd;
		d[dd] = true;
	}
	for(int i = n; true; i++){
		bool f = true;
		int tmp = i;
		while(tmp){
			if(d[tmp % 10]) f = false;
			tmp /= 10;
		}
		if(f){
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt();
        int x2 = sc.nextInt();
        int x3 = sc.nextInt();
        int x4 = sc.nextInt();
        int x5 = sc.nextInt();
        if(x1 == 0){
            System.out.println("1");
            return;
        }
        if(x2 == 0){
            System.out.println("2");
            return;
        }
        if(x3 == 0){
            System.out.println("3");
            return;
        }
        if(x4 == 0){
            System.out.println("4");
            return;
        }
        if(x5 == 0){
            System.out.println("5");
            return;
        }
    }
}

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define co(x) cout << (x) << "\n"
#define pb push_back
#define Never
#define To

using namespace std;

int main(){

	cin.tie(0);
	ios::sync_with_stdio(false);

	long long N, K, ans;
	int R, S, P;
	string T;

	cin >> N >> K;
	cin >> R >> S >> P;
	cin >> T;

	ans = 0;
	
	for(int i = 0; i < T.size(); i++){
		if( (i >= K) && (T[i] == T[i - K])) {
			T[i] = 'z';
			continue;
		}
		switch(T[i]){
			case 'r':
				ans += P;
				break;
			case 's':
				ans += R;
				break;
			case 'p':
				ans += S;
				break;
		}
	}
	
	cout << ans << endl;

	Never To return 0;
}


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

int main() {
  char c;
  int i = 0;
  while (cin >> c) {
    i += (int)(c - '0');
    i %= 9;
  }
  if (i == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3616
def main():
    import numpy as np
    n, m = map(int, input().split())
    inlis = list(map(int, input().split()))
    if n >= m:
        print(0)
    else:
        inlis.sort()
        arr = np.array(inlis)
        #print(arr)
        diff = np.diff(arr)
        diff = list(diff)
        #print(diff)
        diff.sort()
        #print(diff)
        for _ in range(n-1):
            diff.pop()
        print(sum(diff))



if __name__ == "__main__":
    main()

Measured memory_bytes: 22996
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int mod = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

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

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::cout << fixed << setprecision(20);

    int N;
    cin >> N;
    vector<int>A(N);
    cin >> A;

    int odd = count_if(ALL(A), [](int a) {return a % 2 == 1; });
    int four = count_if(ALL(A), [](int a) {return a % 4 == 0; });
    int even = count_if(ALL(A), [](int a) {return a % 4 != 0 && a % 2 == 0; });

    bool yes = false;
    if (odd <= four + 1) {
        four -= odd - 1;
        if ((even + four) % 2 == 0 || even % 2 == 0) {
            yes = true;
        }
    }

    YESNO(yes, "Yes", "No");
    return 0;
}

Measured memory_bytes: 640
gets
S = gets.chomp

ans = 0
for i in 1..(S.length-1)
  s1 = S[0, i]
  s2 = S[i..-1]
  #p i: i, s1: s1, s2: s2
  c1 = s1.chars.uniq
  c2 = s2.chars.uniq
  ans = [ans, (c1 & c2).length].max
end
p ans

Measured memory_bytes: 3836
k, n = map(int, input().split())
a = list(map(int, input().split()))

[k-a[-1]+a[0]]
d = []

for i in range(n):
    if i>0:
        d.append(a[i]-a[i-1])
d.append(k-a[-1]+a[0])
print(k-max(d))


Measured memory_bytes: 33296
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};


int main() {
  int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  ll ans = 0;
  for (int i = 0; i < N; i++) {
    if (i < K) ans += X; else ans += Y;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ma = 0
a.append(0)

for i in range(len(a)-1):
    ma += b[a[i]-1]

    if a[i+1]-a[i] == 1:
        ma += c[a[i]-1]
        

print(ma)

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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

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

    string S;
    cin >> S;
    bool isOk = false;
    REP(i, S.length()) {
        if(S[i] == '7') {
            isOk = true;
        }
    }
    printf("%s\n", isOk ? "Yes" : "No");

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

using int64 = long long;

int main() {
    int64 n,a,b;
    cin >> n >> a >> b;
    vector<int64> x(n);
    for (int64 i=0; i<n; i++) cin >> x[i];

    int64 ans = 0;
    for (int64 i=1; i<n; i++) {
        ans += min(b, a*abs(x[i-1] - x[i]));
    }

    cout << ans << endl;
}

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

#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define pb push_back
#define X first
#define Y second

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
const ll INF = 1e18+1;
const ll MOD = 1000000007L;

#ifdef umang99m
    #include "/home/umang/.templates/header.h"
#else
    #define dbg(args...)
    #define timer()
#endif

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

    vi a(3);
    rep(i,3){
        cin>>a[i];
    }
    sort(a.begin(), a.end());
    if(a[0]==5 && a[1] == 5 && a[2] == 7) cout<<"YES";
    else cout<<"NO";
    cout<<endl;
    timer();
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 1e18;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()

struct unionfind {
	vector<int> par, siz;
	unionfind(int N) : par(N), siz(N,1) {
		for (int i=0;i<N;i++) par[i]=i;
	}
	int root(int x) {
		while(par[x]!=x) x=par[x]=par[par[x]];
		return x;
	}
	void unite(int x, int y) {
		x=root(x); y=root(y);
		if (x==y) return;
		if (siz[x]<siz[y]) swap(x,y);
		siz[x]+=siz[y];
		par[y]=x;
	}
	bool same(int x, int y) {
		return root(x)==root(y);
	}
	int size(int x) {
		return siz[root(x)];
	}
};

int main(){
	int n, k, l;
	cin >> n >> k >> l;
	unionfind a(n), b(n);
	int x, y;
	REP(i,k){
		cin >> x >> y;
		x--; y--;
		a.unite(x,y);
	}
	REP(i,l){
		cin >> x >> y;
		x--; y--;
		b.unite(x,y);
	}
	map<P,int> mp;
	REP(i,n)
		mp[{a.root(i),b.root(i)}]++;
	REP(i,n)
		cout << mp[{a.root(i),b.root(i)}] << " ";
	cout << endl;
	return 0;
}

Measured memory_bytes: 17752
def main():
    N,T = map(int, input().split())
    AB = [[int(i) for i in input().split()] for _ in range(N)]

    AB.sort()

    # dp[i][j]: 満足度の最大値
    # i: i品目まで
    # j: 制限時間(< T)
    dp = [[0] * 3100 for _ in range(3100)]

    dp[0][0] = 0

    # 貰うDP
    ans = 0
    for i in range(1, N + 1):
        for j in range(T):
            dp[i][j] = dp[i - 1][j]
            
            # ラストオーダーはAB[i - 1]
            ans = max(ans, dp[i][j] + AB[i - 1][1])

            if j - AB[i - 1][0] >= 0:
                dp[i][j] = max(dp[i][j], dp[i - 1][j - AB[i - 1][0]] + AB[i - 1][1])

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 119896
#include <bits/stdc++.h>
constexpr int INF = 1001001001;
using ll = long long;
using namespace std;
int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        for (int j = 0; j < m; j++)
            cin >> a[i][j];
    }
    
    int ans = INF;
    for (int bit = 0; bit < (1 << n); bit++) {
        int cost = 0;
        vector<int> s(m, 0);
        for (int i = 0; i < n; i++) {
            if (bit & (1 << i)) {
                cost += c[i];
                for (int j = 0; j < m; j++)
                    s[j] += a[i][j];
            }
            
        }
        
        bool ok = true;
        for (int i = 0; i < m; i++) {
            if (s[i] < x) {
                ok = false;
                break;
            }
        }
        
        if (ok)
            ans = min(ans, cost);
    }
    
    if (ans == INF)
        cout << -1 << endl;
    else
        cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
double ans=0;llfor;///////////////////////////////////////////////////////////
int main(){
 char n,m;sc(n);sc(m);
 if(n<m)puts("<");
 if(n>m)puts(">");
 if(n==m)puts("=");
return 0;}

Measured memory_bytes: 3620
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];



int main() {
    int a,b;
    cin>>a>>b;
    if(a+b>=10){
        cout<<"error"<<endl;
    }
    else{
        cout<<a+b<<endl;
    }

}


Measured memory_bytes: 256
from collections import Counter
h,w = (int(i) for i in input().split())
a = [input() for i in range(h)]
s,num,f = "",0,[0,0,0,0]
for i in a: s+=i
c = Counter(s).most_common()
for i in c: f[i[1]%4]+=1
if h==1 or w==1:
	if f[1]+f[3]==len(s)%2: print("Yes")
	else: print("No")
elif h%2==w%2==0:
	if f[1]+f[2]+f[3]==0: print("Yes")
	else: print("No")
elif h%2==w%2==1:
	x = (h+w-2)//2
	if f[1]+f[3]!=1: print("No")
	elif f[1]==1:
		if f[2]>x or f[2]%2!=x%2: print("No")
		else: print("Yes")
	else:
		if f[2]+1>x or (f[2]+1)%2!=x%2: print("No")
		else: print("No")
else:
	if h%2==0: h,w=w,h
	x = w//2
	if f[1]+f[3]!=0: print("No")
	elif f[2]>x or f[2]%2!=x%2: print("No")
	else: print("Yes")


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

int main(int argc, char *argv[]){
  int A,B,C,X,Y;
  cin>>A>>B>>C>>X>>Y;
  int countA=0,countB=0;
  long long sum=0;
  int mi,ch;
  mi=min(X,Y);
  while(true){
    if(countA<mi || countB<mi){
      if(A+B<2*C){
	sum+=A+B;
	countA++;
	countB++;
      }
      else{
	sum+=2*C;
	countA++;
	countB++;
      }
      if(countA==X && countB==Y) break;
    }
    else{
      if(mi==X){
	if(B<2*C){
	  sum+=B;
	  countB++;
	  
	}
	else{
	  sum+=2*C;
	  countB++;
      }
	if(countB==Y) break;

      }
      else{
	if(A<2*C){
	  sum+=A;
	  countA++;
	}
	else{
	  sum+=2*C;
	  countA++;
	}
	if(countA==X) break;

      }
    }
    //cout<<countB<<" "<<countA<<endl;
  }
  cout<<sum<<endl;
}


Measured memory_bytes: 256
#include<set>  
#include<map>  
#include<stack>  
#include<cmath>  
#include<cstdio>  
#include<queue>  
#include<vector>  
#include<cstring> 
#include<climits>  
#include<iostream> 
#include<algorithm> 
using namespace std; 
int read(){ 
    int f=1,x=0; 
    char c=getchar(); 
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();} 
    while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();} 
    return f*x; 
}
#define MAXN 100
#define INF 0x3f3f3f3f
int a[MAXN+5];
int main(){
	int n=read(),l=INF,r=0,ans=INF;
	for(int i=1;i<=n;i++) a[i]=read(),l=min(l,a[i]),r=max(r,a[i]);
	for(int i=l,s=0;i<=r;i++,s=0){
		for(int j=1;j<=n;j++)
			s+=(i-a[j])*(i-a[j]);
		ans=min(ans,s);
	}
	printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  vector<int> data(3);
  for(int i = 0; i < 3; i++)cin >> data.at(i);
  sort(data.begin(), data.end());
  if(data.at(0) == 5 && data.at(0) == data.at(1) && data.at(2) == 7)cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque
h, w = map(int, input().split())
square = [list(input()) for i in range(h)]
def bfs(si, sj):
    INF = 100
    que = deque([(si, sj)])
    d = [[INF] * w for i in range(h)]
    d[si][sj] = 0
    move = [(-1, 0), (0, 1), (1, 0), (0, -1)]
    while que:
        i, j = que.popleft()
        for mi, mj in move:
            ni, nj = i + mi, j + mj
            if 0 <= ni < h and 0 <= nj < w and square[ni][nj] == '.' and d[ni][nj] == INF:
                que.append((ni, nj))
                d[ni][nj] = d[i][j] + 1
    return d[i][j]

max_num = 0
for i in range(h):
    for j in range(w):
        if square[i][j] == '.':
            max_ij = bfs(i, j)
            max_num = max(max_num, max_ij)
print(max_num)

Measured memory_bytes: 3316
#define _CRT_SECURE_NO_WARNINGS 1

#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <string>
#include <iomanip>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define rep(i,a,b) for(int i = (a) ; i <= (b) ; i++)
#define per(i,a,b) for(int i = (a) ; i >= (b) ; i--)
#define mem(a) memset(a,0,sizeof(a))
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
const int maxn = 2e5 + 7;

LL a[maxn];

int main() {
    int n , k;
    sd(n) , sd(k);
    rep(i,1,n) {
        slld(a[i]);
    }
    sort(a+1,a+n+1);
    int l = 1 , r = n , w = 1;
    LL ans = 1;
    if(k & 1) {
        k--;
        ans = a[r--] , w = ans > 0 ? 1 : -1;
    }
    while(k) {
        LL x = a[l] * a[l + 1];
        LL y = a[r] * a[r - 1];
        // cout << "l = " << l << " r = " << r << endl;
        if(w * x > w * y) {
            ans = (ans * (x % mod)) % mod;
            l += 2;
        } else {
            ans = (ans * (y % mod)) % mod;
            r -= 2;
        }
        k -= 2;
    }
    ans = ((ans % mod) + mod) % mod;
    plld(ans);
    return 0;
}

Measured memory_bytes: 5392
import copy
class Dice:
    def __init__(self, a, b, c, d, e, f):
        self.top = a
        self.front = b
        self.right = c
        self.left = d
        self.behind = e
        self.bottom = f

    def S(self):
        self.top, self.front, self.behind, self.bottom = self.behind, self.top, self.bottom, self.front

    def N(self):
        self.behind, self.top, self.bottom, self.front = self.top, self.front, self.behind, self.bottom

    def E(self):
        self.top, self.bottom, self.left, self.right = self.left, self.right, self.bottom, self.top

    def W(self):
        self.left, self.right, self.bottom, self.top = self.top, self.bottom, self.left, self.right


dice=Dice(*[int(i) for i in input().split(" ")])

n=int(input())
for i in range(n):
    top,front=[int(j) for j in input().split(" ")]
    while(dice.front!=front):
        if(dice.left==front or dice.right==front):
            dice.E()
        else:
            dice.N()
    while(dice.top!=top):
        dice.E()
    print(dice.right)



Measured memory_bytes: 6348
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <array>

using namespace std;

#define fi first	
#define se second
#define long long long
typedef pair<int,int> ii;

int A[103];

int main()
{
	// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	// freopen("input.in", "r", stdin);

	int n, x; cin >> n >> x;
	long sum = 0;
	for(int i = 1; i <= n; i++)
	{
		cin >> A[i];
		sum += A[i];
	}
	sort(A+1, A+1+n);

	if(sum < x)
		cout << n-1 << "\n";
	else if(sum == x)
		cout << n << "\n";
	else 
	{
		int ans = 0;
		for(int i = 1; i <= n; i++)
		{
			if(x >= A[i])
			{
				ans++;
				x -= A[i];
			}
			else break;
		}
		cout << ans << "\n";
	}
}











Measured memory_bytes: 256
n,q=map(int,input().split())
s=input()
count=[0]*n
for i in range(1,n):
    count[i]+=count[i-1]
    if s[i-1:i+1]=="AC":count[i]+=1
for i in range(q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])


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

using namespace std;
using ll=long long;
const ll mod = 1e9 + 7;
int dy[] = {1, -1, 0, 0};
int dx[] = {0, 0, 1, -1};

int main() {
    int N,K;
    cin>>N>>K;

    //a,b,c, mod K=0
    ll ans=pow(N/K,3);

    //a,b,c mod K=K/2
    if(K%2==0){
        N+=K/2;
        ans+=(ll)pow(N/K,3);
    }
    cout<<ans<<endl;
    return 0;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

vii G[100001];

int main() {
	int K;
	cin >> K;
	for (int i = 1; i < K; ++i) {
		G[i].emplace_back((i + 1) % K, 1);
		G[i].emplace_back(10 * i % K, 0);
	}
	vector<int> dist(K, 1e9);
	dist[1] = 1;
	queue<ii> q;
	q.emplace(1, 1);
	while (!q.empty()) {
		int d = q.front().f, u = q.front().s;
		q.pop();
		if (d > dist[u]) continue;
		for (auto& v : G[u]) {
			if (d + v.s < dist[v.f]) {
				dist[v.f] = d + v.s;
				q.emplace(dist[v.f], v.f);
			}
		}
	}
	cout << dist[0] << '\n';
}

Measured memory_bytes: 6400
import sys

def main():
    N, K = map(int, input().split())
    A_list = list(map(int, input().split()))
    A_list = [x-1 for x in A_list]

    passed_list = [False] * N
    time_go_same_city = 0
    now_city = 0
    passed_list[now_city] = True
    while True:
        next_city = A_list[now_city]
        if passed_list[next_city]:
            start_circle_city = next_city
            break
        passed_list[next_city] = True
        time_go_same_city += 1
        now_city = next_city

    passed_list = [False] * N
    time_circle_city = 1
    now_city = start_circle_city
    passed_list[now_city] = True
    while True:
        next_city = A_list[now_city]
        if passed_list[next_city]:
            break
        passed_list[next_city] = True
        time_circle_city += 1
        now_city = next_city

    if time_go_same_city >= K:
        num_teleport = 0
        now_city = 0
        while num_teleport < K:
            next_city = A_list[now_city]
            num_teleport += 1
            now_city = next_city
        print(now_city+1)
        return
    
    K -= time_go_same_city
    K %= time_circle_city
    if K == 0:
        K = time_circle_city
    num_teleport = 1
    now_city = start_circle_city
    while num_teleport < K:
        next_city = A_list[now_city]
        num_teleport += 1
        now_city = next_city

    print(now_city+1)
    return


if __name__ == "__main__":
    main()
    sys.exit(0)

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

int main() {
    long long x, k, d;
    cin >> x >> k >> d;
    x = (x < 0 ? -x : x);

    long long y, tmp;
    tmp = x / d;
    if (k - tmp <= 0) {
        cout << x - k * d << endl;
        return 0;
    }
    y = x - tmp * d;
    if ((k - tmp) % 2 == 0) {
        cout << abs(y) << endl;
    } else {
        cout << abs(y-d) << endl;
    }

    /*
    long long tmp, min1, min2;
    if (0 <= (x - k * d)) {
        cout << abs(x - k * d) << endl;
        return 0;
    }
    tmp = x / d;
    min1 = x - tmp * d;
    min2 = x - (tmp+1) * d;

    if (tmp % 2 == 1 && k % 2 == 1) {
        cout << abs(min1) << endl;
    } else {
        cout << abs(min2) << endl;
    }
    */

    return 0;
}


Measured memory_bytes: 3596
import static java.util.Arrays.deepToString;

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc = new Scanner(System.in);
	public void run() {
		for (;sc.hasNext();) {
			int n = sc.nextInt();
			if (n == 0) break;
			boolean[][] t = new boolean[n][n];
			for (int i = 0; i < n; i++) {
				String s = sc.next();
				for (int j = 0; j < n; j++) {
					t[i][j] = s.charAt(j) == '1';
				}
			}
			int ans = 0;
			ans = Math.max(ans, countRow(t));
			ans = Math.max(ans, countSkew(t));
			t = rot90(t);
			ans = Math.max(ans, countRow(t));
			ans = Math.max(ans, countSkew(t));
			System.out.println(ans);
		}
	}
	
	int countRow(boolean[][] t) {
		int n = t.length;
		int res = 0;
		for (int i = 0; i < n; i++) {
			int here = 0;
			for (int j = 0; j < n; j++) {
				if (t[i][j]) {
					here++;
					res = Math.max(res, here);
				} else {
					here = 0;
				}
			}
		}
		return res;
	}
	int countSkew(boolean[][] t) {
		int n = t.length;
		int res = 0;
		for (int s = -(n-1); s <= (n-1); s++) {
			int i = -Math.min(-s, 0);
			int j = -Math.min(s, 0);
			int here = 0;
			while (0 <= i && i < n && 0 <= j && j < n) {
				if (t[i][j]) {
					here++;
					res = Math.max(res, here);
				} else {
					here = 0;
				}
				
				i++;
				j++;
			}
		}
		return res;
	}
	boolean[][] rot90(boolean[][] t) {
		int n = t.length;
		boolean[][] v = new boolean[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) 
				v[i][j] = t[j][n - 1 - i]; 
		}
		return v;
	}
}

Measured memory_bytes: 26728
def main():
    n, nn, nnn = map(int, input().split(' '))
    print('Yes' if n + nn >= nnn else 'No')


def main_b():
    ad = {}
    mo = {}
    t = int(input())
    for i in range(t):
        c = input()
        ad.setdefault(c, 0)
        ad[c] += 1
    t = int(input())
    for i in range(t):
        c = input()
        mo.setdefault(c, 0)
        mo[c] += 1
    ans = 0
    for a in ad:
        tmp = ad.get(a, 0) - mo.get(a, 0)
        if ans < tmp:
            ans = tmp
    print(ans)
if __name__ == '__main__':
    main_b()

Measured memory_bytes: 3064
#include<cstdio>
const int MAXN = 10000;
int a[MAXN + 5], b[MAXN + 5];
int main() {
	int N;
	scanf("%d", &N);
	for(int i=1;i<=N;i++)
		scanf("%d", &a[i]);
	for(int i=1;i<=N;i++)
		scanf("%d", &b[i]);
	long long ta = 0, tb = 0;
	for(int i=1;i<=N;i++) {
		if( a[i] == b[i] ) continue;
		if( a[i] < b[i] ) {
			if( (b[i] % 2) != (a[i] % 2) ) {
				b[i]++;
				tb++;
			}
			ta += (b[i] - a[i])/2;
		}
		else if( a[i] > b[i] ) {
			tb += a[i] - b[i];
		}
	}
	if( ta < tb ) {
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <functional>
#include <math.h> 
#define enld '\n'
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
// constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------


int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string S;
  cin >> S;
  int N = S.size();
  if(S[N-1] == '1'){
    cout << -1 << "\n";
    return 0;
  }
  if(S[0] == '0'){
    cout << -1 << "\n";
    return 0;
  }
  for(int i=0; i<N/2; i++){
    if(S[i] != S[N-1-1-i]){
      cout << -1 << "\n";
      return 0;
    }
  }
  cout << 1 << " " << 2 << "\n";
  int root = 2;
  int now = 3;
  for(int i=1; i<=(N-1)/2; i++){
    cout << root << " " << now << "\n";
    if(S[i] == '1'){
      root = now;
    }
    now++;
  }
  while(now != N+1){
    cout << root << " " << now << "\n";
    now++;
  }
  return 0;
}


Measured memory_bytes: 3732
program C175
    implicit none
    integer(8) :: X, K, D
    integer(8) :: i, j

    read(5,*) X, K, D
    X = abs(X)

    i = X / D
    j = X - D*i

    if (K <= i) then
        write(6,*) X - D*K
    else
        if (mod(K-i,2) == 0) then
            write(6,*) j
        else
            write(6,*) abs(j-D)
        end if
    end if





    
end program C175

Measured memory_bytes: 2856
using System;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    struct Point
    {
        public int X { get; }
        public int Y { get; }
        public long Height { get; }

        public Point(int x, int y, long height)
        {
            X = x;
            Y = y;
            Height = height;
        }
    }

    class Program
    {
        static bool Satisfies(Point center, Point[] points)
        {
            foreach (var p in points)
            {
                long expected = Max(center.Height - Abs(center.X - p.X) - Abs(center.Y - p.Y), 0);
                if (p.Height != expected)
                {
                    return false;
                }
            }

            return true;
        }

        static Point Solve(Point[] points)
        {
            for (int x = 0; x <= 100; x++)
            {
                for (int y = 0; y <= 100; y++)
                {
                    int distance = Abs(points[0].X - x) + Abs(points[0].Y - y);
                    long height = points[0].Height + distance;
                    Point center = new Point(x, y, height);
                    if (Satisfies(center, points))
                    {
                        return center;
                    }
                }
            }

            throw new InvalidOperationException();
        }

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Point[] points = (from _ in Enumerable.Repeat(0, n)
                              let cols = Console.ReadLine().Split()
                              let p = new Point(int.Parse(cols[0]), int.Parse(cols[1]), long.Parse(cols[2]))
                              orderby p.Height descending
                              select p)
                              .ToArray();

            Point center = Solve(points);
            Console.WriteLine($"{center.X} {center.Y} {center.Height}");
        }
    }
}

Measured memory_bytes: 13652
#include <bits/stdc++.h>
 
using namespace std;
#define ll long long
#define ld long double
 
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    ll n, a, b;
    cin >> n >> a >> b;
    cout << n / (a + b) * a + min(n % (a + b), a) << endl;
}


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

int main(){
    int H, W, K;
    string cake[302];
    int ans[302][302] = {};
    int k = 1;

    cin >> H >> W >> K;
    for(int h=0;h<H;h++){
        cin >> cake[h];
    }

    for(int h=0;h<H;h++){
        for(int w=0;w<W;w++){
            if(cake[h][w] == '#'){
                ans[h][w] = k;
                int i = 1;
                while(h + i < H && cake[h+i][w] == '.'){
                    ans[h+i][w] = k;
                    i++;
                }

                i = 1;
                while(h - i >= 0 && cake[h-i][w] == '.'){
                    ans[h-i][w] = k;
                    i++;
                }
                k++;
            }
        }
    }

    for(int i=0;i<W;i++){
        for(int w=0;w<W;w++){
            if(ans[0][w] == 0){
                if(w > 0 && ans[0][w-1] != 0){
                    for(int h=0;h<H;h++){
                        ans[h][w] = ans[h][w-1];
                    }
                }
                else if(w < W-1 && ans[0][w+1] != 0){
                    for(int h=0;h<H;h++){
                        ans[h][w] = ans[h][w+1];\
                    }

                }
            }
        }
    }

    for(int h=0;h<H;h++){
        for(int w=0;w<W;w++){
            cout << ans[h][w] << " ";
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1280
import math

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

l = [a,b,c,d,e]
# 下一桁を1～10へ変換
ltgt = [(a-1) %10+1,(b-1) %10+1,(c-1) %10+1,(d-1) %10+1,(e-1) %10+1]
l2 =[math.floor((a-1)//10),math.floor((b-1)//10),math.floor((c-1)//10),math.floor((d-1)//10),math.floor((e-1)//10)]

m = min(ltgt)

print((sum(l2)*10)+40+min(ltgt))

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

int main(void){
    int N;
    cin >> N;
    vector<int> a(N);
    int MAX;
    int suma = 0;
    int sumb = 0;

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


    for(int i = 0; i < N; i++){
        MAX = *max_element(a.begin(), a.end());
        for(int j = 0; j < N; j++){
            if(a[j] == MAX){
                a[j] = 0;
                break;
            }
        }
        if(i % 2 == 0)
            suma += MAX;
        else
            sumb += MAX;
    }
   int ans = abs(suma-sumb);

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

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

using namespace std;

#define int long long

signed main(){
        int n,m;
        cin >> n >> m;
        int gcd = __gcd(n,m);
        int ans = 0;
        for (int i = 2; i<sqrt(gcd);i++){
          if (gcd % i == 0) ans ++;
                while (gcd%i == 0){
                        gcd /=i;
                }
          }
        if(gcd != 1){
                ans++;
        }

        cout << ans + 1 << endl;
}


Measured memory_bytes: 256
/**
*    author:  yuya1234
*    created: 25.06.2020 14:00:42
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define SORT(s) sort((s).begin(),(s).end())
#define SORTD(s) sort((s).rbegin(),(s).rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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

    int n;
    cin>>n;

    vector<ll> v;
    ll tmp;

    REP(i,n*3)
    {
        cin>>tmp;
        v.push_back(tmp);
    }

    SORTD(v);
    ll ans=0;

    for (size_t i = 0; i < n; i++)
    {
        ans+=v[i*2+1];
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 7408
#A - Ice Tea Store
Q,H,S,D = map(int,input().split())
N = int(input())

Q1,H1 = 4*Q,2*H
S = min(Q1,H1,S)

if 2*S>D:
    cnt_2 = N//2
    cnt_1 = N%2
    pay = D*cnt_2 + S*cnt_1
else:
    pay = N * S
print(pay)

Measured memory_bytes: 9140
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(i,s,e) for(ll i=s;i<e;i++ )
typedef pair<ll,ll> P;
const ll mod = 1000000007;
const ll INF = 100000000000009;
ll i;

int main(){
    ll A,B,C;
    cin>>A>>B>>C;
    cout<<min(C,B/A)<<endl;
}



Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
k=0
h=max(a)
s=9999999999999999999999999999
for i in range(1,h+1):
  k=0
  for j in range(n):
    k+=(a[j]-i)**2
  s=min(s,k)
print(s)


Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        int a = Integer.valueOf(arr01[0]);
        int b = Integer.valueOf(arr01[1]);

        StringBuffer sb = new StringBuffer();
        if (a == b) {
            for (int i = 1; i <= a; i++) {
                sb.append(String.valueOf(a));
            }
        } else if (a > b) {
            for (int i = 1; i <= a; i++) {
                sb.append(String.valueOf(b));
            }

        } else if (a < b) {
            for (int i = 1; i <= b; i++) {
                sb.append(String.valueOf(a));
            }

        }

        System.out.println(sb.toString());

    }

}

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

int main() {
  int s;
  cin >> s;
  int o = 0;
  if (s / 100 > 0) {
    s = s - 100;
    o++;
  }
  if (s / 10 > 0) {
    s = s - 10;
    o++;
  }
  if (s > 0) o++;
  cout << o << endl;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;

namespace GraphSolve {
    static class Program {
        const int mod = (int)1e9 + 7;
        static List<int>[] grf;
        static bool[] b, h;
        static int ans = 0;
        static void Main() {

            Sc sc = new Sc();
            int[] s = sc.Ia;
            grf = new List<int>[s[0]];
            b = new bool[s[0]];
            h = new bool[s[0]];
            for (int i = 0; i < s[0]; i++) { grf[i] = new List<int>(); }
            for (int i = 0; i < s[1]; i++) {
                int[] e = sc.Ia;
                grf[e[0]].Add(e[1]);
            }
            for (int i = 0; i < s[0] && ans == 0; i++) {
                if (!b[i]) { Func(i, i); }
            }
            Console.WriteLine("{0}", ans);

        }
        static void Func(int a, int g) {
            b[a] = true;
            h[a] = true;
            for (int i = 0; i < grf[a].Count; i++) {
                int nv = grf[a][i];
                if (h[nv]) { ans = 1; }
                else if (!b[nv]) { Func(nv, g); }
            }
            h[a] = false;
        }
    }
}
public class Sc {
    private string[] a;
    private int n = -1, m = 0;
    public int I { get { if (n == -1 || n == a.Length - 1) { n = -1; a = Console.ReadLine().Split(); } n++; return int.Parse(a[n]); } }
    public long L { get { if (n == -1 || n == a.Length - 1) { n = -1; a = Console.ReadLine().Split(); } n++; return long.Parse(a[n]); } }
    public double D { get { if (n == -1 || n == a.Length - 1) { n = -1; a = Console.ReadLine().Split(); } n++; return double.Parse(a[n]); } }
    public string S { get { if (n == -1 || n == a.Length - 1) { n = -1; a = Console.ReadLine().Split(); } n++; return a[n]; } }
    public int[] Ia { get { if (n != -1 && n != a.Length - 1) { m = n; n = -1; return Array.ConvertAll(a.Skip(m + 1).ToArray(), int.Parse); } return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } }
    public int[] Ia2 { get { return Array.ConvertAll(("0 " + Console.ReadLine() + " 0").Split(), int.Parse); } }
    public long[] La { get { return Array.ConvertAll(Console.ReadLine().Split(), long.Parse); } }
    public long[] La2 { get { return Array.ConvertAll(("0 " + Console.ReadLine() + " 0").Split(), long.Parse); } }
    public double[] Da { get { return Array.ConvertAll(Console.ReadLine().Split(), double.Parse); } }
    public string[] Sa { get { return Console.ReadLine().Split(); } }
}



Measured memory_bytes: 18312
#include <stdio.h>
#include <string.h>

int main(void)
{
  char str[200000];
  char new[200000];

  int len,i;

  fgets(str,200000,stdin);
  len = strlen(str);

  for(i = 0;i < len/2;i++)
    new[i] = str[2*i];
  new[i] = '\0';
  printf(new);

  return 0;
}


Measured memory_bytes: 384
//SAIKH SERAJ FAHIM, CSE-HSTU, DINAJPUR, BANGLADESH.

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,i;
    cin>>a;
    string s;
    cin.ignore();
    cin>>s;
    int len=s.size();
    if(len<=a)cout<<s<<"\n";
    else
    {
        for(i=0; i<a; i++)
        {
            cout<<s[i];
        }
        cout<<"..."<<"\n";
    }
    return 0;
}



Measured memory_bytes: 3532
#include <iostream>
#include <vector>
#include <algorithm>

#define ll long long

int main()
{
    int X, N;
    std::cin >> X >> N;

    std::vector<int> data(N);
    for(int i=0; i < N; i++) {
        std::cin >> data[i];
    }

    // 昇順にソート
    std::sort(data.begin(), data.end() );

    int start = 0;
    int end = N-1;
    int point = -1;
    
    // 二分探索
    while(start <= end) {
        int middle = (start + end) / 2;
        if(X == data[middle]) {
            point = middle;
            break;
        }
        else if(X > data[middle]) {
            start = middle + 1;
        }
        else {
            end = middle - 1;
        }
    }

    if(point == -1) {
        std::cout << X << std::endl;
    }
    else if(point == 0) {
        std::cout << X-1 << std::endl;
    }
    else {
        int point_minus = point-1;
        int point_plus = point+1;
        int value_minus = X-1;
        int value_plus = X+1;

        while(true) {
            if(point_minus < 0) {
                std::cout << value_minus << std::endl;
                break;
            }
            if(point_plus > (N-1)) {
                if(data[point_minus] == value_minus) {
                    std::cout << value_plus << std::endl;
                    break;
                }
                else {
                    std::cout << value_minus << std::endl;
                    break;
                }
            }

            if(data[point_minus] != value_minus) {
                std::cout << value_minus << std::endl;
                break;
            }
            else {
                point_minus--;
                value_minus--;
            }

            if(data[point_plus] != value_plus) {
                std::cout << value_plus << std::endl;
                break;
            }
            else {
                point_plus++;
                value_plus++;
            }
        }
    }
}

Measured memory_bytes: 3600
#include <iostream>

using namespace std;
int a[200010],l[200010],r[200010];
int main(){
	int i,n;
	cin >> n;
	for(i=0;i<n;i++){
		cin >> a[i];
	}
	l[0] = 0;
	r[n] = 0;
	for(i=1;i<=n;i++){
		l[i] = max(l[i - 1],a[i - 1]);
	}
	for(i=n-1;i>=0;i--){
		r[i] = max(a[i],r[i + 1]);
	}
	for(i=0;i<n;i++){
		cout << max(l[i],r[i + 1]) << endl;
	}
}

Measured memory_bytes: 3968
#include <stdio.h>
int main(void)
{
  int s, hour, minute, second;
  scanf("%d", &s);
  hour = s / 3600;
  minute = (s % 3600) / 60;
  second = s % 60;
  printf("%d:%d:%d\n", hour, minute, second);
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	while(1)
	{
		c-=b;
		if(c<=0)
		{
			puts("Yes");
			return 0;
		}
		a-=d;
		if(a<=0)
		{
			puts("No");
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 3772
import scala.math._

object Main extends App {
  val sc = new java.util.Scanner(System.in)
//  val list = List.fill(3)(sc.nextInt)
  val x, t = sc.nextInt

  val ans = max(x - t, 0)

  println(ans)

  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}

Measured memory_bytes: 25416