akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int mex=2005;
#define ll long long 
#define test int t;cin>>t;while(t--)
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fo(i,a,n) for(int i=a;i<n;i++)
#define rfo(i,a,b) for(int i=a;i>=b;i--)
#define bg begin()
#define en end()
#define fi first
#define se second
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define veci vector<int>
#define veclli vector<long long int> 
#define all(x) x.begin(),x.end()
#define sci(x) scanf("%d",&x);
#define scc(x) scanf("%c",&x);
#define scs(x) scanf("%s",x);
#define debug(arr,n) for(int i=0;i<n;i++) printf("%d ",arr[i]);
#define sz(x) x.size()
#define loop(x) for(auto it=x.begin();it!= x.end();it++) 

int main()
{
  int n;
  cin>>n;
  vector<pair<int,int> > v;
  fo(i,0,n)
  {
      int k,l;
      cin>>k>>l;
      v.pb({k-l,k+l});
  }
  sort(all(v));
  int mx=v[0].se,id=0;
  int flg[n]={0};
  int cnt=0;
  fo(i,1,n)
  {
      if(v[i].fi<mx)
      {
          if(v[i].se<mx) 
          {
              mx=v[i].se;
              cnt++;
          }
          else
          cnt++;
      }
      else
      {
          mx=v[i].se;
      }
  }
  cout<<n-cnt;
}

Measured memory_bytes: 1524
import Data.Bool (bool)

main :: IO ()
main = do
  s <- getLine
  print $ unify s

unify :: String -> Int
unify s = 2 * fst (unify' (0, s))
  where
    unify' (k, (x : y : ls))
      =
        if x == y
          then
            let (k', ls') = unify' (k, y : ls) in
              case ls' of
                []
                  ->
                    (k', [x])
                y' : ls''
                  ->
                    if x == y'
                      then
                        (k', x : y' : ls'')
                      else
                        (k' + 1, ls'')
          else unify' (k + 1, ls)
    unify' t = t


Measured memory_bytes: 6908
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<=n;i++)
using namespace std;
int main(){
    int N,A;
    cin>>N>>A;
    bool is=false;
    REP(i,A)if((N-i)%500==0)is=true;
    cout<<(is?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n, m;
  cin >> n >> m;
  ll lmax = -1;
  ll rmin = INF;
  rep(i,m){
    ll l, r;
    cin >> l >> r;
    chmax(lmax, l);
    chmin(rmin, r);
  }
  if(lmax>rmin){
    print(0);
  }
  else{
    print(rmin - lmax + 1);
  }
}

Measured memory_bytes: 256
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    num_list = [0 for _ in range(n + 1)]
    for _a in a:
        num_list[_a] += 1
    
    ans_plus_n = sum([_num * (_num - 1) // 2 for _num in num_list])
    
    for _a in a:
        ans = ans_plus_n - (num_list[_a] - 1)
        print(ans)

    return

if __name__ == "__main__":
    solve()

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

int main() {
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		if(s=="Y"){
			cout<<"Four"<<endl;
			break;
		}
		else{
		     if(i==n-1){
            	     cout<<"Three"<<endl;
            	      }
            	     else{
            	     continue;
		}
		
	}
}
}
	
	
	


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout<<setprecision(10)<<fixed;
	int n;
	cin>>n;
	double cnt=n/2;
	double ans=(n-cnt)/n;
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	int q; cin >> q;
	ll x = 0;
	while (q--) {
		int p, n; string c;
		cin >> p >> c >> n;
		if (c == ")") n *= -1;
		x += n;
		cout << (x == 0 ? "Yes" : "No") << endl;
	}
}

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

typedef long long ll;

ll N;
vector<ll> A;
vector<ll> B, S; // 各深さにおける実現可能な非葉の個数の範囲
const ll INF = 1ll << 50;
ll calc() {
  B[0] = S[0] = 1;
  for (ll i = 0; i <= N; ++i) {
    B[i] -= A[i];
    S[i] -= A[i];
    if (B[i] < 0) return -1;
    S[i] = max(S[i], 0ll);
    B[i] = min(INF, B[i]);
    B[i + 1] = 2 * B[i];
    S[i + 1] = S[i];
  }
  if (S[N + 1] > 0) return -1;
  ll res = 0;
  ll now = 0;
  for (ll i = N; i >= 0; --i) {
    now += A[i];
    res += now;
    if (i > 0) now = min(now, B[i - 1]);
  }
  return res;
}
int main() {
  cin >> N;
  A.resize(N + 1);
  for (ll i = 0; i <= N; ++i) cin >> A[i];
  B.resize(N + 2);
  S.resize(N + 2);
  cout << calc() << endl;
  return 0;
}


Measured memory_bytes: 5572
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
using namespace std;
int main(){
	int a = 0, b = 0, c=0, d[100000], e[100000],f=0, count = 0;
	char uc[100000];
	cin >> a;
	if (a % 10 == 9 || -1 < a - 90&& a - 90 < 10) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
		return 0;
}

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

long long uc(long long a,long long b){
    long long r = a % b;
    while(r != 0){
        a = b;
        b = r;
        r = a%b;
    }
    return b;
}


int main(){
    long long n,x;
    cin >> n >> x;
    long long k;
    long long mi;
    for(long long i = 0; i < n; i++){
        cin >> k;
        k = abs(k-x);
        if(i == 0)
            mi = k;
        else{
            mi = uc(max(k,mi),min(k,mi));
        }
    }
    cout << mi;
}

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

using namespace std;

#define INPUT_OUTPUT { \
    freopen("input.txt", "r", stdin); \
    freopen("output.txt", "w", stdout); \
}
#define Pi acos(-1)
#define ll long long

bool conv_and_check(int n)
{
    string s = "";
    bool flag = true;
    while(n) {
        int k = n%10;
        s += k+'0';
        n = n/10;
    }
    reverse(s.begin(), s.end());
    if(s.size()%2 == 0) flag = false;
    return flag;
}

int main()
{
    //INPUT_OUTPUT;
    int n, i, ans = 0;
    cin >> n;
    for(i = n; i >= 1; i--) {
        if(conv_and_check(i)) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# import sys
# import math
# import decimal
# import queue
# import bisect
# import heapq # priolity-queue
# import time
# import itertools
# import collections # queue
# from operator import itemgetter
# from fractions import Fraction

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def main():
    n,m = map(int,input().split())
    city = [0] * n
    for i in range(m):
        a,b = map(int,input().split())
        city[a-1] += 1
        city[b-1] += 1
    for i in range(n):
        print(city[i])
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 3060
/**
 *    created by : PawPaw       
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>  

using namespace __gnu_pbds;  
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,  
        tree_order_statistics_node_update>  
        ordered_set;  

#define F(i,a,b) for(int i = (int)(a); i <= (int)(b); i++)
#define RF(i,a,b) for(int i = (int)(a); i >= (int)(b); i--)
#define LL long long
#define PHI acos(-1)
#define EPS 0.000000001
#define N 1000001
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define FbO find_by_order
#define OoK order_of_key

int solve(){
  LL a, b;
  cin >> a >> b;
  cout << (a*b)/__gcd(a, b) << '\n';
  return 0;
}

void fun(){
  int t = 1;
  // cin >> t;
  while(t--) solve();
} 

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

  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map> 
using namespace std; 
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI1 3.14159265358979311599796346854418516159057617187500

typedef long long int ll;  
ll MOD = 1e9 + 7;

ll power(ll a , ll n)
{
    unsigned long long int result=1,x=a;
    while(n>0)
    {
        if(n % 2 ==1)
            result = (result * x);
        x = (x * x);
        n=n/2;
    }
    return result;
}

ll GCD(ll a , ll b)
{
    if(b==0)
        return a;
    else
        return GCD(b,a%b);
}

int main() 
{ 
    FIO
    int t;
    t=1;
    while(t--)
    {       
        int l,r,x;
        cin >> l >> r >> x;

        int l1 = (l-1)/x;
        int r1 = r/x;

        cout << r1 - l1 << endl;
    }   
    return 0; 
}


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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int n, k;
    cin >> n >> k;

    vector<int> v(n);
    for (int i = 0; i < n; i++)cin >> v[i];
    vector<int> pre(n + 1);
    for (int i = 0; i < n; i++) {
        pre[i + 1] = (pre[i] + v[i] - 1) % k;
    }
    int ans = 0;
    map<int, int> mp;
    mp[0]++;
    for (int i = 0, j = 1; j <= n; j++) {
        if (j - i == k) {
            mp[pre[i++]]--;
        }
        ans = (ans + mp[pre[j]]);
        mp[pre[j]]++;
    }
    cout << ans << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 15872
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

const int INF = INT_MAX / 2;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        bitset<16> initial, final;
        for(int i=0; i<n; ++i){
            char c;
            cin >> c;
            initial[i] = (c == 'B');
        }
        for(int i=0; i<n; ++i){
            char c;
            cin >> c;
            final[i] = (c == 'B');
        }

        vector<vector<int> > memo(1<<n, vector<int>(n, INF));
        multimap<int, pair<bitset<16>, int> > mm;
        for(int i=0; i<n; ++i){
            memo[initial.to_ulong()][i] = 0;
            mm.insert(make_pair(0, make_pair(initial, i)));
        }

        for(;;){
            int cost = mm.begin()->first;
            bitset<16> bs = mm.begin()->second.first;
            int pos = mm.begin()->second.second;
            mm.erase(mm.begin());
            if(cost > memo[bs.to_ulong()][pos])
                continue;

            if(bs == final){
                cout << cost << endl;
                break;
            }

            for(int i=0; i<n; ++i){
                for(int j=0; j<n; ++j){
                    if(!(bs[i] ^ bs[j]))
                        continue;
                    if(!((bs[i] ^ final[i]) && (bs[j] ^ final[j])))
                        continue;

                    int cost2 = cost + abs(pos - i) + abs(i - j);
                    bitset<16> bs2 = bs;
                    bs2[i] = !bs2[i];
                    bs2[j] = !bs2[j];
                    if(cost2 < memo[bs2.to_ulong()][j]){
                        memo[bs2.to_ulong()][j] = cost2;
                        mm.insert(make_pair(cost2, make_pair(bs2, j)));
                    }
                }
            }
        }
    }
}

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

using namespace std;

typedef long long ll;

const int INF = 1000000000;

void dijkstra(int s, vector<vector<pair<ll, int>>>& adj, vector<ll>& dist)
{
  dist[s] = 0;
  priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> que;
  que.push(make_pair(0, s));
  while (not que.empty()) {
    pair<ll, int> p = que.top(); que.pop();
    ll d = p.first;
    int u = p.second;
    if (d > dist[u]) { continue; }
    for (pair<ll, int> q : adj[u]) {
      ll cost = q.first;
      int v = q.second;
      if (dist[u] + cost < dist[v]) {
        dist[v] = dist[u] + cost;
        que.push(make_pair(dist[v], v));
      }
    }
  }
}

int main()
{
  int N; scanf("%d", &N);
  vector<vector<pair<ll, int>>> adj(N + 5, vector<pair<ll, int>>());
  int a, b, c;
  for (int i = 0; i < N - 1; ++i) {
    scanf("%d %d %d", &a, &b, &c);
    adj[a].push_back(make_pair(c, b));
    adj[b].push_back(make_pair(c, a));
  }

  int Q, K; scanf("%d %d", &Q, &K);
  ll LLINF = 1e18;
  vector<ll> dist(N + 5, LLINF);
  dijkstra(K, adj, dist);
  int x, y;
  while (Q-- > 0) {
    scanf("%d %d", &x, &y);
    printf("%lld\n", dist[x] + dist[y]);
  }
  return 0;
}


Measured memory_bytes: 11120
{-#LANGUAGE FlexibleContexts#-}
import Control.Monad
import Control.Monad.State
import Control.Monad.Reader
import Control.Arrow
-- import Control.Comonad
import Data.Maybe
import Data.List
import Data.Bool
import Data.Fixed
import Data.Tuple
import Data.Ratio
import qualified Data.Map.Strict as M
import qualified Data.Array.IO as IA
import qualified Data.Vector as V

getI = read <$> getLine :: IO Int
getIs = map read . words <$> getLine :: IO [Int]
getD = read <$> getLine :: IO Double
getDs = map read . words <$> getLine :: IO [Double]
getInt = read <$> getLine :: IO Integer
getInts = map read . words <$> getLine :: IO [Integer]

type Row = Integer
type Col = Integer
type PointI = (Integer, Integer)
type Point = (Int, Int)

mmm = 1000000007
fact n
    | n < 1 = 1
    | True = foldr1 (*) [1..n]
ti = toInteger
fi = fromInteger
fig = fromIntegral
rf = realToFrac

(.<.) :: Integer -> Integer -> Integer
(.<.) f g -- combination
    | g < 1 || f < 1 || f < g = 1
    | True = foldr1 (*) (take (fi g) [f,f-1..]) `div` fact g
(.>.) f g --combination with repetition
    | g < 1 || f < 1 = 1
    | True = fact (f + g - 1) `div` (fact (f - 1) * fact g)
comb = (.<.)
combWp = (.>.)

unique a = unique_ (reverse . sort $ a) [] Nothing
    where
        unique_ [] arr _ = arr
        unique_ (x:xs) arr n
            | n == Just x = unique_ xs arr n
            | otherwise = unique_ xs (x:arr) $ Just x
 
zeroume keta num
    | (length . show $ num) > keta = show num
    | otherwise = do 
        let zeros = take keta $ repeat '0'
        reverse . take keta $ (reverse . show $ num) ++ zeros
 
i2b num
    | num < 2 = show num
    | otherwise = i2b_ num []
        where
            i2b_ num str
                | num == 0 = str
                | num == 1 = '1':str
                | otherwise = do
                    let next = num `div` 2
                    let this = if odd num then '1' else '0'
                    i2b_ next (this:str)

mapIncr = mapPlus 1
mapPlus n Nothing = Just n
mapPlus n a = (+) n <$> a

countIf f = length . filter f

enumDivisor :: Int -> [Int]
enumDivisor n = do
    let sqrted = floor $ sqrt (fromIntegral n)
        smaller = filter (\x -> mod n x == 0) [1..sqrted]
        bigger = reverse $ map (div n) smaller
    if head bigger == sqrted then smaller ++ (init bigger)
    else smaller ++ bigger

-- 
--
--

main = do
    a <- getLine
    b <- getLine
    c <- getLine
    putStrLn $ seq 'a' a b c
    where 
        seq 'a' [] _ _ = "A"
        seq 'b' _ [] _ = "B"
        seq 'c' _ _ [] = "C"
        seq 'a' (x:xs) b c = seq x xs b c
        seq 'b' a (x:xs) c = seq x a xs c
        seq 'c' a b (x:xs) = seq x a b xs


Measured memory_bytes: 508
#include<bits/stdc++.h>
#define FU(i,a,b) for(register int i = a ; i <= b ; ++i)
#define FD(i,a,b) for(register int i = a ; i >= b ; --i)
#define set_max(a) memset(a,0x3f,sizeof a)
#define set_min(a) memset(a,~0x3f,sizeof a)
#define clear(a) memset(a,0,sizeof a)

using namespace std;

template<typename T>inline void chkmax(T & a,T b){ if(a < b) a = b ; }
template<typename T>inline void chkmin(T & a,T b){ if(a > b) a = b ; }

template<typename T>
inline T read()
{
	int res = 0 , flag = 1 ;
	char ch = getchar();
	while(!isdigit(ch))
	{
		if(ch == '-') flag = -1;
		ch = getchar();
	}
	while(isdigit(ch))
	{
		res = (res << 3) + (res << 1) + ch - '0';
		ch = getchar();
	}
	return res * flag;
}

template<typename T>
inline void write(T x)
{
	if(x/10) write(x/10);
	putchar(x%10+'0');
}

const int INF=0x3f3f3f3f;
const int N=4e1;
int n,m,hx,hy;
int ice[N+5][N+5],dp[N+5][N+5][N+5][N+5];

inline void Input()
{
	n = read<int>(); m = read<int>();

	char ch;
	for(register int i = 1 ; i <= n ; ++i)
	 for(register int j = 1 ; j <= m ; ++j)
	 {
		cin >> ch;
		ice[i][j] = ice[i-1][j] + ice[i][j-1] -ice[i-1][j-1] + (ch == '#');
		if(ch == 'P') { hx = i ; hy = j ; }
	 }
}

inline int thick(int dx,int dy,int rx,int ry)
{
	if(dx > rx || dy > ry) return 0;
	return ice[rx][ry] - ice[rx][dy-1] - ice[dx-1][ry] + ice[dx-1][dy-1];
}

inline int MIN(int a,int b,int c,int d)
{
	return min(min(a,b),min(c,d));
}

inline void Solve()
{
	int ans = INF;
	set_max(dp);
	dp[1][1][n][m] = 0;
	for(register int i = 1 ; i <= hx ; ++i)
	 for(register int j = 1 ; j <= hy ; ++j)
	  for(register int k = n ; k >= hx ; --k)
	   for(register int p = m ; p >= hy ; --p)
	   {
			chkmin(ans , dp[i][j][k][p] + MIN(thick(i,j,hx,hy),thick(hx,hy,k,p),thick(hx,j,k,hy),thick(i,hy,hx,p)));
			for(register int s = i ; s <= k ; ++s)
			 for(register int t = j ; t <= p ; ++t)
			 {
				 if(s >= hx && t >= hy) chkmin(dp[i][j][s][t],dp[i][j][k][p] + thick(s+1,j,k,t) + thick(i,t+1,s,p));
				 if(s <= hx && t <= hy) chkmin(dp[s][t][k][p],dp[i][j][k][p] + thick(s,j,k,t-1) + thick(i,t,s-1,p));
				 if(s >= hx && t <= hy) chkmin(dp[i][t][s][p],dp[i][j][k][p] + thick(i,j,s,t-1) + thick(s+1,t,k,p));
				 if(s <= hx && t >= hy) chkmin(dp[s][j][k][t],dp[i][j][k][p] + thick(i,j,s-1,t) + thick(s,t+1,k,p));
			 }
	   }

	write(ans); putchar('\n');
}

inline void File()
{
	freopen("haner.in","r",stdin);
	freopen("haner.out","w",stdout);
}

int main()
{
	//File();

	Input();
	Solve();

	return 0;
}


Measured memory_bytes: 16384
#include <stdio.h>

int main(){
    int n;
    scanf("%d", &n);
    int bord[n][n];
    int h, w;
    scanf("%d%d", &h, &w);
    int count_x = 0, count_y = 0;
    int x = h, y = w;
    while(h <= n){
        h++;
    }
    while(w <= n){
        w++;

    }
    printf("%d\n", (h-x) * (w-y));
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pl;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18;
const int iINF = 1e9;
int main(){
    string s;
    int n;
    cin>>n>>s;
    if(s.size()%2 != 0){
        cout<<"No"<<endl;
        return 0;
    }
    if(s.substr(0,s.size()/2) == s.substr(s.size()/2,s.size()/2)){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int[] first = new int[10];
			char[] ch = scan.nextLine().toCharArray();
			for(int i = 0;i < 10;i++){
				first[i] = Integer.parseInt(ch[i] + "");
			}
			int n = 9;
			while(n > 0){
				for(int i = 0;i < n;i++){
					first[i] = (first[i] + first[i+1])%10;
				}
				n--;
			}
			System.out.println(first[0]);
		}
	}
}

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

int a, b;
void split(string s) {
	int tmp = 0, n = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != ',') {
			tmp *= 10;
			tmp += s[i] - '0';
		} else {
			a = tmp;
			tmp = 0;
		}
		b = tmp;
	}
}

bool find(vector<int> v, int n) {
	for (int i = 0; i < v.size(); i++) {
		if (v[i] == n) return true;
	}
	return false;
}

int main() {
	string s;
	map<int, int> m1;
	map<int, int> m2;
	vector<int> v;
	while (getline(cin, s)) {
		if (s.size() == 0) break;
		split(s);
		m1[a]++;

		if (find(v, a)) continue;
		v.push_back(a);
	}

	while (getline(cin, s)) {
		split(s);
		m2[a]++;
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < v.size(); i++) {
		if (m2[v[i]] == 0) continue;
		cout << v[i] << " " << m1[v[i]] + m2[v[i]] << endl;
	}
	return 0;
}

Measured memory_bytes: 3216
//
// Created by Hideaki Imamura on 2020-03-15.
//
# include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair <ll, ll> l_l;
typedef pair<int, int> i_i;

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;
}

# define EPS (1e-7)
//# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

int N;
int h[100010];

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> h[i];

    const ll INF = 1LL << 60;
    vector<ll> dp(N, INF);
    dp[0] = 0;
    for (int i = 1; i < N; ++i) {
        chmin(dp[i], dp[i-1] + (ll) abs(h[i] - h[i-1]));
        if (i >= 2) chmin(dp[i], dp[i-2] + (ll) abs(h[i] - h[i-2]));
    }
    cout << dp[N-1] << endl;
    return 0;
}

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

#define rep for(int i = 0;i<n;i++)
const int MOD = 1000000007;

int main(){
  long long a,b; cin >> a >> b;
  a -= 1;
  // f(0,a)^f(0, b)を求める
  if(a % 2 == 0){
          if(((a+1)/2) % 2 == 0){
                  a = a;
          }else{
                  a = a^1;
          }
  }else{
          if(((a+1)/2) % 2 == 0){
                  a = 0;
          }else{
                  a = 1;
          }
  }
  if(b % 2 == 0){
          if(((b+1)/2) % 2 == 1){
                  b = b^1;
          }
  }else{
          if(((b+1)/2) % 2 == 0){
                 b  = 0;
          }else{
               b    = 1;
          }
  }
  //cout << a << " " << b << endl;
  long long ans = a^b;
  cout << ans << endl;

}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
static int[] kazu;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
	   int i,n;
       Scanner red = new Scanner(System.in);
       kazu= new int[red.nextInt()];
       for(i=0;i<kazu.length;i++){
    	   kazu[i]=red.nextInt();
       }
       n=red.nextInt();
      for(i=0;i<n;i++){
    	   if(solve(0,red.nextInt())){
    		   System.out.println("yes");
    	   }else{
    		   System.out.println("no");
    	   }
      }
	}
	public static boolean solve(int p,int t){
		if(t==0) return true;
		if(t<0||p==kazu.length) return false;
		return (solve(p+1,t-kazu[p])||solve(p+1,t));
	}

}



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

#define mem(f, v) memset(f,v,sizeof(f))
#define file(x) freopen(x".in","r",stdin);freopen(x".out","w",stdout);

typedef long long ll;
const int maxn = 100010;
const int inf = ~(1u << 31u);
const ll linf = ~(1llu << 63u);

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<pair<int, int>> d(n);
    for(int i = 0; i < n; i ++){
        cin >> d[i].first;
        d[i].second = i+1;
    }
    sort(d.begin(), d.end());
    for(auto x:d) cout << x.second << " \n"[x.first == (*d.rbegin()).first];
    return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef long double ld;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
ll exp(ll x,ll y){if(y==0) return 1;if(y%2 == 1) return x*exp(x,y/2)*exp(x,y/2);return exp(x,y/2) * exp(x,y/2);}
ll exp(ll x,ll y,ll modd) {if(y==0) return 1;ll t=exp(x,y/2,modd);t = t%modd;t=t*t;t=t%modd;if(y % 2 == 1) return (x*t)%modd ;return t%modd;}
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC target ("sse4")
#define ios ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0)
#define so sizeof
#define pb push_back
#define cl clear() ;
#define vl vector<ll>
#define sz size()
#define len length()
#define emp empty()
#define el endl;cout.flush()
#define be begin()
#define fi first
#define se second
#define br break
#define en end()
#define ro return 0
#define eb emplace_back
#define con continue
#define ms(x) memset(x , 0ll, so x)
#define all(x) (x).be , (x).en
#define acc(x) accumulate((x).be , (x).en , 0ll)
#define forn(i,a,b) for(ll i=a;i<=b;++i)
#define revn(i,a,b) for(ll i=a;i>=b;--i)
#define rng_58 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define vs vector<string>
#define vsi vector<pair<string,int>>
#define vll vector<pair<ll,ll> >
#define vlll vector<pair<ll,pair<ll,ll>>>
#define vlvl vector<pair<pair<ll,ll>,ll>>>
#define pll pair<ll,ll>
#define plll pair<ll,pair<ll,ll>>
#define plvl pair<pair<ll,ll> ,ll>
#define mp make_pair
#define trace3(a,b,c) cerr <<"a is " << a << " b is " << b << " c is " << c << el;
#define trace4(a,b,c,d) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << el ;
#define trace5(a,b,c,d,e) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << el;
#define trace6(a,b,c,d,e,f) cerr <<"a is " << a << " b is " << b << " c is " << c <<" d is " << d << " e is " << e << " f is " << f << el ;

int main()
{
    ios;
    int n;
	cin>>n;
	
	vector<int> arr(n);
	
	for(int i=0;i<n;i++)
		cin>>arr[i];
		
	vector<int> dp(n);
	
	dp[0]=0;
	dp[1] = abs(arr[1]-arr[0]);
	for(int i=2;i<n;i++)
	{
		dp[i] = min(dp[i-1] + abs(arr[i] -arr[i-1]),dp[i-2] + abs(arr[i] -arr[i-2])) ;
	}
		
	cout<<dp[n-1];
	
	return 0;
	
}

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

int main() {
	int N;cin>>N;
	vector<int>a(N);
	double ave = 0;
	for (int i = 0; i < N; i++)
	{
		cin>>a[i];
		ave += a[i];
	}
	ave/=N;

	double minv = 1e9;
	int ans = -1;
	for (int i = 0; i < N; i++)
	{
		if (minv > abs(a[i] - ave))
		{
			minv = abs(a[i] - ave);
			ans = i;
		}
	}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
ll cnt[100005];
int main() {
    init();
    ll N,M;
    cin >> N >> M;
    rep(i,M){
        ll a, b;
        cin >> a >> b;
        cnt[a]++, cnt[b]++;
    }

    bool isok = true;
    repe(i,1,N+1){
        if (cnt[i] % 2) isok = false;
    }
    cout << (isok ? "YES" : "NO") << endl;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int X=0;
  int sum=0;
  for(int i=0;i<5;i++){
    int x;
    cin>>x;
    X+=x;
    sum+=i+1;
  }
  cout<<sum-X<<endl;
  return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <vector>
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

ll gcd(ll x, ll y) { return y ? gcd(y,x%y) : x; }
ll lcm(ll x, ll y) { return x/gcd(x, y)*y; }

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

  int n; cin >> n;
  vector<ll> t(n);
  rep(i, n) cin >> t[i];

  ll ans = 1;
  rep(i, n) ans = lcm(ans, t[i]);

  cout << ans << '\n';
  return 0;
}


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

// Macros
#define F      first
#define S      second
#define PB     push_back
#define MP     make_pair
#define ALL(c) c.begin(),c.end()

// Rename Datatypes
using ll  = long long;
using ld  = long double;
using pii = std::pair <int,int>;

// Random
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
/* [a,b] */ template<class T> T rnd_IntType(T a, T b){ return uniform_int_distribution<T>(a, b)(rng); }
/* [a,b) */ template<class T> T rnd_RealType(T a, T b){ return uniform_real_distribution<T>(a,b)(rng); }

// Common Functions
ll fastpow(ll a, ll ex){ ll res = 1; while(ex){ if(ex & 1) res *= a; a *= a; ex >>= 1; } return res; }
ll fastpow(ll a, ll ex, ll m){ a %= m; ll res = 1; while(ex){ if(ex & 1) res = (a*res) % m; a = (a*a) % m; ex >>= 1; } return res; }
ll modinverse(ll a, ll m){ ll m0 = m; ll y = 0, x = 1; while (a > 1){ ll q = a / m; a %= m; swap(a,m); x -= q*y; swap(x,y); } if(x < 0) x += m0; return x; }

// Output, Common Containers
template <typename T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T> ostream& operator << (ostream &os, const deque<T> &v) { for (T i : v) os << i << ' '; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << "(" << v.F << "=>" << v.S << ") "; return os; }
template <typename T, typename S> ostream& operator << (ostream &os, const map<T, S> &v) { for (auto i : v) os << i << ' '; return os; }

// Debugging
#ifdef LOCAL
	#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); d__f(_it, args); }
	void d__f(istream_iterator<string> it) {}
	template<typename Head, typename... Tail> void d__f(istream_iterator<string> it, Head H, Tail... T) { cerr << *it << " <=> [" << H << "]\n"; d__f(++it, T...); }
#else
	#define trace(args...)
#endif


// CODE STARTS HERE

const int mod = 998244353;

ll add(ll a, ll b) { return (a + b) % mod; }
ll sub(ll a, ll b) { return (a - b) % mod; }
ll mul(ll a, ll b) { return (a * b) % mod; }

signed main() {
	std::ios::sync_with_stdio(false); //Warning: Do NOT use C I/O now.
	std::cin.tie(nullptr); //Note: Comment out this line for interactive questions.
	// std::cout.setf(std::ios::fixed); std::cout.precision(20); //Note: To output decimals correctly.

	// int t; cin>>t;
	// for(int test_no = 1; test_no <= t; ++test_no){}

	int n;
	cin>>n;

	vector<ll> a(n), b(n), c(n);
	for(int i=0; i<n; ++i) cin>>a[i]>>b[i]>>c[i];

	vector<vector<ll>> dp(n, vector<ll>(3));
	dp[0][0] = a[0];
	dp[0][1] = b[0];
	dp[0][2] = c[0];

	for(int i=1; i<n; ++i){
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
		dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i];
	}

	cout<<*max_element(ALL(dp[n-1]));
}

Measured memory_bytes: 8064
N,Y = map(int, input().split())
cnt = 0
for x in range(N + 1):
    if x > N or 10000 * x > Y:
        break
    for y in range(N + 1):
        if x + y > N or 10000 * x + 5000 * y > Y:
            break
        if N - (Y / 1000) == -9 * x - 4 * y:
            print(x, y, N - x - y)
            exit()
print('-1 -1 -1')

Measured memory_bytes: 3060
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N = read()
A = [0] * N; B = [0] * N
for i in range(N):
  A[i], B[i] = reads()

ans = 10 ** 18
ans = min(ans, sum(A))
ans = min(ans, sum(B))

s = sorted([(A[i], i) for i in range(N)] + [(B[i], i) for i in range(N)])

used = [False] * N
for i in range(N):
  used[s[i][1]] = True
cand = sum(a for a, i in s[:N])
if not all(used):
  ans = min(ans, cand)
else:
  if s[N-1][1] != s[N][1]:
    ans = min(ans, cand - s[N-1][0] + s[N][0])
  else:
    ans = min(ans, cand - s[N-2][0] + s[N][0])
    ans = min(ans, cand - s[N-1][0] + s[N+1][0])
print(ans)


Measured memory_bytes: 63400
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

void solve(){

   int x;
   cin >> x;
   int tmp1 = x/500;
   int tmp2 = (x%500)/5;
   cout << 1000*tmp1 + 5 * tmp2 << endl;

}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))

typedef long long ll;
typedef pair<int, int> pii;

char trump;
string NESW[5][15];

int encode(char a) {
	switch (a) {
	case '2':
		return 2;
	case '3':
		return 3;
	case '4':
		return 4;
	case '5':
		return 5;
	case '6':
		return 6;
	case '7':
		return 7;
	case '8':
		return 8;
	case '9':
		return 9;
	case 'T':
		return 10;
	case 'J':
		return 11;
	case 'Q':
		return 12;
	case 'K':
		return 13;
	case 'A':
		return 14;
	}
	return -1;
}

bool wins(char a, char b) {
	return encode(a) > encode(b);
}

void solve() {
	int score[4] = {0,0,0,0};
	int start = 0;
	
	for_(i,0,13) {
		int t = start;
		
		char rank = NESW[t][i][0];
		char base = NESW[t][i][1];
		bool tflag = false;
		if (base == trump) tflag = true;
		int win = t;
		
		for_(j,0,4) {
			int tt = (t + j) % 4;
			char rankj = NESW[tt][i][0];
			char basej = NESW[tt][i][1];
			
			if (tflag) {
				// trump flag
				if (basej == trump && wins(rankj, rank)) {
					rank = rankj;
					win = tt;
				}
			} else {
				// no torump flag
				if (basej == trump) {
					tflag = true;
					rank = rankj;
					win = tt;
				} else if (basej == base && wins(rankj, rank)){
					rank = rankj;
					win = tt;
				}
			}
		}
		
		start = win;
		score[win]++;
	}
	
	if (score[0] + score[2] >= 7) {
		cout << "NS " << score[0] + score[2] - 6 << endl;
	} else {
		cout << "EW " << score[1] + score[3] - 6 << endl;
	}
}

int main() {
	while (cin >> trump) {
		if (trump == '#') break;
		for_(i,0,4) for_(j,0,13) cin >> NESW[i][j];
		solve();
	}
	return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 
#define togglebit(n, i) ((n) ^ (1LL << (i))) 
#define lastone(n) ((n) & (-(n))) 
char gap = 32;
template<typename T> 
ostream& operator<<(ostream &os, const vector<T> &v) { 
    os << '{'; 
    for (const auto &x : v) os << gap << x;
        return os << '}'; 
}
template<typename A, typename B> 
ostream& operator<<(ostream &os, const pair<A, B> &p) {
        return os << '(' << p.first << gap << p.second << ')';
}

template <class T>
void read(T &x) {
    char c;
    for (c = getchar(); c < '0' || c > '9'; c = getchar())
        ;
    for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
}
#define ll long long 
#define lll __int128_t
#define pb push_back
#define mp make_pair
typedef pair < int,int> ii;
typedef vector<ii> vii;
typedef vector<ll>vl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll hashPrime = 1610612741;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll i, j, k, l, n, m;
    cin >> n;
    ll ans = 0;
    ///set<pair<ll,ll>> s;
    for (i = 1; i <= n;i++){
        ans += ((n - 1) / i);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;
 
template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)
 
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;
  

int main() {
    int A, B;
    cin >> A >> B;
    string S;
    cin >> S;

    string res = "Yes";
    rep(i,A) {
        if (S[i] == '-') res = "No";
    }
    if (S[A] != '-') res = "No";
    rep(i,B) {
        if (S[A+1+i] == '-') res = "No";
    }

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<sstream>
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
    int h1,m1,h2,m2,k; cin>>h1>>m1>>h2>>m2>>k;
    int d=(h2*60+m2)-(h1*60+m1)-k;
    cout<<d<<"\n";

}

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

#define lint long long
#define P pair<int, int>
#define LLP pair<long long, long long>
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    lint N;
    cin >> N;
    lint ans1, ans2, ans3;
    for(lint h = 1 ; h <= 3500 ; ++h){
        for(lint n = 1 ; n <= 3500 ; ++n){
            lint left = 4LL * h * n - N * n - N * h, right = N * h * n;
            if(left != 0 && right % left == 0 && right / left > 0){
                ans1 = h;
                ans2 = n;
                ans3 = right / left;
            }
        }
    }
    printf("%lld %lld %lld\n", ans1, ans2, ans3);
    return 0;
}

// 4/N = 1/h + 1/n + 1/w
// 4hnw = Nnw + Nhw + Nhn
// 4hnw - Nnw - Nhw = Nhn
// w(4hn - Nn - Nh) = Nhn

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

#define debug(x) cout << '[' << #x << " is: " << x << "] " <<"\n";
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;

using namespace std;

int main()
{
	FAST;
    char a;
    cin >> a;
    cout << char(a + 1) <<endl;
	return 0;
}


Measured memory_bytes: 256
import math
a = [int(s) for s in input().split()]
saikoro = a[0]
tensu = a[1]
ans = float(0)

for i in range(1, saikoro+1):
    if i >= tensu:
        ans += 1
    else:
        temp = tensu / i
        temp2 = math.ceil(math.log(temp, 2))
        ans += (1 / int((2 ** temp2)))

print(ans / saikoro)

Measured memory_bytes: 8908
#include <stdio.h>
#include <math.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>

static long long Qp[100010];
int 
main(){
	long long Q,K,N;
	long long A[100010];

	
	scanf("%lld%lld%lld",&N,&K,&Q);
	int i;
	
	for(i=0;i<Q;i++){
		scanf("%lld",&A[i]);
		Qp[A[i]-1]++;
	}
	for(i=0;i<N;i++){
		if(K-Q+Qp[i]>0)printf("Yes\n");
		else printf("No\n");
	}
		

 return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
//#include "h.h"
using namespace std;

#define ll long long
#define pint pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(VECTOR) (VECTOR).begin(),(VECTOR).end()

//最大公約数
ll gcd(ll a, ll b) {
	if (a < b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
//最小公倍数
//gcd関数を使用
ll lcm(ll a, ll b) {
	return a / gcd(a, b)*b;
}

int main(){

	ll N, M;
	string S, T;
	map<ll, char> m;
	cin >> N >> M >> S >> T;
	ll L = lcm(N, M);
	for(ll i = 0; i < N; i ++){
		m[i * L / N + 1] = S[i];
	}
	for(ll i = 0; i < M; i ++){
		if(m[i * L / M + 1] != 0 && m[i * L / M + 1] != T[i]){
			cout << "-1" << endl;
			return 0;
		}
	}
	cout << L << endl;

	return 0;
}

Measured memory_bytes: 10880
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String c = "CODEFESTIVAL2016";
        int res = 0;
        for (int i=0; i<16;i++) {
            if (s.charAt(i) != c.charAt(i)) {
                res++;
            }
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 9552
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	vector<ll>a(n);
	vector<ll>sum(n,0);
	vector<ll>sum2(n, 0);
	ll count = 0;
	for (int i = 0; i < n; ++i) cin >> a[i];
	sum[0] = a[0]; sum2[0] = a[0];
	for (int i = 0; i < n; ++i) {
		if(i)sum[i] =sum[i-1]+a[i];
		if (i % 2 == 0) {
			if (sum[i] <= 0) {
				count += abs(sum[i]) + 1;
				sum[i] += abs(sum[i]) + 1;
			}
		}
		else if(i%2!=0){
			if (sum[i] >= 0) {
				count += abs(sum[i]) + 1;
				sum[i] -= (abs(sum[i]) + 1);
			}
		}
	}
	ll minv = count;
	count = 0;
	for (int i = 0; i < n; ++i) {
		if (i)sum2[i] = sum2[i - 1] + a[i];
		if (i % 2 != 0) {
			if (sum2[i] <= 0) {
				count += abs(sum2[i]) + 1;
				sum2[i] += abs(sum2[i]) + 1;
			}
		}
		else if(i%2==0){
			if (sum2[i] >= 0) {
				count += abs(sum2[i]) + 1;
				sum2[i] -= (abs(sum2[i]) + 1);
			}
		}
	}
	cout << min(minv, count) << endl;
	return 0;
}

Measured memory_bytes: 2560
n = int(input())
v = [1,6,36,216,1296,7776,46656,9,81,729,6561,59049]
dp = [float("inf") for i in range(n+1)]
dp[0] = 0
for i in range(n):
	for j in v:
		if i + j <= n:
			dp[i+j] = min(dp[i+j], dp[i]+1)
print("{}".format(dp[n]))


Measured memory_bytes: 6296
fun main(args:Array<String>){
  var n = readLine()!!.toInt()
  var a:Long = 2
  var b:Long = 1
  var c:Long = 0
  if(n==0){
    println(a)
  }else if(n==1){
    println(b)
  }else{
    for(i in 2..n){
      c = a+b
      a = b
      b = c
    }
    println(c)
  }
}


Measured memory_bytes: 33608
#include <cstdio>
#include <iostream>
#include <complex>
using namespace std;
typedef complex<double> P;

/* ?¨±?????????????????  */
#define EPS (1e-10)

/* ?????? (cross product) : a??b = |a||b|sin */
double cross(const P& a, const P& b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}

/* a1,a2???????????¨??????????????¨b1,b2???????????¨??????????????????????????? */
int isIntersectedLS(P a1, P a2, P b1, P b2) {
  if(max(a1.real(),a2.real()) + EPS < min(b1.real(),b2.real())) return false;
    if(max(b1.real(),b2.real()) + EPS < min(a1.real(),a2.real())) return false;
    if(max(a1.imag(),a2.imag()) + EPS < min(b1.imag(),b2.imag())) return false;
    if(max(b1.imag(),b2.imag()) + EPS < min(a1.imag(),a2.imag())) return false;
  return ( cross(a2-a1, b1-a1) * cross(a2-a1, b2-a1) < EPS ) &&
         ( cross(b2-b1, a1-b1) * cross(b2-b1, a2-b1) < EPS );
}

int main() {
  int n;
  int ax, ay, bx, by, cx, cy, dx, dy;
  scanf("%d", &n);

  while(n--) {
    scanf("%d %d %d %d %d %d %d %d", &ax, &ay, &bx, &by, &cx, &cy, &dx, &dy);
    P a(ax, ay), b(bx, by), c(cx, cy), d(dx, dy);

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

Measured memory_bytes: 3176
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<int, int> P;


int main(){
    int n, q;   cin >> n >> q;
    string s;   cin >> s;
    vector<int> x(n, 0);
    for(int i = 1; i < n; i++){
        if(s[i] == 'C' && s[i-1] == 'A'){
            x[i] = 1;
        }
    }
    for(int i = 0; i < n-1; i++){
        x[i+1] += x[i];
    }

    for(int i = 0; i < q; i++){
        int l, r;   cin >> l >> r;
        l--; r--;
        if(l == 0){
            cout << x[r] << endl;
        }
        else{
            cout << x[r] - x[l] << endl;
        }
    }


    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
string a1;
int main() {
  cin >> a1;
  char a = a1.at(a1.size()-1);
  if(a == '2' || a == '4' || a == '5' || a == '7' || a == '9'){
    cout << "hon" << endl;
  }else if(a == '0' || a == '1' || a == '6' || a == '8'){
    cout << "pon" << endl;
  }else{
    cout << "bon" << endl;
  }
  return 0;
}


Measured memory_bytes: 3652
//g++ -std=gnu++14 a.cpp
//#include <bits/stdc++.h>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
   ll N;
   cin >> N;
   string ans = "";

   int keta;
   ll m = 26;

  for(int i = 1; i < 15;i++){
    if(m >= N){
      keta = i;
      break;
    }else{
      ll plus = 1;
      rep(j,i+1)plus *= 26;
      m = m + plus;
    }
  }

  ll ban = N;
  ll minus = 26;
  for(int i = 1;i < keta;i++){
    ban -= minus;
    minus *= 26;
  }
  ban--;

  //cout << ban << endl;

  rep(i,keta){
    ll w = 26;
    char s = ban%w;
    ans += ('a' + s);
    ban /= 26;
  }

  reverse(ans.begin(),ans.end());

  cout << ans << endl;
/*
  ll wari = 1;
  rep(i,keta-1)wari *= 26;

  while(N > 0){
    int t;
    for(int i = 1;i <= 26;i++){
      if(wari*26 <= N){
        t = 26;
        break;
      }
      if(wari*i > N){
        t = i-1;
        break;
      }else{
        continue;
      }
    }

    char s = 96 + t;
    ans += s;
    N -= wari*t;
    if(wari != 1)wari /= 26;
  }

  cout << ans << endl;
*/


}


Measured memory_bytes: 3528