akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 19;
const ll MOD = 100000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

ll myrem(ll x) {
	return (x % 2 + 2) % 2;
}

ll in[1050][2];
int main() {
	int N, i, j;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%lld %lld", &in[i][0], &in[i][1]);
	
	ll c = myrem(in[1][0] + in[1][1]);
	for (i = 2; i <= N; i++) if (myrem(in[i][0] + in[i][1]) != c) return !printf("-1\n");

	if (c == 1) {
		printf("33\n");
		for (ll i = 0; i <= 32; i++) printf("%lld ", 1ll << i);
		printf("\n");
	}
	else {
		printf("34\n1 ");
		for (ll i = 0; i <= 32; i++) printf("%lld ", 1ll << i);
		printf("\n");
	}

	for (i = 1; i <= N; i++) {
		ll x = in[i][0], y = in[i][1];
		x *= -1, y *= -1;

		if (c == 0) {
			printf("R");
			x++;
		}

		for (ll j = 0; j <= 31; j++) {
			if (x % 2) {
				if (myrem((x + 1) / 2) != myrem(y / 2)) {
					x++;
					printf("R");
				}
				else {
					x--;
					printf("L");
				}
			}
			else {
				if (myrem(x / 2) != myrem((y + 1) / 2)) {
					y++;
					printf("U");
				}
				else {
					y--;
					printf("D");
				}
			}
			x /= 2, y /= 2;
		}
		if (x == -1) printf("R");
		else if (x == 1) printf("L");
		else if (y == -1) printf("U");
		else printf("D");
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = list(input())
e=S[1:].count('E')
w=S[:0].count('W')
ans = e+w
for i in range(1,N):
    if(S[i]=='E'):
        e=e-1
    if(S[i-1]=='W'):
        w=w+1
    ans=min(ans,e+w)
print(ans)


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

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)calloc(n,sizeof(int));
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int64 *dp=(int64 *)calloc(n,sizeof(int64));
  for(i=1;i<=n;i++){
    for(int j=0;j+i-1<n;j++){
      dp[j]=MAX(a[j]-dp[j+1],a[j+i-1]-dp[j]);
    }
  }
  printf("%lld\n",dp[0]);
}

int main(void){
  run();
  return 0;
}

Measured memory_bytes: 256
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var a = BigInt(next());
  var b = BigInt(next());
  var n = BigInt(next());
  var ans = 0n;
  for(var i = b-1n, j = 0; i <= n && j < 1e5; i += b, j++){
    var t = a*i/b - a*(i/b);
    if(ans < t)ans = t;
  }
  var t = a*n/b - a*(n/b);
  if(ans < t)ans = t;
  for(var i = n/b*b-1n, j = 0; i > 0 && j < 1e5; i -= b, j++){
    var t = a*i/b - a*(i/b);
    if(ans < t)ans = t;
  }
  return ans.toString();
}

Measured memory_bytes: 35156
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int n, ma, mb;
vi a(40);
vi b(40);
vi c(40);
int dp[41][404][404];

int rec(int i, int an, int bn){
  if(dp[i][an][bn] >= 0) return dp[i][an][bn];

  int res;
  if(an == 0 && bn == 0) res = 0;
  else if(i == n) res = INF;
  else if(an >= a[i] && bn >= b[i]){
    res = min(rec(i+1, an-a[i], bn-b[i]) + c[i], rec(i+1, an, bn));
  }
  else res = rec(i+1, an, bn);
  return dp[i][an][bn] = res;
}

int main(){
  cin >> n >> ma >> mb;
  rep(i, n) cin >> a[i] >> b[i] >> c[i];
  vector<P> cand;
  int maa, mab;
  rrep(i, 100){
    maa = ma * i; mab = mb * i;
    if(maa > 400 || mab > 400) break;
    cand.pb(make_pair(maa, mab));
  }

  int ans = INF;
  rep(i, cand.size()){
    memset(dp, -1, sizeof(dp));
    ans = min(ans, rec(0, cand[i].fi, cand[i].se));
  }
  if(ans >= INF) cout << -1 << endl;
  else cout << ans << endl;
  return 0;
}

Measured memory_bytes: 26368
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int N = sc.nextInt();
      	int preT = 0;
      	int preX = 0;
      	int preY = 0;
      
      	int postT, postX, postY, dt, dist;
      	for(int i = 0; i < N; i++){
        	postT = sc.nextInt();
          	postX = sc.nextInt();
          	postY = sc.nextInt();
          	
          	dt = postT - preT;
          	dist = Math.abs(postX-preX) + Math.abs(postY-preY);
          	if((dt < dist) || ((dist-dt)%2 != 0)){
            	System.out.println("No");
              	return;
            }
          	preT = postT;
          	preX = postX;
          	preY = postY;
        }
      	System.out.println("Yes");
    }
}

Measured memory_bytes: 57168
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

signed main(){
	cout<<fixed<<setprecision(10);
	
	int N;
	int ans = 0;
	map<int, int> con;
	
	
	cin>>N;
	
	int a;
	
	for(int i = 0; i < N; i++){
		cin>>a;
		con[a]++;
	}
	
	for(pair<int,int> p : con){
		if(p.first > p.second)ans += p.second;
		else if(p.first < p.second) ans += p.second - p.first;
	}
	
	cout<<ans<<endl;
	
	
	return 0;
}

Measured memory_bytes: 6272
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            int mod = (int)Math.Pow(10, 9) + 7;
            var n = ReadInt();
            var a = ReadIntArray();

            var isEven = n % 2 == 0;
            var seq = Enumerable.Range(0, n).Select(v => v % 2 == 0 ? v + (isEven ? 1 : 0) : v + (isEven ? 0 : 1));
            if (a.OrderBy(v => v).SequenceEqual(seq))
            {
                Console.WriteLine(Utility.PowMod(2, n / 2, mod));
            }
            else
            {
                Console.WriteLine(0);

            }
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);
    }
    public static class Utility
    {
        public static long PowMod(long a, long n, long mod)
        {
            long result = 1;
            while (n > 0)
            {
                if ((n & 1) != 0) result = result * a % mod;
                a = a * a % mod;
                n >>= 1;
            }
            return result;
        }
    }
}


Measured memory_bytes: 21600
using System;
using System.Collections.Generic;

public class Hello{
    public static void Main(){
        string[]array=Console.ReadLine().Split(' ');
        var list=new List<int>();
        for(var i=0;i<3;i++){
            list.Add(int.Parse(array[i]));
        }
        
        list.Sort();
        var sum=0;
        sum=list[0]+list[1];
        Console.WriteLine(sum);
    }
}

Measured memory_bytes: 11092
n = int(input())
w = [input() for _ in range(n)]

last = ""
s = set()

for i in range(n):
    if i != 0:
        if (last != w[i][0]) or w[i] in s:
            print("No")
            exit()
    s.add(w[i])
    last = w[i][-1]


print("Yes")
    


Measured memory_bytes: 3060
#include<bits/stdc++.h>
 using namespace std;
 int main()
 {
 	int d,n;
 	cin>>d>>n;
 	if(n==100)
 	{
 		cout<<"101";
	}
	else
	{
		cout<<n;
	}
	if(d==1)
	{
		cout<<"00\n";
	}
	else if(d==2)
	cout<<"0000\n"; 
 	return 0;
  } 

Measured memory_bytes: 256
import itertools
import math

N, D = map(int, input().split())
POINTS = [[int(i) for i in input().split()] for _ in range(N)]

results = 0
comb = itertools.combinations(range(1, N + 1), 2)
for a, b in comb:
    A = POINTS[a - 1]
    B = POINTS[b - 1]
    n = 0
    for d in range(D):
        n += math.fabs(B[d] - A[d])**2
    if math.sqrt(n).is_integer():
        results += 1

print(results)


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

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

int gcd(int a, int b) {
    while(b != 0) {
        int r=a%b;
        a=b;
        b=r;
    }
    return a;

}

int ans;
int k;
//void dfs(vector<int> s) {
//    if(s.size()==3) {
//        ans+=gcd(gcd(s[0],s[1]),s[2]);
//        //cout<<s[0]<<' '<<s[1]<<' '<<s[2]<<endl;
//        return;
//    }
//
//    for(int i=1;i<=k;i++) {
//        s.push_back(i);
//        dfs(s);
//        s.pop_back();
//    }
//
//    return;
//        
//}

int main() {
    fast_io;
    ans=0;

    cin>>k;

    for(int i=1;i<=k;i++) {
        for(int j=1;j<=k;j++) {
            for(int l=1;l<=k;l++) {
                ans+=gcd(gcd(i,j),l);
            }
        }
    }

    cout<<ans<<endl;


}




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

const ll mod = 1e9 + 7;

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

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

vector<ll> fact, fact_inv;

template <typename T> T mpow(T x, T n) {
    T ret = 1;
    while(n > 0) {
        if(n & 1) (ret *= x) %= mod;
        (x *= x) %= mod;
        n = n >> 1;
    }
    return ret;
}

void COMinit(ll MAX) {
    fact.resize(MAX + 1);
    fact_inv.resize(MAX + 1);
    fact[0] = fact_inv[0] = 1;
    rep(i, MAX) {
        fact[i + 1] = fact[i] * (i + 1) % mod;
        fact_inv[i + 1] = mpow(fact[i + 1], mod - 2);
    }
}

ll COM(ll n, ll k) {
    if(n < k || k < 0) return 0;
    return (fact[n] * fact_inv[k] % mod) * fact_inv[n - k] % mod;
}

ll f(int x, int y) {
    if(x < y) swap(x, y);
    ll re = 0;
    rep(i, y + 1)(re += COM(x + i + 1, i + 1)) %= mod;
    return re;
}

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

    int r1, r2, c1, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    r1--;
    c1--;

    cout << (f(r2, c2) - f(r2, c1) - f(r1, c2) + f(r1, c1) + mod * 2) % mod;
}

Measured memory_bytes: 31488
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(){
	string s;
	cin >> s;
	
	int f = 0;
	if(s[0]=='A') f = 1;
	int k = -1;
	for(int i=2;i<s.size()-1;i++){
		if(s[i]=='C'){
			k = i;
			f++;
		}
	}

	for(int i=1;i<s.size();i++){
		if(k==i) continue;
		int p = s[i] - 'a';
		if(p<0 || p>=26){
			f = 0;
			break;
		}
	}
	if(f==2) cout << "AC\n";
	else cout <<"WA\n";
	return 0;

}


Measured memory_bytes: 256
main(){
  int n,m,a,b,c,d[100010],r,i;
  while(scanf("%d %d %d %d %d",&n,&a,&b,&c,&m),n){
    for(i=0;i<n;i++)scanf("%d",&d[i]);
    for(i=r=0;i<10001;i++){
      if(d[r]==m)r++;
      if(r==n)break;
      m=(a*m+b)%c;
    }
    printf("%d\n",r-n?-1:i);
  }
  return 0;
}

Measured memory_bytes: 604
n, x = map(int, input().split())

level = [1]
p = [1]
for i in range(n):
    level.append(level[i]*2 + 3)
    p.append(p[i]*2 + 1)
#print(level)
#print(p)


def f(N, X):
    # 終了条件
    if N == 0:
        if X <= 0:
            return 0
        else:
            return 1
    mid = (level[N]+1)//2
    if X < mid:
        return f(N-1, X-1)
    elif X == mid:
        return p[N-1] + 1
    elif mid < X:
        return p[N-1] + 1 + f(N-1, X-mid)


ans = f(n, x)
print(ans)

Measured memory_bytes: 38256
//https://atcoder.jp/contests/abc142/tasks/abc142_b
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long 
int main(){
    int n,k;
    int ans=0;
    cin >>n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h.at(i);
    
    rep(i,n){
        if(h.at(i) >= k) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
 
int main(void) {
 
	// ??°????????\???????????°????????????????????\???
	int num1, num2, num3;
	scanf("%d %d %d", &num1, &num2, &num3);
	
	// ?´???°?????°
	int divisor = 0;
 
	// ??\???????????????????????°????¨????????????????
	for(int cnt = num1; cnt <= num2; cnt++) {

		if(num3 % cnt ==0) {
			
			divisor++;
			
		}
	}
	printf("%d\n", divisor);
 	return 0;
}

Measured memory_bytes: 1848
N, maxW = map(int, input().split())
V, W = [], []
for i in range(N):
    v, w = map(int, input().split())
    V.append(v); W.append(w)
dp = [[0]*(maxW+1) for _ in range(2)]
for i in range(N):
    for j in range(maxW+1):
        if j < W[i]:
            dp[(i+1)&1][j] = dp[i&1][j]
        else:
            dp[(i+1)&1][j] = max(dp[i&1][j], dp[i&1][j-W[i]] + V[i])
print(dp[N&1][maxW])

Measured memory_bytes: 7240
#include <bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;

    int x = (a + b) / 2;
    if (a % 2 == 0 && b % 2 != 0 || a % 2 != 0 && b % 2 == 0) {
        cout << x + 1 << endl;
    } else {
        cout << x << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>
#include <sstream>

using namespace std;


bool solve(){
	int w, n;
	cin>> w>> n;
	vector<int> W(w,0);
	for(int i=0;i<w;i++){
		W[i]=i+1;
	}
	
	int a, b;
	char c;
	for(int i=0;i<n;i++){
		cin>> a>> c>> b;
		swap(W[a-1],W[b-1]);
	}
	
	for(int i=0;i<w;i++){
		cout<< W[i]<< endl;
	}
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(5);
	solve();

	return 0;
}

 

Measured memory_bytes: 1192
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <iomanip>
#include <cassert>
#include <random>


int main() {
    long long a, b, c, k; std::cin >> a >> b >> c >> k;
    long long ans = 0;
    ans += std::min(a, k);
    k -= std::min(a, k);
    k -= std::min(b, k);
    ans -= std::min(c, k);
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 3640
using System.Text;
using System;

public class UnionFind
{
    private int[] data;
    public UnionFind(int size)
    {
        data = new int[size];
        for (int i = 0; i < size; i++) data[i] = -1;
    }
    public bool Unite(int x, int y)
    {
        x = Root(x);
        y = Root(y);
        if (x != y)
        {
            if (data[y] < data[x])
            {
                var tmp = y;
                y = x;
                x = tmp;
            }
            data[x] += data[y];
            data[y] = x;
        }
        return x != y;
    }
    public bool IsSameGroup(int x, int y) => Root(x) == Root(y);
    public int Root(int x) => data[x] < 0 ? x : data[x] = Root(data[x]);
    public int getMem(int x) => -data[Root(x)];
}


public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        var a = new int[m];
        var b = new int[m];
        for (int i = 0; i < m; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            a[i] = int.Parse(line[0]) - 1;
            b[i] = int.Parse(line[1]) - 1;
        }
        Array.Reverse(a);
        Array.Reverse(b);
        putAns(a, b, n, m);
    }
    static void putAns(int[] a, int[] b, int n, int m)
    {
        var ans = new long[m + 1];
        var uf = new UnionFind(n + 10);
        ans[0] =(long) n * (n - 1) / 2L;
        for (int i = 0; i < m; i++)
        {
            if (uf.IsSameGroup(a[i], b[i])) ans[i + 1] = ans[i];
            else
            {
                long wa = uf.getMem(a[i]);
                long wb = uf.getMem(b[i]);
                ans[i + 1] = ans[i] - wa * wb;
                uf.Unite(a[i], b[i]);
            }
        }
        Array.Reverse(ans);
        var sb = new StringBuilder();
        for (int i = 1; i <= m; i++)
            sb.Append(string.Format("{0}\n", ans[i]));
        Console.Write(sb);
    }
}

Measured memory_bytes: 24508
#ifndef DEBUG
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#endif
#include <bits/stdc++.h>
using namespace std;
//using namespace __gnu_pbds;

#ifdef DEBUG
#define IO
#else
#define IO ios::sync_with_stdio(0);cin.tie(0)
#define endl '\n'
#define cerr
#endif
#define _ <<' '<<
#define Fr(i, s, e) for(auto i = s; i < e; ++i)
#define Ft first
#define Sd second
#define All(v) v.begin(),v.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
// template<typename T> using rkt = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

signed main() {
    IO;

    int a, b;
    while (cin >> a >> b) {
    	int x = 1;
	    while (x != 1e6 && !(x/10 == b && x*8/100 == a)) x++;
    	cout << (x==1e6 ? -1 : x) << endl;
    }

}

Measured memory_bytes: 256
#include <iostream>

using i64 = long long;

const i64 MOD = 1000000007;
const int N = 19, S = 1 << 16 | 7;

int n, m;
int a[N];
i64 g[S], f[S];
i64 fac[S], ifc[S];
i64 ans;

i64 pow(i64 a, i64 k) {
	i64 t = 1;
	for (; k; a = a * a % MOD, k >>= 1)
		if (k & 1) t = t * a % MOD;
	return t;
}
i64 binom(int n, int m) {
	return n < m || m < 0 ? 0 : fac[n] * ifc[m] % MOD * ifc[n - m] % MOD;
}

int main() {
//	freopen("code.in", "r", stdin);
//	freopen("code.out", "w", stdout);

	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i)
		scanf("%d", a + i);
	fac[0] = 1;
	for (int i = 1; i <= 1 << n; ++i)
		fac[i] = fac[i - 1] * i % MOD;
	ifc[1 << n] = pow(fac[1 << n], MOD - 2);
	for (int i = 1 << n; i; --i)
		ifc[i - 1] = ifc[i] * i % MOD;

	for (int i = 1; i < 1 << n; ++i)
		g[i] = g[i ^ (i & -i)] + (i & -i);
	f[0] = 1;
	for (int i = m; i; --i)
		for (int j = (1 << n) - 1; j; --j)
			for (int k_ = j, k; k_; k_ ^= k_ & -k_)
				k = j ^ k_ & -k_, ( f[j] += f[k] * binom((1 << n) - a[i] - g[k], (j ^ k) - 1) % MOD * fac[j ^ k] ) %= MOD;
	for (int i = 0; i < 1 << n; ++i)
		( ans += (__builtin_parity(i) ? -1 : 1) * f[i] * fac[g[(1 << n) - 1 ^ i]] ) %= MOD;
	ans = ans * (1 << n) % MOD;
	printf("%lld", (ans + MOD) % MOD);
	
	return 0;
}


Measured memory_bytes: 5876
#include<iostream>
using namespace std;
int main(){
    int A,B,m,n,p,q;
    cin >> A >> B;
    int count = 0;
    for (int i = A; i <= B; i++){
        m = i/1000;
        p = i%10;
        q = i%100 - p;
        n = p*10 + q/10;
        if(m == n){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}

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

#define ms(s,n) memset(s,n,sizeof(s))
#define all(a) a.begin(),a.end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mk make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;

const int MOD = (int) 1e9+7;
const int INF = (int) 1e9+1;
inline ll gcd(ll a,ll b){ll r;while(b){r=a%b;a=b;b=r;}return a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int main(){
	string s;
	cin>>s;
	int sum=0;
	for(int i=0;i<s.length();i++){
		sum+=s[i]-'0';
	}
	if(sum%9==0)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}


Measured memory_bytes: 3736
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int n, q;
vector<int> ki[200001];
vector<int> value(200001);
vector<ll> ans(200001, -1);


ll llmax(ll x, ll y){
	if (x > y) return x;
	return y;
}

void dfs(int from_value, int now){
	ans[now] = value[now] + from_value;
	for (auto x : ki[now]){
		if (ans[x] == -1){
			dfs(ans[now], x);
		}
	}
}


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

	for (int i = 1; i < n; i++){
		int a, b;
		cin >> a >> b;
		ki[a].push_back(b);
		ki[b].push_back(a);
	}
	for (int i = 0; i < q; i++){
		int p, x;
		cin >> p >> x;
		value[p] += x;
	}

	dfs(0, 1);
	for (int i = 1; i <= n; i++){
		cout << ans[i] << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 21888
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<float.h>
#include<tuple>
#include<string.h>
#include<iomanip>

using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define ALLOF(c) (c).begin(), (c).end()
const ll mod=10e9+7;
ll ABS(ll a){return max(a,-a);}


int main(void){
    ll N,maxi=0;
    cin>>N;
    vector<ll> H(N);
    rep(i,N){
        cin>>H.at(i);
        maxi=max(maxi,H.at(i));
        if(maxi-H.at(i)>1){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>
#include<string.h>

#define M 1046527
#define L 14

char H[M][L]; 

int getChar(char ch){
  if ( ch == 'A') return 1;
      else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}


long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  
  return sum;
  
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M -1)); }

int find(char str[]){

    
  long long key,i,h;

  key = getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0)return 0;
  }
}

int insert(char str[]){

  
  long long key,i,h;

  key = getKey(str);
  for(i=0;;i++){
    h=(h1(key)+i*h2(key))%M;
    if(strcmp(H[h],str)==0)return 1;
    else if(strlen(H[h])==0){
      strcpy(H[h],str);
      return 0;
    }
  }
}

int main(){
    int i, n, k;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}



Measured memory_bytes: 16100
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

vector<int> a;
vector<int> b;
vector<int> c;
vector<int> d;
int ans=0;
  int n, m ,q;

void dfs(vector<int> A){
  if(A.size()==n+1){
    int score=0;
    rep(i, q){
      if(A[b[i]]-A[a[i]]==c[i]){
        score+=d[i];
      }
    }
    ans=max(ans, score);
    return;
  }
  A.push_back(A.back());
  while(A.back()<=m){
    dfs(A);
    A.back()++;
  }
}

int main(){
  cin >> n >> m >> q;
  a.resize(q);b.resize(q);c.resize(q);d.resize(q);
  rep(i, q){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
  }
  dfs(vector<int> (1, 1));
  cout << ans << endl;
  return 0;
}


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

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

int check(vector<int> S,vector<int> C,vector<vector<int>> A,int X,int M){
    int cost = 0;
    vector<int> expert(M,0);
    for(int i:S){
        cost += C[i];
        for(int j = 0 ;j<M;++j){
            expert[j] += A[i][j];
        }
    }
    
    bool flg = true;
    for(int j=0;j<M;++j){
        if(expert[j]<X){
            flg = false;
            break;
        }
    }
    
    
    if(flg) return cost;
    else return -1;
    
}

int main(void){
    int N,M,X;
    cin>>N>>M>>X;
    
    vector<int> C(N);
    vector<vector<int>> A(N,vector<int>(M));
    
    for(int i=0;i<N;++i){
        for(int j=0;j<M+1;++j){
            if(j==0)cin>>C[i];
            else cin>>A[i][j-1];
        }
    }
    
    // for(int i=0;i<N;++i){
    //     cout<<C[i]<<" ";
    //     for(int j=0;j<M;++j){
    //         cout<<A[i][j]<<" ";
    //     }
    //     cout<<" "<<endl;
    // }

    bool can = false;
    long long minCost = 9223372036854775807;
    for (int bit = 0; bit < (1 << N); ++bit) {
        // どれを選ぶか
        vector<int> S = IntegerToVector(bit, N);
        int cost = check(S,C,A,X,M);
        if(cost<0) continue;
        if(cost<minCost){
            minCost=cost;
            can = true;
        }
    }
    if(can)cout<<minCost<<endl;
    else cout<<"-1"<<endl;
}


Measured memory_bytes: 3600
#include <iostream>
using namespace std;
typedef long long ll;
int N,Q;
int A[100010];
ll bit0[100010] = {0},bit1[100010] = {0};

ll sum(ll *b,ll i){
	ll s = 0;
	while(i>0){
		s += b[i];
		i -= i&-i;
	}
	return s;
}

void add(ll *b,int i,ll v){
	while(i<=N){
		b[i] += v;
		i += i&-i;
	}
}

void seg_add(int l,int r, ll x){
	add(bit0,l,-x*(l-1));
	add(bit1,l,x);
	add(bit0,r+1,x*r);
	add(bit1,r+1,-x);	
}

ll seg_sum(int l, int r){
	ll res = 0;
	res += sum(bit0,r) + sum(bit1,r)*r;
	res -= sum(bit0,l-1) + sum(bit1,l-1)*(l-1);
	return res;
}

int s,t,com;
ll x;

int main(){
	cin >> N >> Q;
	for(int i=0;i<Q;i++){
		cin >> com;
		if(com==0){
			cin >> s >> t >> x;
			seg_add(s,t,x);
		}else{
			cin >> s >> t;
			cout << seg_sum(s,t) << endl;
		}
	}
}


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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m; cin>>n>>m;
    vector<int> a(m,0);
    REP(i,n){
        int k; cin>>k;
        REP(j,k){
            int in; cin>>in;
            a[in-1]++;
        }
    }
    int ans = 0;
    REP(i,m){
        if(a[i]==n) ans++;
    }
    print(ans);
    return 0;
}

Measured memory_bytes: 256
/*ITP1_5_A:Print a Rectangle*/
#include <iostream>
using namespace std;

int main() {
    int H,W;
    cin >> H >> W;

    while ( H!=0 || W!=0) {
        for (int i=0; i<H; i++) {
            for (int j=0; j<W-1; j++) {
                cout << '#';
            }   
            cout << '#' << endl;
        }   
        cin >> H >> W;
        cout << endl;
    }   
    
    return 0;
}



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

#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int long long int
#define MAX 1e9
#define MIN -1e9
#define mod 1000000007
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define output(x) cout << ( x ? "Yes" : "No" ) << '\n' ;
#define mxn 100005
using namespace std;

void solve(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        ans += n / i;
        if(n % i == 0)ans--;
    }
    cout << ans << '\n' ;
}

int32_t main()
{
    FLASH
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}



Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
const int MAX = (1<<20);
const int mod = 100000;
#define rep(i,n) for(int i = 0;i < n;i++)

int cur[2][MAX], nex[2][MAX], msk = MAX-1;
char str[22][22], ss[] = "JOI";

int solve(int y, int x, int s, char c){
	if(str[y][x] != c && str[y][x] != '?')return 0;
	if(c == 'I' && (s & (1<<x)))return 0;
	int mask = (1<<x)^msk;
	if(1 <= x && c == 'O')nex[0][(s|(1<<(x-1)))&mask] += cur[1][s];
	if(x == 0 && c == 'O')nex[0][s&mask] += cur[1][s];
	if(c == 'J')nex[1][s&mask] += cur[0][s]+cur[1][s];
	if(c == 'O')nex[0][s&mask] += cur[0][s];
	if(c == 'I')nex[0][s&mask] += cur[0][s]+cur[1][s];
	nex[0][s&mask] %= mod;
	nex[1][s&mask] %= mod;
	return 0;
}

int main(){
	int h, w;
	scanf("%d%d", &h, &w);
	for(int i = 0;i < h;i++)scanf("%s", str[i]);
	
	cur[0][0] = 1;
	rep(y,h)rep(x,w){
		fill((int*)nex, (int*)(nex+2), 0);
		rep(s,(1<<w))rep(i,3)solve(y, x, s, ss[i]);
		swap(cur, nex);
	}
	
	int ans = 1;
	rep(i,h)rep(j,w)if(str[i][j] == '?')ans = (ans*3)%mod;
	rep(i,2)rep(j,(1<<w))ans = (ans-cur[i][j]+mod)%mod;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 19572
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define lsc(x)      scanf("%lld",&x)
#define sc(x)       scanf("%d",&x)
#define lpr(x)      printf("%lld ",(long long)x)
#define pr(x)       printf("%d ",x)
#define n_l         printf("\n")
#define VI          vector<int>
#define VII         vector<long long int>
#define m_p         make_pair
#define pb          push_back
#define fi           first
#define se           second
#define mset(x,y)   memset(x,y,sizeof(x))
#define sz(v)       (int)v.size()
#define all(v)      v.begin(), v.end()
#define fr(i, a, n) for(int i=a;i<=n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const int N=(int)1e6+5;
const int mod = 1000000007;
typedef long long ll;
// order_of_key (val): returns the no. of values strictly less than val
// find_by_order (k): returns the kth largest element iterator.(0-based)
// vector<int>::iterator itr=lower_bound(v.begin(),v.end(),x);
// s.substr(pos[0-indexed], len(default=till end))
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll fmod(ll x){if (x<mod) return x;return x%mod;}
ll mul(ll a, ll b, ll c){
	ll ret=0;while(b){if (b%2) ret=(ret+a)%c;a=(a*2)%c;b>>=1;}
    return ret;
}
int modpow(ll a, ll b){
    ll ret=1;while(b){if (b%2) ret=(ret*a)%mod;a=(a*a)%mod;b>>=1;}
    return (int)ret;
}
inline int inv(int x){ return modpow(x, mod-2);}
int isprime[N];
void calc_prime(){
	isprime[1]=1;for(ll i=2;i<N;i++) if (!isprime[i]) for(ll j=i*i;j<N;j+=i) isprime[j]=1;
}
int main(){
    int n;sc(n);
    int x;sc(x);

    pr(max(max(n*x, n-x), n+x));n_l;
    return 0;
}



Measured memory_bytes: 3788
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

  private void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int heapSize = Integer.parseInt(br.readLine());
      String[] keys = br.readLine().split(" ");
      int[] heap = new int[heapSize+1];
      for(int i=1; i<=heapSize; i++)
        heap[i] = Integer.parseInt( keys[i-1] );

      StringBuilder buf = new StringBuilder();
      for(int i=1; i<=heapSize; i++){
        buf.append("node " + i + ": key = " + heap[i] + ", ");
        if( i != 1 ) buf.append("parent key = " + heap[i/2] + ", ");
        if( i*2 <= heapSize) {
          buf.append("left key = " + heap[i*2] + ", ");
          if( i*2+1 <= heapSize) {
            buf.append("right key = " + heap[i*2+1] + ", ");
          }
        }
        buf.append("\n");
      }

      System.out.print(buf);
    } catch(IOException e) {
      System.out.println("IOException!");
    }
  }
}


Measured memory_bytes: 24240
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define Mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f 
#define MEM(x,y) memset(x,y,sizeof(x))
#define Maxn 100005
#define P pair<int,int>
using namespace std;
int main()
{
	char a[100005];
	scanf("%s", &a);
	int ans = 0;
	for (int i = 0; i < strlen(a)-1; i++)
	{
		if (a[i] == a[i + 1])
			continue;
		else
		{
			ans++;
		}
	}
	cout << ans;
}

Measured memory_bytes: 384
n = input()
getDigit = len(n)

if getDigit%2 == 0: digit = getDigit - 1
else : digit = getDigit
x = '9'
x = int(x.rjust(digit,'9'))

n = int(n)
diff = max(x - n,0)
ans = 9

for i in range(1,int(digit/2)+1):
    ans += 100 ** i * 9
    
ans -= diff

print(ans)

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

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

  int sum = 0;
  for (int i = 0; i < N; i++){
    int r, l;
    cin >> r >> l;
    sum += l - r + 1;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define all(v) v.begin(),v.end()
#define zeros(arr) memset(arr,0,sizeof(arr));
#define precise(num)  cout<<fixed; cout << std::setprecision(num)
#define nl cout<<"\n";
#define test int t;cin>>t;while(t--) 
const int maxx  =1e6+1 , limit = 1e17 , MOD=1e9+7;
#define boost  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int32_t main(){
    boost;
        
        
    int k;
    cin>>k;
    
    int dp[k+1];
    
    for(int i=1;i<=k ; i++ ){
        int v1 = k/i;
        dp[i] = v1*v1*v1;
    }
    
    
    for(int i = k ; i >=0 ; i-- ){
        
        for(int p = 1 ; p  <  i ; p++  ){
            
            if(i%p ==0 ){
                dp[p] = dp[p] - dp[i];
            }
            
        }
        
        
    }
    
    int res =0 ;
    for(int i =1 ;i<=k ;i++ ){
        res = res + dp[i]*i;
    }
    cout<<res<<endl;
        
    
}


Measured memory_bytes: 3652
# coding: utf-8
# Your code here!
X,K,D=map(int,input().split())

move=min(abs(X)//D,K)
ans=abs(X)-move*D

if move==K:
    print(ans)
else:
    if (K-move)%2==0:
        print(ans)
    else:
        print(abs(ans-D))

Measured memory_bytes: 9160
#include <stdio.h>
#include <string.h>

int main(void)

{
	int n,i;
	long long int power=1;
	scanf("%d",&n);
	
	for(i=1;i<=n;i++){
		power*=i;
		power=power%(10*10*10*10*10*10*10*10*10+7);
	}
	printf("%lld\n",power);
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1609&lang=jp>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

int n;
string solve(){
    string res = "#";
    vector<int> cand(26,0);
    vector<char> c(n);
    for(auto& in:c){ cin >> in; in -= 'A';}
    for(int i = 0; i < n;i++){
        cand[c[i]]++;
        int leaf = n - i - 1;
        for(int j = 0; j < 26;j++){
            bool ok = true;
            for(int k = 0; k < 26;k++){
                if(j == k) continue;
                if(cand[j] <= cand[k] + leaf) { ok = false; break;}
            }
            if(ok){
                res = string(1,(char)(j+'A')) + " " + to_string(i+1);
                return res;
            }
        }
    }
    res = "TIE";
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    while(cin >> n,n){
        cout << solve() << endl;
    }
    return 0;
}



Measured memory_bytes: 3264
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ldb;
typedef pair<ll,ll> pll;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define V vector
#define endl "\n"
#define CLEAR(a) memset(a,0,sizeof(a))
#define all(x) x.begin(),x.end()
#define sz(x) ((ll)x.size())
#define rep0(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define ios_tie() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(nullptr)
#define trace1(a)             cout <<#a<<":"<<a<< endl;
#define trace2(a,b)           cout <<#a<<":"<<a<<" | "<<#b<<":"<<b<< endl;
#define trace3(a,b,c)         cout <<#a<<":"<<a<<" | "<<#b<<":"<<b<<" | "<<#c<<":"<<c<<endl;
#define trace4(a,b,c,d)       cout <<#a<<":"<<a<<" | "<<#b<<":"<<b<<" | "<<#c<<":"<<c<<" | "<<#d<<":"<<d<<endl;

const ll inf = (ll)1e18;
const ll maxn = 1e9+1;
const ldb PI = acos(-1);

void lol(ll s) {cerr<<"check........................................... "<<s<<endl;}
ll power(ll x, ll y, ll mod) {ll res=1; x%=mod; while(y) {if(y&1) res=(res*x)%mod; y>>=1LL; x=(x*x)%mod; }return res;}
ll inv(ll x, ll mod) {return power(x,mod-2,mod);}//(1/x)%y = x^(y-2) % y;   // pow(x,y)%m = pow(x,y%(m-1))%m
mt19937 rng((ll)chrono::steady_clock::now().time_since_epoch().count());

// I can solve mirror cube in 2 mins but can't solve div2 C in 1hr.
void solve()
{
    char ch;
    cin>>ch;
    if('A'<=ch && ch<='Z') {
        cout<<"A\n";
    }
    else {
        cout<<"a\n";
    }
}
int main()
{
    ios_tie();
    // freopen("input.txt", "r", stdin);
    // freopen("myOut.txt", "w", stdout);
    ll _ = 1;
    // cin>>_;
    rep1(i,_)
    {
        // cout<<"Case #"<<i<<": ";
        solve();
    }
    return 0;
}


Measured memory_bytes: 3652
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
using namespace std;

int main() {
    int L;
    cin >> L;
    double s = L / 3.0;
    printf("%.9lf\n", s*s*s);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int a,b;
	cin >> a >> b;
	int ans = 0;
	int k = 1;
	for(;;){
		if(k >= b)break;
		ans++;
		k = k + a - 1;
	}
	cout << ans << endl;
	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int

using namespace std;
int main()
{
    ll n,x,a=0,i;
    cin>>n;
    map<ll,ll> m;
    set<ll> s;
    map<ll,ll> :: iterator it;

    for(i=0; i<n; i++)
    {
        cin>>x;
        m[x]++;
        //s.insert(x);

    }

    for(it=m.begin(); it!=m.end(); it++)
    {
        if((it->first)<=(it->second))
        {
            a+=((it->second)-(it->first));
            //cout<<a<<endl;
        }
        else if((it->first)>(it->second))
        {
            a+=(it->second);
             //cout<<a<<endl;
        }
    }

    cout<<a<<endl;
    return 0;
}



Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
struct pro{
	bool q=false;
	int n=0;	
}a[maxn];
int main(){
	int n,m,sum1=0,sum2=0;
	cin>>n>>m;
	while(m--){
		int x;string s;
		cin>>x>>s;
		if(s=="WA"){
			if(a[x].q==false){
				a[x].n++;
			}
		}
		else{
			a[x].q=true;
		}
	}
	for(int i=1;i<=n;i++){
		if(a[i].q==true){
			sum1++;
			sum2+=a[i].n;
		}
	}
	cout<<sum1<<' '<<sum2;
	
	
	
	return 0;
	
}

Measured memory_bytes: 1024
import java.util.Scanner;

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

		if(S <= W) {
			System.out.println("unsafe");
		}else {
			System.out.println("safe");
		}
		scan.close();
	}

}


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

int main() {
    int N, f;
    cin >> N;
    int M = N;
    f = 0;
    while(true){
        f += M % 10;
        M /= 10;
        if(M  == 0){
            break;
        }
    }
     if(N % f == 0 ){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static List<int>[] li;
	static bool[] b;
	static int[] h;
	static int[] low,pre;
	static List<Tuple<int,int>> ans;
	static void Main(){
		Sc sc=new Sc();
		int[] s=sc.Ia;
		int n=s[0],m=s[1];
		if(m==0){return;}
		li=new List<int>[n+1];
		b=new bool[n+1];
		h=new int[n+1];
		low=new int[n+1];
		pre=new int[n+1];
		ans=new List<Tuple<int,int>>();
		for(int i=0;i<n;i++){li[i]=new List<int>();}
		for(int i=0;i<m;i++){
			int[] e=sc.Ia;
			li[e[0]].Add(e[1]);
			li[e[1]].Add(e[0]);
		}
		Fu(1,0,-1);
		var ans2=ans.OrderBy(x=>x.Item1).ThenBy(x=>x.Item2).ToArray();
		StringBuilder sb=new StringBuilder();
		foreach(var e in ans2){sb.Append(e.Item1+" "+e.Item2+"\n");}
		Console.Write(sb);
	}
	static void Fu(int a,int g,int p){
		b[a]=true;
		pre[a]=g;
		low[a]=g;
		for(int i=0;i<li[a].Count;i++){
			if(!b[li[a][i]]){
				Fu(li[a][i],g+1,a);
				if(low[li[a][i]]==pre[li[a][i]]){ans.Add(Tuple.Create(Min(a,li[a][i]),Max(a,li[a][i])));}
			}
			if(li[a][i]!=p){low[a]=Min(low[li[a][i]],low[a]);}
		}
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}



Measured memory_bytes: 25024
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>

using ll = long long;

int main() {
  int N;

  std::cin >> N;

  std::vector<std::tuple<long, long>> Tasks;

  Tasks.reserve(N);

  for (int i=0; i<N; i++) {
    ll a, b;
    std::cin >> a >> b;
    Tasks.emplace_back(b, a);
  }

  std::sort(Tasks.begin(), Tasks.end());

  ll total = 0;

  for (auto p: Tasks) {
    ll a, b;
    std::tie(b, a) = p;

    total += a;

    if (total > b) {
      std::cout << "No" << std::endl;
      return 0;
    }
  }

  std::cout << "Yes" << std::endl;

  return 0;
}


Measured memory_bytes: 3328