akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep1(i,n,a)    for(int i=0;i<n;i+=a)
#define rep2(i,n,a)    for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define inarr(arr,n)   rep1(i,n,1)cin>>arr[i]
#define ll             long long int
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define trav(a,x)      for(auto x:a)
#define endl           "\n"
#define eb             emplace_back
#define fr             first
#define sc             second
#define gcd(a,b)       __gcd(a,b)
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)         (int)a.size()
#define pii            pair<int,int>
#define psi            pair<string,int>
#define pss            pair<string,string>
#define pll            pair<ll,ll>
#define vec            vector<int>
#define IOS            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ret            return 0
#define pi             3.1415926536
#define hell           1000000007
#define narak          998244353
const int inf1=1e9;
const ll inf2=1e18;
const int N=100000;
using namespace std;
int dirs[4][2] ={{1,0},{-1,0},{0,1},{0,-1}};
// syntax for min priority_queue of pairs
// priority_queue<pair<ll,ll>,vector<pair<ll,int>>,greater<pair<ll,int>>> q;
int solve(){
 int n;cin>>n;
 int arr[n][3];
 rep3(n)cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
 int dp[n][3];
 dp[0][0]=arr[0][0];
 dp[0][1]=arr[0][1];
 dp[0][2]=arr[0][2];
 for(int i=1;i<n;i++){
     dp[i][0]=arr[i][0]+max(dp[i-1][1],dp[i-1][2]);
     dp[i][1]=arr[i][1]+max(dp[i-1][0],dp[i-1][2]);
     dp[i][2]=arr[i][2]+max(dp[i-1][1],dp[i-1][0]);
 }
 cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;  
 ret;
}
int main(){
    IOS;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    ret;
}
 

Measured memory_bytes: 2560
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <set>
#define pye cout << "yes" << endl;
#define pno cout << "no" << endl;
#define pYe cout << "Yes" << endl;
#define pNo cout << "No" << endl;
#define pYE cout << "YES" << endl;
#define pNO cout << "NO" << endl;
#define prin(num) cout << num << endl;
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000001
#define MAX 100000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll, ll> P;

int main(void) {
    string s;
    cin >> s;
    ll i;
    ll ans=(ll)s.size();
    ll d=0;
    for(i=0; i<s.size(); i++) {
        if(s[i]=='S') {
            d++;
        }else {
            if(d>0) ans-=2;
            d=max(0, d-1);
        }
    }
    
    prin(ans)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
using namespace std;
using LL = long long;
const int INF = 1e9;

int main(void)
{
    int M1, D1, M2, D2;
    cin >> M1 >> D1 >> M2 >> D2;
    if (M1 != M2) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}



Measured memory_bytes: 256
N,L = map(int,input().split())
sentences = []
for i in range(N):
    s = input().rstrip('\n')
    sentences.append(s)

ans =[]
count = 0
while len(sentences)>0:
    add = min(sentences)
    sentences.remove(add)
    ans.append(add)
print("".join(ans))

Measured memory_bytes: 3060
#include <set>
    #include <map>
    #include <list>
    #include <queue>
    #include <stack>
    #include <cmath>
    #include <ctime>
    #include <cstdio>
    #include <vector>
    #include <string>
    #include <bitset>
    #include <cctype>
    #include <cstdlib>
    #include <cstring>
    #include <utility>
    #include <numeric>
    #include <complex>
    #include <sstream>
    #include <fstream>
    #include <iomanip>
    #include <cassert>
    #include <iostream>
    #include <iterator>
    #include <algorithm>
    using namespace std;
    typedef long long ll;
    typedef vector<int> vint;
    typedef pair<int, int> pint;
    #define rep(i, n) REP(i, 0, n)
    #define all(v) v.begin(), v.end()
    #define REP(i, x, n) for(int i = x; i < n; i++)
    #define INF 2e9
    signed main(){
    int a,b,ta,ka,hi;
    cin>>a>>b;
    ta=a+b;
    ka=a*b;
    hi=a-b;
    if(ta > ka && ta > hi){
    cout<<ta<<'\n';
    }
    else if(ka > ta && ka > hi){
    cout<<ka<<'\n';
    }
    else if(hi > ta && hi >ka){
    cout<<hi<<'\n';
    }
    else{
      cout<<hi<<'\n';
    }
    return(0);
    }


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

using namespace std;

int main()

{

    int a,b,c;

    cin>>a>>b>>c;

    if(a!=b&&a!=c&&b!=c)

    {

        cout<<3;

    }

    else if((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&a!=c))

    {

        cout<<2;

    }

    else if((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&a!=c))

    {

        cout<<2;

    }

    else if(a==b&&b==c)

    {

        cout<<1;

    }

    return 0;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  for (int i = K; i < N; i++){
    if (A[i] > A[i - K]){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 4048
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		double ans=0;
		for(int i=1;i<=n;i++){
			int score=i;
			double bunbo=n;
			double ans2=1/bunbo;
			int count=0;
			while(true){
				if(score<k){
					score*=2;
					count++;
					ans2*=0.5;
				}else
					break;
			}
			ans+=ans2;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23636
#include <vector>
#include <math.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <deque>
#include <map>

typedef long long ll;
#define rep(i, a, n) for(int i = a; i<n; i++)
#define ALL(a) begin(a), end(a)
#define mii map<int, int>
#define msi map<string, int>
#define vi vector<int>
#define vl vector<ll>
#define MOD 1000000007
#define INF 1e9
#define showVector(v) rep(i,0,v.size()){p(v[i]);p(" ")} pl("")
#define p(s) std::cout << s ;
#define pl(s)  std::cout << s << endl;
using namespace std;

// 素数判定 O(√n)
bool is_prime(int n){
    for(int i = 2; i * i <= n; i++){
        if(n % i == 0) return false;
    }
    return true;
}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;

}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    int N, K;
    cin >> N >> K;
    //vector<vector<int>> data(3, vector<int>(4));
    //初期値0
    //vector<int> data(i, 0);
    int res = 1;
    rep(i, 0, N) {
        res = min(res * 2, res+K);
    }
    cout << res << endl;
    return 0;
}

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

int main(){
    long long a,b,k; cin>>a>>b>>k;
    if(a>=k){
        a=a-k;
        cout << a << " " << b << endl;
    }
    else{
        k=k-a;
        long long ss = 0;
        cout << 0 << " " << max(ss,b-k);
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){

	int h,w;
	cin >> h>>w;
	int a,b;
	cin >> a>>b;
	cout << (a-h)*(b-w) << endl;


}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
 
public class Main {
	private static FastScanner sc = new FastScanner();
	
	public static void main(String[] args) {
		int N = sc.nextInt();
		
		int cnt4 = 0;
		int cnt2 = 0;
		int cntodd = 0;
		for(int i=0; i<N; i++) {
			int a = sc.nextInt();
			if(a%4 == 0) {
				cnt4++;
			} else if(a%2 == 1) {
				cntodd++;
			} else {
				cnt2++;
			}
		}
		
		if(cnt4 >= cntodd || (cnt4 + 1 == cntodd && cnt2 == 0)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
	
	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}


Measured memory_bytes: 35328
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  input! {
    n: usize,
    sp: [(chars, usize); n],
  }
  use cmp::Ordering::{Less, Equal, Greater};
  let mut sp: Vec<_> = sp.into_iter().enumerate().collect();
  sp.sort_by(|&(_, (ref s1, ref p1)), &(_, (ref s2, ref p2))| {
    match s1.cmp(&s2) {
      Less => Less,
      Greater => Greater,
      Equal => p2.cmp(&p1)
    }
  });
  for &(i, _) in sp.iter() {
    println!("{}", i+1);
  }
}


Measured memory_bytes: 4352
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long n,a[200005],i,total=0,min[200005],mn;
    cin>>n;
    mn=10000000000;
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]<mn)
        {
            mn=a[i];
        }
        min[i]=mn;        
    }
    for(i=1;i<=n;i++)
    {
        if(a[i]<=min[i])
        {
            total++;
        }
    }
    cout<<total<<endl;
    return 0;
}

Measured memory_bytes: 6760
#include <iostream>
#include <vector>
#include <math.h>
#include <iomanip>
#include <algorithm>

using namespace std;

int main(){
	int p, q, r;
	cin >> p >> q >> r;

	vector<int> v;
	v.push_back(p);
	v.push_back(q);
	v.push_back(r);
	int maxIndex = distance(v.begin(), max_element(v.begin(), v.end()));

	int val = 0;
	for (int i=0; i<3; i++){
		if (i == maxIndex){
			continue;
		}
		val += v[i];
	}
	cout << val << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(){
  int N, Q;
  cin >> N >> Q;
  vector<tuple<int, int, int>> a(N);
  rep(i, N) {
    int S, T, X;
    cin >> S >> T >> X;
    a[i] = make_tuple(X, S-X, T-X);
  }
  vector<int> D(Q);
  set<int> st;
  rep(i, Q) {
    cin >> D[i];
    st.insert(D[i]);
  }
  sort(a.begin(), a.end());
  map<int, int> mp;
  rep(i, N) {
    int x, s, t;
    tie(x, s, t) = a[i];
    auto it = st.lower_bound(s);
    while(it != st.end() && *it < t) {
      mp[*it] = x;
      st.erase(it++);
    }
  }
  rep(i, Q) {
    if(mp[D[i]])
      cout << mp[D[i]] << endl;
    else
      cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 22656
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String S = sc.next();
		char[] inputSplit = S.toCharArray();
		for (int i = 0; i < inputSplit.length; i++) {
			if ((int) inputSplit[i] + N > 90) {
				System.out.print((char) ((int) inputSplit[i] + N - 26));
			} else {
				System.out.print((char) ((int) inputSplit[i] + N));
			}
		}
	}
}


Measured memory_bytes: 25940
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    ll ans=0,tmp=0;
    string s,a="ACGT";
    cin>>s;
    rep(i,s.size()){
        bool ok=false;
        rep(j,4){
            if(s[i]==a[j]) ok=true;
        }
        if(ok){
            tmp++;
            ans = max(ans, tmp);
        }else tmp = 0;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3596
info=[[[0 for i in range(10)] for j in range(3)] for k in range(4)]
#print(info)

n=int(input())

#b棟f階のr番目の部屋にv人が追加で入居したことを示します
for i in range(n):
    b,f,r,v=list(map(int, input().split(" ")))
    #print(b,f,r,v)
    info[b-1][f-1][r-1]=info[b-1][f-1][r-1]+v

for i,building in enumerate(info):
    if(i):
        print("####################")
    for floor in building:
        for room in floor:
            print(" "+str(room),end="")
        print()
    


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

bool dp1[2][20000], dp2[2][20000];

signed main() {
  string s;
  cin >> s;
  int x, y;
  cin >> x >> y;
  vector<int> tv, yv;
  int rf = 0, si = 0;
  rep(i, 0, s.length()) {
    if(s[i] == 'F') {
      rf++;
    }else {
      if(rf) {
        if(si) yv.pb(rf);
        else tv.pb(rf);
        rf = 0;
      }
      si = !si;
    }
  }
  if(rf) {
    if(si) yv.pb(rf);
    else tv.pb(rf);
    rf = 0;
  }
  if(tv.size()) {
    if(s[0] == 'F') {
      dp1[1][10000 + tv[0]] = 1;
    }else {
      dp1[1][10000 + tv[0]] = 1;
      dp1[1][10000 - tv[0]] = 1;
    }
  }else {
    dp1[0][10000] = 1;
  }
  dp2[0][10000] = 1;
  rep(i, 1, tv.size()) {
    rep(j, 0, 20000) {
      if(dp1[i % 2][j]) {
        dp1[i % 2][j] = 0;
        dp1[!(i % 2)][j - tv[i]] = 1;
        dp1[!(i % 2)][j + tv[i]] = 1;
      }
    }
  }
  rep(i, 0, yv.size()) {
    rep(j, 0, 20000) {
      if(dp2[i % 2][j]) {
        dp2[i % 2][j] = 0;
        dp2[!(i % 2)][j - yv[i]] = 1;
        dp2[!(i % 2)][j + yv[i]] = 1;
      }
    }
  }
  if((dp1[0][10000 + x] || dp1[1][10000 + x]) && (dp2[0][10000 + y] || dp2[1][10000 + y])) {
    cout << "Yes" << endl;
  }else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 384
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const n = parseInt(args[0][0], 10)
	const k = parseInt(args[0][1], 10)
	if (n % k === 0) console.log(0)
	else console.log(1)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

ll calc1(vector<ll> &a, vector<int> &one, int n, int limit)
{
    ll ret = 0;
    rep(i, limit)
    {
        int j = max(one[i], n - one[i]);
        ret += (1ll << i) * j;
    }

    return ret;
}

//bit目のみを見たときの最大値
ll calc2(vector<ll> &a, vector<int> &one, int n, int bit)
{
    ll ret = 0;
    int j = max(one[bit], n - one[bit]);
    ret += (1ll << bit) * j;

    return ret;
}
int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<int> one(41, 0);
    rep(i, n)
    {
        cin >> a[i];
        rep(j, 41)
        {
            one[j] += ((a[i] >> j) & 1);
        }
    }

    vector<vector<ll>> dp(41, vector<ll>(2, 0)); //dp[i][j]、今jを使ったときの、iビット目までの最大値

    ll ans = -1;
    ll cur = 0;
    if ((k & 1) == 0)
    {
        dp[0][0] = one[0];
    }
    else
    {
        dp[0][0] = n - one[0];
    }
    //dp[0][1] = max((ll)one[0], n - one[0]);

    rep(i, 1, 41)
    {
        int t = (k >> i) & 1;
        //cerr << i << " " << t << endl;
        if (t == 1)
        {
            //cerr << "aaaaa" << endl;
            dp[i][0] = max(calc1(a, one, n, i) + one[i] * (1ll << i), (n - one[i]) * (1ll << i) + dp[i - 1][0]);
            //dp[i][1] = calc1(a, one, n, i + 1);
        }
        else
        {
            //cerr << one[i];
            dp[i][0] = dp[i - 1][0] + (1ll << i) * one[i];
            //dp[i][1] = calc1(a, one, n, i + 1);
        }
    }
    //cerr << dp[39][1] << endl;
    cout << dp[40][0] << endl;
    return 0;
}

Measured memory_bytes: 1024
s = str(input())
t = str(input())
sx = len(s)
tx = len(t)
n = sx - tx + 1
amax = 0
for i in range(n):
  x = 0
  for j in range(tx):
    if s[i+j] == t[j]:
      x += 1
    else:
      pass
  if x > amax:
    amax = x
print(tx - amax)

Measured memory_bytes: 8808
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	int a, b, c; cin >> a >> b >> c;
	if(a+b==c or b+c==a or c+a==b)cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 100002;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()
int32_t main()
{ 
   IOS
  
  
  int n;
  cin >> n;
  vector<string> a(n);
  for(int i = 0;i<n;i++) cin >> a[i];

  cout<<"AC x "<<count(all(a),"AC")<<endl;
  cout<<"WA x "<<count(all(a),"WA")<<endl;
  cout<<"TLE x "<<count(all(a),"TLE")<<endl;
  cout<<"RE x "<<count(all(a),"RE")<<endl;



  




  
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)

typedef long long ll;

int main() {
  ll n;
  cin >> n;
  if (n % 2 == 1) {
    cout << 0 << endl;
    return 0;
  }
  ll temp_n = n / 2;
  vector<int> vec;

  for (int i = 0; temp_n > 0; i++) {
    vec.push_back(temp_n % 5);
    temp_n = temp_n / 5;
  }

  ll cnt = 0;
  ll temp = 1;
  for (int i = 1; i < vec.size(); i++) {
    cnt += temp * vec[i];
    temp = temp * 5 + 1;
  }
  cout << cnt << endl;

  return 0;
}

Measured memory_bytes: 256
public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		java.util.Scanner sc = new java.util.Scanner(System.in);

		int n = Integer.parseInt( sc.nextLine() );

		String[] stra = sc.nextLine().split(" ");
		long[] a = new long[n];
		for ( int i = 0; i < n; i++) {
			a[i] = Long.parseLong(stra[i]);
		}

		java.util.Arrays.sort(a);
		long min = a[0];
		long max = a[n-1];

		long sum = 0;
		for (int i = 0; i < n; i++) {
			sum += a[i];
		}

		System.out.printf("%d %d %d\n", min, max, sum);
	}

}

Measured memory_bytes: 31792
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main(){
	int n;
	string s;
	cin >> n;
	cin >> s;
	bool check = true;
	rep(i, n / 2) {
		if (!(s[i] == s[i + n / 2])) {
			check = false;
		}
	}
	if (n % 2 == 1)cout << "No" << endl;
	else if (check)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


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

//const int N = 1000000001;   //確保できない
//vector<int> array(N, 0);
//int array[N] = {0};

int main(){
    int n;
    cin >> n;
    vector<int> a(n);

    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    if(n == 1){
        cout << n << endl;
        return 0;
    }

    int tmp = a[0];
    int cnt = 1;
    int ans = 0;
    for(int i = 1; i < n; i++){
        if(tmp == a[i]){
            cnt++;
            //cout << "cnt:" << cnt << endl;
        }
        else{
            if(cnt % 2 == 1){
                ans++;
            }
            tmp = a[i];
            cnt = 1;
        }
        if(i == n - 1 && (a[i] != a[i - 1])){
            ans++;
        }
        if(i == n - 1 && cnt > 1){
            if(cnt % 2 == 1){
                ans++;
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
const ll MOD=1000000007;

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    rep (i,N){
        cin >> A[i];
    }
    int now=0,ans=1;
    rep(i,N-1){
        if (now==0){
            if (A[i]<A[i+1]){
                now=1;
            }
            else if (A[i]>A[i+1]){
                now=2;
            }
        }
        else if (now==1){
            if (A[i]>A[i+1]){
                ans++;
                now=0;
            }
        }
        else {
            if (A[i]<A[i+1]){
                ans++;
                now=0;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
input = gets.split(' ')


a = input[0].to_i
b = input[1].to_i
c = input[2].to_i
d = input[3].to_i

pro = []

pro[0] = a*c
pro[1] = a*d
pro[2] = b*c
pro[3] = b*d

p pro.max

Measured memory_bytes: 14200
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
#include <iomanip>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int mod=1e9+7;
const int64_t INF=1e18;
int64_t N,K;
int64_t A[1000005];
int64_t f(int64_t m){
  int cnt=0;
  for(int i=0;i<N;i++){
    if(A[i]>m){cnt+=(A[i]-1)/m;}
  }
  return cnt;
}
int main() {
  cin>>N>>K;
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  
  int64_t l=0,r=1e9+1;
  while(r-l>1){
    int64_t m=(r+l)/2;//m=max長さ
    if(f(m)<=K){r=m;}//K回以内でｍ以内の長さにできる長さの範囲＝ｒ
    if(f(m)>K){l=m;}
  }
  cout<<r<<endl;
  return 0;  
}

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

int  main(){
 int a,b,c,i,tmp,d[3];
 cin>>a>>b>>c;
 d[0]=abs(a-b);
 d[1]=abs(b-c);
 d[2]=abs(c-a);
  if(d[0]<d[1]){tmp=d[0];d[0]=d[1];d[1]=tmp;}
  if(d[0]<d[2]){tmp=d[0];d[0]=d[2];d[2]=tmp;}

 cout<<d[1]+d[2]<<endl;
 return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define mp            make_pair
#define PI            3.14159265
#define M             1000000007
#define MM            998244353
#define fr            first
#define sc            second
#define all(v)        (v).begin(),(v).end()
#define rall(v)       (v).rbegin(),v.rend()
#define vc            vector
#define vi            vector<int>
#define pii           pair<int,int>
#define psi           pair<string,int>
#define pis           pair<int,string>
#define mii           map<int,int>
#define msi           map<string,int>

int solve() {
    int n; cin>>n;
    cout<<((n)*(n-1))/2;
    return 0;
}

signed main() {
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--) solve();
    return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())

ans = 0
if (B-A)%2 == 0:
    print((B-A)//2)
else:
    if A-1 < N-B:
        ans += A-1
    else:
        ans += N-B
    ans += 1
    ans += (B-A-1)//2
    print(ans)


Measured memory_bytes: 9152
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s,l={};
long unsigned int k,i;
cin>>k;
cin>>s;
if(s.length()<=k)
cout<<s;
else
{
for(i=0;i<k;i++)
l+=s[i];
l+="...";
cout<<l;
}
return 0;
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long  ll; typedef vector<int> VI; typedef pair<int,int> pii;
typedef vector<ll> VL; const int MD = 1e9 + 7;
void dbg(){cerr<<"\n";} template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	ll  a, bb;  double b;
	cin >>a >>b;
	ll aa = a;
	bb = b*1000; 
	__int128_t  ans = ((__int128_t)aa * bb ) /1000;
	dbg( bb, (ll)ans);
	cout << (ll)ans <<"\n";
	return 0;
}


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

int total(int n);
int main(){
  int num;
  cin >> num;
  cout << total(num) << endl;
  return 0;
}

int total(int n){
  if(n==1) return 1;
  return n+total(n-1);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;

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

int m,c,n;
int place[102];
vector<int> desk[13],req[102];
queue<int> q;

void solve(){
  int ans = 0;

  while(!q.empty()){
    int idx = q.front(); q.pop();
    int book = req[idx][0]; req[idx].erase(req[idx].begin());
    int p = place[book];

    ans += p;
    desk[p].erase(find(desk[p].begin(),desk[p].end(),book));

    if(desk[1].size() < c){
      desk[1].push_back(book);
      place[book] = 1;
      ans++;
    }
    else{
      REP(i,2,m+2){
        if(desk[i].size() < c || i == m+1){
          desk[i].push_back(book);
          place[book] = i;
          ans += i;
          break;
        }
      }

      int tmp = desk[1][0]; desk[1].erase(desk[1].begin());
      ans++;

      REP(i,2,m+2){
        if(desk[i].size() < c || i == m+1){
          desk[i].push_back(tmp);
          place[tmp] = i;
          ans += i;
          break;
        }
      }

      desk[1].push_back(book);
      p = place[book];
      desk[p].erase(find(desk[p].begin(),desk[p].end(),book));
      place[book] = 1;
      ans += p + 1;
    }

    if(!req[idx].empty()) q.push(idx);
  }

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

int main(){
  while(scanf("%d%d%d",&m,&c,&n),m||c||n){
    rep(i,13) desk[i].clear();

    rep(i,n){
      int k;
      scanf("%d",&k);
      req[i].clear();
      q.push(i);

      rep(j,k){
        int b;
        scanf("%d",&b);
        req[i].push_back(b);
        desk[m+1].push_back(b);
        place[b] = m+1;
      }
    }

    solve();
  }

	return 0;
}

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

int N;
vector<int> A;

long long solve() {
   long long res = 0;
   int x = 0;
   for(int i = N-1; i > 0; i--, x--) {
      if(A[i] < x) return -1;
      if(x < 0) x = 0;
      if(A[i] > x) {
         x = A[i];
         res += A[i];
      }
   }
   if(x > 0 || A[0] > 0) return -1;
   return res;
}

int main() {
   scanf("%d", &N);
   A.resize(N);
   for(int& a : A) scanf("%d", &a);

   printf("%lld\n", solve());
}


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

using namespace std;

typedef long long ll;
#define SWAP(x,y,z) {if ( y > z ) swap(y,z); if ( x > y ) swap(x,y); if (y > z) swap(y,z);}


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

    int a,b;
    char k;
    cin >> a >> k >> b;
    if ( k == '+' ) cout << a+b;
    else cout << a-b;

    return 0;
    // 274751WM
}


Measured memory_bytes: 256
#pragma warning(disable:4996)
#include<iostream>
#include<stdio.h>
#include<sstream>
#include<cmath>
#include<stack>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#include<limits.h>
using namespace std;
using ll = long long int;
int main() {
	ll N, K, ans = 0;
	vector<ll> rec;
	cin >> N >> K;
	rec = vector<ll>(N);
	for (int i = 0; i < N; ++i)
		cin >> rec[i];
	sort(rec.begin(), rec.end(), greater<ll>());
	for (int i = K; i < N; i++)
		ans += rec[i];
	cout << ans;
	return 0;
}

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

int n, sum;

int calc(int n, int k) {
	while (n % k) { int t = n / k; n -= (n - t * k + t) / (t + 1) * (t + 1); }
	return n / k;
}

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n;
	for (int i = 0, a, k; i < n; ++i)
		std::cin >> a >> k, sum ^= calc(a, k);
	std::cout << (sum ? "Takahashi" : "Aoki") << '\n';
	return 0;
}

Measured memory_bytes: 384
// Java program For handling Input/Output 
import java.io.*; 
import java.util.*;
import java.math.*;
//import java.awt.*;

public class Main 
{ 
    FastReader sc;
    //actual logic
    void solve() throws IOException{
        int n = sc.ni();
        int a[] = new int[n];

        for(int i = 0;i < n;i++)
        {
            a[i] = sc.ni();
        }

        int min = a[0];
        int ans = 1;
        for(int i = 1;i < n;i++)
        {
            if(a[i] <= min)
                ans++;
            min = Math.min(min, a[i]);
        }
        System.out.println(ans);

    }

    //constructor
    Main()
    {
        try{  
            sc = new FastReader();
        }catch(Exception e){
            System.out.println(e);
        }
    }


    //main metohd
    public static void main(String[] args) throws IOException
    { 
     new Main().solve();
 }
    //Utility methods

 static class FastReader{
    BufferedReader br;
    StringTokenizer st;
    FastReader(){
        br = new BufferedReader(new InputStreamReader(System.in));
        try{
            st = new StringTokenizer(br.readLine());
        }catch(Exception e){
            System.out.println(e);
        }
    }

    FastReader(String s){
        try{
            br = new BufferedReader(new FileReader(s));
            st = new StringTokenizer(br.readLine());
        }catch(Exception e){
            System.out.println(e);
        }
    }

    String ns(){
        if(!st.hasMoreTokens())
        {
            try{
                st = new StringTokenizer(br.readLine());
            }catch(Exception e){
                System.out.println(e);
            }    
        }
        return st.nextToken();

    }

    int ni(){
        return Integer.parseInt(ns());
    }

    long nl(){
        return Long.parseLong(ns());
    }

    double nd(){
        return Double.parseDouble(ns());
    }
}
}


Measured memory_bytes: 46932
import           Control.Applicative
import           Control.Monad
import           Data.List

main :: IO ()
main =  do
  n <- getLine
  triangles <- replicateM (read n) getLine
  mapM_ (putStrLn . test . map read . words) triangles
    where
      test [a,b,c]
        | a^2 + b^2 == c^2 || b^2 + c^2 == a^2 || a^2 + c^2 == b^2 = "YES"
        | otherwise = "NO"


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

int main(void){
	int n;
	int ans = 0;
	cin >> n;

	for(int i=0; i<n; i++){
		int x;
		cin >> x;

		if(x == 1) continue;
		if(x == 2) ans++;
		if(x % 2 == 0) continue;

		int j;
		for(j=3; j*j<=x; j+=2){
			if(x%j == 0) break;
		}
		if(j*j > x){
			ans++;
		}
	}
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 1144
/**
 * Created by hiramekun at 20:53 on 2020-04-26.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll s, w;
    cin >> s >> w;
    cout << (w >= s ? "unsafe" : "safe") << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 3596
def main():
    N, T = map(int, input().split())
    t = list(map(int, input().split()))
    ans = T
    for i in range(1, N):
        dt = t[i] - t[i - 1]
        if T > dt:
            ans += dt
        else:
            ans += T
    print(ans)


main()


Measured memory_bytes: 25196
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	if(m>0&&n>=0)
	{
		if(m>n)
			printf("%d",m-n);
		else
			printf("%d",n-m+2);
	}
	else if(m==0)
	{
		if(n>0)
			printf("%d",n-m+1);
		else
			printf("%d",m-n);
	}
	else if(m<0&&n>=0)
	{
		printf("%d",abs(abs(n)-abs(m))+1);
	}
	else if(m>0&&n<=0)
	{
		printf("%d",abs(abs(n)-abs(m))+1);
	}
	else if(m<0&&n<=0)
	{
		if(m>n)
			printf("%d",m-n);
		else if(n!=0)
			printf("%d",n-m+2);
		else
			printf("%d",n-m+1);
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
#define int long long int

void solve() {
  // int x;
  // cout << endl;
}
set<char> s;

signed main() {
  int n;
  cin >> n;
  while (n--) {
    string str;
    cin >> str;
    s.insert(str.front());
  }
  // cout << s.size() << endl;
  if (s.size() == 3) {
    cout << "Three" << endl;
  } else {
    cout << "Four" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long
int main() {
	int n, m;
	scanf("%d%d", &n, &m);
	pair<ll, ll> students[55];
	pair<ll, ll> checkpoints[55];

	for (int i = 0; i < n; i++)
		scanf("%lld%lld", &students[i].first, &students[i].second);
	for (int i = 0; i < m; i++)
		scanf("%lld%lld", &checkpoints[i].first, &checkpoints[i].second);

	for (int i = 0; i < n; i++) {
		ll min = 1e9, index = 0;
		for (int j = 0; j < m; j++) {

			if (abs(students[i].first - checkpoints[j].first)
					+ abs(students[i].second - checkpoints[j].second) < min) {

				min = abs(students[i].first - checkpoints[j].first)
						+ abs(students[i].second - checkpoints[j].second);
				index = j+1;

			}

		}
		printf("%lld\n", index);
	}

}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P  = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    vector<int> a(5);
    rep(i, 5) {
        cin >> a[i];
        if(a[i] == 0)
        {
            cout << i+1 << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3620
import java.io.*;
import java.util.*;

class Main {

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[] P = new int[N];
		for (int i = 0; i < N; i++) {
			P[i] = sc.nextInt();
		}

		int[] Q = new int[N];
		for (int i = 0; i < N; i++) {
			Q[i] = sc.nextInt();
		}

		int[] a = new int[N];
		for (int i = 0; i < N; i++) {
			a[i] = i + 1;
		}

		int cp = 0;
		while (true) {
			boolean ok = true;
			for (int i = 0; i < a.length; i++) {
				if (P[i] != a[i]) {
					ok = false;
					break;
				}
			}
			if (ok) break;
			cp++;
			if (!nextPermutation(a)) break;
		}

		for (int i = 0; i < N; i++) {
			a[i] = i + 1;
		}

		int cq = 0;
		while (true) {
			boolean ok = true;
			for (int i = 0; i < a.length; i++) {
				if (Q[i] != a[i]) {
					ok = false;
					break;
				}
			}
			if (ok) break;
			cq++;
			if (!nextPermutation(a)) break;
		}

		System.out.println(Math.abs(cp - cq));
	}

	private static boolean nextPermutation(int[] a) {
		int n = a.length, k = n - 2, l = n - 1;
		while (k >= 0 && a[k] > a[k + 1]) k--;
		if (k < 0) return false;
		while (a[l] <= a[k]) l--;
		swap(a, k, l);
		k++;
		n--;
		while (k < n) swap(a, k++, n--);
		return true;
	}

	private static void swap(int[] a, int i, int j) {
		int t = a[i];
		a[i] = a[j];
		a[j] = t;
	}


}


Measured memory_bytes: 23252
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

long long pow_mod(long long n, long long p, long long m)
{
    if (p == 0) {
        return 1;
    }

    if (p % 2 == 0) {
        long long t = pow_mod(n, p / 2, m);
        return t * t % m;
    }
    return n * pow_mod(n, p - 1, m) % mod;
}

long long nCr_mod(long long n, long long r)
{
    long long x = 1;
    for (long long i = n - r + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }

    long long a = 1;
    for (long long i = 1; i <= r; i++) {
        a *= i;
        a %= mod;
    }

    long long y = pow_mod(a, mod - 2, mod) % mod;

    return x * y % mod;
}

int main()
{
    long long a, b, n;
    std::cin >> a >> b >> n;

    std::cout << (long long)(std::floor(a * std::min(b - 1, n) / b)) << std::endl;
}


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int d = max(a-b,b-a), e = max(b-c,c-b), f = max(c-a,a-c);
  cout << min({d+e,e+f,d+f}) << endl;
}

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

int main() {
    int N,flag = 0;
    cin >> N ;
  	string tmp;
  std::map<std::string,int> salary{};
  for(int i = 0 ; i < N;i++){
    cin >> tmp;
    salary[tmp] = 0;
  }
  cout << salary.size();
}

Measured memory_bytes: 19228
def f(n)
  if n == 1
    return 1, 1
  elsif n % 2 == 0
    a, b = f(n / 2)
    return 2 * a * b - a ** 2, a ** 2 + b ** 2
  else
    a, b = f(n / 2)
    return a ** 2 + b ** 2, 2 * a * b + b ** 2
  end
end
puts f(gets.to_i + 1)[0]

Measured memory_bytes: 6100
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
int main() {
	ios::sync_with_stdio(false);
	ll res=0;
	string s;
	cin>>s;
	REP(bit,(1<<(s.size()-1))) {
		ll sum=0;
		int l=0;
		int buf=bit;
		REP(i,s.size()-1) {
			if(buf%2==0) {
				sum+=stol(s.substr(l,i-l+1));
				l=i+1;
			}
			buf/=2;
		}
		sum+=stol(s.substr(l,s.size()-l));
		res+=sum;
	}
	cout<<res<<endl;
}


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

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<pdd> vdd;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(x) (x).begin(),(x).end()
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline ll modInverse(ll a) { return modPow(a, MOD-2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){
    string s;cin>>s;
    int n=s.size();
    vi v(n,1);
    rep(i,n-1){
        if(s[i]=='R'){
            if(s[i+1]=='L'){}
            if(s[i+1]=='R'){
                v[i+2]+=v[i];
                v[i]=0;
            }
        }
        if(s[n-1-i]=='L'){
            if(s[n-1-i-1]=='L'){
                v[n-1-i-2]+=v[n-1-i];
                v[n-1-i]=0;
            }
        }
    }
    rep(i,n){
        cout<<v[i]<<" ";
    }
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main()
{
	bool p[1000000] = { false };
	int n;

	while (cin >> n){
		for (int i = 2; i <n ; i++){
			for (int i2 = 2; i*i2 <= n; i2++){
				p[i*i2] = true;
			}
		}
		p[2] = false;
		p[3] = false;
		int c = 0;
		for (int i = 2; i <= n; i++){
			if (!p[i])c++;
		}
		cout << c << endl;
	}
}

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

#define ll long long int
#define vi vector<int>
#define endl "\n"

int main() {
  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  int d; cin >> d;
  int curr = 25;
    cout << "Christmas ";
  while(curr != d) {
    cout << "Eve ";
    curr--;
  }
  cout << endl;
  return 0;
}



Measured memory_bytes: 256
console.log((args=>{
  const N = args.trim()|0;
  const a = Array(N).fill(0);
  for ( let x = 1; x*x < N; x++ ) {
    for ( let y = 1; y*y < N; y++ ) {
      for ( let z = 1; z*z < N; z++ ) {
        const i = x*x + y*y + z*z + x*y + y*z + z*x;
        if ( i > N ) break;
        a[i-1]++;
      }
    }
  }
  return a.join`\n`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 32464