akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int calc_func ( int n ) {
    int num_out = 1;
    if ( n == 0 ) {
        num_out = 1;
    }
    else {
        for ( int i = n; i > 0; i-- ) {
            num_out *= i; 
        }
    }

    return num_out;
}

int main() {
    int n;
    cin>>n;
    int p[n];
    int q[n];
    int a_out_num = 0;
    int b_out_num = 0;
    for ( int i=0; i<n; i++ ) {
        cin>>p[i];
    }
    for ( int i=0; i<n; i++ ) {
        cin>>q[i];
    }
    for ( int i = 0; i < n; i++ ) {
        int a_init = p[i];
        int b_init = q[i];
        int a_small_num = 0;
        int b_small_num = 0;
        int calc_func_num = calc_func(n-i-1);
        for ( int j = i; j < n; j++ ) {
            if ( a_init > p[j] ) {
                a_small_num++;
            }
        }
        a_out_num += a_small_num * calc_func_num;
        for ( int j = i; j < n; j++ ) {
            if ( b_init > q[j] ) {
                b_small_num++;
            }
        }
        b_out_num += b_small_num * calc_func_num;

    }

    if ( a_out_num > b_out_num ) {
        cout<<a_out_num-b_out_num<<endl;
    }
    else {
        cout<<b_out_num-a_out_num<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll LINF = 1e18;
const int INF = 1e9;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
    string S; cin>>S;
    ll cnt=0;
    rep(i,S.length()){
        int a=S[i]-'0';
        cnt+=a;
    }
    if(cnt%9==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                    \
  ifstream in("abc135/abc135_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

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

  ll diff = abs(A - B);
  ll bigger = max(A, B);
  cout << (diff % 2 == 0 ? to_string(bigger - diff / 2) : "IMPOSSIBLE") << endl;
}

Measured memory_bytes: 3660
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define pb push
#define mp make_pair
#define X first
#define Y second
#define Mad(a,b) a=(a+b)%mod;
typedef long long ll;

using namespace std;
typedef pair<ll,ll> P;
queue<P> Q;
#define N 3010
ll n,m,d[N],c[N];string s;
int main(){
    cin>>n>>m>>s;
    Q.pb(mp(0,0));
    while(m--){
	ll a,b;cin>>a>>b;
	if(Q.back().Y<b)Q.pb(mp(a,b));
    }
    lol(i,N)d[i]=0;d[0]=1;
    for(ll i=0,rnd=0;i<=n;i++){
	ll cnt=0;
	while(!Q.empty()){
	    if(not(Q.front().X<=i))break;
	    for(ll j=max(i-1,rnd);j<Q.front().Y;j++)cnt+=s[j]-'0';
	    rnd=Q.front().Y;Q.pop();
	}
	for(ll j=N-1;j>=0;j--)d[j]=(j-cnt>=0?d[j-cnt]:0);
	ll lim=max(0LL,rnd-i);
	for(ll j=0;j<=lim;j++)Mad(d[j],d[j+1]);
	for(ll j=lim+1;j<N;j++)d[j]=0;
    }
    cout<<d[0]<<endl;
    return 0;
}


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

using ll = long long;
using ld = long double;

const ll MOD = 1e9 + 7;
const int N = 1e5;

ll val[N + 5];
ll n, k;

ll fastexpo(ll a, ll b) {
  ll res = 1;
  while(b) {
    if(b & 1) { res = (res * a) % MOD; }
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}

void solve() {
  cin >> n >> k;
  ll ans = 0;
  for(int i = k; i >= 1; i--) {
    ll temp = fastexpo(k / i, n);
    for(int j = 2 * i; j <= k; j += i) {
      temp -= val[j]; temp %= MOD;
    }
    val[i] = temp;
    ans = (ans + temp * i) % MOD;
  }
  if(ans < 0) ans += MOD;
  cout << ans << '\n';
}

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

  int TC = 1;
  for(int i = 1; i <= TC; i++) {
    solve();
  }
  
  return 0;
}

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

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

  vector<long long> a(N);
  for (int i = 0; i < N; ++i) cin >> a.at(i);

  vector<long long> s(N + 1, 0);
  for (int i = 0; i < N; ++i) s.at(i + 1) = s.at(i) + a.at(i);

  long long res = 1LL << 60;
  for (int i = 1; i < N; i++) {
    res = min(res, abs(s.at(N) - s.at(i) * 2));
  }

  cout << res << endl;
}

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

int read()
{
	int ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=false;
	if(ch=='-')
	{
		flag=true;
		ch=getchar();
	}
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10+ch-'0';
	return flag?-ans:ans;
}

long long rell()
{
	long long ans=0;
	char ch=getchar();
	for(;(ch<'0' || ch>'9') && ch!='-';ch=getchar());
	bool flag=false;
	if(ch=='-')
	{
		flag=true;
		ch=getchar();
	}
	for(;ch>='0' && ch<='9';ch=getchar())ans=ans*10ll+(long long)(ch-'0');
	return flag?-ans:ans;
}

void write(int a)
{
	if(!a)
	{
		putchar('0');
		return;
	}
	static char ans[233];
	int n=0;
	for(;a;a/=10)ans[n++]=a%10+'0';
	for(;n;)putchar(ans[--n]);
}

void write(long long a)
{
	if(!a)
	{
		putchar('0');
		return;
	}
	static char ans[233];
	int n=0;
	for(;a;a/=10)ans[n++]=a%10+'0';
	for(;n;)putchar(ans[--n]);
}
const int N=1<<18;
int a[N],b[N],c[N],d[N];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",a+i);
	}
	for(int i=0;i<n;i++)
	{
		scanf("%d",b+i);
	}
	int ans=0;
	for(int k=0;k<30;k++)
	{
		int sum=0;
		for(int i=0;i<n;i++)
		{
			sum^=(a[i]>>k)^(b[i]>>k);
			c[i]=a[i]&((1<<k)-1);
			d[i]=b[i]&((1<<k)-1);
		}
		sum&=n&1;
		sort(c,c+n);
		sort(d,d+n);
		for(int i=0,j=n;i<n;i++)
		{
			for(;j && d[j-1]+c[i]>=(1<<k);j--);
			sum^=n-j;
			//printf("i=%d j=%d\n",i,j);
		}
		ans+=(sum&1)<<k;
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 3840
import java.io.*;

class Main
{
public static void main(String[] args) throws IOException
 {
  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

  String str = br.readLine();

  int x=Integer.parseInt(str),h=x/3600,m,s;
  x%=3600;

  m=x/60;
  x%=60;

  s=x;

  System.out.println(h+":"+m+":"+s);
}
 }

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


#define int long long
#define ll long long
#define pb push_back

#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, a, b) for(int i = (a); i > (b); --i)

typedef pair <int,int> ii;
typedef vector <int> vi;
typedef vector <ii> vii;
typedef vector <ll> vl;

const int mod = 1e9+7;
const ll inf = 2e18+5;

void solve(){
    int n,k;
    cin>>n;
    int a=0,b=0,c=0,d=0; string s;
    loop(i,0,n){
        cin>>s;
        if(s=="AC") a++;
        if(s=="WA") b++;
        if(s=="RE") d++;
        if(s=="TLE") c++;
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<b<<endl;
    cout<<"TLE x "<<c<<endl;
    cout<<"RE x "<<d<<endl;
}















signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
            freopen("fin.txt", "r", stdin);
            freopen("fout.txt", "w", stdout);
    #endif   
    int cases=1;
    //cin>>cases;
    
    
    for(int iter=0; iter<cases; iter++){      
        solve();
    }
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define bit(x,j) ((x>>j)&1)
using namespace std;
// bitset<8>set1(p);
// __builtin_popcountll(x);
// bitset<100> b("1010");
ll int mod=1e9+7;//998244353;
int mul(ll int x, ll int y)
{
    return (x * 1ll * y) % mod;
}

int add(int x, int y)
{
    x += y;
    while(x >= mod) x -= mod;
    while(x < 0) x += mod;
    return x;
}

long long power(long long a, long long b,ll m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = mul(res,a);
        a = mul(a,a);
        b >>= 1;
    }
    return res%m;
    }


  ll int binomial(ll int n, ll int k) 
{ 
    ll int C[k+1]; 
    memset(C, 0, sizeof(C)); 
  
    C[0] = 1;  // nC0 is 1 
  
    for (ll int i = 1; i <= n; i++) 
    { 
        // Compute next row of pascal triangle using 
        // the previous row 
        for (int j = min(i, k); j > 0; j--) 
            C[j] = C[j]+C[j-1]; 
    } 
    return C[k]; 
} 
  vector<int> pr;
  bool prime[10000000];
void Sieve(ll int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            pr.push_back(p);
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
}
 


//It reurns Fn,Fn+1
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}
int sum(int n)  
{  
    if (n == 0)  
    return 0;  
    return (n % 10 + sum(n / 10));  
}  
ll int factorial(ll int n,ll int m) 
{ 
    ll int fact = 1; 
    for(int i=2;i<=n;i++) { 
        fact = (fact * i)%m; 
    } 
    return fact%m; 
} 

int reduce(int x, int y) 
{ 
    int d; 
    d = __gcd(x, y); 
  
    x = x / d; 
    y = y / d; 
    return x; 
} 

int main() {
  ios;
  ll int x,k,d;
  cin>>x>>k>>d;
  x=abs(x);
  ll int l=x/d;
  if(l>=k)
  {
      x-=k*d;
      cout<<x<<endl;
      return 0;
  }
  x-=l*d;
  k-=l;
  //cout<<x<<" "<<k<<endl;
  if(k%2==1)
  {
     cout<<min(abs(x-d),abs(x+d))<<endl;
  }
  else
  {
      cout<<min(abs(x-2*d),abs(x))<<endl;
  }
  }


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (int i = 0;i < (int)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007
int main(){
  int N,M;
  cin >> N >> M;
  vector<lli> S(N);
  vector<int> ooo(100,0);
  int co=99;
  int cycle=0;
  rep(i, N){
  cin >> S[i];
    ooo[log2(S[i])]++;
  }
  rep(i, 100-1){
  ooo[99-i-1]+=ooo[99-i];
  }
  rep(i, M){
    while(co>-1&&ooo[co]==cycle){
      cycle=0;
      co--;
    sort(ALL(S));
    }
    if(N-cycle-1<0)
      cycle=0;
    S[N-cycle-1]/=2;
    cycle++;
  }
  lli sum =0;
  rep(i, N)
    sum+=S[i];
  cout << sum << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cassert>
#include <typeinfo>
#include <vector>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#include <random>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

int h,w,n;

int main(){
	cin>>h>>w>>n;
	vp a;
	vi used(n);
	for(int i=0;i<n;i++){
		int x,y,X,Y;
		cin>>x>>y>>X>>Y;
		if((x==0||x==h||y==0||y==w)&&(X==0||X==h||Y==0||Y==w)){
			if(!x) a.push_back({y,i});
			else if(y==w) a.push_back({w+x,i});
			else if(x==h) a.push_back({h+2*w-y,i});
			else a.push_back({2*w+2*h-x,i});		
			if(!X) a.push_back({Y,i});
			else if(Y==w) a.push_back({w+X,i});
			else if(X==h) a.push_back({h+2*w-Y,i});
			else a.push_back({2*w+2*h-X,i});
		}
	}
	sort(a.begin(),a.end());
	int S=a.size();
	stack<int> q;
	for(int i=0;i<S;i++){
		int k=a[i].second;
		if(used[k]){
			if(q.top()==k) q.pop();
			else{
				cout<<"NO"<<endl;
				return 0;
			}
		}
		else{
			q.push(k);
			used[k]=1;
		}
	}
	cout<<"YES"<<endl;
}

Measured memory_bytes: 2932
N , M  = map(int,input().split())
Xm = [ x for x  in  map(int, input().split()) ]
Xm.sort()
lst = []
for i in range(M -1):
    lst.append(abs(Xm[i] - Xm[i+1]))
               
if(N >= M ):
    print(0)
else:
    lst.sort(reverse=True)
    print(sum(lst[N-1:]))

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

using namespace std;

#define endl "\n"

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);cout.tie(NULL);
   
   int k;
   cin>>k;
   while(k--)
   cout<<"ACL";
    
   
     return 0;
}

Measured memory_bytes: 3504
# coding=utf-8

n, q = map(int, input().split())
queue = []
total_time = 0
finished_loop = 0

for i in range(n):
    name, time = input().split()
    queue.append([name, int(time)])

while True:
    n -= finished_loop
    finished_loop = 0
    for i in range(n):
        poped = queue.pop(0)
        name = poped[0]
        time = poped[1]
        if time > q:
            queue.append([name, time - q])
            total_time += q
        else:
            total_time += time
            print(name, total_time)
            finished_loop += 1

    if n == 0:
        break

Measured memory_bytes: 15780
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	set<string>s;
	string s1;
	cin>>s1;
	s.insert(s1);
	for(int i=1;i<n;i++){
	    string s2;
	    cin>>s2;
	    if(s.count(s2)||s2[0]!=s1[s1.length()-1]){
	   	    printf("No\n");
	   	    return 0;
	    }
	   	s.insert(s2);
	   	s1=s2;
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
//#define ll long long
//#define int  unsigned long long
#define pb push_back
#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int N = 300000;
int mod = 1e9 + 7;
int a[N], f[N];
string s;

main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n, k;
    cin >> n >> k;
    if (k == 1){
        cout << 0;
        return 0;
    }
    cout << n - k;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader(); 
        int N = r.i();
        int i1 = -1;
        int m1 = 0;
        int m2 = 0;
        for(int i = 0; i < N; i++){
            int A = r.i();
            if(m1 < A){
                i1 = i;
                m1 = A;
            } else if(m2 < A)
                m2 = A;                        
        }
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < N; i++){
            if(i == i1)
                sb.append(m2);
            else
                sb.append(m1);
            sb.append("\n");
        }
        print(sb);
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long.parseLong(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 42280
#include "bits/stdc++.h"

// Begin Header {{{
using namespace std;

#ifndef DEBUG
#define dump(...)
#endif

#define all(x) x.begin(), x.end()
#define rep(i, n) for (intmax_t i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (intmax_t i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (intmax_t i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)

constexpr size_t    operator""_zu(unsigned long long value) { return value; };
constexpr intmax_t  operator""_jd(unsigned long long value) { return value; };
constexpr uintmax_t operator""_ju(unsigned long long value) { return value; };

constexpr int INF = 0x3f3f3f3f;
constexpr intmax_t LINF = 0x3f3f3f3f3f3f3f3f_jd;

template <class T, class Compare = less<>>
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template <class T, class Compare = greater<>>
using MinHeap = priority_queue<T, vector<T>, Compare>;

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

template <class T>
inline istream& operator>>(istream &is, vector<T> &vec) {
    for (auto &e: vec) {
        is >> e;
    }
    return is;
}

inline void output() { cout << "\n"; }
template <class Head, class... Tail>
inline void output(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) {
        cout << " ";
    }
    output(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e: vec) {
        os << e << delim[&e == &vec.back()];
    }
    return os;
}

template <class T>
inline vector<T> makeVector(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeVector(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeVector<T>(initValue, args...))>(sz, makeVector<T>(initValue, args...));
}

template <class Func>
class FixPoint : Func {
public:
    explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {}

    template <class... Args>
    constexpr decltype(auto) operator()(Args&&... args) const {
        return Func::operator()(*this, std::forward<Args>(args)...);
    }
};

template <class Func>
static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept {
    return FixPoint<Func>{forward<Func>(f)};
}

template <class T>
inline bool chmax(T &a, const T &b) noexcept {
    return b > a && (a = b, true);
}

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

template <class T>
inline T diff(const T &a, const T &b) noexcept {
    return a < b ? b - a : a - b;
}
// End Header }}}

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

    var(string, r, g, b);

    const string n = r + g + b;
    output(stoi(n) % 4 == 0 ? "YES" : "NO");

    return 0;
}


Measured memory_bytes: 764
import java.util.Scanner;

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

        int result = 1;
        while(result <=  N ){
            result = result * 2;
        }
        System.out.println(result / 2);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

struct Combination {
    vector<int64_t> fact, rfact;
    Combination(int sz) : fact(sz + 1), rfact(sz + 1) {
        fact[0] = 1;
        for(int i = 1; i < fact.size(); i++){
            fact[i] = fact[i - 1] * i % mod;
        }
        rfact[sz] = inv(fact[sz]);
        for(int i = sz - 1; i >= 0; i--){
            rfact[i] = rfact[i + 1] * (i + 1) % mod;
        }
    }
    int64_t inv(int x) const {
        return pow(x, mod - 2);
    }
    int64_t pow(int64_t x, int64_t n) const {
        int64_t ret = 1;
        while(n > 0){
            if(n & 1) (ret *= x) %= mod;
            (x *= x) %= mod;
            n >>= 1;
        }
        return (ret);
    }
    int64_t P(int n, int r) const {
        if(r < 0 || n < r) return (0);
        return (fact[n] * rfact[n - r] % mod);
    }

    int64_t C(int p, int q) const {
        if(q < 0 || p < q) return (0);
        return (fact[p] * rfact[q] % mod * rfact[p - q] % mod);
    }

    int64_t H(int n, int r) const {
        if(n < 0 || r < 0) return (0);
        return (r == 0 ? 1 : C(n + r - 1, r));
    }
};

long long mod_pow(long long x, long long n){
    if(n == 0) return 1;
    long long res = mod_pow(x*x % mod, n / 2);
    if(n & 1) res = res*x % mod;
    return res;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, a, b, c;
    cin >> n >> a >> b >> c;
    int ans = 0;
    Combination cb(500010);
    int dv = mod_pow(a + b, mod - 2);
    for(int i = n; i <= 2 * n - 1; i++){
        int times = i * 100 * mod_pow(a + b, mod - 2) % mod;
        int pa = cb.C(i - 1, n - 1) * mod_pow(a, n) % mod * mod_pow(b, i - n) % mod * mod_pow(dv, i) % mod;
        int pb = cb.C(i - 1, n - 1) * mod_pow(a, i - n) % mod * mod_pow(b, n) % mod * mod_pow(dv, i) % mod;
        ans += times * (pa + pb) % mod;
        ans %= mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8064
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception {
	Scanner scan = new Scanner(System.in);
	int x = scan.nextInt();
	int y = scan.nextInt();
	if(x>y) System.out.println("a > b");
	else if(x<y) System.out.println("a < b");
	else System.out.println("a == b");
	}
}

Measured memory_bytes: 26076
#include<iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
using namespace std;

#define ll int64_t
const long MOD = 1e9 + 7;


int main()
{

  double a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  //濃度e
  //ビーカーの容量f

  //水の量
  //w = ai + bj
  set<double> w;
  for (int i = 0; i <= 30; ++i) {
    for (int j = 0; j <= 30; ++j) {
      if (i == 0 && j == 0)continue;
      if (100 * a * i + 100 * b * j > f)continue;
      w.insert(100 * a * i + 100 * b * j);
    }
  }

  //砂糖の量
  //s = ci + dj
  set<double> s;
  for (int i = 0; i <= e*30; ++i) {
    for (int j = 0; j <= e*30; ++j) {
      if (c * i + d * j > e*30 )continue;
      s.insert(c * i + d * j);
    }
  }


  //この組み合わせを出した後

  //<s,w>について全探索
  double NowBest = 0;
  double Max = e / 100;

  long ans_liquidSum, ans_sugerSum;

  // for (auto water : w) {
  //   cerr << "water:" <<water <<endl;
  // }
  // for (auto suger : s) {
  //   cerr << "suger:" <<suger <<endl;
  // // }

  double density_max = 0;
  double water_max = 0;
  double sugar_max = 0;


  for (auto water : w) {
    for (auto suger : s) {
      if (water + suger <= f && water + suger != 0 && water != 0) {
        double density = 100 * suger / (water + suger);
        double d_E = 100 * e / (100 + e);
        if (density <= d_E) {
          if (density >= density_max) {
            density_max = density;
            water_max = water;
            sugar_max = suger;
          }

        }
      }
    }
  }






  cout << water_max + sugar_max << " " << sugar_max << endl;

  return 0;
}


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

void dfs(int n, int c = 1, string acc = "a") {
  if (acc.size() == n) {
    cout << acc << endl;
    return;
  }
  int nc = max(c, acc.back() - 'a' + 1);
  for (int i = 0; i <= nc; ++i)
    dfs(n, nc, acc + char('a' + i));
}

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

  dfs(n);
}

Measured memory_bytes: 1536
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			while (sc.hasNext()) {
				String line = sc.nextLine();
				int offset = calculateIndex(line);
				System.out.println(encryptString(line, offset));
			}
		}
	}

	public static int calculateIndex(String str) {
		String[] ss = str.split(" ");
		for (String s : ss) {
			if (s.length() == 4) { // this, that
				if ((s.charAt(0) + 26 - 't') % 26 == (s.charAt(1) + 26 - 'h') % 26
						&& (s.charAt(0) + 26 - 't') % 26 == (s.charAt(2) + 26 - 'i') % 26
						&& (s.charAt(0) + 26 - 't') % 26 == (s.charAt(3) + 26 - 's') % 26) {
					return s.charAt(0) - 't';
				} else if ((s.charAt(0) + 26 - 't') % 26 == (s.charAt(1) + 26 - 'h') % 26
						&& (s.charAt(0) + 26 - 't') % 26 == (s.charAt(2) + 26 - 'a') % 26
						&& (s.charAt(0) + 26 - 't') % 26 == (s.charAt(3) + 26 - 't') % 26) {
					return s.charAt(0) - 't';
				}
			} else if (s.length() == 3) { // the
				if ((s.charAt(0) + 26 - 't') % 26 == (s.charAt(1) + 26 - 'h') % 26
						&& (s.charAt(0) + 26 - 't') % 26 == (s.charAt(2) + 26 - 'e') % 26) {
					return s.charAt(0) - 't';
				}
			}
		}
		return 0;
	}

	public static String encryptString(String str, int offset) {
		char[] result = new char[str.length()];
		for (int i = 0; i < str.length(); i++) {
			char cc = str.charAt(i);
			result[i] = cc;
			if (cc == ' ' || cc == '.') {
				continue;
			}
			result[i] = (char)((((result[i]) % 'a') + 26 - offset) % 26 + 'a');
		}
		return new String(result);
	}
}

Measured memory_bytes: 25600
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <cmath>

using namespace std;

int main(){

    bool n = false;
    bool w = false;
    bool s = false;
    bool e = false;

    string S;
    cin >> S;
    for(int i = 0; i < S.size(); i++){
        if(S[i] == 'N') n = true;
        if(S[i] == 'W') w = true;
        if(S[i] == 'S') s = true;
        if(S[i] == 'E') e = true;
    }

    if(n == s && e == w){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<int>vec(n);
    for(int i=0;i<n;i++){
        cin>>vec[i];
    }
    sort(vec.begin(),vec.end());
    for(int i=0;i<n-1;i++){
        if(vec[i]==vec[i+1]){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}



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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){
  
  int n,k;
  cin >> n >> k;
  vector<vector<int>> v(n);
  rep(i,n-1){
    int a,b;cin >> a >> b;
    a--,b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  vector<int> d(n,-1);
  d[0] = 0;
  queue<int> que;
  que.push(0);
  ll res = k;
  while(!que.empty()){
    int ov = que.front();que.pop();
    int size = v[ov].size();
    if(ov == 0)for(ll i = k-1;i >= k-size;i--)(res *= i)%= MOD;
    else for(ll i = k-2;i > k-1-size;i--)(res *= i)%= MOD;
    for(int nv : v[ov]){
      if(d[nv] != -1)continue;
      d[nv] = d[ov]+1;
      que.push(nv);
    }
  }
  cout << res << endl;



  return 0;
}

Measured memory_bytes: 6904
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>
#include <array>
#include <map>

using tile = std::array<int16_t, 4>;

tile rotate(const tile &t, int r) {
  tile res{};
  for (int i = 0; i < 4; ++i) {
    res[i] = t[(i + r) & 3];
  }
  return res;
}

tile normalize(const tile &t) {
  std::array<tile, 4> tmp{};
  for (int i = 0; i < 4; ++i) {
    tmp[i] = rotate(t, i);
  }
  std::sort(tmp.begin(), tmp.end());
  return tmp.front();
}

int type(const tile &t) {
  if (t[0] == t[1] && t[1] == t[2] && t[2] == t[3]) return 4;
  if (t[0] == t[2] && t[1] == t[3]) return 2;
  return 1;
}

int main() {
  int N;
  std::cin >> N;
  std::vector<tile> C(N);
  std::map<tile, int> memo;
  for (auto &t: C) {
    for (auto &x: t) {
      std::cin >> x;
    }
    t = normalize(t);
    memo[t]++;
  }
  int64_t ans = 0;
  for (int i = 0; i < N; ++i) {
    memo[C[i]]--;
    const auto &up = C[i];
    for (int j = i + 1; j < N; ++j) {
      memo[C[j]]--;
      for (int k = 0; k < 4; ++k) {
        auto down = rotate(C[j], k);
        std::map<tile, int> query;
        query[normalize(tile{ up[0], up[3], down[2], down[1] })]++;
        query[normalize(tile{ up[1], up[0], down[1], down[0] })]++;
        query[normalize(tile{ up[2], up[1], down[0], down[3] })]++;
        query[normalize(tile{ up[3], up[2], down[3], down[2] })]++;
        int64_t add = 1;
        for (auto &q: query) {
          auto itr = memo.find(q.first);
          if (itr == memo.end()) {
            add = 0;
            break;
          }
          int s = itr -> second, t = type(q.first);
          for (int i = 0; i < q.second; ++i) {
            add *= (s - i) * t;
          }
        }
        ans += add;
      }
      memo[C[j]]++;
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# coding: utf-8

# In[26]:


N = int(input())
A = sorted(list(map(int, input().split())))


# In[32]:


tmp = 0
asm = []
for i in range(N):
    tmp += A[i]
    asm += [tmp]
ans = 1
for i in range(2,N+1):
    if asm[-i]*2 >= A[-i+1]:
        ans += 1
    else:
        break
print(ans)


# In[ ]:






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

int main()
{
	int i, n;
	cin >> n;
	for (i = 1; i <= n; i++){
		int n1, n2, n3, a, b, c;
		cin >> n1 >> n2 >> n3;
		a = n1 > n2 ? n1 : n2;
		b = n1 + n2 - a;
		c = a > n3 ? a : n3;
		a= a + n3 - c;
		if (c == sqrt(a * a + b * b))
			cout << "YES\n";
		else cout << "NO\n";
	}
	return 0;
}

Measured memory_bytes: 1120
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define b begin
#define e end
using namespace std;
int main()
{
    ll n;
    cin>>n;
    ll x=0,w=0,t=0,r=0;
    ll i;
    for(i=0;i<n;i++){
        char a[4];
        scanf("%s",a);
        if(a[0]=='A')
        x++;
        else if(a[0]=='W')
        w++;
        else if(a[0]=='T')
        t++;
        else
        r++;
    }
    printf("AC x %lld\nWA x %lld\nTLE x %lld\nRE x %lld\n",x,w,t,r);
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n],mn=200,mx=-200,ans=2000000,sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]<mn)
        {
            mn=a[i];
        }
        if(a[i]>mx)
        {
            mx=a[i];
        }
    }
    for(int j=mn;j<=mx;j++)
    {
    for(int i=0;i<n;i++)
    {
       sum+=(a[i]-j)*(a[i]-j);
    }
           if(sum<ans)
       {
           ans=sum;
       }
       sum=0;
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int a, b, c, tmp;

  scanf("%d %d %d", &a, &b, &c);

  if(a > b) {
    tmp = a;
    a = b;
    b = tmp;
  }

  if(b > c) {
    tmp = b;
    b = c;
    c = tmp;
  }

  if(a > b) {
    tmp = a;
    a = b;
    b = tmp;
  }

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

  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n, m = 0;
int a[101];
vector<int> ans;
for(int i=1 ; i <= 100 ; i++){
a[i] = 0;
}
while( cin >> n ){
a[n]++;
}
for(int i=1 ; i <= 100 ; i++){
m = max( a[i] , m );
}
for(int i=1 ; i <= 100 ; i++){
if( m == a[i] ) ans.push_back(i);
}
for(int i=0 ; i < ans.size() ; i++ ){
cout << ans[i] << endl;
}
}

Measured memory_bytes: 3084
#include<iostream>
#include<cstdio>

using namespace std;

int main() {
  int a, b, n, sum_a, sum_b;
  sum_a = sum_b = n = 0;
  
  while(scanf("%d,%d", &a, &b) != EOF) {
    sum_a += (a * b);
    sum_b += b;
    n++;
    getchar();
  }
  //  cout << sum_b << endl;
  cout << sum_a  << endl << int(sum_b*1.0  / n + 0.5) << endl;

  return 0;
}

    

Measured memory_bytes: 1204
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	// 整数の入力
	int n,y,a,b,c;
	cin >> n>>y;
	for ( a = 0; a <= n; a++)
	{
		for ( b = 0; b <= n-a; b++)
		{
			for ( c = 0; c <= n-a-b; c++)
			{
				if (a*10000+b*5000+c*1000==y&&a+b+c==n)
				{
					cout << a << " " << b << " " << c << endl;
					return 0;
				}
			}
		}
	}
	
	// 出力
	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))
L.sort(reverse=True)

def f(j, max1, max2):
    L_temp = L[j+1:]
    # print("max1 = ", max1, "max2 = ", max2, L_temp)
    dif = max1 - max2
    left = -1
    right = len(L_temp)
    while right - left != 1:
        temp = (left+right)//2
        if dif < L_temp[temp]:
            left = temp
        else:
            right = temp
    if left != N:
        return left+1
    else:
        return left


ans = 0
max1 = 0
max2 = 0
for i in range(N):
    max1 = L[i]
    for j in range(i+1, N-1):
        max2 = L[j]
        ans += f(j, max1, max2)
        # print("ans = ", ans)
print(ans)


Measured memory_bytes: 52348
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
constexpr int mod = 1000000007;
using mint = Fp<mod>;
constexpr int a_max = 2001;
int main(){
  int n;
  mint k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<mint> cnt(n,0);

  for (int j = 0; j < n; j++) {
    mint sum = 0;
    for (int i = 0; i < j; i++) {
      if (a[i] > a[j]) sum += 1; 
    }
    cnt[j] = sum;
  }

  mint res = 0;

  for (int i = 0; i < n; i++) {
    mint d = k * (k - 1) / 2;
    mint cnt2 = 0;
    for (int j = 0; j < n; j++) if (a[j] > a[i]) cnt2 += 1; 
    res += cnt[i] * k + cnt2 * d;
  }

  cout << res << endl;

  return 0;
} 

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

using namespace std;


void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> X(n), b(n);
    {
        vector<pair<int, int>> a(n);
        for (int i = 0; i < n; i++) {
            int x,y;
            cin >> x >> y;
            a[i] = {x,y};
        }
        sort(a.begin(), a.end());
        for (int i = 0; i < n; i++) {
            tie(X[i], b[i]) = a[i];
        }
    }
    b.push_back(0);
    for (int i = n; i >= 1; i--) {
        b[i] ^= b[i-1];
    }
    vector<vector<pair<int,int>>> g(n + 1);
    for (int i = 0; i < m; i++) {
        int l,r;
        cin >> l >> r;
        l = lower_bound(X.begin(), X.end(), l) - X.begin();
        r = upper_bound(X.begin(), X.end(), r) - X.begin();
        if (l == r)continue;
        //cerr<<l <<','<<r<<endl;
        g[l].emplace_back(r, i);
        g[r].emplace_back(l, i);
    }
    
    vector<int> res(m);
    vector<bool> trk(n + 1);
    function<void(int,int)> dfs = [&](int u, int p){
        trk[u] = true;
        for (auto& _: g[u]) {
            int v,i;
            tie(v,i) = _;
            if (v == p) continue;
            if (trk[v]) continue;
            dfs(v, u);
            res[i] = b[v];
            b[u] ^= res[i]; b[v] ^= res[i];
        }
    };
    for (int i = 0; i <= n; i++) {
        if (!trk[i]) {
            dfs(i, -1);
            if (b[i]) {
                cout << -1; return;
            }
        }
    }
    for (int i = 0; i <= n; i++) {
        if (b[i]) {
            cout << -1; return;
        }
    }
    vector<int> ans;
    for (int i = 0; i < m; i++) {
        if (res[i]) ans.push_back(i);
    }
    cout << ans.size() << "\n";
    for (auto& x: ans) {
        cout << x+1 << ' ';
    }
}

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


Measured memory_bytes: 17896
/**
 *    author:  math2do
 *    created: 03.03.2020 11:22:06
**/

#include <bits/stdc++.h>

using namespace std;

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  read(n);
  int ans = n / 2 + (n % 2 != 0);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
def main():
    from collections import defaultdict
    from heapq import heappush, heappop
    _, m, *ab = map(int, open(0).read().split())
    works = defaultdict(list)
    # == zip(ab[0::2], ab[1::2])
    for a, b in zip(*[iter(ab)]*2):
        # 最大値が欲しいが、heappopは最小値を取り出すので-1倍しておく
        works[a].append(-b)

    candidates, pay = [], 0
    for day in range(1, m+1):
        for x in works[day]:
            heappush(candidates, x)
        if candidates:
            pay -= heappop(candidates)
    print(pay)


if __name__ == "__main__":
    main()


Measured memory_bytes: 35680
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int LEN = 0;

	void doIt() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.println(6 - a - b);
	}

	public static void main(String[] args) {
		new Main().doIt();
	}
}


Measured memory_bytes: 24276
from collections import Counter

N = int(input())
input_list = sorted([int(i) for i in input().split()])
inupt_dict = (Counter(input_list))
result = 0
input_dict_keys = inupt_dict.keys()

if N == 1:
    result = 1
elif N == 2 and input_list[0] == input_list[1]:
    result = 2
elif N == 2 and input_list[0] != input_list[1]:
    if input_list[1] == input_list[0] + 1:
        result = 2
    else:
        result = 1
else:
    for i in range(N-2):
        if i in input_dict_keys:
            if i+1 in input_dict_keys:
                if i+2 in input_dict_keys:
                    result = max(result, (inupt_dict[i] + inupt_dict[i+1] + inupt_dict[i+2]))
    for i in range(N-1):
        if i in input_dict_keys:
            if i+1 in input_dict_keys:
                result = max(result, (inupt_dict[i] + inupt_dict[i+1]))
    for i in range(N):
        if i in input_dict_keys:
            result = max(result, inupt_dict[i])

print(result)

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    ll h, w; cin >> h >> w;
    if (h == 1 || w == 1) cout << 1 << endl;
    else cout << (h * w + 1) / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  vector<int> l(n);
  for(int i=0; i<n; i++){
	  cin >> l[i];
  }

  int result = 0;
  
  //for(int i=0; i<l.size(); i++){
  //  cout << l[i] << endl;
  //}
  
  if(n==1){
	  cout << result << endl;
	    return 0;
  }
  
  for(int i=0; i<l.size()-2; i++){
    //cout << i << "-" << l[i] << " " << endl;
    for(int j=i+1; j<l.size()-1; j++){
      //cout << "  " << j << "-" <<  l[j] << endl;
      for(int k=j+1; k<l.size(); k++){
        //cout << "    " << k << "-" << l[k];
        if(l[i] != l[j] && l[i] != l[k] && l[j] != l[k] && (l[i] + l[j] > l[k] && l[i] + l[k] > l[j] && l[j] + l[k] > l[i]) ){
          result++;
          //cout << "[x]";
        }
        //cout << endl;
      }
    }
  }

  cout << result << endl;

  return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int check(string S) {

    int N = S.length();
    int ans = N;
    rep(i,N) {
        if (S[i] == '1') {
            ans = min(ans, max(i, N - 1 - i));
        }
    }

    return ans;

}

int main() {

    string S;
    cin >> S;

    int N = S.length();
    int ans = check(S);

    rep(i,N) S[i] = (S[i] == '0' ? '1' : '0');
    ans = max(ans, check(S));

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

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define EPS 0.000000001 //1e-9
using ll = long long;
using pii = pair<int, int>;
const long long INF = 2e18;

template <class A, class B> ostream& operator<<(ostream &os, const pair<A, B> &p) {os << "(" << p.first << ", " << p.second << ")"; return os;} 
template <class A> ostream& operator<<(ostream &os, const vector<A> &v) {os << "{"; for(int i = 0; i < (int)v.size(); i++) if(i == 0) os << v[i]; else os << ", " << v[i]; os << "}"; return os;}

void dprint(string s) {cout << endl;}
template <class T, class... U> void dprint(string s, T t, U... u) 
{int w = s.find(','); cout << "[" << s.substr(0, w) << ": " << t << "] "; dprint(s.substr(w+2, (int)s.size()-w-1), u...);} 

#define DEBUG 
#ifdef DEBUG
#define dbg(X...) dprint(#X, X)
#else
#define dbg(X...) "KEEP CALM" 
#endif

const int N=1e6+5; // CHANGE this value ACC. TO Q.

int32_t main()
{
    IOS;
    int n; cin>>n;
    int arr[n];
    for(int &x: arr)
        cin>>x;
    int mx=arr[0];
    int ans=0;
    for(int i=1;i<=n-1;i++)
    {
        ans+=max(0ll, mx-arr[i]);
        mx=max(mx, arr[i]);
    }
    cout<<ans;
    return 0;
}

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

bool IsPrime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0)
            return false;
    }
    return true;
}
 
int main(){
    int X;
    cin >> X;
    
    for(int i=X;;i++){
        if( IsPrime(i) ){
            cout << i << endl;
            return 0;
        }
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define precise cout.precision(8); cout << fixed;
#define seed srand(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);
using namespace std;

int main() {

    zoom;    
    ll N, K; cin >> N >> K;
    vector<ll> A(N);
    vector<bool> one(K + 1, false);
    for(ll i = 0; i < N; i += 1) {
        cin >> A[i];
        one[A[i]] = true;
    }
    for(ll i = 1; i <= K; i += 1) {
        if(one[i])
            continue;
        for(ll j : A) {
            if(j > i)
                break;
            if(!one[i - j]) {
                one[i] = true;
                break;
            }
        }
    }
    if(one[K])
        cout << "First";
    else
        cout << "Second";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int n;
	while(cin>>n){
		if(n==0) break;
		const int SIZ[]={60,80,100,120,140,160};
		const int W[]={2,5,10,15,20,25};
		const int FEE[]={600,800,1000,1200,1400,1600,0};
		int x,y,h,w,sum=0;
		for(int i=0;i<n;++i){
			cin>>x>>y>>h>>w;
			int j,size=x+y+h;
			for(j=0;j<6;++j)if(size<=SIZ[j]&&w<=W[j]) break;
			sum+=FEE[j];
		}
		cout<<sum<<"\n";
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<long> a(n), sum1(n), sum2(n);
    long ans1 = 0, ans2 = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(i > 0){
            sum1[i] = sum1[i-1] + a[i];
            sum2[i] = sum2[i-1] + a[i];
        }else
            sum1[0] = sum2[0] =  a[0];
        if(i % 2 == 0){
            if(sum1[i] <= 0){
                ans1 += abs(1 - sum1[i]);
                sum1[i] = 1;
            }
            if(sum2[i] >= 0){
                ans2 += abs(-1 - sum2[i]);
                sum2[i] = -1;
            }
        }
        if(i % 2 == 1){
            if(sum1[i] >= 0){
                ans1 += abs(-1 - sum1[i]);
                sum1[i] = -1;
            }
            if(sum2[i] <= 0){
                ans2 += abs(1 - sum2[i]);
                sum2[i] = 1;
            }
        }
    }
    cout << min(ans1, ans2) << endl;
}

Measured memory_bytes: 2560
import math
n = int(input())
C = list()
for _ in range(n):
  a, b = map(int, input().split(" "))
  C.append((a, b))

D = list()
for i, (x1, y1) in enumerate(C):
  for j, (x2, y2) in enumerate(C):
    if i>=j:continue
    d = math.sqrt((x1-x2)**2+(y1-y2)**2)
    D.append(d)

# print(D)
D = [x*(2*math.factorial(n-1)) for x in D]
# print(D)
# print(sum(D))
# print(math.factorial(n))
print(sum(D) / math.factorial(n))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
void Main()
{
    ll n;
    cin >> n;

    vector<ll> T(n), A(n);
    rep(i, n) cin >> T[i] >> A[i];
    
    ll t = T[0], a = A[0];
    repi(i, n) {
        ll v = 1e18;

        ll v1 = (t + T[i] - 1) / T[i];
        ll t1 = T[i] * v1;
        ll a1 = A[i] * v1;
        if (t1 >= t && a1 >= a) {
            v = min(v, v1);
        }

        ll v2 = (a + A[i] - 1) / A[i];
        ll t2 = T[i] * v2;
        ll a2 = A[i] * v2;
        if (t2 >= t && a2 >= a) {
            v = min(v, v2);
        }

        t = T[i] * v;
        a = A[i] * v;
    }

    cout << t + a << endl;
}
signed main(){ Main();return 0;}

Measured memory_bytes: 3572