akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

constexpr char newl = '\n';

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

    int n, K;
    cin >> n >> K;

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

    for (int i = K; i < n; i++) {
        cout << (a[i] > a[i - K] ? "Yes" : "No") << newl;
    }

    return 0;
}

Measured memory_bytes: 4764
// https://atcoder.jp/contests/abc132/tasks/abc132_d

#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define FORR(i, m, n) for (int(i) = (n); (i) >= (m); i--)
#define rep(...) _overload3(__VA_ARGS__, FOR, REP, )(__VA_ARGS__)
#define repr(...) _overload3(__VA_ARGS__, FORR, REPR, )(__VA_ARGS__)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

ll MOD = 1e9 + 7;

vector<vector<ll>> comb(int n, int r)
{
  vector<vector<ll>> v(n + 1, vector<ll>(n + 1, 0));
  for (int i = 0; i < v.size(); i++)
  {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++)
  {
    for (int k = 1; k < j; k++)
    {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]) % MOD;
    }
  }
  return v;
}

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

  auto c = comb(N, K);
  rep(i, K)
  {
    cout << (c[N - K + 1][i + 1] * c[K - 1][i]) % MOD << '\n';
  }

  return 0;
}


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

long long N=0,K=0,M=0,A=0,ansac=0,answa=0,p=0;
string S;
int main(){
    cin >> N >> M;
    vector<pair<string,long long>> P(N+1,pair<string,long long>("WA",0));
    /*for (i=1;i<=N;i++){
        P[i] = make_pair("WA",0);
    }*/

    for (int i=0;i<M;i++){
        cin >> p >> S;
        if (P[p].first != "AC"){
            P[p].first = S;
            if (P[p].first=="AC") {
                ansac++;
                answa += P[p].second;
            } else {
                P[p].second++;
            }
        }
    }
    cout << ansac << endl << answa << endl;
    return 0;
}


Measured memory_bytes: 6528
import java.util.ArrayList;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		String last = "";
		String first = "";
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String W = sc.next();
		ArrayList<String> ws = new ArrayList<String>();
		int judge = 0;
		for(int i = 0;i < N -1; i++) {
			ws.add(W);

			last = W.substring(W.length()-1);
			W = sc.next();
			first = W.substring(0,1);//次の文字

			if(!(last.equals(first))) {
				++judge;
			}

			if(ws.contains(W)){
				++judge;
			}

		}


		if(judge == 0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 23636
#include <math.h>
#include <iostream>
#include <string>
using namespace std;
int main(void){
  bool check = false;
  int k, a, b;
  cin >> k;
  cin >> a;
  cin >> b;
  while((check == false) && (a <= b)){
    if((a % k) == 0){
      check = true;
      cout << "OK" << endl;
    }
    a++;
  }
  if(check == false){
    cout << "NG" << endl;
  }
  return 0;
}


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

int main(void)
{
  int n,tmp;
  int a[1000001]={0};
  int max=0;
  int ans=0;

  scanf("%d",&n);
  for(int i=0;i<n;i++)
  {
    scanf("%d",&tmp);
    a[tmp]++;
    if(max<tmp) max=tmp;
  }

  for(int i=1;i<=max;i++)
  {
    if(a[i]>0)
    {
      if(a[i]==1) ans++;
      for(int j=2*i;j<=1000000;j+=i)
      {
        a[j]=0;
      }
    }
  }

  printf("%d\n",ans);

  return 0;
}

Measured memory_bytes: 5600
#include<stdio.h>
int main() {
  double a, b, c, p1[2], p2[2], p3[2], pp[2];
  while (scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &p1[0], &p1[1], &p2[0], &p2[1], &p3[0], &p3[1], &pp[0], &pp[1]) != EOF) {
    a = p2[1] - p1[1]; b = p1[0] - p2[0]; c = p2[0] * p1[1] - p1[0] * p2[1];
    if ((a * p3[0] + b * p3[1] + c) * (a * pp[0] + b * pp[1] + c) > 0) {
      a = p3[1] - p2[1]; b = p2[0] - p3[0]; c = p3[0] * p2[1] - p2[0] * p3[1];
      if ((a * p1[0] + b * p1[1] + c) * (a * pp[0] + b * pp[1] + c) > 0) {
	a = p3[1] - p1[1]; b = p1[0] - p3[0]; c = p3[0] * p1[1] - p1[0] * p3[1];
	if ((a * p2[0] + b * p2[1] + c) * (a * pp[0] + b * pp[1] + c) > 0) {
	  printf("YES\n");
	} else {
	  printf("NO\n");
	}
      } else {
	printf("NO\n");
      }
    } else {
      printf("NO\n");
    }
  }
  return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
using namespace std;
int serch(int i,int j,int n)
{
    if(!n&&!j)return 1;
    else if(i==10||!n)return 0;
    return serch(i+1,j-i,n-1)+serch(i+1,j,n);
}
int main()
{
    int n,s;
    while(cin>>n>>s&&(n!=0||s!=0))cout<<serch(0,s,n)<<endl;
}

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


int main() 
{
  int a;
  cin>>a;
  if(a%10==3)
  {
    cout<<"bon"<<endl;
  }
  else if(a%10==0||a%10==1||a%10==6||a%10==8)
  {
    cout<<"pon"<<endl;
  }
  else
  {
    cout<<"hon"<<endl;
  }
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;cin>>S;int a=0;
  for(int i=0;i<S.size()/2;i++){
    if(S.at(i)!=S.at(S.size()-i-1))a++;
  }
  cout<<a<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>

static const int N = 1000;

void trace(int A[], int n){
  int i;
  for ( i = 1; i <= n; i++ ){
    if ( i > 1 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

int main(){
  int n, i, j,key;
  int A[N+1];
  scanf("%d", &n);

  for ( i = 1; i <= n; i++ )scanf("%d", &A[i]);
  
  for ( i = 1; i <= n; i++ ){
    key = A[i];
    for(j=i-1; j>=0&& A[j]>key;j--){
      A[j+1] = A[j];
    }
    A[j+1] = key;
    trace(A,n);
  }

  return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin >> a >> b >> c;
    if (a < b) swap(a, b);
    if (a < c) swap(a, c);
    if (b < c) swap(b, c);
    if ((b - c) % 2 == 0) {
        cout << (a - b) + (b - c) / 2;
    }
    else {
        cout << 1 + (a + 1 - b) + (b  - c - 1) / 2;
    }
    return 0;
}


Measured memory_bytes: 768
N=parse(Int,readline())
ap=[0 for _=1:N]
id=1
L=R=-1
for a=map(x->parse(Int,x),split(readline()))
	if ap[a]>0
		L,R=ap[a],id
		break
	end
	ap[a]=id
	id+=1
end
mod=10^9+7
F=Int[1]
for i=1:N+1
	push!(F,F[end]*i%mod)
end
I=[1 for _=1:N+2]
I[N+2]=invmod(F[N+2],mod)
for i=N+1:-1:1
	I[i]=I[i+1]*i%mod
end
b(n,r)=n>=r ? F[n+1]*I[n-r+1]%mod*I[r+1]%mod : 0
for k=1:N+1
	println((b(N+1,k)-b(L+N-R,k-1)+mod)%mod)
end


Measured memory_bytes: 157616
from sys import stdin
input = stdin.readline


def main():
  X = int(input())

  if 400 <= X <= 599:
    print(8)
  elif 600 <= X <= 799:
    print(7)
  elif 800 <= X <= 999:
    print(6)
  elif 1000 <= X <=1199:
    print(5)
  elif 1200 <= X <= 1399:
    print(4)
  elif 1400 <= X <= 1599:
    print(3)
  elif 1600 <= X <= 1799:
    print(2)
  elif 1800 <= X <= 1999:
    print(1)


if(__name__ == '__main__'):
  main()


Measured memory_bytes: 61764
import numpy as np
n, t = map(int, raw_input().split())
c = []
for i in range(n):
	c.append(map(int, raw_input().split()))
c = np.array(c)
y, x = c.shape
for i in range(y):
	if c[i,1] > t:
		c[i,0] = 9999
if min(c[:,0]) < 9999:
	print min(c[:,0])
else:
	print 'TLE'

Measured memory_bytes: 16352
import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.Unboxed            as AU
import qualified Data.Array.ST                 as ST
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                   as IM
import           Data.List
import qualified Data.Map                      as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                      as S
import           Data.Time
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
readInts n = replicateM n readInt
readString = map BS.unpack . BS.words <$> BS.getLine
readStrings n = replicateM n $ BS.unpack <$> BS.getLine
toPair [x, y] = (x, y)

main = do
  [n, r] <- readInt
  print $ solve n r

solve n r | n >= 10   = r
          | otherwise = r + 100 * (10 - n)



Measured memory_bytes: 380
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 11, maxn = 1<<8|3;
int n,m;
char s[maxn];
bool flag[maxn];

inline bool check(){
	if (s[0]=='0') return 1;
	FOR(i,1,m) if (s[i]=='1')
		FOR(j,1,m) if ((i&j)==j){
			if (s[j]=='0') return 1;
		} 
	FOR(i,1,m) if (s[i]=='0')
		FOR(j,1,m) if ((i&j)==i){
			if (s[j]=='1') return 1;
		}
	return 0;
}

int main(){
	scanf("%d%s",&n,s),m=strlen(s);
	if (check()) return puts("Impossible"),0;
	FOR(i,0,m) if (s[i]=='0')
		FOR(j,0,m) if (((i&j)==i)&&i!=j) flag[j]=1;
	vector<pa>ans={{0,1}};
	FOR(i,0,m) if (s[i]=='0'&&flag[i]==0){
		poly tmp;
		int r=0;
		Dow(j,n,1) if (i&(1<<j-1)){r=j;break;}
		tmp={r,-r};
		Dow(j,r-1,1) if (i&(1<<j-1)){
			poly tmp2={j};
			tmp2.insert(tmp2.end(),all(tmp));
			tmp2.pb(j),tmp2.pb(-j),reverse(all(tmp));
			tmp2.insert(tmp2.end(),all(tmp));
			tmp2.pb(-j),tmp=tmp2;
		} else tmp.insert(tmp.begin(),j),tmp.insert(tmp.end(),j);
		int x=0,y=1;
		for (auto j:tmp){
			int a=0,b=0;
			if (j<0) a=-j,b=0;
				else a=j,b=1;
			if (y!=b) ans.ep(x,b),y=b;
			if (x<a){
				while (x<a) ++x,ans.ep(x,y);
			} else {
				while (x>a-1) --x,ans.ep(x,y);
			}
		}
		if (y==0) ans.ep(x,1),y=1;
		while (x) --x,ans.ep(x,y); 
	}
	puts("Possible");
	printf("%d\n",siz(ans)-1);
	for (auto i:ans) printf("%d %d\n",i.fi,i.se);
}

Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "No" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl

signed main(void){
    int H,W,A,B;
    cin >> H >> W >> A >> B;
    REP(i,H){
        REP(j,W){
            cout << ((i<B)^(j<A));
        }cout << endl;
    }
    
    return 0;
}



Measured memory_bytes: 1280
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long ans = 0;
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            ans += b - a + 1;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 24260
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int t,su=0;
  cin>>t;
  while(t--)
  {
  	int l,r;
  	cin>>l>>r;
  	su+=(r-l)+1;
  }
  cout<<su;
 return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdlib.h>

using namespace std;

int main(){

  int a[5];
  int k;

  for(int i = 0;i < 5;i++){
    cin >> a[i];
  }
  cin >> k;
  bool isOK = true;
  for(int i = 0;i < 5;i++){
    for(int j = i+1;j < 5;j++){
      int dis = abs(a[i] - a[j]);
      if(dis > k)isOK = false;
    }
  }

  cout << (isOK?"Yay!":":(") << endl;



  return 0;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

ll rec (ll a, ll b, ll c, ll n) {
    if (a%2 || b%2 || c%2) {
        return n;
    }

    rec((b+c)/2, (c+a)/2, (a+b)/2, n+1);
}

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll A, B, C;
    cin >> A >> B >> C;

    if (A == B && B == C) {
        if (A%2) {
            cout << 0 << endl;
            return 0;
        } else {
            cout << -1 << endl;
            return 0;
        }
    }

    cout << rec(A, B, C, 0) << endl;
    return 0;
}

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

using ll = long long;

int main() {
    ll MOD = 1e9 + 7;
    string S;
    cin >> S;
    int n = S.size();
    ll dp[100001][13];
    rep(i, 100001) rep(j, 13) dp[i][j] = 0;
    dp[0][0] = 1;
    int x = 1;
    rep(i, n) {
        if (S[n - 1 - i] == '?') {
            rep(j, 10) {
                rep(k, 13) {
                    dp[i + 1][(j * x + k) % 13] += dp[i][k];
                    dp[i + 1][(j * x + k) % 13] %= MOD;
                }
            }
        } else {
            int j = S[n - 1 - i] - '0';
            rep(k, 13) {
                dp[i + 1][(j * x + k) % 13] += dp[i][k];
                dp[i + 1][(j * x + k) % 13] %= MOD;
            }
        }
        x = (x * 10) % 13;
    }
    cout << dp[n][5] << endl;
}

Measured memory_bytes: 10624
#include <stdio.h>
int main()
{
	int X,Y,K,N,M;
	scanf("%d %d %d %d",&N,&K,&X,&Y);
	if(N>=K)
	{
		M=X*K+Y*(N-K);
		printf("%d\n",M);
	}
	else
	{
		M=X*N;
		printf("%d\n",M);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int cnt=0;
double ans;
int main()
{
	int i,j,n,k;
	ans=cnt;
	scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++){
		double tmp=1.0/n;
		int x=i;
		while(x<k){
			x*=2;
			tmp/=2;
		}
		ans+=tmp;
	}
	printf("%.12f\n",ans);
	return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main()
{
  int n;cin>>n;
  vector<int> v(n,0);
  
  int temp;
  for(int i=0;i<n-1;++i)
  {
    cin>>temp;
    v[--temp]++;
  }
  
  for(auto i :v) cout<<i<<endl;
}


Measured memory_bytes: 4052
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define maxn 200005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,a[maxn];
ll f[maxn][7];
int main(){
	scanf("%d",&n);
	for(int i = 1;i <= n;i++) scanf("%d",&a[i]);
	for(int i = 1;i <= n;i++){
		f[i][1] = f[i - 1][1];
		f[i][2] = min(f[i - 1][2],f[i][1]);
		f[i][3] = min(f[i - 1][3],f[i][2]);
		f[i][4] = min(f[i - 1][4],f[i][3]);
		f[i][5] = min(f[i - 1][5],f[i][4]);
		f[i][1] += a[i];
		if(a[i] == 0) f[i][2] += 2;
		else f[i][2] += a[i] & 1;
		f[i][3] += 1 - (a[i] & 1);
		if(a[i] == 0) f[i][4] += 2;
		else f[i][4] += a[i] & 1;
		f[i][5] += a[i];
	}
	ll res = 0x3f3f3f3f;
	for(int i = 1;i <= 5;i++) res = min(res,f[n][i]);
	printf("%lld\n",res);
	return 0;
}


Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<ll> t(n), a(n);
	rep(i,n) cin >> t.at(i) >> a.at(i);
	ll T = 1, A = 1;
	rep(i,n){
		ll x = max((T + t.at(i) - 1) / t.at(i), (A + a.at(i) - 1) / a.at(i));
		T = x * t.at(i);
		A = x * a.at(i);
	}
	cout << T + A << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#define N 1005
char A[N][N];
int f[N*N][3],res=0;
int main() {
	int n,m,i,j,h=0,t=0,ans,x,y;
	int fs[8]={-1,0,0,-1,0,1,1,0}; 
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++) {
		getchar();
		for(j=0;j<m;j++) {
			scanf("%c",&A[i][j]);
			if(A[i][j]=='#') {
				f[t][0]=i,
				f[t][1]=j,
				f[t][2]=0;
				t++;
			}
			else res++;
		}
	}
	while(h<t) {
		for(i=0;i<8;i+=2) {
			x=fs[i]+f[h][0],
			y=fs[i+1]+f[h][1];
			if(x>=0 && y>=0 && x<n && y<m && A[x][y]=='.') {
				A[x][y]='#';
				res--;
				f[t][0]=x,f[t][1]=y,f[t][2]=f[h][2]+1;
				t++;
			}
		}
		h++;
		if(!res) break;
	}
	printf("%d",f[t-1][2]);
} 

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

typedef long long ll;

ll g1(ll n, int p) { //nは偶数
    if (n==0) return 0;
    return n/p + g1(n/p,p);
}

ll g2(ll n, int p){ //nは偶数
    ll ret = g1(n/2,p);
    if (p==2) ret += n/2;
    return ret;
}

int main() {
    ll N;
    cin >> N;
    if (N%2 == 1) {
        cout << 0 << endl;
        return 0;
    }
    cout << min(g2(N, 2),g2(N, 5)) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
using namespace std;
using ll = long long;
int main()
{

	ll a, b = 0, c = 0, d = 0;
	ll l;
	string s, t;
	ll n, m, h, w, X;
	
	ll M[10000] = {};
	cin >> n;
	n = n - (n%500);



	cout << n << endl;

	//cout << sum << endl;
	//cout <<  endl;

	return 0;
}

//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;

//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}




Measured memory_bytes: 3096
#include <iostream>

using namespace std;

int main(void){
    int n,tmp,max=0,cash=0;

    cin>>n;

    for(int i=0;i<n;i++){
        cin>>tmp;
        cash+=tmp;
        if(max<tmp)max=tmp;
    }

    cout<<cash-max/2<<endl;

    return 0;
}

Measured memory_bytes: 256
# -*- coding:utf-8 -*-


def binarySearch(A, key):
    left, right = 0, n
    while left < right:
        mid = int((left + right) / 2)
        if A[mid] == key:
            return True
        elif key < A[mid]:
            right = mid
        else:
            left = mid + 1
    return False

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

count = 0

for i in T:
    if binarySearch(S,i):
        count += 1

print (count)

Measured memory_bytes: 18804
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using VecVec = vector<Vec>;
using Tree = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T& b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T& b){if(a > b){a = b; return true;} return false;}
template <typename T>
void co(const T n){cout << n << endl;}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void coVec(const Vec &v){for(ll i : v) cosp(i); cout << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;

int main(void){
	ll n, k, s;
	cin >> n >> k >> s;

	Vec ans(n);
	if(k == 0){
		if(s != 1e9) rep(i, n) ans[i] = 1e9;
		else rep(i, n) ans[i] = 1;
	}else{
		rep(i, k) ans[i] = s;
		if(s != 1e9) REP(i, k, n) ans[i] = 1e9;
		else REP(i, k, n) ans[i] = 1;
	}
	coVec(ans);

	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define INF 0x7fffffff
#define N 300001
typedef long long ll;
typedef long double ld;
 
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()

int stk[N], top;
int main()
{
	fastIO;
	
	int n, m = 0, cnt = 0, ans = 0;
	string s;

	cin >> n >> s;
	for(int i = 0; i < n; i++)
		if(s[i] == 'R') m++;
		else stk[top++] = i;

	for(int i = 0; i < n && cnt < m; i++)
	{
		if(s[i] == 'R') cnt++;
		else
		{
			int idx = stk[--top];
			s[idx] = 'W';
			s[i] = 'R';
			cnt++, ans++;
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4396
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int cnt[210] = {};
    for(int i = 0;i < 3;i++){
        int a;
        cin >> a;
        cnt[a+100]++;
    }
    for(int i = 0;i <= 200;i++){
        if(cnt[i] == 1){
            cout << i-100 << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;

void main()
{
    auto hw = readln.split.to!(int[]);
    auto H = hw[0];
    auto W = hw[1];
    string[][] map;
    map.length = H;
    foreach (i; 0..H) {
        map[i] = readln.chomp.split("");
    }

    foreach (y; 0..H) {
        bool b;
        foreach (x; 0..W) {
            if (map[y][x] == "#") {
                b = true;
                break;
            }
        }
        if (!b) {
            foreach (x; 0..W) {
                map[y][x] = "";
            }
        }
    }

    foreach (x; 0..W) {
        bool b;
        foreach (y; 0..H) {
            if (map[y][x] == "#") {
                b = true;
                break;
            }
        }
        if (!b) {
            foreach (y; 0..H) {
                map[y][x] = "";
            }
        }
    }

    foreach (line_; map) {
        auto line = line_.join;
        if (!line) continue;
        writeln(line);
    }
}

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

int main(){
  int n;
  cin>>n;

  int card[4][13] ={};
  for(int i=0;i<n;i++){
    string suit;
    int num;
    cin>>suit>>num;

    if(suit == "S") card[0][num-1] = 1;
    if(suit == "H") card[1][num-1] = 1;
    if(suit == "C") card[2][num-1] = 1;
    if(suit == "D") card[3][num-1] = 1;
  }

  string str[4] = {"S", "H", "C", "D"};

  for(int i=0;i<4;i++){
    for(int j=0;j<13;j++){
      if(card[i][j] == 1)continue;
      cout<<str[i]<<" "<<j+1<<endl;
    }
  }

  return 0;

}



Measured memory_bytes: 3116
import collections
n = int(input())
s_L = []
for _ in range(n):
    s = input()
    s_L.append(s)
c = collections.Counter(s_L)
c = sorted(c.items(),key=lambda x: x[1],reverse=True)
num = c[0][1]
c = sorted(c,key=lambda x:x[0])
for k,v in c:
    if v == num:
        print(k)

Measured memory_bytes: 115024
#include<bits/stdc++.h>
#define ll long long

using namespace std;
int f[10];
int main()
{
    int n,m,x;

    cin>>n>>m;

    map<int,int>mp;
    for(int i=0; i<m; i++)
    {
        cin>>x;
        mp[x]=x+1;
    }
    for(int i=n; ;i++)
    {
        x=i;
        int cnt=0,sz=0;
        while(x!=0)
        {
            int r=x%10;
            if(mp[r]==0)cnt++;
            x=x/10;
            sz++;
        }
        if(cnt==sz){cout<<i<<endl;return 0;}
    }


    return 0;



}


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

int main()
{
    int k, s;
    cin >> k >> s;

    ll count = 0;
    for (int x = 0; x <= k; ++x)
    {
        for (int y = 0; y <= k; ++y)
        {
            int z = s - y - x;
            if (z >= 0 && z <= k)
                ++count;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 3636
/*************************************************************
190914-001-AGC028A


＜入力＞


＜出力＞


*************************************************************/

#include <stdio.h>
#include <stdlib.h>

// //////////////////////////////////////////////////////////////////////////////////
// 機能：ユークリッドの互除法によりa,bの最大公約数を求める
// 戻り値： 最大公約数、(自然数以外が指定されたときは-1)
// //////////////////////////////////////////////////////////////////////////////////
int gcd(
    int a,
    int b
)
{
    int temp;

    if (a < b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    if (b < 1)
        return -1;

    if (a % b == 0)
        return b;
        
    return gcd(b, a % b);
}

int main(int argc, char const *argv[])
{
    long long N,M;
    scanf("%lld%lld", &N, &M);
    char *S = (char *)malloc(sizeof(char) * N + 1);
    char *T = (char *)malloc(sizeof(char) * M + 1);
    scanf("%s", S);
    scanf("%s", T);

    int g, a, b;
    g = gcd(N, M);
    a = N / g;
    b = M / g;

    int i, j;
    for (i = 0, j = 0; i * a < N && j * b < M; i++, j++)
    {
        if(S[i*a] != T[j*b])
        {
            printf("-1\n");
            return 0;
        }
    }

    printf("%lld\n", (N * M / g));

    return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<math.h>
#include<time.h>

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)

typedef long long i64;
typedef pair<i64,i64> P;


int a,b,c;

int main(){
	cin >> a >> b;
	
	if(a==b){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 764
using System;
using System.Linq;

public class Program
{
    static void Main()
    {
        int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        Console.WriteLine(input[1] + input[2] - input[0] > 0 ? input[1] + input[2] - input[0] : 0);
    }
}

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

ll n, k; // 変数

int main() {
// input
    cin >> n;
    cin >> k;
// solve
    ll ans = 0;
    if (n > k) n %= k;
    ans = min(n, abs(n-k));
// output
    cout << ans << "\n";
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using System.Threading.Tasks;

namespace Triangle
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            double[] ngo = new double[3];
            for (int i = 0; i < 3; ++i) ngo[i] = double.Parse(input[i]);
            ngo[2] = Math.PI * ngo[2] / 180;
            double s = ngo[0] * ngo[1] * Math.Sin(ngo[2]) / 2.0;
            double l = ngo[0] + ngo[1] + Math.Sqrt(Math.Pow(ngo[0], 2) + Math.Pow(ngo[1], 2) - 2 * ngo[0] * ngo[1] * Math.Cos(ngo[2]));
            double h = ngo[1] * Math.Sin(ngo[2]);
            Console.WriteLine(s);
            Console.WriteLine(l);
            Console.WriteLine(h);
        }
    }
}


Measured memory_bytes: 9456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin>>n;
	vector<int> a;
	ll sum = 0;
	for(int i=1;i<=n;i++) {
		int t;cin>>t;
		a.emplace_back(t-i);
	}
	sort(all(a));
	ll tmp = a[n/2];
	ll ans = 0;
	for(auto t : a){
		ans += abs(t-tmp);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1400
/*
    *****
    @Author: Harith Insider
    *****
*/
#include<bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define ff first
#define ss second
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
void solve()
{
    ll x1,x2,t1,t2,t;
    cin>>x1>>t1>>x2>>t2>>t;
    ll a=abs(x1-x2);
    ll b=(t1-t2)*t;
  if(a<=b)
    cout<< "YES" << endl;
  else
    cout << "NO" << endl;
}
int main()
{
    fastio;
    solve();
}


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

int main() {

    vector<int> a;
    int sameCount = 0;


    for(int i = 0; i < 3; i++) {
        int num;
        cin >> num;
        a.push_back(num);
    }

    sort(a.begin(), a.end());

    for(int i = 1; i < 3; ++i) {
        if(a[i] == a[i - 1])
            sameCount++;

    }

    if(sameCount == 1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

ll binomialCoeff(ll n, ll k) 
{ 
    ll C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (ll j = min(i, k); j > 0; j--) 
            C[j] = C[j] + C[j-1]; 
    } 
    return C[k]; 
} 

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt(),m=nxt();
    vector < vector <int> > g;
    vector <int> r1;
    g.resize(n+1,r1);
    for(int i=0;i<m;i++)
    {
        int u=nxt(),v=nxt();
        g[u].push_back(v);
        g[v].push_back(u);
    }
    vector <bool> visited;
    visited.resize(n+1,0);
    visited[1]=1;
    queue<int> q;
    q.push(1);
    vector <int> dist;
    dist.resize(n+1,0);
    while(q.size())
    {
        int x=q.front();
        q.pop();
        for(auto i:g[x])
        {
            if(!visited[i])
            {
                dist[i]=dist[x]+1;

                visited[i]=1;
                q.push(i);
            }
        }

    }
    if(dist[n]==2)
        cout<<"POSSIBLE\n";
    else
        cout<<"IMPOSSIBLE\n";
    
    
    
    return 0;   
}




 
 


Measured memory_bytes: 13168
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	public static void main(String[] args) throws IOException {
		// 入力導入部
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String st=br.readLine();
		String[] str=st.split("");

		for(int i=0;i<str.length;i++){
			if(str[i].equals(str[i].toLowerCase())){
				System.out.print(str[i].toUpperCase());
			}else System.out.print(str[i].toLowerCase());
		}
System.out.println();


}}

Measured memory_bytes: 19296
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;} return false;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;} return false;}

int h, w, k, ans;
char c[7][7];

void dfs(vector<int> &A) {
    if (A.size() == h+w) {
        vector<vector<bool>> f(h, vector<bool>(w, true));
        rep(i, h+w) {
            if(A.at(i) == 1) {
                if(i < h) {
                    rep(j, w) {
                        f[i][j] = false;
                    }
                }
                else {
                    rep(j, h) {
                        f[j][i-h] = false;
                    }
                }
            }
        }
        int cnt = 0;
        rep(i, h) {
            rep(j, w) {
                if(c[i][j] == '#' && f[i][j]) {
                    cnt++;
                }
            }
        }
        if(cnt == k) ans++;
        return;
    }

    for (int v = 0; v < 2; ++v) {
        A.push_back(v);
        dfs(A);
        A.pop_back();
    }
}

int main(){
    cin >> h >> w >> k;
    rep(i, h) {
        rep(j, w) {
            cin >> c[i][j];
        }
    }
    vector<int> A;
    dfs(A);
    cout << ans << endl;
    return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

int n;
vvi g, dist;

void Main(){
	int x, y;
	cin >> n >> x >> y;
    g.resize(n);
    dist.resize(n, vi(n,0));
    
    rep(i,n-1){
        g[i].pb(i+1);
        g[i+1].pb(i);
    }
    g[x-1].pb(y-1);
    g[y-1].pb(x-1);
    
    rep(i,n-1){
        queue<int> que;
        que.push(i);
        while (!que.empty()) {
            int v = que.front(); 
            que.pop();

            // v から辿れる頂点をすべて調べる
            for (auto nv : g[v]) {
                if (dist[i][nv]!=0 || i == nv) continue; 
                dist[i][nv] = dist[i][v] + 1;
                //cout << i << " " << v << " " << nv << " " << dist[i][nv] << endl;
                que.push(nv);
            }
        }
    }
    
    vi cnt(n,0);
  	rep(i,n-1){
    	rep3(j,i+1,n-1){
        	cnt[dist[i][j]]++;
        }
    }
    rep3(i,1,n-1) cout << cnt[i] << endl;
	return;
}

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 16128
/* Author: Jason L.(int3xccATgmailDOTcom), Mon Nov 13 15:48:55 CST 2017 */
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pll = pair<ll, ll>; using dd = long double;
//=========================================================================
namespace {
static bool constexpr dbg =
#ifdef INT3XCC_DEBUG
        1;
#else
        0;
#endif
#define Dprintf(fmt, ...) do{if(dbg) printf(fmt, ##__VA_ARGS__);}while(0)
#define REP0(i, n) for (ll i = 0, ii_ = (n); i <  ii_; ++i)
#define REP1(i, n) for (ll i = 1, ii_ = (n); i <= ii_; ++i)
//=========================================================================
ll constexpr N = 1.1e5;
ll n, a[N+9], b[N+9], c[N+9], r1[N+9], res;
//=========================================================================
void init() {
    cin>>n;
    REP1(i, n) cin>>a[i]; REP1(i, n) cin>>b[i]; REP1(i, n) cin>>c[i];
}
void solve() {
    sort(a+1, a+n+1); sort(b+1, b+n+1); sort(c+1, c+n+1);
    REP1(i, n) {
        r1[i] = r1[i-1] + lower_bound(a+1, a+n+1, b[i]) -(a+1);
    }
    REP1(i, n) {
        res += r1[lower_bound(b+1, b+n+1, c[i])-(b+1)];
    }
    cout<<res;
}}
//=========================================================================
int main() {
    if (!dbg) { std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
    cout<<fixed<<setprecision(20); init(); solve(); return 0;
}


Measured memory_bytes: 3456
object Main extends App {
	val N = scala.io.StdIn.readInt
	val b = scala.io.StdIn.readLine.split(" ").map(_.toInt)
	val a = new Array[Int](N)

	
	var tp = 0

	for(i<-0 until N){
		if(i%2 == 0) tp += b(i)
		else tp -= b(i)
	}

	a(0) = tp
	a(N-1) = 2*b(N-1) - a(0)

	for(i <- 1 until N-1){
		a(i) = 2*b(i-1) - a(i-1)
	}

	println(a.mkString(" "))



	
}

Measured memory_bytes: 59140
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		long tot = 0;
		tot += 1000 * (X / 500);
		X %= 500;
		tot += 5 * (X / 5);
		Console.WriteLine(tot);
	}
	long X;
	public Sol(){
		X = rl();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 13140
#include <stdio.h>

int main(void)
{
	int time, hour, minute, second;

	scanf ("%d", &time);
	if ((0 <= time) && (time <= 86400))
	{
		hour = time / (60 * 60);
		minute = (time - hour * 60 * 60) / 60;
		second = time % 60;
		printf("%d:%d:%d\n", hour, minute, second);

		return 0; 
	}
	else return -1;
}

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

const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)


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

Measured memory_bytes: 3636
import java.util.*;

class Reader {
  Scanner sc = new Scanner(System.in);

  public int ini() {
    return sc.nextInt();
  }

  public int[] vi(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = sc.nextInt();
    return a;
  }
}

public class Main extends Reader {
  public static void main(String[] args) {
    Main main = new Main();
    main.show(main.solve());
  }

  int n;
  int[] a;

  public Main() {
    n = ini();
    a = vi(n);
  }
  
  int solve() {
    int[] cnt = new int[101];
    for (int i = 0; i < n; i++) {
      cnt[a[i]]++;
    }
    int ans = 0;
    for (int i = 1; i <= 100; i++) {
      if (cnt[i] != 0) ans++;
    }
    return ans;
  }

  int calc(int left, int right) {
    int ans = 0;
    for (int i = left; i <= right; i++) {
      ans += i;
    }
    return ans;
  }

  void show(int ans) {
    System.out.println(ans);
  }
}




Measured memory_bytes: 35916
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};

fn main() {
    input! {
        n:usize,a:Usize1,b:Usize1,c:Usize1,d:Usize1,
        s:Chars,
    }

    for i in a + 1..max(c, d) {
        if s[i] == '#' && s[i + 1] == '#' {
            yn(false);
            return;
        }
    }
    if c > d {
        let mut ok = false;
        for i in b..=d {
            if s[i - 1] == '.' && s[i] == '.' && s[i + 1] == '.' {
                ok = true;
                break;
            }
        }
        if !ok {
            yn(false);
            return;
        }
    }
    yn(true);
}

pub fn yn(ans: bool) {
    if ans {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

using namespace std;

int N,H[100100],D[100100];
int main() {
	scanf ("%d",&N);

	for (int i=1;i<=N;i++) scanf ("%d",&H[i]);
	for (int i=2;i<=N;i++){
		D[i] = D[i-1] + abs(H[i-1]-H[i]);
		if (i > 2 && D[i] > D[i-2] + abs(H[i-2]-H[i]))
			D[i] = D[i-2] + abs(H[i-2]-H[i]);
	}
	printf ("%d\n",D[N]);

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

unsigned gcd(unsigned a, unsigned b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

INT dp[100010];
bool br[100010] = { false };

int main()
{
	int n, m;
	cin >> n >> m;

	for (size_t i = 0; i < m; i++)
	{
		int a;
		cin >> a;
		br[a] = true;
	}

	dp[0] = 1;
	dp[1] = 1;
	for (size_t i = 2; i <= n; i++)
	{
		dp[i] = (!br[i - 2] ? dp[i - 2] : 0) + (!br[i - 1] ? dp[i - 1] : 0);
		dp[i] %= 1000000007;
	}

	cout << dp[n] << endl;
}


Measured memory_bytes: 1152
N,Y=map(int,input().split())

for x in range(N+1):
    for y in range(N+1):
        z=N-x-y
        if 9*x+4*y==Y*(10**(-3))-N and z>=0:
            print(x,y,z)
            exit()

print("-1 -1 -1")


Measured memory_bytes: 40684
<?php
list($n) = ints();
$reaf = ints();
$next_max_node = 1;
$cnt = 0;
$cusum[-1] = 0;
for ($i = 0; $i <= $n; ++$i) $cusum[$i] += $cusum[$i - 1] + $reaf[$i];
for ($i = 0; $i <= $n; ++$i) {
    if ($next_max_node < $reaf[$i]) exit('-1');
    $not_reaf[$i] = $i < $n ? $next_max_node - $reaf[$i] : 0;
    $cnt += $reaf[$i] + $not_reaf[$i];
    $next_max_node = min($not_reaf[$i] * 2, $cusum[$n] - $cusum[$i]);
}
echo $cnt;
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 31644
import sys

X = int(input())

X_l = list(range(1,X+1))
box = set()

if X == 1:
    print(1)
    sys.exit()

for i in X_l:
    for j in range(2, X+1):
        if i ** j in X_l:
            box.add(i ** j)
        elif i ** j > X:
            break

print(max(box))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define LL long long
#define db double
using namespace std;

template <typename T> inline void read(T &x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}

template <typename T> inline bool CheckMax(T &a, const T &b) {
	return a < b ? a = b, true : false;
}

template <typename T> inline bool CheckMin(T &a, const T &b) {
	return a > b ? a = b, true : false;
}

//#define LOCAL

int main() {
	int a, b, c;
	LL k;
	read(a), read(b), read(c), read(k);
	if (k & 1) {
		printf("%d\n", b - a);
	} else {
		printf("%d\n", a - b);
	}
#ifdef LOCAL
	Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
     
    int n,m;
    int g[20][20];
    char str[20];
     
    inline int RD()
    {
    	int res=0,k=1;char ch=getchar();
    	for(;ch<'0'||ch>'9';ch=getchar()) if(ch=='-') k=-1;
    	for(;ch>='0'&&ch<='9';ch=getchar()) res=(res<<1)+(res<<3)+ch-'0';
    	return k*res;
    }
     
    int main()
    {
    	n=RD(); m=RD();
    	for(int i=1;i<=n;i++)
    	{		scanf("%s",str);
    			for(int j=0;j<m;j++)
    			{
    				if(str[j]=='#') g[i][j+1]=1;
    				else g[i][j+1]=0;
    			}
    	}
    	
    	int i=1,j=1,flag=0;
    	while(i!=n||j!=m)
    	{
    		if(!g[i+1][j]&&!g[i][j+1])
    			{flag=1;break;}
    		if(g[i-1][j])
    			{flag=1;break;}
    		if(g[i][j-1])
    			{flag=1;break;}
    		if(g[i][j]&&g[i+1][j]&&g[i][j+1])
    			{flag=1;break;}
    		if(g[i][j]&&g[i][j+1])
    		{
    			g[i][j]=0;
    			j++;
    		}
    		else if(g[i][j]&&g[i+1][j])
    		{
    			g[i][j]=0;
    			i++;
    		}
			if((i==n)&&(j==m)&&(g[i][j-1]||g[i-1][j]))
				{flag=1;break;}
    	}
     
    	if(flag) printf("Impossible\n");
    	else printf("Possible\n");
     
    	return 0;
    }
	
	

Measured memory_bytes: 128