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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n; cin >> n;
    vl a(n),b(n);
    vpii p;
    rep(i,n){
      cin >> a[i] >> b[i];
      p.push_back({a[i],b[i]});
    }
    auto c = a;
    auto d = b;
    sort(all(p));
    sort(all(c));
    sort(all(d));
    ll res = 0;
    if(n & 1){
      ll left = c[n/2];
      ll right = d[n/2];
      res = right - left + 1;
    }
    else{
      ll left1 = c[n/2 - 1];
      ll left2 = c[n/2];
      ll right1 = d[n/2 - 1];
      ll right2 = d[n/2];

      ll left = left1+left2;
      ll right = right1+right2;
      res = right - left + 1;
    }
    out(res);
}


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

// template < typename T >
// void (const vector < T > & )

void solve () {

}

const int mod = 1e9 + 7;

int mul (int a, int b) {
    return ((ll) a * b) % mod;
}

int power (int a, int n) {
    int answer = 1;
    while (n >= 1) {
        if (n % 2) {
            answer = mul (answer, a);
        }
        a = mul (a, a);
        n >>= 1;
    }
    return answer;
}

int inverse (int a) {
    return power (a, mod - 2);
}

int fact (int n) {
    int answer = 1;
    for (int i = 1; i <= n; i++) {
        answer = mul (answer, i);
    }
    return answer;
}

int main() {
    int x, y;
    cin >> x >> y;
    int a = 2 * y - x;
    int b = 2 * x - y;
    if (a<0 || b < 0 || (a%3) || (b%3)) {
        cout << 0 << endl;
        return 0;
    }
    int p = a / 3, q = b / 3;
    int upper = fact (p + q);
    int lower = mul (fact (p), fact (q));
    int answer = mul (upper, inverse (lower));
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

    int a,b,c;
    cin>>a>>b;
    c = a*b;

    if(c%2==0)
    {
        cout<<"Even"<<endl;
        //cout<<"As "<<a<<" x "<<b<<" = "<<c<<" is even, print Even."<<endl;
    }
    else
    {
        cout<<"Odd"<<endl;
        //cout<<"As "<<a<<" x "<<b<<" = "<<c<<" is odd, print Odd."<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long num = sc.nextLong();
    List<Long> list = new ArrayList<>();
    for ( long i = 1; i <= num; i++ ) {
      if ( i % 3 == 0 ) continue;
      if ( i % 5 == 0 ) continue;
      list.add(i);
    }
    var sum = BigInteger.ZERO;
    for ( var n : list ) {
      sum = sum.add(BigInteger.valueOf(n) );
    }
    System.out.println(sum);
  }
}


Measured memory_bytes: 72464
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
#include <random>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define REPE(i, n) for (int (i)=0; (i) <= (n); (i)++)
#define CONTAINS_MAP(m, a) ((m).find((a)) != m.end())
#define CONTAINS_SET(m, a) ((m).find((a)) != m.end())
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void Yes() { cout << "Yes" << endl; }
void No() { cout << "No" << endl; }



signed main()
{
	int x, a, b;
	cin >> x >> a >> b;
	cout << (abs(x - a) < abs(x - b) ? "A" : "B") << endl;
}



Measured memory_bytes: 3548
S=input()
n=len(S)
c0=0
c1=0
for i in range(n):
    if i%2==0:
        if S[i]=="0":
            c1+=1
        else:
            c0+=1
    else:
        if S[i]=="0":
            c0+=1
        else:
            c1+=1
print(min(c0,c1))

Measured memory_bytes: 3188
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <iomanip>
#include <sstream>

using namespace std;
using ll = long long;

// inf
constexpr ll infl = 1LL << 60;
constexpr int inf = 1 << 30;

constexpr ll mod = 1000000007LL;

// a - bをmodをとりつつ計算する.
ll submod(ll a, ll b) {
    return a > b ? (a - b) % mod : ((a - b) % mod + mod);
}

// x^nをmodをとりつつ求める
ll powmod(ll x, ll n) {
    if (n == 0LL) return 1LL;
    x %= mod;
    if (n % 2LL == 0) {
        return powmod((x * x) % mod, n / 2LL);
    }
    else {
        return (x * powmod((x * x) % mod, n / 2LL)) % mod;
    }
}

// xの逆元を求める.
ll modinv(ll x) {
    return powmod(x, mod - 2LL);
}

ll mfac[200000+1];

void initFac() {
    mfac[0] = mfac[1] = 1LL;

    for (int i = 2; i <= 200000; ++i) {
        mfac[i] = mfac[i - 1] * i % mod;
    }
}

// nPkを求める
ll perm(ll n, ll k) {
    if (k > n) throw "k must be less or equal than n";
    return mfac[n] * modinv(mfac[n - k]) % mod;
}

// nCkを求める
ll comb(ll n, ll k) {
    if (k > n) return 0LL;
    else return mfac[n] * modinv(mfac[k] * mfac[n - k]) % mod;
}

int main() {
    initFac();
    int N, K; cin >> N >> K;
    for (int i = 1; i <= K; ++i) {
        if (((N - K) - (i - 1)) >= 0) {
            if (K >= i) {
                int M = (N - K) - (i - 1);
                cout << (comb(M + i, i) * comb(K - 1, i - 1) % mod) << endl;
            }
            else {
                cout << 0 << endl;
            }
        }
        else {
            cout << 0 << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 1792
using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		string[] s = Console.ReadLine().Split(' ');
		int a = int.Parse(s[0]);
		int b = int.Parse(s[2]);
		
		while(s[1] != "?") {
			int ans = 0;
			
			switch(s[1]){
				case "+":
					ans = a+b;
					break;
				case "-":
					ans = a-b;
					break;
				case "*":
					ans = a*b;
					break;
				case "/":
					ans = a/b;
					break;
			}
			Console.WriteLine(ans);
			
			s = Console.ReadLine().Split(' ');
			a = int.Parse(s[0]);
			b = int.Parse(s[2]);
		}
	}
}

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

int main() {
    long long w, h, x, y;
    cin >> w >> h >> x >> y;
    double ans = (double) w * (double) h / 2;
    cout << fixed << setprecision(6) << ans << " ";
    if (2 * x == w && 2 * y == h) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  int n, m;
  cin >> n >> m;
  char a[50][50], b[50][50];
  for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> a[i][j];
  for (int i = 0; i < m; i++) for (int j = 0; j < m; j++) cin >> b[i][j];
  bool x = false;
  for (int k = 0; k <= n-m; k++) {
    if (x) break;
    for (int l = 0; l <= n-m; l++) {
      x = true;
      for (int i = 0; i < m; i++) {
	if (!x) break;
	for (int j = 0; j < m; j++) {
	  if (a[i+k][j+l] != b[i][j]) {
	    x = false;
	    break;
	  }
	}
      }
      if (x) break;
    }
  }
  dump(x ? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String n = scan.next();
        if(n.charAt(0) == n.charAt(2)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll N, H;
    cin >> N >> H;
    
    vector<ll> a(N), b(N);
    rep(i, N) cin >> a[i] >> b[i];

    sort(all(a));
    reverse(all(a));
    sort(all(b));
    reverse(all(b));

    ll max_a = a[0];
    ll ans = 0;
    rep(i, N) {
        if (b[i] >= max_a) {
            ans++;
            H -= b[i];
        }
        if (H <= 0) {
            H = 0;
            break;
        }
    }
    
    ans += (H + max_a - 1LL) / max_a;

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

Measured memory_bytes: 1792
#include <stdio.h>
#include<iostream>
#include<math.h>
int uncoo(int n){
 return (int)(logf((float)n)/logf(10.0))+1;
}
int main(){
	using namespace std;
	int unco[200],temp,i;
	for(i=0;i<200;i++){
		if(!(cin>>unco[i]))break;
		cin>>temp;
		unco[i]+=temp;
	}
	for(int j=0;j<i;j++){
		cout<<uncoo(unco[j])<<endl;
	}
	return 0;
}

Measured memory_bytes: 1180
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int main(){
    string s1,s2;
    cin >> s1 >> s2;
    if(s1[0]==s2[2]&&s1[1]==s2[1]&&s1[2]==s2[0])    cout << "YES";
    else    cout << "NO";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<int> edge[8];
bool used[8];
int ans = 0, N;

void dfs(int n, int p) {
  if (used[n])
    return ;
  used[n] = true;
  for (auto &e: edge[n]) {
    if (e == p)
      continue;
    dfs(e, n);
  }
  bool chk = true;
  for (int i=0; i<N; i++)
    if (!used[i])
      chk = false;
  if (chk)
    ans++;
  used[n] = false;
}

int main() {
  int M, a, b;
  cin >> N >> M;
  for (int i=0; i<M; i++) {
    cin >> a >> b;
    a--;
    b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  dfs(0, -1);
  cout << ans << endl;
  return 0;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define lfs <<fixed<<setprecision(10)<<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = n; i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = n - 1; i >= (ll)(m); i--)
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>v,ll n){cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
template<typename T>
void emp(map<T,ll>&m, T x){m.emplace(x,0).first->second++;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};

template<ll mod>
struct RollingHash{
  vector<ll> hash,p;
  ll base;
  RollingHash(string s, ll b){
    ll n = (ll)s.size();
    base = b;
    hash.assign(n+1,0);
    p.assign(n+1,1);
    for(ll i=0;i<n;i++){
      hash[i+1]=(hash[i]*base+s[i])%mod;
      p[i+1]=(p[i]*base)%mod;
    }
  }
  ll get(ll l, ll r){
    ll ret=hash[r+1]-(hash[l]*p[r-l+1])%mod;
    if(ret<0)ret+=mod;
    return ret;
  }
};

int main(){
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  const ll tmp_mod1=608396398;
  const ll tmp_mod2=979418779;
  //const ll tmp_mod=775791517;
  using RH = RollingHash<tmp_mod1>;
  using RH2 = RollingHash<tmp_mod2>;
  ll base=100000;
  ll n;cin>>n;
  string s;cin>>s;
  RH rh(s,base);
  RH rh2(s,base);
  /*auto v=vec(n,n,0LL);
  rep(i,0,n)rep(j,0,n){
    if(i+j<n)v[i][j]=rh.get(i,i+j);
  }*/
  rep(i,0,n-1)rep(j,i+1,n){
    if(s[i]!=s[j])continue;
    ll l=i,r=j;
    while(r-l>=2){
      ll mid=(l+r)/2;
      if(j+mid-i>=n||rh.get(i,mid)!=rh.get(j,j+mid-i)
      ||rh2.get(i,mid)!=rh2.get(j,j+mid-i)){
        r=mid;
      }
      else l=mid;
    }
    chmax(res,l-i+1);
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#include <ext/numeric>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scs(a) scanf("%s", a)
#define pri(x) printf("%d\n", x)
#define prie(x) printf("%d ", x)
#define pris() printf("\n")
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false)
#define db(x) cerr << #x << " == " << x << endl
#define power(a,x) __gnu_cxx::power(a, x)
#define eps 1e-5
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
const ld pi = acos(-1);
const int MOD = 1e9 + 7;
string s;
int t;
int dp[310][310][310];
int main()
{
    cin>>s>>t;
    int n=s.size();
    for(int i=n-1;i>=0;i--)
    {
        for(int j=i;j<n;j++)
        {
            if(i+1==j)
                dp[i][j][0]=1+(s[i]==s[j]);
            for(int k=0;k<=t;k++)
            {
                if(i==j)
                {
                    dp[i][j][k]=1;
                    continue;
                }
                if(i+1==j)
                {
                    if(k>0)
                        dp[i][j][k]=2;
                    continue;
                }
                int mx=0;
                mx=max(mx,dp[i+1][j][k]);
                mx=max(mx,dp[i][j-1][k]);
                if(k>0)
                    mx=max(mx,dp[i][j][k-1]);
                if(s[i]==s[j])
                    mx=max(mx,2+dp[i+1][j-1][k]);
                if(k>0)
                    mx=max(mx,2+dp[i+1][j-1][k-1]);
                dp[i][j][k]=mx;
            }
        }
    }
    cout<<dp[0][n-1][t]<<endl;
    return 0;
}



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

using namespace std;

int main(void) {
  int N; cin >> N;
  int X[N]; for (int i = 0; i < N; i++) cin >> X[i];
  int ans = 1'000'000;
  for (int p = 1; p <= 100; p++) {
    int tmp = 0;
    for (int i = 0; i < N; i++) {
      tmp += (X[i] - p) * (X[i] - p);
    }
    ans = tmp > ans ? ans : tmp;
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S;
    cin>>S;
    int c,d;
    for(int i=0;i<S.size();i++){
       if(S.at(i)=='A'){
            c=i+1;
           break;
       }
    }
    reverse(S.begin(),S.end());
    for(int i=0;i<S.size();i++){
        if(S.at(i)=='Z'){
             d=i+1;
            break;
        }
    }
    cout <<S.size()-c-d+2<<endl;  
   
}

Measured memory_bytes: 3704
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

A,B=many_int()

S=one_str()

flg=False
if S[A]=="-":
    temp = S[:A-1] + S[A+1:]
    if temp.isdecimal() and len(S) == A+B+1:
        flg=True

if flg:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		List<Integer> list = new ArrayList<>();

		int p = sc.nextInt();
		int q = sc.nextInt();
		int r= sc.nextInt();
		int minimumL = Math.max(Math.max(p,q),r);
		System.out.println(p+q+r-minimumL);

	}
}


Measured memory_bytes: 21716
#include<iostream>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
long long int p[100000];
long long int n[100000];
int m;cin>>m;
int s=0;int t=0;
long long int ans=0;
for(int i=0;i<m;i++){
	long long int a;
	cin>>a;
	if(a>0){p[s]=a;s++;}
	else{n[t]=a;t++;}
	ans+=abs(a);
}
if(s>0 and t>0){
	cout<<ans<<endl;
	int k=n[0];
	for(int i=0;i<=s-2;i++){
		cout<<k<<" "<<p[i]<<endl;
		k-=p[i];
	}
	cout<<p[s-1]<<" "<<k<<endl;
	k=p[s-1]-k;
	for(int i=1;i<=t-1;i++){
		cout<<k<<" "<<n[i]<<endl;
		k-=n[i];
	}
}
if(s==0){
	sort(n,n+t);
	int k=n[t-1];
	cout<<ans+2*k<<endl;
	for(int i=0;i<=t-2;i++){
		cout<<k<<" "<<n[i]<<endl;
		k-=n[i];
	}
}
if(t==0){
	sort(p,p+s);
	int k=p[0];
	cout<<ans-2*k<<endl;
	for(int i=1;i<=s-2;i++){
		cout<<k<<" "<<p[i]<<endl;
		k-=p[i];
	}
	cout<<p[s-1]<<" "<<k<<endl;
}

	return 0;
}

Measured memory_bytes: 2688
n = int(input())
f = []
p = []

for i in range(n):
    f.append(list(map(int, input().split())))

for i in range(n):
    p.append(list(map(int, input().split())))

maxp = -100000000000
def culc(nowt, open):
    global n
    global f
    global p
    global maxp
    if 10 <= nowt:
        tmp_max = 0
        for i in range(n):
            count = 0
            for j in range(10):
                if f[i][j] == 1 and open[j] == 1:
                    count += 1
            tmp_max += p[i][count]
        maxp = max(maxp, tmp_max)
    else:
        culc(nowt + 1, open + [0])
        culc(nowt + 1, open + [1])
for i in range(1, 11):
    culc(i, [0] * (i - 1) + [1])
print(maxp)

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

typedef long long ll;

int main(){
	ll N;
	cin >> N;
	
	ll ans = 0;
	if(N%2 == 0){
		N /= 10;
		while(N){
			ans += N;
			N /= 5;
		}
	}
	cout << ans << endl;
		
}




Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
using namespace std;
int main(){
   int n,m;
   cin>>n>>m;
   for (int i = 0; i < m+2;i++)
    cout<<"#";
   cout<<endl;
   for (int i = 0; i < n; i++){
        cout<<"#";
    for (int j = 0; j < m;j++){
        char c;
        cin>>c;
        cout<<c;
    }
   cout<<"#"<<endl;
   }
    for (int i = 0; i < m+2;i++)
    cout<<"#";
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>

#define rep(i, a) REP(i, 0, a)
#define REP(i, a, b) for(int i = a; i < b; ++i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> P;
typedef std::pair<P, int> PP;
const double PI = 3.14159265358979323846;
const double esp = 1e-9;
const int infi = (int)1e+9 + 10;
const ll infll = (ll)1e+17 + 10;

const int maxN = 200001;

int n, s = -infi, ans = -infi;
int r[maxN];

int main(){
	std::cin >> n;
	rep(i, n)std::cin >> r[i];
	for (int i = n - 1; i >= 0; --i){
		ans = std::max(ans, s - r[i]);
		s = std::max(s, r[i]);
	}
	std::cout << ans << std::endl;
	return 0;
}

Measured memory_bytes: 1940
#include <iostream>
using namespace std;
#define ll long long

int main() {
	int a, b, c;
	int ans = 0;
	cin >> a >> b >> c;

	if (a >= b && a >= c) {
		if (b % 2 == 0 && c % 2 == 0) {
			ans = (a - b) + (a - c);
			cout << ans / 2 << endl;
			return 0;
		} 
		else if(b % 2 != 0 && c % 2 != 0) {
			ans = (a - b) + (a - c);
			cout << ans / 2 << endl;
			return 0;

		}
		else {
			ans = (a - b) + (a - c);
			cout << ans / 2 + 2 << endl;
			return 0;

		}
	}

	if (b >= a && b >= c) {
		if (a % 2 == 0 && c % 2 == 0) {
			ans = (b - a) + (b - c);
			cout << ans / 2 << endl;
			return 0;

		}
		else if (a % 2 != 0 && c % 2 != 0) {
			ans = (b - a) + (b - c);
			cout << ans / 2 << endl;
			return 0;

		}
		else {
			ans = (b - a) + (b - c);
			cout << ans / 2 + 2 << endl;
			return 0;

		}
	}
	if (c >= a && c >= b) {
		if (a % 2 == 0 && b % 2 == 0) {
			ans = (c - a) + (c - b);
			cout << ans / 2 << endl;
			return 0;

		}
		else if (b % 2 != 0 && c % 2 != 0) {
			ans = (c - a) + (c - b);
			cout << ans / 2 << endl;
			return 0;

		}
		else {
			ans = (c - a) + (c - b);
			cout << ans / 2 + 2 << endl;
			return 0;

		}
	}
}

Measured memory_bytes: 384
#include <iostream>
#include <cmath>
#define PI 3.141592653589793

using namespace std;

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

    double v = (a * a * b) / 2.0;
    
    if (x <= v) {
        double aa = a * (x/v);
        printf("%.10f\n", atan(b/aa) * 180.0 / PI);
    }
    else if (x > v) {
        x = a*a*b - x;
        double bb = b * (x/v);
        printf("%.10f\n", atan(bb/a) * 180.0 / PI);
    }
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265


void f(int w,int h){
  int map[100][100]={};
  bool c[100][100]={};

  rep(i,h){
    rep(j,w){
      cin>>map[i][j];
    }
  }

  int ans=0;
  rep(i,h){
    rep(j,w){
      if(map[i][j]&&!c[i][j]){
        
        queue<P> q;
        q.push(P(i,j));
        while(q.size()){
          P p=q.front(); q.pop();
          int a=p.first,b=p.second;
          for(int k=-1;k<2;k++){
            for(int l=-1;l<2;l++){
              int y=a+k;
              int x=b+l;
              if(0<=x&&x<w&&0<=y&&y<h)
              if(map[y][x]&&!c[y][x]){
                c[y][x]=true;
                q.push(P(y,x));
              }
            }
          }
        }
        ans++;
      }
    }
  }

  cout<<ans<<endl;
}

int main(){
  int w,h;
  while(1){
    cin>>w>>h;
    if(w==0) break;
    f(w,h);
  }

  return 0;
}


Measured memory_bytes: 3124
#include<stdio.h>

int main(void)
{
 	int a, b, c, d;
 
	scanf("%d %d %d", &a, &b, &c);

	if(b <= a){
		d = a;
		a = b;
		b = d;
	}	
	if(c <= b){
		d = b;
		b = c;
		c = d;
	}
	if(b <= a){
		d = a;
		a = b;
		b = d;
	}

	printf("%d %d %d\n", a, b, c);
	
   
	return 0;
   
}

Measured memory_bytes: 2700
#include<stdio.h>
int main()
{
	int L[11], v1, v2, i, l;
	L[0] = 0;
	while (scanf("%d", &L[1])>0) {
		for (i = 2; i <= 10; i ++) {
			scanf(",%d", &L[i]);
			L[i] += L[i-1];
		}
		scanf(",%d,%d", &v1, &v2);
		l = L[10]*v1;
		for (i = 1; i <= 10; i ++)
			if (l <= L[i]*(v1+v2)) {
				printf ("%d\n", i);
				break;
			}
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())
A = list(map(int, input().split()))

cnt=dict()
# a内の数とその±1をdict型の配列に入れながら個数をカウント
for a in A:
  cnt[a] = cnt.setdefault(a,0) + 1
  cnt[a-1] = cnt.setdefault(a-1,0) + 1
  cnt[a+1] = cnt.setdefault(a+1,0) + 1
  
  
# カウントした数字で昇順にソート  
cnt_sort = sorted(cnt.items(), key=lambda x:x[1])
cnt_sort.reverse()

print(cnt_sort[0][1])

Measured memory_bytes: 28132
def all_green(g, pi, ci)
  ans = pi.inject(:+)
  # bit全探索
  0.upto((1 << pi.size) - 1) do |bit|
    sum = 0
    num = 0
    # p '------------------------'
    # p sprintf("%#010b", bit)
    0.upto(pi.size - 1) do |i|
      # p sprintf("%#010b", bit & (1 << i))
      if bit & (1 << i) == (1 << i)
        sum += ci[i] + pi[i] * 100 * (i + 1)
        num += pi[i]
      end
    end

    if g <= sum
      ans = [ans, num].min
    else
      pos = pi.size - 1
      (pi.size - 1).downto(0) do |i|
        next if bit & (1 << i) == (1 << i)
        pos = i
        break
      end

      0.upto(pi[pos]) do |j|
        sum += 100 * (pos + 1)
        num += 1
        if g <= sum
          ans = [ans, num].min
          break
        end
      end
    end
  end

  ans
end

n, g = gets.split.map(&:to_i)
pi = []
ci = []
n.times do
  param = gets.split.map(&:to_i)
  pi << param[0]
  ci << param[1]
end
 
puts all_green(g, pi, ci)

Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int t[2][220000];

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n>>m;
	for(i=0;i<n;i++){
		cin>>t[0][i];
	}
	for(i=0;i<m;i++){
		for(j=0;j<n;j++){
			a=max(j-t[0][j],0);
			t[1][a]++;
			a=min(j+t[0][j]+1,n);
			t[1][a]--;
		}
		for(j=0;j<n;j++){
			t[1][j+1]+=t[1][j];
		}
		for(j=0,k=0;j<=n;j++){
			t[0][j]=t[1][j];
			t[1][j]=0;
			if(j<n && t[0][j]==n)k++;
		}
		if(k==n)break;
	}
	if(i<m){
		for(i=0;i<n;i++){
			t[0][i]=n;
		}
	}
	array_show(t[0],n);
}

Measured memory_bytes: 5308
import sys


def _ia(): return map(int, sys.stdin.readline().strip().split())


class UnionFind:
    def __init__(self, n):
        self._par = [-1]*n

    def root(self, x):
        if self._par[x] < 0:
            return x
        else:
            self._par[x] = self.root(self._par[x])
            return self._par[x]

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        if self._par[x] > self._par[y]:
            x, y = y, x
        self._par[x] += self._par[y]
        self._par[y] = x

    def size(self, x):
        return -self._par[self.root(x)]


def main():
    n, m = _ia()
    uf = UnionFind(n)
    for _ in range(m):
        a, b = map(lambda x: x-1, _ia())
        uf.unite(a, b)
    return max(uf.size(i) for i in range(n))


if __name__ == "__main__":
    print(main())


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

string ten_to_two(int n,int k){
    string s="";
    int l;
    for(int i=k-1;i>=0;i--){
        l = n / int(pow(3.0f,i));
        s = s + to_string(l);
        n -= l * int(pow(3.0f,i));
    }   
    return s;
}

bool check(int a,int b,int c,int k){
    int p[3];
    int len = int(pow(3.0f,k));
    for(int j=0;j<len;j++){
        string s = ten_to_two(j,k);
        p[0] = a;
        p[1] = b;
        p[2] = c;
        for(int i=0;i<k;i++){
            char u=s[i];
            int l = int(u)-48;
            p[l] = 2 * p[l];
        }
        // cout <<"a" << p[0] << "  b" << p[1] << "  c"<<p[2] << endl;
        if(p[0] < p[1] && p[1] < p[2]){
            return true;
            break;
        }
    }
    return false;
}

int main()
{
    int a,b,c,k;
    bool f=false;
    cin >> a >> b >> c >> k ;
    f = check(a,b,c,k);
    if(f){
        cout << "Yes";
    }else{
        cout << "No";
    }
    return 0;
}

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

struct UnionFind {
    vector<int> r;
 
    UnionFind(int N) {
        r = vector<int>(N, -1);
    }
 
    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }
 
    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }
 
    int size(int x) {
        return -r[root(x)];
    }
};
 
 
int main() {
    int N, M;
    cin >> N >> M;
 
    UnionFind UF(N);
    for (int i = 0; i < M; i++)
    {
        int A, B;
        cin >> A >> B;
        A -= 1; B -= 1;
        UF.unite(A, B);
    }
 
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans = max(ans, UF.size(i));
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 4024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define INF 1e18
#include <math.h> /* M_PI */
vector<ll> A(2000);
vector<vector<ll>> done(3000, vector<ll>(3000));
vector<vector<ll>> memo(3000, vector<ll>(3000));
vector<vector<ll>> value(3000, vector<ll>(3000));

ll dp(ll r, ll l)
{
    if (r + 1 == l)
    {
        value[r][l] = (A[r] + A[l]);
        return value[r][l];
    }
    if (r == l)
    {
        value[r][l] = A[r];
        return 0;
    }
    if (r > l)
    {
        return 0;
    }
    if (done[r][l] != 0)
    {
        return memo[r][l];
    }
    ll res = INF;
    ll index = -1; //最大値
    for (int i = 0; r + i < l; i++)
    {
        ll ans = dp(r, r + i) + dp(r + i + 1, l); //dpが答えを持つとした方が楽。
        ans += value[r][r + i] + value[r + i + 1][l];
        if (res > ans)
        {
            res = ans;
            index = r + i;
        }
    }
    value[r][l] = value[r][index] + value[index + 1][l];
    memo[r][l] = res;
    done[r][l] = 1;
    return res;
}
int main()
{
    ll n;
    cin >> n;
    rep(i, n)
    {
        cin >> A[i];
    }
    ll u = dp(0, n - 1);

    cout << u << endl; //それらを1つにした時の値はなんでしょう
    //cout << value[0][n - 1] << endl;
}


Measured memory_bytes: 213632
import Control.Monad

main = do
  s <- getLine
  let [x,y] = map (read ::String->Int) $ words s in
    if x /= 0 && y /= 0 then do
      forM_ [1..x] $ \ i -> do
        forM_ [1..y] $ \ j ->
          putStr "#"
        putStr "\n"
      putStr "\n"
      main
    else
      return ()

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

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

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

  ll dp[100110];
  for (int i = 0; i <= n; i++) dp[i] = INFL;

  dp[0] = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= k; j++) {
      dp[i + j] = min(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
    }
  }

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


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); if(a && b){ return gcd(b, a % b); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int cnt = 0;
    int N, K;
    cin >> N >> K;
    char now;
    cin >> now;
    for(int i = 0; i < N - 1; i++){
        char c;
        cin >> c;
        if(now != c){
            cnt++;
            now = c;
        }
    }
    cout << min(N - 1 - cnt + K * 2, N - 1) << endl;
}


Measured memory_bytes: 256
import numpy as np
N, M = map(int, input().split())
AB_list = np.zeros((N, 2))

for i in range(N):
    A, B = map(int, input().split())
    AB_list[i] = [A, B]

if N==1:
    print(int(M*AB_list[0, 0]))

elif np.sum(AB_list[:, 1]) == M:
    tmpsum = 0
    for i in range(N):
        tmpsum += AB_list[i, 0] * AB_list[i, 1]
    print(int(tmpsum))

else:
    AB_list = AB_list[np.argsort(AB_list[:, 0])]
    i = 0
    money = 0
    while(AB_list[i, 1] <= M):
        money += AB_list[i,0] * AB_list[i, 1]
        M -= AB_list[i, 1]
        i += 1

    money += AB_list[i, 0] * M
    print(int(money))


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

int count_black(vector<string> vec){
    int H, W;
    H = vec.size();
    W = vec[0].size();
    int ret = 0;
    for (int i=0; i<H; i++){
        for (int j=0; j<W; j++)if (vec[i][j] == '#')ret++;
    }
    
    return ret;
}

//列を色付け
vector<string> column_coloring( vector<string>vec, int cbit){
    int H, W;
    H = vec.size();
    W = vec[0].size();
    for (int i=0; i<W; i++){
        if (cbit & (1 << i)){
            //列i を塗る
            for (int j=0; j<H; j++)vec[j][i] = 'R';
        }
    }
    return vec;
}


//行を色付け
vector<string> row_coloring(vector<string>vec, int rbit){
    int H, W;
    H = vec.size();
    W = vec[0].size();
    string row;
    for (int i=0; i<W; i++)row += "R";

    for (int i=0; i<H; i++){
        if (rbit & (1 << i)){
            vec[i] = row;
        }
    }
    return vec;
}


int main() {
    int H, W, K;
    cin >> H >> W >> K;
    vector<string>c(H);
    for (int i=0; i<H; i++)cin >> c[i];
    int ans = 0;

    //どの行を選ぶかのbit, どの列を選ぶかのbitがあればよい
    //どの行を選ぶか
    for (int rbit=0; rbit<(1<<H); rbit++){
        //どの列を選ぶか
        for (int cbit = 0; cbit<(1<<W); cbit++){
            vector<string>vec = row_coloring(c, rbit);
            vec = column_coloring(vec, cbit);
            if (count_black(vec) == K){
                ans++;
            }
        }
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };


int main(){cout<<fixed<<setprecision(10);
		   int n;
           cin>>n;
           vin s(10000);
           int cnt=0;
           rep(i,0,10000){
             cnt++;
            if(n%2)s[i]=1;
            else s[i]=0;
             n-=s[i];
             if(n==0)break;
             n/=(-2);
           }
           rep(i,0,cnt){
            cout<<s[cnt-1-i]; 
           }
           cout<<endl;
}

Measured memory_bytes: 3676
#pragma comment(linker, "/STACK:256000000")

#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <assert.h>
#include <functional>
#include <vector>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <deque>
#define _USE_MATH_DEFINES
#include <math.h>
#include <bitset>
#include <list>
#include <iomanip>      // std::setprecision
#include <random>
#include <array>

typedef std::mt19937 rng_type;
std::uniform_int_distribution<rng_type::result_type> udist(0, 1);

rng_type rng;

using namespace std;

FILE * in, *out;

#define fo(a,b,c) for(int a = ( b ); a < ( c ); ++ a )
#define fr(a,b) fo( a, 0, ( b ) )
#define fi(a) fr( i, ( a ) )
#define fj(a) fr( j, ( a ) )
#define fk(a) fr( k, ( a ) )
#define mp make_pair
#define pb push_back
#define all(v) (v).begin( ), (v).end( )
#define _(a,b) memset( a, b, sizeof( a ) )

#define LL long long

int ri() { int a; fscanf(in, "%d", &a); return a; }
double rf() { double a; fscanf(in, "%lf", &a); return a; }
char sbuf[100005];
string rstr()
{
	//fscanf(in, "%lf", sbuf); 
	char c;
	char * b = sbuf;
	while(c = fgetc(in))
	{
		if(c == '\n' || c == 255) break;
		*b++ = c;
	}
	*b = 0;
	return sbuf;
}


long long nod(long long a, long long b)
{
	if(a == 1 || b == 1) return 1;
	if(a == 0) return b;
	if(b == 0) return a;

	return nod(b%a, a);
}

vector<int> primes;
void calculatePrimes()
{
	primes.push_back(2);
	for(int i = 3; i < 100000; i += 2)
	{
		bool bFound = false;
		int m = (int)sqrt((float)i);
		for(int j = 1; j < primes.size() && !bFound && primes[j] <= m; j++)
			bFound = ((i%primes[j]) == 0);
		if(!bFound)
			primes.push_back(i);
	}
}

bool isPrime(int p)
{
	for(int i : primes)
		if(p != i && (p%i) == 0) return false;
	return true;
}


//	std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield);
//	std::cout.precision(7);


void egcd(int a, int b, int &g, int &x, int &y)
{
	if(a == 0)
	{
		g = b;
		x = 0;
		y = 1;
		return;
	}
	egcd(b%a, a, g, y, x);
	x = x - (b / a)*y;
}

int modinv(int a, int m)
{
	int g = 0, x = 0, y = 0;
	egcd(a, m, g, x, y);
	return (x+m)%m;
}

long long modpow(int a, long long n, int p)
{
	long long res = 1;
	long long curp = (a%p);
	while(n)
	{
		if(n&1)
		{
			res = (res*curp)%p;
		}
		curp = (curp*curp)%p;
		n /= 2;
	}
	return res;
}


#define MODP  998244353 //1000000007
long long nf(int n)
{
	if(n == 1) return 1;
	return (n*nf(n-1))%MODP;
}

long long intpowmod(long long base, long long exp)
{
	if(exp == 0) return 1;
	if(exp == 1) return base;
	if((exp & 1) != 0) return (base * intpowmod((base * base)%MODP, exp / 2))%MODP;
	return intpowmod((base * base)%MODP, exp / 2);
}

#ifdef _WIN32
#define LOCAL_TEST
#endif

int main()
{
	long long a,b,c,k;
	cin >> a >> b >> c >> k;
	if((k&1)==0)
		cout << a-b;
	else
		cout << b-a;
	return 0;
}


Measured memory_bytes: 256
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**8) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

s = ns()
cnt = Counter()

for si in s:
    cnt[si] += 1
    
print('No')  if (cnt['N'] > 0 and cnt['S'] == 0) or\
                (cnt['N'] == 0 and cnt['S'] > 0) or\
                (cnt['E'] > 0 and cnt['W'] == 0) or\
                (cnt['E'] == 0 and cnt['W'] > 0) else print('Yes')
    

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
int main(){
int64_t A,B,C;
  cin>>A>>B>>C;
  if(A%2==0 || B%2==0 || C%2==0)
    cout<<0<<endl;
  else{
  vector<int64_t>D(3);
    D[0]=A;
    D[1]=B;
    D[2]=C;
    sort(D.begin(),D.end());
    int64_t ans=D[0]*D[1];
    cout<<ans<<endl;
  
  
  }
   return 0;
}

Measured memory_bytes: 256
//C:\Program Files(x86)\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\x86_64-w64-mingw32\bits\stdc++.h
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cstring>
#include<cstdlib>
#include<deque>
#include<fstream>
#include<functional>
#include<iomanip>
#include<iostream>
#include<limits>
#include<list>
#include<map>
#include<math.h>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<sstream>
#include<string>
#include<time.h>
#include<utility>
#include<vector>

using namespace std;

int n,m,ans;
int a[100005];
bool vis[100005],used[100005];
vector<int> vec;
vector<int> ve[100005];

void dfs(int cur){
	vis[cur]=1;
	used[cur]=1;
	vec.push_back(cur);
	for(int i=0;i<ve[cur].size();i++) if(!vis[ve[cur][i]]) dfs(ve[cur][i]);
	return;
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d",a+i);
		a[i]--;
		ve[i].push_back(i);
	}
	for(int i=0;i<m;i++){
		int u,v;
		scanf("%d%d",&u,&v);
		u--;v--;
		ve[u].push_back(v);
		ve[v].push_back(u);
	}
	for(int i=0;i<n;i++){
		if(!used[i]){
			memset(vis,0,sizeof(vis));
			vec.clear();
			dfs(i);
			for(int j=0;j<vec.size();j++) if(vis[a[vec[j]]]) ans++;
//			for(int j=0;j<vec.size();j++) printf("%d %d\n",vec[j],a[vec[j]]);
//			puts("");
//			for(int j=0;j<n;j++){
//				printf("%d %d\n",used[j],vis[j]);
//			}
//			puts("");
		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 8956
S = list(input())
S = [int(s) if s != "?" else -1 for s in S]
mod = [1]
for i in range(10**5 + 1):
	mod.append((mod[i] * 10) % 13)
MOD = 10**9 + 7
N = len(S)
dp = [[0 for j in range(13)] for i in range(N)]
for i in range(N):
	d = S[N-1 - i]
	for x in range(10):
		if d == x or d == -1:
			plus = (mod[i] * x) % 13
			if i == 0:
				dp[i][x] = 1
			else:
				for j in range(13):
					J = (j+plus) % 13
					dp[i][J] = (dp[i][J] + dp[i-1][j]) % MOD
print(dp[N-1][5])

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

int main(){
  int a, b;
  cin >> a >> b;
  int d = max(a,b) - min(a,b);
  int c = 16 - 2 * min(a, b);
  if (c >= 2 * d )
    cout << "Yay!" << endl;
  else
    cout << ":(" << endl;
}



Measured memory_bytes: 764
import Control.Applicative

-- 1行をStringとして読む
getStr :: IO String
getStr = getLine

-- 1行をIntとして読む
getInt :: IO Int
getInt = readLn

-- スペース区切りの1行を[String]として読む
getStrList :: IO [String]
getStrList = words <$> getLine

-- スペース区切りの1行を[Int]として読む
getIntList :: IO [Int]
getIntList = map read . words <$> getLine

main :: IO ()
main = do
    [a, b, c] <- getStrList
    putStrLn $ unwords [c, a, b]

Measured memory_bytes: 380
#include <stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    int n1;
    n1=n/2;
    if(n%2==0){
        printf("%f\n",(float)n1/n);
    }
    else{
        printf("%f\n",(float)(n1+1)/n);
    }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
#include <algorithm>
#include <string>
#include <vector>
char s[110][110];
int main()
{

    int w,h;
    cin>>h>>w;
    
    for(int i=0;i<h;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<h*2;i++)
    {
        for(int j=0;j<w;j++)
        {
            cout<<s[i/2][j];
        }
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
"use strict"
let fs = require('fs');
let input = fs.readFileSync("/dev/stdin", "utf8").split(/\s/);
let inputNum = input.map(mp => +mp);
inputNum.sort((a,b) => b - a);
const diff1 = inputNum[0] - inputNum[1];
let changedMin = inputNum[2] + diff1;
const diff2  = Math.ceil((inputNum[0] - changedMin)/2);
const diff3 = inputNum[2] + diff1 + (diff2*2) === inputNum[0] ? 0 : 1;
console.log(diff1 + diff2 + diff3);

Measured memory_bytes: 7500
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    srand(time(nullptr));
    int D; cin >> D;
    vector<int> c(26+1, 0);
    for(int i = 1; i <= 26; i++) cin >> c[i];
    vector<vector<int>> s(D+1, vector<int>(26+1, 0));
    for(int i = 1; i <= D; i++)for(int j = 1; j <= 26; j++) cin >> s[i][j];
    vector<int> t(D+1, 0);
    for(int i = 1; i <= D; i++) {
        t[i] = (i-1) % 26 + 1;
    }
    ll ans = 0;
    /*
    for(int _ = 0; _ <= 100000; _++){
        vector<int> last(26+1, 0);
        auto f = [&](int d){
            int res = 0;
            for(int i = 1; i <= 26; i++){
                res += c[i] * (d - last[i]);
                if(mx < c[i] * (d - last[i])) id = i;
            }
            return res;
        };
        vector<int> old = t;
        srand(time(nullptr));
        //t[rand() % (D-1) + 1] = rand() % 25 + 1;
        ll tmp = 0;
        for(int day = 1; day <= D; day++){
            //mx = 0;
            //t[day] = id;
            int con = t[day];
            tmp += s[day][con];
            last[con] = day;
            tmp -= f(day); 
        }
        if(ans > tmp) {
            t = old;
            continue;
        }
        ans = max(ans, tmp);
    }
    */
    for(int i = 1; i <= D; i++) cout << t[i] << endl;
}

Measured memory_bytes: 3684
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int[] kekka=new int[10];
		int kotae=0;
		String watasi="";

		while(sc.hasNext()) {
			watasi=sc.next();
			for(int i=0; i<10; i++) {
				kekka[i]=Integer.parseInt(watasi.charAt(i)+"");
			}
			kotae=kekka[0]+kekka[1]*9+kekka[2]*6+kekka[3]*4+kekka[4]*6+kekka[5]*6+kekka[6]*4+kekka[7]*6+kekka[8]*9+kekka[9];
			kotae=kotae%10;
			System.out.println(kotae);
		}
	}
}


Measured memory_bytes: 25968