akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O2,Ofast,inline,unroll-all-loops,-ffast-math")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#define maxn 20
#define maxs (1 << 16) + 10
#define ll long long
#define ull unsigned long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define pii pair<int, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define IL inline
#define ss system
using namespace std;

int a[maxn], sum[maxs], n, m;
ll f[maxn][maxs], fac[maxs], ifac[maxs], ans = 0;
const ll p = 1e9 + 7;
template <class T> void read (T &x) {
  char ch = x = 0;
  bool fl = false;
  while (!isdigit(ch))
    fl |= ch == '-', ch = getchar();
  while (isdigit(ch))
    x = x * 10 + ch - '0', ch = getchar();
  x = fl ? -x : x;
}
ll pw(ll a, ll b) {
  ll ret = 1;
  while (b) {
    if (b & 1)
      ret = ret * a % p;
    a = a * a % p, b >>= 1;
  }
  return ret;
}
ll C(int a, int b) {
  return a < b || b < 0 ? 0 : fac[a] * ifac[b] % p * ifac[a - b] % p;
}
void init() {
  fac[0] = 1;
  for (int i = 1; i < maxs; i++) {
    fac[i] = fac[i - 1] * i % p;
  }
  ifac[maxs - 1] = pw(fac[maxs - 1], p - 2);
  for (int i = maxs - 2; ~i; i--) {
    ifac[i] = ifac[i + 1] * (i + 1) % p;
  }
  for (int s = 1; s < 1 << n; s++) {
    for (int i = 0; i < n; i++) {
      if (s >> i & 1)
        sum[s] += 1 << i;
    }
  }
}
int main() {
  read(n), read(m), init();
  for (int i = 1; i <= m; i++) {
    read(a[i]);
  }
  sort(a + 1, a + m + 1, greater<int>());
  f[0][0] = 1;
  for (int i = 1; i <= m; i++) {
    for (int s = 0; s < 1 << n; s++) {
      f[i][s] = f[i - 1][s];
      for (int j = 0; j < n; j++) {
        if (~s >> j & 1)
          continue;
        f[i][s] = (f[i][s] + f[i - 1][s ^ (1 << j)] * C((1 << n) - a[i] - sum[s ^ (1 << j)], (1 << j) - 1) % p * fac[1 << j]) % p;
      }
    }
  }
  for (int s = 0; s < 1 << n; s++) {
    ans = (ans + f[m][s] * fac[(1 << n) - sum[s] - 1] % p * (__builtin_parity(s) ? p - 1 : 1)) % p;
  }
  printf("%lld\n", (ans << n) % p);
  return 0;
}

Measured memory_bytes: 10240
from math import cos, sin, radians, sqrt

def resolve():
    a,b,h,m = map(int,input().split())
    hh = (h / 12 + m / 60 / 12) * 360
    mm = m / 60 * 360

    hbb = (a * cos( radians(hh)), a * sin(radians(hh)))
    mbb = (b * cos( radians(mm)), b * sin(radians(mm)))
    # print(hh,mm, hbb, mbb)
    print('{:.12f}'.format(sqrt( (hbb[0] - mbb[0])**2 + (hbb[1] - mbb[1])**2)))

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int dp[105][10];
const int mod = 1000000007;

int main(){
    int H, W, K; cin >> H >> W >> K;
    for(int i=0; i<105; i++) for(int j=0; j<10; j++) dp[i][j] = 0;
    dp[0][0] = 1;

    for(int height=1; height<=H; height++){
        for(int width=0; width<W; width++){
            for(int bit=0; bit<(1<<(W-1)); bit++){

                //二本連続してないかチェックする
                bool flg = true;
                for(int i=0; i<W-2; i++){
                    if((bit&1<<i) && (bit&1<<(i+1))) flg = false;
                }
                if(!flg) continue;

                if(width>0 && bit&1<<(width-1)){
                    dp[height][width] += dp[height-1][width-1];
                    dp[height][width] %= mod;
                }
                else if(width<W-1 && bit&1<<width){
                    dp[height][width] += dp[height-1][width+1];
                    dp[height][width] %= mod;
                }
                else{
                    dp[height][width] += dp[height-1][width];
                    dp[height][width] %= mod;
                } 
            
            }
        }
        
    }

    cout << dp[H][K-1] << endl;
}

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

#define fio() ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;
typedef pair<pi, ll> pii;

const ll mod = 1e9 + 7;
const ll maxn = 1e2 + 2;
const ll N = 1e2 + 2;
const ll inf = 1e12;
const ld eps = 1e-6;

ll g[maxn][maxn], matchU[maxn], ans;
bool vis[maxn];
ll n, m, e;
bool isDone;

bool dfs(ll v) {
	for (int i = 0; i < m; i++) {
		if (g[v][i] && !vis[i]) {
			vis[i] = true;
			if (matchU[i] < 0 || dfs(matchU[i])) {
				matchU[i] = v;
				return true;	
			}
		}
	}
	return false;
}

int main() {
	fio();
	cin >> n >> m >> e;
	for (int i = 0; i < e; i++) {
		ll fr, to;
		cin >> fr >> to;
		g[fr][to] = 1;	
	}
	for (int i = 0; i < maxn; i++)
		matchU[i] = -1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < maxn; j++)
			vis[j] = 0;
		if (dfs(i))
			ans++;	
	}
	cout << ans << endl;
}



Measured memory_bytes: 3284
#include<stdio.h>
#define INF 100000
#define NIL -1
#define MAX 101
#define WHITE 0
#define BLACK 1

int main(){
  int i,j,u,v,n;
  int mincost,sum=0;
  int a[MAX][MAX],d[MAX],pi[MAX],color[MAX];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&a[i][j]);
      if(a[i][j]==-1) a[i][j] =INF;
    }
  }

  for(u=0;u<n;u++){
    d[u] = INF;
    pi[u] = NIL;
    color[u] = WHITE;
  }
  d[0] = 0;

  while(1){

    mincost = INF;
    for(i=0;i<n;i++){
      if(color[i]!=BLACK && d[i]<mincost){
	mincost = d[i];
	u = i;
      }
    }
    
    if(mincost==INF)break;

    color[u] = BLACK;
    
    for(v=0;v<n;v++){
      if(color[v]!=BLACK && a[u][v]< d[v]){
	pi[v] = u;
	d[v] = a[u][v];
      }
    }
    
  }
  for(i=0;i<n;i++){
    sum += d[i];
  }
  printf("%d\n",sum);
  return 0;
}


Measured memory_bytes: 2036
///created: 13/Jun/2019 11:54:50

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
#define db(x) cerr << "debug: " << #x << " = " << x << '\n';
template<class __Ty> bool minimize(__Ty& a, __Ty b) {
	if (a > b) { a = b; return true; }
	return false;
}
template<class __Ty> bool maximize(__Ty& a, __Ty b) {
	if (a < b) { a = b; return true; }
	return false;
}

const int N = 1e2 + 5;
ll x[N], y[N], h[N];
int n;

int main() {
	///ios::sync_with_stdio(0); cin.tie(0);
	cin >> n;
	int t = 0;
	for (int i = 1; i <= n; ++i) {
		cin >> x[i] >> y[i] >> h[i];
		if (h[i] > 0)
			t = i;
	}
	assert(t);
	swap(h[t], h[1]);
	swap(x[t], x[1]);
	swap(y[t], y[1]);
	for (int cx = 0; cx <= 100; ++cx)
		for (int cy = 0; cy <= 100; ++cy) {
			bool testok = 1;
			ll H = -1;
			for (int k = 1; k <= n; ++k) {
				ll d = abs(cx - x[k]) + abs(cy - y[k]);
				if (h[k] == 0) {
					if (H != -1 && H > d)
						testok = 0;
				}
				else {
					if (H == -1)
						H = h[k] + d;
					else
						if (H != h[k] + d)
							testok = 0;
				}
			}
			if (testok) {				
				cout << cx << ' ' << cy << ' ' << max(H, 0LL);
				return 0;
			}
		}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	int n; cin>>n;
  	int mysum=0, m=n;
  	for(int i=0;i<10;i++){
     	mysum += m % 10;
      	m = m/10;
      	if(m<10){
        	mysum += m;
          	break;
        }
    }
  	if(n%mysum==0){
    	cout<<"Yes"<<endl;
    }else{
    	cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
a,b,c = map(int,input().split())
cnt = 0
if a%2 == b%2 and a%2 != c%2:
  a += 1
  b += 1
  cnt += 1
elif a%2 == c%2 and a%2 != b%2:
  a += 1
  c += 1
  cnt += 1
elif b%2 == c%2 and a%2 != b%2:
  b += 1
  c += 1
  cnt += 1
M = max(a,b,c)
print(int(cnt + (M-a)/2 + (M-b)/2 + (M-c)/2))

Measured memory_bytes: 3064
from collections import Counter

N = int(input())
D = list(map(int, input().split()))
M = int(input())
T = list(map(int, input().split()))

T_cnt = list(Counter(T).items())
D_cnt = Counter(D)

for t in T_cnt:
    if D_cnt[t[0]] < t[1]:
        print("NO")
        break

else:
    print("YES")

Measured memory_bytes: 58588
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>

int h, w, k, ans;
char q[7][7];
bool chose[13], hang[10], lie[10];

void count() {
	int tot = 0;
	memset(hang, 0, sizeof hang);
	memset(lie, 0, sizeof lie);
	for (int i = 1; i <= h; ++i) {
		if (chose[i] == 1) hang[i] = 1;
	}
	for (int i = h + 1; i <= h + w; ++i) {
		if (chose[i] == 1) lie[i - h] = 1;
	}
	for (int i = 1; i <= h; ++i) {
		if (hang[i] == 1 ) continue;
		for (int j = 1; j <= w; ++j) {
			if(lie[j] == 1) continue;
			if(q[i][j] == '#') ++tot;
		}
	}
	if (tot == k) ++ans;
}

void dfs(int step) {
	if (step == h + w + 1) {
		count();
		return;
	}
	for (int i = 0; i <= 1; ++i) {
		if (i == 0) dfs(step + 1);
		else {
			chose[step] = 1;
			dfs(step + 1);
			chose[step] = 0;
		}
	}
}

int main() {
	scanf("%d %d %d", &h, &w, &k);
	for (int i = 1;i <= h; ++i) {
		for (int j = 1; j <= w; ++j) {
			std::cin >>q[i][j] ;
		}
	}
	dfs(1);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3812
import java.util.Scanner;
import java.util.ArrayList;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        ArrayList<Integer> ar = new ArrayList<>(); 
        sc.forEachRemaining(e -> ar.add(Integer.parseInt(e)));
        for (int i=0; i<n;i++){
            if(i % 2 ==0 && ar.get(i) % 2 !=0){
                ans +=1;
            }else{
            }
        }
        System.out.println(ans);
    }
}



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

int makeNum(int A, int B){
    int N = 0;
    for(int i = 0; i < A; i++){
        N += B;
        B *= 10;
    }
    return N;
}

int main(){
    int a, b;
    cin >> a >> b;
    int n;
    if (a > b) n = makeNum(a, b);
    else  n = makeNum(b, a);
    cout << n << endl; 

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<utility>
#include<climits>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<map>

using namespace std;

int main(){
	int n;
	cin>>n;
	int a[n];
	int count=0;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=0;i<n;i++){
		while(!(a[i]&1)){
			a[i]=a[i]>>1;
			count++;
		}
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define dl double long
const int INF=0x3fffffff;
const ll MOD=1000000007;
const ll MODD=998244353;
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;
 
    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };
 
    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }
 
    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }
 
    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }
 
    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }
 
    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

int main() {
  	string S;
    cin >> S;
	if(S[0] == S[1] && S[2] == S[3] && S[0] != S[2]||
       S[0] == S[2] && S[1] == S[3] && S[0] != S[1]||
       S[0] == S[3] && S[1] == S[2] && S[0] != S[1]){
      cout << "Yes" << "\n";
      return(0);
    }

    cout << "No" << "\n";
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int N;
    cin >> N;
    bool enable = false;
    for (int i = 1; i <= 9; ++i) {
        if (enable) break;
        for (int j = 1; j <= 9; ++j) {
            if (i * j == N) {
                enable = true;
                break;
            }
        }
    }
    cout << ((enable) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import math
from decimal import Decimal

def next_year_depo(x):
    return (x * Decimal(1.01)).quantize(Decimal('1.'), rounding='ROUND_DOWN')

depo = Decimal(100)
target = int(input())

ans = math.floor(math.log(target/100, 1.01))
for _ in range(ans):
    depo = next_year_depo(depo)

while depo < Decimal(target):
    depo = next_year_depo(depo)
    ans +=1
print(ans)

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

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

    return sum;
}

int main(){
    int n,a,b,ans=0,sum,i;

    cin>>n>>a>>b;

    for(i=1; i<=n; i++){
        sum = findsum(i);
        if(sum>=a && sum<=b) ans+=i;
    }

    cout<<ans<<endl;
}



Measured memory_bytes: 3596
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

#[allow(unused)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}
#[allow(unused)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (let _ = write!(out,$($format)*););
    }
    input! {
        n: i64, m: usize,
        a: [i64; m],
    }
    let sum: i64 = a.iter().sum();
    puts!("{}\n", if n >= sum { n - sum } else { -1 });
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 2320
#include<bits/stdc++.h>
#include <string>
using namespace std;
#include<chrono>
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define foo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define min3(a,b,c)         min(a,min(b,c))
#define max3(a,b,c)         max(a,max(b,c))
#define min4(a,b,c,d)       min(a,min(b,min(c,d)))
#define max4(a,b,c,d)       max(a,max(b,max(c,d)))
#define max5(a,b,c,d,e)     max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e)     min(min3(a,b,c),min(d,e))
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pl>    vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void DFS(int n);
bool isprime(ll n);
int gcd(int a,int b);
void rstgraph(int n);

const int mod = pow(10,9)+7;
const int N = 3e5, M = N;

//=======================================================================================
vi g[N];
int vis[N];
int nodes=0;
// ll ans=0;

void iluzn() {

int n;
cin>>n;
vi a(n);
int i;
fo(i,n)  cin>>a[i];
ll count=0;
foo(i,1,n){
  if(a[i-1]>a[i]){
    count+=abs(a[i]-a[i-1]);
    a[i]=a[i-1];
  }
}
cout<<count;
}
 
int main() {
  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
     {
      iluzn();
    
      }
    return 0;
}
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
bool isprime(ll n){
    if(n<=1)
        return false;
    if(n==2)
        return true;
    if(n%2==0)
        return false;
    ll rt = sqrt(n);
    for(ll i=3;i<rt;i+=2){
        if(n%i==0)
            return false;
    }
    return true;
}
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
void ipgraph(int m){
  int u, v;
  while(m--){
    cin>>u>>v;
    g[u].pb(v);
    // g[v].pb(u);
  }
}

void DFS(int n)
{  ++nodes;
    vis[n] = 1;
    for(vector<int>::iterator i = g[n].begin(); i != g[n].end() ; i++)
    {
        if(!vis[*i])
            DFS(*i);
    }
}
void rstgraph(int n){
  int i;
  fo(i,n+1){
    g[i].clear();
    vis[i]=0;
  }
  nodes=0;
}

Measured memory_bytes: 11112
/*________________________Bismillahir Rahmanir Rahim___________________
|                                                                      |
|                    /\     |     | |\    |     /\     |-------        |
|                   /  \    |     | | \   |    /  \    |               |
|                  /----\   |-----| |  \  |   /----\   |-----          |
|                 /      \  |     | |   \ |  /      \  |               |
|                /        \ |     | |    \| /        \ |               |
|                     14th batch CSE , ID : 12008029                   |
|                     Comilla University                               |
|                     Email : sheikhahnafshifat@gmail.com              |
|______________________________________________________________________*/
#include<bits/stdc++.h>
using namespace std;
#define ll                      long long
#define MAX                     1234567
#define pb(x)                   push_back(x)
#define mp(x,y)                 make_pair(x,y)
#define vii                     vector<int>
#define vll                     vector<long long>
#define vp                      vector<pair<int, int> >
#define v_min(a)                *min_element(a.begin(),a.end())
#define v_max(a)                *max_element(a.begin(),a.end())
#define v_sum(a)                accumulate(a.begin(),a.end(),0)
#define un(a)                   a.erase(unique(a.begin(),a.end()),a.end())
#define SORT(a)                 sort(a.begin(),a.end())
#define AHNAF                   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define gcd(a,b)                __gcd(a,b)
#define lcm(a,b)                ((a)*(b))/gcd(a,b)
#define YES                     cout<<"YES"<<endl;
#define NO                      cout<<"NO"<<endl;
#define testcase(t)             int t;cin>>t;while(t--)
#define reverse(a)              reverse(a.begin(),a.end())
#define ff                      first
#define ss                      second
int main()
{
    AHNAF;
    ll s,n;
    cin>>s>>n;
    ll sum=0;
    for(int i=0; i<n; i++)
    {
        int x;
        cin>>x;
        sum+=x;
    }
    if(s>=sum) cout<<s-sum;
    else cout<<-1;

}


Measured memory_bytes: 3640
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <climits>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define FOR(i, m, n) for (int i = (int)m; i < (int)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define REPe(e, mp) for (auto& e : mp)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
using ll = long long int;
using vecint = vector<int>;
using vecll = vector<ll>;
using vec2int = vector<vector<int>>;
using P = pair<int, int>;
////////////////////////////////////////////////
////////////////////////////////////////////////
int main() {
  ////////////////////////////////////////////////
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ////////////////////////////////////////////////
  int n, m, k;
  cin >> n >> m >> k;
  REP(i, n + 1) {
    REP(j, m + 1) {
      if (n * j + m * i - 2 * i * j == k) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}
//////////////////////////////////////////////


Measured memory_bytes: 256
s=input()
t=input()
S=list(s)
S.sort()
x=''.join(S)
T=list(t)
T.sort(reverse=True)
y=''.join(T)

A=[x,y]

A.sort()

if A[0]==x and x!=y:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
length = input()
lst = input()
lst = lst.split()
q = 0
for i in range(len(lst)):
    lst[i] = int(lst[i])
for i in range(int(length)-1):
    if lst[i] >= lst[i+1]:
        q += (lst[i]-lst[i+1])
        lst[i + 1]= lst[i]
print(q)


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

int main(void){

  int n;
  int i, k;

  scanf("%d", &n);

  for(i = 1; i <= n; i++){
    if(i % 3 == 0){
      printf(" %d", i);
    }else{
      k = i;
      while(k >= 1){
	if(k % 10 == 3){
	  printf(" %d", i);
	  break;
	}
	k = k / 10;
      }
    }
  }
  printf("\n");
  
  return 0;
}


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

int main() {
    int64_t A, B, V, W, T, len, vel;
    cin >> A >> V >> B >> W >> T;
    len = abs(A - B);
    vel = V - W;
    //cout << len << " " << vel << endl;
    string ans;
    while (1) {
        if (vel <= 0 || len > T * vel) {
            ans = "NO";
            break;
        } else {
            if (len % vel != 0) {
                len -= (int64_t)(len / vel) * (len % vel);
                T -= len / vel;
            } else {
                ans = "YES";
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

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

struct mint {
    const int mod = 1e9 + 7;
    long long x;

    mint(long long x = 0) : x((x % mod + mod) % mod) {}

    mint &operator=(const long long a) {
        x = a % mod;
        return *this;
    }

    mint &operator=(const mint a) {
        x = a.x % mod;
        return *this;
    }

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint &operator-=(const mint a) {
        if ((x += (mod - a.x)) >= mod) x -= mod;
        return *this;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(long long t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};


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

    vector<int> v(n), s(m);
    for (int i = 0; i < n; i++)cin >> v[i];
    for (int i = 0; i < m; i++)cin >> s[i];

    vector<vector<mint>> dp(n + 1, vector<mint>(m + 1));
//    for(int i = 0; i <= n; i++)dp[i][0] = 1;
//    for(int i = 0; i <= m; i++)dp[0][i] = 1;
//    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (v[i - 1] == s[j - 1])dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] + 1);
            else dp[i][j] = (dp[i][j - 1] + dp[i - 1][j] - dp[i - 1][j - 1]);
        }
    }
    dp[n][m] += 1;
    cout << dp[n][m].x << endl;
}

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

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

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



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

using namespace std;

int main()
{
  int a, b, s = 0;
  cin >> a >> b;
  s = max(s,2*a-1);
  s = max(s,2*b-1);
  s = max(s,a+b);
  cout << s;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

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



int main()
{
    int N,K;
    cin >> N >> K;
    vector<int> P(N);
    for(int i=0; i<N; i++) cin >> P[i];

    sort(P.begin(),P.end());
    int ans=0;
    for(int i=0; i<K; i++) ans+=P[i];
    cout << ans << endl;




    return 0;
}

Measured memory_bytes: 3600
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
N = int(input())
A = list(map(int, input().split()))
A = np.array(A, np.int64)
while len(A) > 1:
    A = A[np.nonzero(A)]
    A = np.sort(A)
    minA = A[0]
    A %= minA
    A[0] = minA
A = A[np.nonzero(A)]
print(A[0])

Measured memory_bytes: 23136
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
def lcm(n,m):
    return int(n*m/gcd(n,m))

import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace

from queue import PriorityQueue as pq

# from itertools import accumulate
# from collections import deque
import random


def main():
    n,k = map(int, input().split())
    k=k-1
    s=input()
    s=s[:k]+s[k].lower()+s[k+1:]
    print(s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 67308
N=int(input())
A=list(map(int,input().split()))
A2=[0]*N
for i in range(N):
    A2[i]=A2[i-1]+A[i]
r,f,s=0,1,0
for a in A2:
    if (a+s)*-f>=0:
        x=a+s-f
        s-=x
        r+=abs(x)
    f*=-1
r2,f,s=0,-1,0
for a in A2:
    if (a+s)*-f>=0:
        x=a+s-f
        s-=x
        r2+=abs(x)
    f*=-1
print(min(r,r2))

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

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

  if (n >= m)
  {
    cout << 0;
    return 0;
  }

  vector<int> x(m);
  for (int i = 0; i < m; i++)
  {
    cin >> x[i];
  }

  sort(x.begin(), x.end());
  vector<int> d(m - 1);

  for (int i = 0; i < m - 1; i++)
  {
    d[i] = x[i + 1] - x[i];
  }

  sort(d.begin(), d.end());

  int ans = 0;
  for (int i = 0; i < d.size() - (n - 1); i++)
  {
    ans += d[i];
  }

  cout << ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;
    if(v <= w) NO();
    else{
        ll dist = abs(b-a);
        ll prog = (v-w)*t;
        (dist <= prog) ? YES() : NO();
    }
}

Measured memory_bytes: 3564
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n)for(int i=0;i<(int)(n);i++)
#define PI 3.141592653589793
//vector < vector<int>>a(0, vector<int>(0));二次元配列宣言


int main()
{
	int k, x;
	cin >> k >> x;
	int i;
	i = x - k + 1;
	while (i <= x + k - 1)
	{
		
		cout << i;
		i++;
		if (i > x + k - 1)
		{
			break;
		}
		cout << " ";
	}
	cout << endl;
}

Measured memory_bytes: 3604
from time import time

t = time()
n,m = list(map(int, input().split()))
k = (1/2) * (2**(m-1))
i = 1
testms = 100*(n-m) + 1900*m
ans = 0
while time()-t<1.9:
    ans = ans + (i*testms)*k
    i += 1
    k = k/2

print(round(ans))

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

using namespace std;
int fat(int x){
	if (x==1)
		return 1;
	return x*fat(x-1);
}
int main() {
	int N,x[11],y[11],vet[11];
	double res=0;
	scanf("%d", &N);

	for (int i = 0;i < N;i++) {
		vet[i]=i;
		scanf("%d %d", &x[i], &y[i]);
	}
	do{
		for (int i =0;i < N-1;i++){
			res += hypot(x[vet[i+1]]-x[vet[i]],y[vet[i+1]]-y[vet[i]]);
		}
	}while(next_permutation(vet,vet+N));

	printf("%.10lf\n", res/fat(N));

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int max=10001;
  int arr[max];
  int N;
  cin >> N;
  for(int i = 0; i < N; ++i) cin >> arr[i];
  int cnt;
  for(int i = 0; i < N; ++i){
    while(true){
      if(arr[i]%2 == 0){
        ++cnt;
        arr[i] /= 2; 
      }
      else break;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <functional>
#include <random>
using namespace std;
#define Would
#define you

const int MOD = 1e9 + 7;
const int INF = 999999999;

int N,M,R,d[201][201],r[9],A,B,C,res;
bool used [9];

void dfs(int c,int las,int dist) {
    if(c==R+1) {
      if(res>dist){res=dist;}
      return;
    }
for(int i=1;i<=R;i++){
    if(!used[i]) {
         used[i]=true; 
         if(las==-1){dfs(c+1,i,0);}
         else{dfs(c+1,i,dist+d[r[las]][r[i]]);}
         used[i]=false;
    }
  }
}

int main () {
    cin>>N>>M>>R;
for(int i=1;i<=N;i++)for(int j=1;j<=N;j++)if(i!=j)d[i][j]=INF; 
for(int i=1;i<=R;i++) cin>>r[i];
  
for(int i=1;i<=M;i++){
  cin>>A>>B>>C;
  if(d[A][B]>C)d[A][B]=d[B][A]=C;
}
  
for(int k=1;k<=N;k++){
  for(int i=1;i<=N;i++){
    for(int j=1;j<=N;j++){
        if(d[i][j]>d[i][k]+d[k][j]){d[i][j]=d[i][k]+d[k][j];}
    }
  }
}
        res=INF;
        dfs(1,-1,0);
        cout<<res<<endl;
}

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

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

    ll a = 0, b = 0;
    for (ll i = 1; i <= n; i++) {
        if (i % k == 0) a++;
        if (k % 2 == 0 && i % k == k / 2) b++;
    }

    cout << a * a * a + b * b * b << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <functional>
#define MOD 1000000007


struct edge {
    int to;
    int cost;
};

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

bool compare_by_b(pair<int,pair<string,int>> a, pair<int,pair<string,int>> b) {
    if(a.second.first != b.second.first){
        return a.second.first < b.second.first;
    }else{
    return a.second.second > b.second.second;
    }
}

int main(void) {
    ll i=0,j=0,k=0;
    ll n;
    vector<int> v;
    cin >> n;
    for(i=0;i<n;i++){
        int a;
        cin >> a;
        v.push_back(a);
    }
    int ans = 0;
    for(i=1;i<n-1;i++){
        if(v[i-1] < v[i] && v[i] < v[i+1] || v[i-1] > v[i] && v[i] > v[i+1]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
 
using namespace std;
 
#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
 
const int INF = 10000000;
const int mod = 1e9 + 7;
const double EPS = 1e-9;


int main(){
	vi v(3,0), ans(3, 0);
	double d;
	int n = 0;
	while(cin>>v[0]>>v[1]>>v[2]){
		sort(all(v));
		d = (double)(v[0]*v[0]+v[1]*v[1]-v[2]*v[2])/(2*v[0]*v[1]);
		if(v[2] >= v[1] + v[0]){
			cout<<n;
			for(int i = 0; i < 3; i++){
				cout<<" "<<ans[i];
			}
			cout<<endl;
			break;
		}
		if(d > 0) ans[1]++;
		else if (d < 0) ans[2]++;
		else ans[0]++;
		n++;
	}
}	

Measured memory_bytes: 1216
#include <iostream>

using namespace std;
typedef long long ll;

int n;
ll a[200010];

void solve() {
  for (int i=0;i<(n+1)/2;i++) {
    if (i != 0) {
      cout << " ";
    }
    cout << a[n - 1 - i * 2];
  }
  for (int i=0;i<n/2;i++) {
    cout << " " << a[i * 2 + (n % 2)];
  }
  cout << endl;
}
int main() {
  cin >> n;
  for (int i=0;i<n;i++) {
    cin >> a[i];
  }
  solve();
}


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

const int MAXN = 1e5+2;
int dp[MAXN], h[MAXN], n, k;

int main(){
//    freopen(".in", "r" , stdin);

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

    cin >> n >> k;
    for(int i=1; i<=n; i++)
        cin >> h[i];

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

    cout << dp[n] << '\n';

    return 0;
}

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

class Main{
	public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
        String rank ="";
        while(sc.hasNext()){
        	double f =sc.nextDouble();
        	double s =sc.nextDouble();
        	
        	if(f<35.5 && s<71.0) rank ="AAA";
        	else if(f<37.50 && s<77.00) rank ="AA";
        	else if(f<40.00 && s<83.00) rank ="A";
        	else if(f<43.00 && s<89.00) rank ="B";
        	else if(f<50.00 && s<105.00) rank ="C";
        	else if(f<55.00 && s<116.00) rank ="D";
        	else if(f<70.00 && s<148.00) rank ="E";
        	else rank="NA";
        	
        	System.out.println(rank);
        }
	}
	}

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

int main(){
  string c = "Good";
  string s;
  cin >> s ;
  for(int i=0;i<s.size()-1;i++){
    if(s.at(i)==s.at(i+1))
       c = "Bad";
   }
   cout << c << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
long long dp[3005][3005];
long long mod = 1e9 + 7;
int main() {
	int N; cin >> N;
	string s; cin >> s;
	dp[0][0] = 1;
/*	for (int i = 1; i < N; i++) {
		if (s[i - 1] == '<') {
			for (int j = 0; j < i; j++) dp[i][i] += dp[i - 1][j];
			for (int j = 0; j < i; j++) {
				for (int k = 0; k < j; k++) {
					dp[i][j] += dp[i - 1][k];
				}
			}
		} else {
			for (int j = 0; j <= i; j++) {
				for (int k = j; k < i; k++) {
					dp[i][j] += dp[i - 1][k];
				}
			}
		}
	}*/
	for (int i = 1; i < N; i++) {
		long long p[3005] = {};
		p[0] = dp[i - 1][0];
		for (int j = 1; j < i; j++) p[j] = p[j - 1] + dp[i - 1][j];
		if (s[i - 1] == '<') {
			dp[i][i] = p[i - 1] % mod;
			for (int j = 1; j < i; j++) {
				dp[i][j] = p[j - 1] % mod;
			}
		} else {
			dp[i][0] = p[i - 1] % mod;
			for (int j = 1; j <= i; j++) {
				dp[i][j] = (p[i - 1] - p[j - 1]) % mod;
			}
		}
	}
/*	for (int i = 0; i <= 5; i++) {
		for (int j = 0; j <= i; j++) {
			cout << "dp[" << i << "][" << j << "] = " << dp[i][j] << endl;
		}
	}*/
	long long sum = 0;
	for (int i = 0; i < N; i++) sum = (sum + dp[N - 1][i]) % mod;
	cout << sum << endl;
}


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

#define int long long

using namespace std;

int32_t main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    vector<int> suff_sums(n + 1);
    suff_sums[n] = 0;
    for (int i = n - 1; i >= 0; --i) {
        suff_sums[i] = suff_sums[i + 1] + v[i];
        suff_sums[i] = suff_sums[i] % 1'000'000'007;
    }
    int result = 0;
    for (int i = 0; i < n - 1; ++i) {
        result += v[i] * suff_sums[i + 1];
        result = result % 1'000'000'007;
    }
    cout << result;
    return 0;
}

Measured memory_bytes: 6388
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, -1, 0, 1 };

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

int Ws[300010], Es[300010];

signed main() {
	int N;
	string S;

	cin >> N >> S;

	rep(i, N) {
		if (S[i] == 'W') Ws[i + 1]++;
		else Es[i + 1]++;
	}

	REP(i, 1, N + 5) {
		Ws[i] += Ws[i - 1];
		Es[i] += Es[i - 1];
	}

	int ret = INT_MAX;
	rep(i, N) {
		int val = Ws[i] + (Es[N] - Es[i + 1]);
		ret = min(ret, val);
	}

	cout << ret << endl;

    return 0;
}


Measured memory_bytes: 5380
def main():
    n = int(input())
    l = ["AC", "WA", "TLE", "RE"]
    cnt = {ll: 0 for ll in l}
    for _ in range(n):
        cnt[input()] += 1
    for ll in l:
        print(ll, "x", cnt[ll])


if __name__ == '__main__':
    main()



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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

using namespace std;
#define ll  long long
#define PI  acos(-1)
#define pb  push_back
#define ins insert
#define INF 5000000000000000007 //1e18+7
#define mk  make_pair
#define ff  first
#define ss  second
#define endl "\n"
#define max3(x,y,z)  max(x,max(y,z))
#define min3(x,y,z)  min(x,min(y,z))
#define sz(a) (ll)a.size()
#define double long double
#define coud(a,b) cout << fixed << setprecision((b)) << (a)
#define mset(x,y)  memset(x,y,sizeof(x))
#define all(x)   (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define bp(n)  __builtin_popcountll(n)
#define mxt(a)  *(max_element(a.begin(),a.end()))
#define mnt(a)  *(min_element(a.begin(),a.end()))
#define unique_sort(c) (sort(all(c)), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define rep(i,a,b) for(ll i=(a);i<=(b);++i)
#define trav(a, x)    for(auto &a : x)

const double eps=1e-7;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int d8x[8]={+1, +1, +1, 0, 0, -1, -1, -1};
int d8y[8]={+1, 0, -1, +1, -1, +1, 0, -1};
int d4x[4]={1, 0, 0, -1};
int d4y[4]={0, -1, 1, 0};
ll power(ll x,ll y){ll ans=1;x=x;while(y>0){if(y&1)ans=(ans*x);y=y>>1;x=(x*x);}return ans;}
ll sqr(ll x) { return x * x;}

template <typename T> T gcd(T a,T b){ if(a==0) return b; return gcd(b%a,a); }
template <class T> inline void chmax(T &x,T y){ x = max((x), (y));}
template <class T> inline void chmin(T &x,T y){ x = min((x), (y));}
template <class T> T abs(T x) { return x>0 ? x : -x;}
template <typename T> T powm(T a,T b, ll m){T cnt=1; while(b>0) { if(b%2==1) cnt=(cnt*a)%m; b/=2; a=(a*a)%m; }return cnt%m;}
typedef pair<int,int>  pii;
typedef pair<ll,ll>  pll;
typedef vector<pll>  vpll;
typedef vector<pii>  vpii;
typedef vector<ll>   vll;
typedef vector<int>  vii;
#define minpq priority_queue<T,vector<T>,greater<T> >;
// #define T int
// #define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
//*X.find_by_order(k) returns the kth largest element (0-based).
//X.order_of_key(val) returns the no. of values less than val.
ll ncr(ll n,ll r) {ll ans=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){ans*=(n-i);ans/=(i+1);}return ans;}
const int MOD = 1000000007;   
const int N = 100010;

void run() {
  int n;
  cin >> n;
  ll a[n+5];
  rep(i,1,n) cin >> a[i];
  ll ans = 0;
  for (int i=2; i<=n; ++i) {
    if(a[i] < a[i-1]) {
      ans += a[i-1] - a[i];
      a[i] = a[i-1];
    }
  }
  cout << ans;
}

int32_t main() {
  cin.sync_with_stdio(0);cin.tie(0);
  cin.exceptions(cin.failbit);
  int tc=1;
  //cin >> tc;
  for (int i=1; i<=tc; ++i) {
    run();
  }
  return 0; 
}
/* 
    stuff you shoulds look for
    * int overflow,array bounds.
    * special cases (n=1?).
    * N,MOD value.
*/

Measured memory_bytes: 5176
def answer(h: int, n: int, a: []) -> str:
    return 'Yes' if h <= sum(a) else 'No'


def main():
    h, n = map(int, input().split())
    a = map(int, input().split())
    print(answer(h, n, a))


if __name__ == '__main__':
    main()


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N; cin >> N;
    vi t(N), x(N), y(N); REP(i, N) cin >> t[i] >> x[i] >> y[i];
    int time = 0; pii pos(0, 0);
    REP(i, N)
    {
        int tt = t[i] - time;
        int dist = abs(x[i] - pos.first) + abs(y[i] - pos.second);
        if(tt - dist >= 0 && tt % 2 == dist % 2);
        else
        {
           cout << "No" << endl;
           return; 
        }
        
        pos.first = x[i]; pos.second = y[i];
        time = t[i];
    }
    cout << "Yes" << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <set>
#include <list>

using namespace std;


int main() {
    int n;
    long v_max{-1000000000};
    cin >> n;
    long R[n], min_R[n];

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

    min_R[0] = R[0];
    for(int i=1;i<n;i++){
        min_R[i] = min(min_R[i-1], R[i-1]);
    }

    for(int i=1;i<n;i++){
        v_max = max(v_max, R[i] - min_R[i]);
    }
    cout << v_max << endl;
}


Measured memory_bytes: 6204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    string S, T;
    cin >> S >> T;
    int a, b;
    a = S.length();
    b = T.length();
    if(a < b){
        printf("UNRESTORABLE\n");
        return 0;
    }

    bool check;
    for (int i = a-b; i >= 0; i--) {
        check = true;
        for (int j = 0; j < b; j++) {
            if(S[i+j] != '?' && S[i+j] != T[j]){
                check = false;
                break;
            }
        }
        if(check == true){
            for (int j = 0; j < a; j++) {
                if(j >= i && j <= i + b - 1){
                    printf("%c", T[j-i]);
                }
                else{
                    if(S[j] == '?'){
                        printf("a");
                    }
                    else{
                        printf("%c", S[j]);
                    }
                }
            }
            return 0;
        }
    }
    
    printf("UNRESTORABLE\n");

}

Measured memory_bytes: 3620
package main

import (
	"fmt"
)

func getAbs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}
func getMin(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func getDist(l, r int) int {
	a := getAbs(l) + getAbs(r-l)
	b := getAbs(r) + getAbs(r-l)
	return getMin(a, b)
}

func main() {
	var N, K int
	fmt.Scan(&N, &K)

	X := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&X[i])
	}

	dist := 2147483647
	for i := 0; i+K <= N; i++ {
		dist = getMin(dist, getDist(X[i], X[i+K-1]))
	}
	fmt.Println(dist)
}


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

using namespace std;

int main(){
    int a,b,c,x,count=0;
    cin >> a >> b >> c >> x;
    for(int i = 0; i <= a; i++){
        for(int j = 0; j <= b; j++){
            for(int k = 0; k <=c; k++){
                if(500*i+100*j+50*k == x)
                    count++;
            }
        }
    }
    cout << count;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> pll;
const int INF=1e9;
const ll MOD=1e9+7;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};

int gcd(int x,int y){
    if(y==0) return x;
    return gcd(y,x%y);
}

int dis2(int x1,int y1,int x2,int y2){
    return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}

int main(){
    ll n,p;cin>>n>>p;
    ll g=1;
    for(ll i=2;i*i<=p;i++)if(p%i==0){
        ll c=0;
        while(p%i==0){
            p/=i;
            c++;
        }
        if(c/n>=1){
            g*=pow(i,c/n);
        }
    }
    if(p!=1){
        if(n==1) g*=p;
    }
    cout<<g<<endl;
    return 0;
}

Measured memory_bytes: 256