akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys
import math
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def gcd(*numbers):
    return reduce(math.gcd, numbers)

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

    ans = 0
    for a in range(1, K + 1):
        for b in range(1, K + 1):
            for c in range(1, K + 1):
                ans += gcd(a, b, c)
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 74712
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}

main(){
  int n;
  cin>>n;
  vector<P> v(n);

  rep(i,n){
    cin>>v[i].S>>v[i].F;
  }

  sort(all(v));

  int t=0;
  rep(i,n){
    if(t+v[i].S>v[i].F){
      cout<<"No"<<endl;
      return 0;
    }
    t+=v[i].S;
  }

  cout<<"Yes"<<endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
#define LL long long 

int main(){
    int r,g,b;
    int x, y;
    cin >> x >> y;
    if(x == 2){
        if(y == 2){
            cout << "Yes" << endl;
        }else
        {
            cout<< "No" << endl;
        }  
    }else if(x == 4 || x == 6 || x == 9 || x == 11){
        if(y == 4 || y == 6 || y == 9 || y == 11){
            cout << "Yes" << endl;
        }else
        {
            cout<< "No" << endl;
        }  
    }else{
        if(y != 4 && y != 6 && y != 9 && y != 11 && y != 2){
            cout << "Yes" << endl;
        }else
        {
            cout<< "No" << endl;
        }  
    }
}

Measured memory_bytes: 888
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    a, b, c = map(int, readline().split())
    print(a+b+c-max(a,b,c))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9236
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define rep1(i, n) for (int i = 1; i < int(n); ++i)
#define repx(i, x, n) for (int i = int(x); i < int(n); ++i)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define ALL(n) begin(n), end(n)
#define IN(a, x, b) ((a) <= (x) && (x) < (b))
#define OUT(a, x, b) ((x) < (a) || (x) < (b))
typedef long long ll;
typedef long double ld;
const ll INF = 1e18;
const ll MOD = 1000000007;

int main()
{
    ll n, ans;
    cin >> n;
    for (ans = 1; ans * ans <= n; ++ans)
    {
        if (ans * ans > n)
        {
            break;
        }
    }
    cout << (ans - 1) * (ans - 1) << endl;
    return 0;
}


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

#define int long long
#define uint unsigned int
#define pii pair<int, int>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,n,0)
#define ALL(c) ((c).begin()), ((c).end())

#define PB(a) push_back(a)
#define EMPB(...) emplace_back(__VA_ARGS__)
#define EMP(...) emplace(__VA_ARGS__)
#define MP(a,b) make_pair(a,b)
#define MT(...) make_tuple(__VA_ARGS__)

#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))

#define PW(n) (1LL << (n))

using namespace std;

template <class T> inline bool CHMIN(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T> inline bool CHMAX(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline void SORT(T &a) { sort(a.begin(), a.end()); }
template <class T> inline void REV(T &a) { reverse(a.begin(), a.end()); }
template <class T> inline void UNI(T &a) { sort(a.begin(), a.end()); a.erase(unique(a.begin(), a.end()), a.end()); }

template <class S, class T> ostream& operator << (ostream& os, const pair<S, T> v) {
  os << "(" << v.first << ", " << v.second << ")"; return os;
}

const int MOD = 1000000007;
const int INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

/* ---------------------------------------------------------------------------------------------------- */

string s;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> s;
  cout << ((s.size() & 1) ^ (s[0] == s.back()) ? "First" : "Second") << endl;

  return 0;
}

Measured memory_bytes: 512
//To debug :  g++ -g file.cpp -o code
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 INT_MAX
#define big3 1000000000
#define sma -(big+1)
#define sma1 LONG_MIN
#define sma2 INT_MIN
#define sma3 -1000000000
#define mp make_pair
#define mt make_tuple
#define dub double
#define ivec vector<int>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define inv2 500000004
#define MOD 998244353 
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);

int main()
{

	ll ans = 0;

	ll x;

	cin>>x;

	ans = (x/500)*1000;
	x = x%500;

	ans += (x/5)*5;


	cout<<ans<<"\n";




	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()
z1000 = [0 for _ in range(1000)]
l = [-1 for _ in range(10)]
r = [-1 for _ in range(10)]
for i in range(n):
  d = int(s[i])
  if l[d] == -1:
    l[d] = i
for i in range(n)[::-1]:
  d = int(s[i])
  if r[d] == -1:
    r[d] = i
for i in range(n):
  d = int(s[i])
  for dl in range(10):
    for dr in range(10):
      if l[dl] != -1 and r[dr] != -1:
        if l[dl] < i < r[dr]:
          z1000[100*dl+10*d+dr] = 1
#print(l)
#print(r)
#for j in range(1000):
  #if z1000[j] == 1:
    #print(j)
print(sum(z1000))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
 
#define INF 1234567890
#define ll long long

int N, M;
vector<int> g[100101];

int main()
{
	scanf("%d %d", &N, &M);
	for(int i=0; i<M; i++)
	{
		int a, b;
		scanf("%d %d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
	}
	queue<int> q; vector<int> p(100101, -1);
	q.push(1); p[1] = 1;
	while(!q.empty())
	{
		int n = q.front(); q.pop();
		for(auto &next : g[n])
		{
			if (p[next] != -1) continue;

			q.push(next);
			p[next] = n;
		}
	}
	printf("Yes\n");
	for(int i=2; i<=N; i++)
		printf("%d\n", p[i]);
	return 0;
}

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

int cost(int a[], int dp[], int n, int i)
{
	if(i > n-1)
		return 100000;
	if(i == n-1)
		return 0;
	if(dp[i] >= 0 )
		return dp[i];
	else
	{
		int k1 = abs(a[i+1] - a[i]) + cost(a, dp, n, i+1); 
		int k2 = abs(a[i+2] - a[i]) + cost(a, dp, n, i+2);
		if(k1 > k2)
		{
			dp[i] = k2;
		}
		else
		{
			dp[i] = k1;
		}
		return dp[i]; 
	}
}

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

	cin >> n;

	int a[n+2] = {};
	int dp[n];

	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
		dp[i] = -1;	
	}

	int k = cost(a, dp, n, 0);


	cout << k;
	return 0;
}


Measured memory_bytes: 8832
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#define INF 1000000000
#define MOD 1000000007

using namespace std;

int main()
{
    long long i;
    long long n;

    cin >> n;

    i = 1;
    while (i * (i + 1) / 2 < n) i++;

    cout << i << endl;

    return 0;
}


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

int main()
{
	int a, b, c, x, y;
	cin >> a >> b >> c >> x >> y;
	cout << min({ a * x + b * y, c * 2 * x + b * max(0, y - x), a * max(0, x - y) + c * 2 * y }) << endl;
	return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod= 1e+9+7;

const int MAX=1000010;
ll fac[MAX],finv[MAX],inv[MAX];

void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
ll C(int n,int k){
    if(n<k)return 0;
    if(n<0||k<0)return 0;
    return fac[n]*(finv[k]*finv[n-k]%mod)%mod;
}


int main(){
    ll x,y; cin>>x>>y;
    if(2*x-y<0||2*y-x<0||(2*x-y)%3!=0||(2*y-x)%3!=0){
        cout<<0<<endl;
        return 0;
    }
    ll n=(2*x-y)/3,m=(2*y-x)/3;
    COMinit();
    ll ans=C(n+m,n);
    cout<<ans<<endl;
}



























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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  double total = 0;
  rep(i, n) total += 1.0 / a[i];
  double ans = 1.0 / total;
  printf("%.10f\n", ans);
  return 0;
}

Measured memory_bytes: 3760
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
 
using namespace std;

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

    string s;
    map<string,int> mp;

    for ( int i = 0 ; i < n ; i++ )
    {
        cin>>s;
        mp[s]++;
    }
    int a = 0;
    for ( map<string,int>::iterator it = mp.begin() ; it != mp.end() ; it++ )
    {
        a = max(a,it->second);
    }

    for ( map<string,int>::iterator it = mp.begin() ; it != mp.end() ; it++ )
    {
        if ( it->second == a )
        {
            cout<<it->first<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 23808
#include <bits/stdc++.h>
using namespace std;
ofstream fo("output.out");
#define fast() {ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}
#define out(a) { fo << #a << ":" << (a) <<" ";}
#define outv(a) { fo << "["; \
	for(int i = 0; i < (a).size(); ++i){ \
		fo << i <<":" << a[i] <<" "; \
		if(i % 10 == 9) fo <<"\n"; \
		} \
	fo << "]"; \
}
#define outvv(a) { fo << "["; \
	for(int i = 0; i < a.size(); ++i){ \
		for(int j = 0; j < a[i].size(); ++j){ \
			fo << "(" << i <<"," <<j <<")" <<":" << a[i][j] <<" "; \
		} \
		fo << "\n"; \
	} \
	fo << "]"; \
}
#define outp(a) { fo <<"[" << #a << ".fi:"<<a.first; \
					fo << " "<< #a << ".se:" << a.second <<"]"; }
using ll = long long;
const int mod = 1e9 + 7;
void add_self(int &a, int b){
	a += b;
	if(a >= mod) {
		a -= mod;
	}
}
void sub_self(int &a, int b){
	a -= b;
	if(a < 0){
		a += mod;
	}
}
int main()
{
    int n, k;
    cin >> n >> k;
    vector<int>dp(k + 1, 0);
    dp[0] = 1;
   
    for(int child = 0; child < n; ++child){
    	int up_to;
    	cin >> up_to;
    	//sum += up_to;
    	vector<int>sum(k+2, 0);
    	for(int candies = k; candies >= 0; --candies){
    		int temp = dp[candies];
    		int L = candies + 1;
    		int R = candies + min(up_to, k - candies);
    		if(L <= R){
	    		add_self(sum[L], temp);
	    		sub_self(sum[R + 1], temp);
			}
    		/*for(int i = L; i <= R; ++i){
    			add_self(dp[candies + i], temp);
    		}*/
    	}
    	int prefix = 0;
    	for(int i = 0; i <= k; ++i){
    		add_self(prefix, sum[i]);
    		add_self(dp[i], prefix);
    	}	
    }
   
    cout << dp[k];
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/22  Problem: ABC 051 C / Link: http://abc051.contest.atcoder.jp/tasks/abc051_c  ----- */


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

	LL sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;
	LL x = tx - sx, y = ty - sy;

	string U = string(y, 'U');
	string R = string(x, 'R');
	string D = string(y, 'D');
	string L = string(x, 'L');
	string ans = U + R + D + L + "LU" + U + R + "RDRD" + D + L + "LU";
	
	
	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 256
s = list(map(int, input()))
ans1 = 0
ans2 = 0
for i in range(len(s)):
    if i%2 == 0:
        if s[i] == 0:
            ans1 += 1
        else:
            ans2 += 1
    else:
        if s[i] == 0:
            ans2 += 1
        else:
            ans1 += 1
ans = min(ans1, ans2)
print(ans)

Measured memory_bytes: 9924
#include <bits/stdc++.h>
#define PB push_back
#define MAX3(i,j,k) max(i,max(j,k))
#define MIN3(i,j,k) min(i,min(j,k))
#define FOR(i,k) for(int i=0; i<k; i++)
#define OUT(x) cout<<(x)<<endl
#define F first
#define S second

using namespace std;

typedef pair<int, int> PII;
vector<PII> neighbors = {{0,1}, {1,0}, {-1,0}, {0,-1}};
template <typename T,typename U>
pair<T,U> operator+(const pair<T,U> & l,const pair<T,U> & r) {   
  return {l.F+r.F,l.S+r.S};
}         
bool IsValid(PII &p, int H, int W) {
  return p.F >= 0 && p.S >= 0 && p.F < H && p.S <= W;
}

int main() {
  int H,W;
  bool g[50][50];
  cin>>H>>W;
  FOR(y, H)
    FOR(x, W) {
      char in;
      cin>>in;
      if(in=='#')
	g[y][x] = true;
      else
	g[y][x] = false;
    }
  
  FOR(y, H) {
    FOR(x, W) {
      int neighborCount = 0;
      for(auto &n : neighbors) {
	PII newCoord = n + PII({y, x});
	if(!IsValid(newCoord, H, W))
	  continue;
	if(g[newCoord.F][newCoord.S])
	  neighborCount++;
      }
      if(g[y][x] && neighborCount == 0) {
	OUT("No");
	return 0;
      }
    }
  }
  OUT("Yes");
}

Measured memory_bytes: 256
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let alice = (input::<u32>(), input::<u32>());
    let bob = (input::<u32>(), input::<u32>());

    let (first, second) = if alice.0 < bob.0 {
        (alice, bob)
    } else {
        (bob, alice)
    };

    if first.1 > second.0 {
        let e = std::cmp::min(second.1, first.1);
        println!("{}", e - second.0);
    } else {
        println!("0")
    }
}

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

int main(){
  int32_t N;
  vector<int32_t> L;

  int32_t Lsum = 0;
  
  cin >> N;
  for (int i=0; i<N; i++) {
	int Li;
	cin >> Li;
	L.push_back(Li);
	Lsum += Li;
  }

  string ans = "Yes";
  for (int i=0; i<N; i++) {
	// cout << "#" << L.at(i) << endl;
	if ( L.at(i) >= Lsum - L.at(i) ) ans = "No";
  }

  cout << ans << endl; 
}

Measured memory_bytes: 256
#![allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}
fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let n: usize = read();
    let a: Vec<i64> = read_vec();
    let m = 1000000007;
    let mut sum = 0;
    let mut ans = 0;
    for i in (1..n).rev() {
        sum = (sum + a[i]) % m;
        ans = (ans + ((sum * a[i - 1]) % m)) % m;
    }
    println!("{}", ans);
}

Measured memory_bytes: 6508
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;

int mat[102][102];
int N, M;

vector<int> vs;
int ans;

void dfs(int v){
    int n = vs.size();
    if(n > 1){
        int total = 0;
        for(int p : vs){
            int score = 1000002;
            for(int q : vs){
                if(p == q) continue;
                score = min(score, mat[p][q]);
            }
            total += score;
        }
        ans = max(ans, total);
    }
    for(int nv=v+1;nv<N;nv++){
        bool ok = true;
        for(int p : vs){
            if(mat[p][nv] == 0){
                ok = false;
                break;
            }
        }
        if(ok){
            vs.push_back(nv);
            dfs(nv);
            vs.pop_back();
        }
    }
}

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

    memset(mat, 0, sizeof(mat));
    for(int i=0;i<M;i++){
        int u, v, f;
        cin >> u >> v >> f;
        u--; v--;
        mat[u][v] = f;
        mat[v][u] = f;
    }

    ans = 0;
    vs.clear();
    for(int i=0;i<N;i++){
        vs.push_back(i);
        dfs(i);
        vs.pop_back();
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3208
/*input

*/


//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
#include<bits/stdc++.h>
using namespace std;
#define ll          long long
#define pb          push_back
#define pii         pair<ll int,ll int>
#define vpii        vector< pii >
#define vi          vector<ll int>
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int solve()
{
	ll n,m;cin>>n>>m;
	vvi adj(n,vi ());
	vvi can_be_reached(n,vi ());
	rep(i,0,m)
	{
		ll x,y;cin>>x>>y;
		x--,y--;
		adj[x].pb(y);
		can_be_reached[x].pb(y);
	}

	double ans=inf;
	rep(del,0,n)
	{
		vector<double> dp(n,0);
		repr(i,n-2,-1)
		{
			double k = (double)sz(can_be_reached[i]);
			if(i!=del)
			{
				for(double j=0;j<k;j++) dp[i]+=dp[can_be_reached[i][(ll)j]];
				dp[i]/=k;
				dp[i]+=1;
			}
			else
			{
				double mx=0;
				for(double j=0;j<k;j++) mx=max(mx,dp[can_be_reached[i][(ll)j]]);
				dp[i]-=mx;
				for(double j=0;j<k;j++) dp[i]+=dp[can_be_reached[i][(ll)j]];
				dp[i]/=(k-1);
				dp[i]+=1;
			}
		}
		ans=min(ans,dp[0]);
	}

	cout<<setprecision(15)<<ans<<"\n";	
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	// cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}


Measured memory_bytes: 4736
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
#include <utility>
typedef long long ll;
using namespace std;

int main(void){
  int a,b;
  cin>>a>>b;

  if(b>a)swap(a,b);

  for(int i=0;i<a;i++){
    cout<<b;
  }
  cout<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define N 200005
int n,ans,a[N],v[N];
void upd(int x) {for(;x<=n;x+=x&-x) ++v[x];}
int qSm(int x) {int res=0;for(;x;x-=x&-x) res+=v[x];return res;}
int main()
{
	scanf("%d",&n);
	for(int i=1,x;i<=n;++i)
	{
		scanf("%d",&x);
		if(!qSm(x)) ++ans;upd(x);
	}printf("%d\n",ans);return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
#include<queue>
using namespace std;
typedef pair<int,int> P;

int H, W, N;
int map[1000][1000];
bool visited[1000][1000];
P Points[10];
int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

struct point {
    int x;
    int y;
    int step;
    point(int xx, int yy, int ss) : x(xx), y(yy), step(ss) {} 
};

int main() {
    cin >> H;
    cin >> W;
    cin >> N;
    char tmp[1000];
    for (int i = 0; i < H; i++) {
        cin >> tmp;
        for (int j = 0; j < W; j++) {
            if (tmp[j] == 'X') map[i][j] = 1;
            else {
                map[i][j] = 0;
                if (tmp[j] == 'S') {
                    Points[0] = make_pair(i,j);
                }
                else if (tmp[j] != '.') {
                    Points[tmp[j]-'0'] = make_pair(i,j);
                }
            }
        }
    }

    int res = 0;

    for (int i = 0; i < N; i++) {
        P start = Points[i];
        P goal = Points[i+1];
        int sx = start.first, sy = start.second, gx = goal.first, gy = goal.second;
        
        memset(visited,false,sizeof(visited));
        visited[sx][sy] = true;
        queue<point> que;
        que.push(point(sx,sy,0));

        while (!que.empty()) {
            point p = que.front(); que.pop();
            int x = p.x, y = p.y, s = p.step;
            if (x == gx && y == gy) {
                res += s;
                break;
            }
            for (int i = 0; i < 4; i++) {
                int x1 = x + dx[i], y1 = y + dy[i];
                if (x1 >= 0 && x1 < H && y1 >= 0 && y1 < W && !visited[x1][y1] && map[x1][y1] == 0) {
                    visited[x1][y1] = true;
                    que.push(point(x1,y1,s+1));
                }
            }
        }
    }
    cout << res << "\n";

}


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

using namespace std;

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

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

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

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

    ll N, M;
    cin >> N >> M;

    vector<ll> cnt(N+1, 1);
    vector<bool> flags(N+1, false);
    flags[0] = true;

    rep (i, M) {
        ll x, y;
        cin >> x >> y;
        x--;
        y--;

        if (flags[x]) {
            flags[y] = true;
        }

        cnt[x]--;
        cnt[y]++;
        if (cnt[x] <= 0) {
            flags[x] = false;
        }
    }

    ll ans = 0;
    rep (i, N) {
        if (flags[i]) {
            ans++;
        }
    }

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

Measured memory_bytes: 1024
using System;

namespace A___Measure
{
    class Program
    {
        static void Main (string[] args)
        {
            var s = Console.ReadLine ();
            if (s.Length == 2)
                Console.WriteLine (s);

            else
            {
                for (var i = s.Length - 1; i >= 0; i--)
                {
                    Console.Write (s[i]);
                }
                Console.WriteLine ();
            }
        }
    }
}

Measured memory_bytes: 11092
#include <stdio.h>
#include <stdlib.h>

#define N	100000

long long ss[N];

int compare(const void *a, const void *b) {
	int i = *(int *) a;
	int j = *(int *) b;

	return ss[i] < ss[j] ? -1 : 1;
}

int search(int *ii, int n, long long s) {
	int lower = -1, upper = n;

	while (upper - lower > 1) {
		int h = (lower + upper) / 2;

		if (ss[ii[h]] <= s)
			lower = h;
		else
			upper = h;
	}
	return lower == -1 || ss[ii[lower]] != s ? -1 : ii[lower];
}

int main() {
	static int ii[N], sz[N], pp[N], dd[N];
	int n, i;
	long long sum;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%lld", &ss[i]);
		ii[i] = i;
	}
	qsort(ii, n, sizeof *ii, compare);
	for (i = 0; i < n; i++)
		sz[i] = 1;
	for (i = n - 1; i > 0; i--) {
		int p = search(ii, n, ss[ii[i]] - (n - sz[ii[i]] * 2));

		if (sz[ii[i]] * 2 >= n || p == -1) {
			printf("-1\n");
			return 0;
		}
		pp[ii[i]] = p, sz[p] += sz[ii[i]];
	}
	sum = 0;
	for (i = 1; i < n; i++)
		sum += dd[ii[i]] = dd[pp[ii[i]]] + 1;
	if (ss[ii[0]] != sum) {
		printf("-1\n");
		return 0;
	}
	for (i = 1; i < n; i++)
		printf("%d %d\n", ii[i] + 1, pp[ii[i]] + 1);
	return 0;
}


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

ll k;

ll s(ll x)
{
	ll s = 0;
	while (x)
    {
        s += x % 10;
        x /= 10;
    }
	return s;
}

int main()
{
    ll d = 1, n = 1;

	cin >> k;
	cout << "1\n";
	while(--k) {
		if ((n + d * 10) * s(n + d) < (n + d) * s(n + d * 10))
            d *= 10;
		cout << (n += d) << "\n";
	}
	return 0;
}


Measured memory_bytes: 256
while 1:
    n=int(input())
    if n==0:break
    a=[set(list(map(int,input().split()))[1:])for _ in range(n)]
    b=set(list(map(int,input().split()))[1:])
    c=[i+1 for i in range(n) if b<=a[i]]
    print(c[0] if len(c)==1 else -1)

Measured memory_bytes: 9044
#include <stdio.h>

int greatest_value(int A, int B) {
    int greatest = A + B, op = A - B;
    
    if(op > greatest) {
        greatest = op;
    }

    op = A * B;

    if(op > greatest) {
        greatest = op;
    }

    return greatest;

}


int main() {
    int A, B;

    scanf("%d %d", &A, &B);

    printf("%d\n", greatest_value(A, B));

    return 0;
}

Measured memory_bytes: 128
#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
#mod = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    A=[]
    for i in range(n):
        A.append(INT())
    
    B=sorted(A,reverse=True)
    m1=A.count(B[0])
    m2=A.count(B[1])
    if m1>=2:
        flg=True
    else:
        index=A.index(B[0])
        flg=False

    #print(A,B,index)

    if flg:
        for i in range(n):
            print(B[0])
    else:
        for i in range(n):
            if i!=index:
                print(B[0])
            else:
                print(B[1])


if __name__=='__main__':
    do()

Measured memory_bytes: 19016
require 'prime'

N = gets.chomp!.to_i
sum = 0

x = Prime.instance.prime_division(N).map {|n, e|
    #puts "#{n},#{e}"
    0.upto(e).map {|i| n ** i }
}
x << [1]

x[0].product(*x[1..-1]) {|x| 
    m = x.inject(1) {|c, x| c *= x } - 1
    next if m == 0
    a = N / m 
    b = N % m
    sum += (a == b ? m : 0)
}

puts sum

Measured memory_bytes: 2556
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int n, m;
vector<int> a;
int main() {
  while (cin >> n >> m) {
	a.resize(n);
	for (int i = 0; i < n; ++i) {
	  cin >> a[i];
	  --a[i];
	}

	long long def = 0;
	for (int i = 0; i < n-1; ++i) {
	  if (a[i] < a[i+1]) def += a[i+1] - a[i];
	  else def += (a[i+1] + m) - a[i];
	}

	vector<long long> sum(m*2+5, 0);
	for (int i = 0; i < n-1; ++i) {
	  if (a[i] < a[i+1]) {
		sum[a[i]+m+2]++;
		sum[a[i+1]+m+2] += (a[i+1] - a[i] - 1);
		sum[a[i+1]+m+1] -= (a[i+1] - a[i]);
	  }
	  else {
		sum[a[i]+2]++;
		sum[a[i+1]+m+2] += (a[i+1]+m - a[i] - 1);
		sum[a[i+1]+m+1] -= (a[i+1]+m - a[i]);
		sum[a[i]+m+2]++;
	  }
	}
	for (int iter = 0; iter <= 2; ++iter) {
	  //for (int i = 0; i <= m * 2 + 1; ++i) cout << i << ": " << sum[i] << endl;
	  
	  if (iter == 2) break;
	  for (int i = 0; i <= m*2+1; ++i) {
		sum[i+1] += sum[i];
	  }
	}

	long long res = 0;
	int pres = -1;
	for (int i = m; i < m*2; ++i) {
	  if (chmax(res, sum[i])) {
		pres = i-m;
	  }
	}

	//COUT(def); COUT(res); COUT(pres);

	cout << def - res << endl;
	
  }
}




Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;


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

	ll pos = 0, neg = 0, sum = 0;
	for (int i = 0; i < n; ++i) {
		ll diff = b[i] - a[i];
		sum += diff;
		if (diff <= 0) neg -= diff;
		else pos += (diff) / 2;
	}
	string ans = "No";
	if (neg<= pos)ans = "Yes";
	cout << ans << endl;
}


Measured memory_bytes: 384
#include<iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<stdlib.h>
using namespace std;
#define PI 3.14159265358979
typedef unsigned long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#include<set>
//---------------------------------------------
 


int main(void)
{
string s;
cin>>s;

if(s[2]==s[3]&&s[4]==s[5]) cout<<"Yes"<<endl;

else cout<<"No"<<endl;

}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    ll n,m;cin >>n>>m;
    vector<ll>x(m);
    for (int i = 0; i < m; ++i) {
        cin >>x[i];
    }
    sort(all(x));
    vector<ll>d;
    ll ans=0;
    for (int i = 0; i < m- 1; ++i) {
        d.push_back(x[i + 1] - x[i]);
    }
    sort(all(d));
    ll s=m-n;
    for (int j = 0; j <s; ++j) {
        ans+=d[j];
    }
    cout <<ans <<endl;
    return 0;
}

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

int lose[100005], v[100005];
int main(){
    int n, k; scanf("%d %d", &n, &k);
    for(int i = 0; i < n; i++)
        scanf("%d", &v[i]);
    for(int i = 0; i < v[0]; i++)
        lose[i] = 1;
    
    for(int i = v[0]; i <= k; i++){
        int win = 0;
        for(int j = 0; j < n; j++)
            if(i-v[j] >= 0 and lose[i-v[j]])
                win = 1;
        lose[i] = !win;
    }
    if(lose[k]) puts("Second");
    else puts("First");
	return 0;
}


Measured memory_bytes: 640
def calc_k(p, ws):
    k = 1
    s = 0
    for w in ws:
        if w > p:
            return None
        elif s + w <= p:
            s += w
        else:
            k += 1
            s = w
    return k

def search_minimum_p(k, ws):
    """
    ?????????P????????????????????¢?´¢??????
    max(P) = max(wi) * max(n)
    ????????¨???????????????1??°?????¨????????????????????????
    min(P) = max(wi)
    ?°?????????¨??????????????????????????§????????????????????????????????????
    """
    lp = max(ws)
    rp = 10000 * 100000

    while lp <= rp:
        cp = (lp + rp) // 2
        k1 = calc_k(cp, ws)
        if k1 <= k:
            # ???????????¨???????????????k??°??\????????????????????§??????
            k2 = calc_k(cp - 1, ws)
            if k2 == None or k2 > k:
                # cp???k??°???????????????????????????p???????°??????§??????
                return cp
            else:
                # ???????°???????p????????¨??????
                rp = cp - 1
        else:
            # ???????????¨???????????????k??°????????????????????????????????????????????????????¶?????????????
            lp = cp + 1

    return None

n, k = map(int, input().split())
ws = []
for i in range(n):
    ws.append(int(input()))

print(search_minimum_p(k, ws))

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

int main(){
    
    int n,k;
    cin >> n >> k;
    vector<double> p(n);
    for(int i=0; i<n; i++){
        cin >> p.at(i);
    }
    
    double ans=0;
    for(int i=0; i<k; i++){
        ans+=p.at(i);
    }
    double num=ans;

    for(int i=0; i<n-k; i++){
        num=num-p.at(i)+p.at(k+i);
        ans=max(ans,num);
    }

    ans=(ans+k)/2;
    cout << fixed << setprecision(9) << ans << endl;
}

Measured memory_bytes: 4788
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main(){
  int n;
  cin >> n;
  
  char a[n];
  int flag_p = 0;
  int flag_g = 0;
  int flag_w = 0;
  int flag_y = 0;
  
  for(int i = 0; i < n; i++){
    cin >> a[i];
    if(a[i] == 'P'){
      flag_p = 1;
    } else if(a[i] == 'G'){
      flag_g = 1;
    } else if(a[i] == 'W'){
      flag_w = 1;
    } else if(a[i] == 'Y'){
      flag_y = 1;
    }
  }
  if(flag_p == 1 && flag_w == 1 && flag_g == 1 && flag_y == 1){
    cout << "Four" << endl;
  } else if(flag_p == 1 && flag_w == 1 && flag_g == 1){
    cout << "Three" << endl;
  }
  
  return 0;
}

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

using namespace std;
#define REPP(i,a,b,c) for(int i=a; i<=b; i+=c)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,c) for(int i=a; i>=b; i-=c)
#define REV(i,a,b) REVV(i,a,b,1)
#define FOR(i,a) REP(i,0,(int)a-1)
#define FORD(i,a) REV(i,(int)a-1,0)
#define PB push_back
#define POB pop_back
#define FI first
#define SE second
#define MP make_pair
typedef long long ll;
typedef unsigned long long ull;
typedef pair < int , int > pii;
typedef vector < int > vi;
typedef vector < pii > vii;
typedef vector < ll > vl;
typedef pair < ll , ll > pll;

const double PI = acos(-1);
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const int INF = 1e9;


ll addMod(ll a, ll b){
	if(a + b >= MOD) return a + b - MOD;
	return a + b;
}

ll mulMod(ll a, ll b){
	return (a*b)%MOD;
}

ll fast(ll a, ll b){
	if(b == 0) return 1;
	ll tmp = fast(a,b/2);
	tmp = mulMod(tmp,tmp);
	if(b & 1) tmp = mulMod(tmp,a);
	return tmp;
}

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

//////////////////////////////////////////////

map < int , bool > vis;

int main(){
	ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	int ans = 0, x;
	FOR(i,n){
		cin >> x;
		if(vis[x]){
			vis[x] = false;
			ans--;
		}
		else{
			vis[x] = true;
			ans++;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4992
import sys


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

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x


N, M = map(int, input().split())
uf = UnionFind(N)
for _ in range(M):
    a, b = map(lambda x: int(x) - 1, sys.stdin.readline().split())
    uf.union(a, b)

print(sum(p < 0 for p in uf.parents) - 1)


Measured memory_bytes: 73692
/*
[ ( ^ _ ^ ) ]
*/
// problem: atc/abc163_a
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000000



int main() {
    int r;
    scanf("%d", &r);
    double c = 2 * r * M_PI;
    printf("%.20f\n", c);
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int K, X;
  cin >> K >> X;
  for(int i = X - K + 1; i <= X + K - 1; i++) cout << i << " ";
  cout << endl;
}




Measured memory_bytes: 256
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

#include<bits/stdc++.h>
using namespace std;

/*-----<Defines>-----*/
#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)size(x))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)-1)/(x)+1)
#define     flush           fflush(stdout)

using ull=unsigned long long;
using ll=long long;
using ld=long double;
/*-----</Defines>-----*/

/*-----<Debugging Stuff>-----*/
string to_string(char s)
{   string res="'''";res[1]=s;return res; }

string to_string(string s)
{   return '"'+s+'"'; }

string to_string(const char* s)
{   return to_string((string)s); }

string to_string(bool b)
{   return (b?"true":"false"); }

template<typename A, typename B>
string to_string(pair<A, B> p)
{   return "("+to_string(p.F)+", "+to_string(p.S)+")"; }

template<typename A>
string to_string(A v)
{
    bool first=1; string res="{";
    for(const auto &x:v)
    {
        if(!first)  res+=", ";
        first=0;
        res+=to_string(x);
    }
    res+="}";
    return res;
}

void debug() { cout<<"\n"; }
template<typename Head, typename... Tail>
void debug(Head H, Tail... T)
{
    cout<<" "<<to_string(H);
    debug(T...);
}

#define show(...) cout << "[" << #__VA_ARGS__ << "]:", debug(__VA_ARGS__)
/*-----</Debugging Stuff>-----*/

/*-----<Mod Operations>-----*/
const int M=1e9+7;
inline int add(int a,int b,int p=M){ a=a+b; if(a>=p) a-=p; return a; }
inline int sub(int a,int b,int p=M){ a=a-b; if(a<0) a+=p; return a; }
inline int mul(int a,int b,int p=M){ a=(a*1ll*b)%p; return a; }
/*-----</Mod Operations>-----*/

/*-----<Constants>-----*/
const ld pi=acos(-1),eps=1e-9;
const ll inf=1e18;
const int N=1;
/*-----</Constants>-----*/

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

    int arr[4]={0};

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

        if(s=="AC")
            ++arr[0];
        else if(s=="WA")
            ++arr[1];
        else if(s=="TLE")
            ++arr[2];
        else
            ++arr[3];
    }

    cout<<"AC x "<<arr[0]<<"\n";
    cout<<"WA x "<<arr[1]<<"\n";
    cout<<"TLE x "<<arr[2]<<"\n";
    cout<<"RE x "<<arr[3]<<"\n";
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}



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

int main() {
  int n;
  cin >> n;
  int count = 1;
  while (true) {
  	int value = count * 2;
    if (value <= n) {
    	count = value;
    } else {
    	break;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <cmath>
#include <string>
#include <set>
#include <map>
#include <cassert>
#define SIZE 300005
#define MOD 998244353

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

struct UF
{
	int par[SIZE],rank[SIZE];
	
	void init(int n)
	{
		for(int i=0;i<n;i++)
		{
			par[i]=i;
			rank[i]=0;
		}
	}
	int find(int x)
	{
		if(par[x]==x) return x;
		return par[x]=find(par[x]);
	}
	void unite(int l,int r)
	{
		par[l]=r;
	}
	bool same(int x,int y)
	{
		return find(x)==find(y);
	}
};
UF left,right;
int A[SIZE];
vector <int> vec[SIZE];
bool use[SIZE];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
		A[i]--;
		vec[A[i]].push_back(i);
	}
	ll ret=1;
	int cnt=0;
	if(vec[0].size()==n)
	{
		for(int i=1;i<=n;i++) ret=ret*(ll) i%MOD;
		printf("%lld\n",ret);
		return 0;
	}
	int k=vec[0].size();
	left.init(n+2);
	right.init(n+2);
	int zan=n;
	for(int i=0;i<n;i++)
	{
		if(vec[i].empty())
		{
			if(cnt==i)
			{
				ret=0;
				break;
			}
			ret=ret*(ll) (cnt-i)%MOD;
		}
		else
		{
			for(int j=0;j<vec[i].size();j++)
			{
				int v=vec[i][j];
				if(zan>1)
				{
					zan--;
					use[v]=true;
					if(use[(v+1)%n])
					{
						right.unite(v,(v+1)%n);
						left.unite((v+1)%n,v);
					}
					if(use[(v-1+n)%n])
					{
						right.unite((v-1+n)%n,v);
						left.unite(v,(v-1+n)%n);
					}
					int l=left.find(v),r=right.find(v);
					int vl=v-l,vr=r-v;
					if(vl<0) vl+=n;
					if(vr<0) vr+=n;
					cnt-=max(0,vl-k+1);
					cnt-=max(0,vr-k+1);
					cnt+=max(0,vl+vr+1-k+1);
				}
				else
				{
					zan--;
					cnt=n;
				}
			}
			if(zan==0)
			{
				sort(vec[i].begin(),vec[i].end());
				int all=0;
				for(int j=0;j<vec[i].size();j++)
				{
					int v=vec[i][j];
					int u=vec[i][(j+1)%vec[i].size()];
					int L=u-v-1;
					if(L<0) L+=n;
					all+=max(0,L-(n-k)+1);
				}
				ret=ret*(ll) all%MOD;
			}
			else
			{
				bool up=true;
				for(int j=0;j<vec[i].size();j++)
				{
					int v=vec[i][j],u=vec[i][0];
					if(!right.same(v,u))
					{
						up=false;
						break;
					}
				}
				if(!up)
				{
					ret=0;
					break;
				}
				int l=left.find(vec[i][0]),r=right.find(vec[i][0]);
				int L=r-l+1;
				if(L<0) L+=n;
				int vl=L,vr=L;
				for(int j=0;j<vec[i].size();j++)
				{
					int v=vec[i][j];
					int len=v-l;
					if(len<0) len+=n;
					vl=min(vl,len);
					len=r-v;
					if(len<0) len+=n;
					vr=min(vr,len);
				}
				int c=L-vl-vr;
				if(c>k||L<k)
				{
					ret=0;
					break;
				}
				int nm=k-c+1;
				nm=min(nm,vl+1);
				nm=min(nm,vr+1);
				ret=ret*(ll) nm%MOD;
			}
		}
		//printf("%lld : %d\n",ret,cnt);
	}
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 22784
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, x, S=0;
  cin >> N >> K;
  for(int i=0; i<N; i++){
    cin >> x;
    if(x > K / 2){
      S = S + 2 * (K - x);
    }else{
      S = S + 2 * x;
    }
  }
  cout << S << endl;
}

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

int main() {
  long long ans=0;
  int n;
  cin >> n;
  for(int i=0; i<n; i++) {
    int a;
    cin >> a;
    while(a) {
      if(a%2) break;
      ans++;
      a>>=1;
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//登録しよう！→ https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
#define syo(x) fixed << setprecision(x) //iostreamで小数をx桁表示

void solve(long long N, std::vector<long long> L){
  sort(all(L));
  int ans = 0;
  for (int i = 0; i < N*2; i+=2) {
    ans += L[i];
  }
  cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> L(2*N);
    for(int i = 0 ; i < 2*N ; i++){
        scanf("%lld",&L[i]);
    }
    solve(N, std::move(L));
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;

    int n = N;
    int sum = 0;

    while (n > 0){
        sum += n % 10;
        n = n / 10;
    }

    if (N % sum == 0){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256