akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) \
  SORT(var);       \
  REVERSE(var)
#define OPTIMIZE_STDIO         \
  ios::sync_with_stdio(false); \
  cin.tie(0);                  \
  cout.precision(10);          \
  cout << fixed
#define endl '\n'

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
struct mint {
  ll x;
  mint() : x(0) {
  }
  mint(ll x) : x((x % MOD + MOD) % MOD) {
  }
  mint& operator+=(const mint& r) {
    if ((x += r.x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint& operator-=(const mint& r) {
    if ((x -= r.x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint& operator*=(const mint& r) {
    if ((x *= r.x) > MOD) {
      x %= MOD;
    }
    return *this;
  }
  mint& operator++() {
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return *this;
  }
  mint operator++(int) {
    mint ret = x;
    if ((++x) >= MOD) {
      x -= MOD;
    }
    return ret;
  }
  mint& operator--() {
    if ((--x) < 0) {
      x += MOD;
    }
    return *this;
  }
  mint operator--(int) {
    mint ret = x;
    if ((--x) < 0) {
      x += MOD;
    }
    return ret;
  }
  mint operator+(const mint& r) {
    mint ret;
    return ret = x + r.x;
  }
  mint operator-(const mint& r) {
    mint ret;
    return ret = x - r.x;
  }
  mint operator*(const mint& r) {
    mint ret;
    return ret = x * r.x;
  }
  mint operator-() {
    return mint() - *this;
  }
  bool operator<(const mint& a) {
    return x < a.x;
  }
  bool operator>(const mint& a) {
    return x > a.x;
  }
  bool operator<=(const mint& a) {
    return x <= a.x;
  }
  bool operator>=(const mint& a) {
    return x >= a.x;
  }
  bool operator==(const mint& a) {
    return x == a.x;
  }
  bool operator!=(const mint& a) {
    return x != a.x;
  }
};
ostream& operator<<(ostream& os, const mint& r) {
  os << r.x;
  return os;
}
ostream& operator>>(ostream& os, const mint& r) {
  os >> r.x;
  return os;
}

ll a, b, n;
ll ans;

void solve(istream& cin, ostream& cout) {
  cin >> a >> b >> n;
  ll r = min(b - 1, n);
  ll ans = floor(a * r / b) - a * floor(r / b);
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W, K;
  cin >> H >> W >> K;
  int map[6][6];
  for (int h = 0; h < H; h++) {
    getchar();
    for (int w = 0; w < W; w++)
      map[h][w] = (getchar() == '#');
  }
  int count = 0;
  for (int hc = 0; hc < (1 << H); hc++) {
    bitset<6> hs(hc);
    for (int wc = 0; wc < (1 << W); wc++) {
      bitset<6> ws(wc);
      int hashs = 0;
      for (int a = 0; a < H; a++) {
        for (int b = 0; b < W; b++) {
          hashs += map[a][b] * hs[a] * ws[b];
        }
      }
      count += (int)(hashs == K);
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;

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

int main(){
    int a, b; cin>>a>>b;
    int ans=0;
    for(int i=a; i<=b; i++){
        int num=i;
        string s;
        while(num>0){
            s.push_back(num%10);
            num/=10;
        }

        bool can_count=true;
        for(int i=0; i<s.size(); i++){
            if(s[i]!=s[s.size()-1-i]) can_count=false;
        }

        if(can_count) ans++;
    }
    cout << ans << endl;
}

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

using namespace std;

#define IOS                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
    cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define Debug(x) cout << #x " = " << (x) << endl
#define SORT(a) sort(a.begin(), a.end())
#define SORTR(a) sort(a.rbegin(), a.rend())
#define mod 1000000007
#define pi 3.141592653589793238
#define ll long long int
#define ull unsigned long long
#define be begin()
#define en end()
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define FORI(i, a, b) for (int i = a; i >= b; i--)

typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
typedef vector<PI> VPI;

int main()
{
    IOS;

    int n, sum = 0;
    cin >> n;

    if (n >= 400 && n <= 599)
        sum = 8;
    else if (n >= 600 && n <= 799)
        sum = 7;
    else if (n >= 800 && n <= 999)
        sum = 6;
    else if (n >= 1000 && n <= 1199)
        sum = 5;
    else if (n >= 1200 && n <= 1399)
        sum = 4;
    else if (n >= 1400 && n <= 1599)
        sum = 3;
    else if (n >= 1600 && n <= 1799)
        sum = 2;
    else if (n >= 1800 && n <= 1999)
        sum = 1;

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 3648
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

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

using ll = long long;

ll N;
ll prv, ans;

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

  rep( i, N )
  {
    ll A;
    std::cin >> A;

    if( !prv )
    {
      ans += A-1;
      prv = 1;
    }
    else if( A == prv+1 )
      ++prv;
    else if( A > prv+1 )
      ans += (A-1)/(prv+1);
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	arr := make([]int, 3)
	for i := 0; i < 3; i++ {
		fmt.Scan(&arr[i])
	}
	sort.Sort(sort.IntSlice(arr))
	d := arr[2] - arr[0] + arr[2] - arr[1]
	if d % 2 == 0 {
		fmt.Println(d / 2)
	} else {
		fmt.Println((d + 1) / 2 + 1)
	}
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N, K = MAP()
A = LIST()

MAX = N * K
# dp[i][j][k] := i枚目までからj枚取って、合計をkにする通り数
dp = list3d(N+1, N+1, MAX+1, 0)
dp[0][0][0] = 1
for i in range(N):
    a = A[i]
    for j in range(i+1):
        for k in range(MAX+1):
            dp[i+1][j][k] += dp[i][j][k]
            if j+1 <= N and k+a <= MAX:
                dp[i+1][j+1][k+a] += dp[i][j][k]
ans = 0
for j in range(1, N+1):
    # 1枚以上取った時の、平均がKになる所 → j枚取って合計がj*Kの所 を合計する
    ans += dp[N][j][j*K]
print(ans)


Measured memory_bytes: 92252
s=input()
if s[0:1]=='k' and s[len(s)-6:len(s)]=='eyence':
  print('YES')
elif s[0:2]=='ke' and s[len(s)-5:len(s)]=='yence':
  print('YES')
elif s[0:3]=='key' and s[len(s)-4:len(s)]=='ence':
  print('YES')
elif s[0:4]=='keye' and s[len(s)-3:len(s)]=='nce':
  print('YES')
elif s[0:5]=='keyen' and s[len(s)-2:len(s)]=='ce':
  print('YES')
elif s[0:6]=='keyenc' and s[len(s)-1:len(s)]=='e':
  print('YES')
else:
  print('NO')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define MAX 51
#define INFTY 25001
int map[MAX][MAX];
int H, W;
int dmap[MAX][MAX];

int main()
{
    std::scanf("%d %d", &H, &W);
    char c[MAX];
    for (int i = 1; i <= H; i++) {
        std::scanf("%s", c);
        for (int j = 0; j < W; j++) {
            map[i][j+1] = c[j]-'0';
            dmap[i][j+1] = INFTY;
        }
    }
    dmap[1][1] = 0;
    for (int i = 2; i <= W; i++) dmap[1][i] = dmap[1][i-1] + map[1][i];
    for (int i = 2; i <= H; i++) dmap[i][1] = dmap[i-1][1] + map[i][1];

    for (int i = 2; i <= H; i++) {
        for (int j = 2; j <= W; j++) {
            dmap[i][j] = std::min(dmap[i][j], std::min(dmap[i][j-1] + map[i][j], dmap[i-1][j] + map[i][j]));
        }
    }

    std::cout << dmap[H][W] << std::endl;
    return 0;
}



Measured memory_bytes: 3244
#include <iostream>

int main() {
	using namespace std;
	int a,b;
	cin >> a >> b;
	if ( a < b ) {
		cout << "a < b" << endl;
	} else if ( a > b ) {
		cout << "a > b" << endl;
	} else {
		cout << "a == b" << endl;
	}
}

Measured memory_bytes: 1156
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val m = sc.nextInt()
    val lr = (0 until m).map {
        sc.next().toInt() to sc.next().toInt()
    }

    abc127c(n, m, lr)
}

fun abc127c(n: Int, m: Int, lr: List<Pair<Int, Int>>){
    var mn = 1
    var mx = n
    for (i in 0 until m) {
        var lri = lr.get(i)
        mn = Math.max(mn, lri.first)
        mx = Math.min(mx, lri.second)
    }

    var ans = mx - mn + 1
    if (ans < 0) {
        ans = 0
    }
    println(ans)
}


Measured memory_bytes: 61820
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
typedef vector<char> vc;
typedef vector<vc> vcc;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define in insert
#define sz(v) v.size()
#define mina(a,b) (a)=min((a),(b));
#define maxa(a,b) (a)=max((a),(b));
const int INF = 1e9 + 7;
vvi v;
ll ans;
int n,k;
void rec(int ind,int cur,int parent){
    for(int i = 0; i < v[ind].size(); i++){
        if(v[ind][i]==parent) continue;
        ans=(ans*(ll)(k-cur))%INF;
        cur++;
        rec(v[ind][i],2,ind);
    }
}

void solve(){
    cin>>n>>k;
    ans=k;
    v = vvi(n+1,vi());
    for(int i = 1; i < n; i++){
        int a,b; cin>>a>>b;
        v[a].pb(b);
        v[b].pb(a);
    }
    rec(1,1,-1);
    cout<<ans;
}
int main(){
    int T=1;
    //cin>>T;
    for(int i = 0; i < T; i++) solve(); 
}

Measured memory_bytes: 10368
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;

const ll MOD = 1e9+7;

int main()
{
	int n;
	string s;
	ll ans=0;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		if(!(i&1) && s[i]=='L')
		{
			cout<<"No"<<endl;
			return 0;
		}else if((i&1) && s[i]=='R'){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long ll;
const int N=2550;
ll f[6007][57]={0};
int n,a,num[57];
int main()
{
	scanf("%d%d",&n,&a);
	for (int i = 1; i <= n; ++i)
	{
		int x;
		scanf("%d",&x);
		num[i]=x-a;
	}
	for (int i = 1; i <= n; ++i)
	{
		for (int j = 55; j < 5057; ++j)
		{
			f[j][i]+=f[j][i-1];
			f[j+num[i]][i]+=f[j][i-1];
		}
		f[N+num[i]][i]++;
	}
	printf("%lld\n", f[N][n]);
	return 0;
}

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
using lli = int_fast64_t;
using ulli = uint_fast64_t;
#define debug(x) cerr << #x << " : " << x << endl
#define debugv(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x << ", ";}cerr << endl
#define debugst(x) auto xt = x;cerr << #x << " : {";for(int i=0;i<x.size();i++){ cerr << xt.top() << ", ";xt.pop();}cerr << endl
#define debugvp(x) cerr << #x << " : {";for(auto value_of_x:x){ cerr << value_of_x.first << " : " << value_of_x.second << ", ";}cerr << endl

const lli MOD = 1000000007;
const lli LIMIT = 1000000000000000000 * 5;
const int tenfive = 100000;

int main() {
	int N;
	cin >> N;
	vector<string> v(N);
	for (int i = 0; i < N; i++)
	{
		cin >> v[i];
	}
	int ba = 0, ca = 0, bc = 0, cc = 0;
	int ans = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < v[i].size() - 1; j++) {
			if (v[i].substr(j, 2) == "AB") {
				ans++;
			}
		}
		bool isb = false, isa = false;
		if (v[i][0] == 'B')isb = true;
		if (v[i][v[i].size() - 1] == 'A')isa = true;
		if (isb && isa) {
			ba++;
		}
		else if (isb) {
			bc++;
		}
		else if (isa) {
			ca++;
		}
		else {
			cc++;
		}
	}

	if (ba > 0) {
		ans += ba - 1;
		ba = 0;
		if (ca > 0) {
			ans++;
			ca--;
		}
		if (bc > 0) {
			ans++;
			bc--;
		}
	}
	cout << ans + min(ca, bc) << endl;

	return 0;
}



Measured memory_bytes: 768
import java.util.Scanner;
class Main
{
    public static void main(String args[])
    {
	Scanner scan=new Scanner(System.in);
	int n=scan.nextInt();
	long sum=0;
	for(int i=0;i<n;i++)
	    {
		sum+=scan.nextInt();
	    }
	System.out.println(sum/n);
    }
}

Measured memory_bytes: 31088
#include<bits/stdc++.h>
#include<string>
#define ll long long
#define lld long double
#define llu unsigned long long int
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define gll(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define mod 1000000007
#define mod1 998244353
#define pi 3.1415926535897
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("B-small-attempt0.in", "r", stdin);freopen("output.txt", "w", stdout);
    //std::cout << std::setprecision(9);
    //std::cout << std::fixed;
    ll n,i;
    cin>>n;
    ll a[n];
    gll(a,n);
    sort(a, a+n);
    ll x=a[n/2]-a[n/2-1];
    cout<<x;
}


Measured memory_bytes: 1024
#if 0

#endif

#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void p(A a){cout << (a) << endl;}
template<class A,class B>void p(A a,B b){cout << a << " "  ;p(b);}
template<class A,class B,class C>void p(A a,B b,C c){cout << a << " " ;p(b,c);}
template<class A,class B,class C,class D>void p(A a,B b,C c,D d){cout << a << " " ;p(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for copy
// for(int i=0;i<N;++i) {

int main(void) {
  string s;cin>>s;
  if(s=="SUN") p(7);
  else if(s=="MON") p(6); 
  else if(s=="TUE") p(5); 
  else if(s=="WED") p(4); 
  else if(s=="THU") p(3); 
  else if(s=="FRI") p(2); 
  else if(s=="SAT") p(1);
  return 0;
}



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

vector<int> bfs(vector<vector<int>> graph, int sv)
{
    int n = graph.size();
    vector<int> dist(n, -1);
    queue<int> que;
    dist[sv] = 0;
    que.push(sv);
    while (!que.empty())
    {
        int v = que.front();
        que.pop();
        for (int nv : graph[v])
        {
            if (dist[nv] != -1)
                continue;
            dist[nv] = dist[v] + 1;
            que.push(nv);
        }
    }
    return dist;
}

int main()
{
    int n, x, y;
    cin >> n >> x >> y;

    vector<vector<int>> g(n);
    g[x - 1].push_back(y - 1);
    g[y - 1].push_back(x - 1);
    rep (i, n - 1)
    {
        g[i].push_back(i + 1);
        g[i + 1].push_back(i);
    }

    vector<int> ans(n);
    rep (sv, n)
    {
        vector<int> dist = bfs(g, sv);
        rep (i, n)
            ans[dist[i]]++;
    }

    for (int i = 1; i < n; i++)
        cout << ans[i] / 2 << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(x) (ll) __builtin_popcount(x);1
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define mp make_pair	
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
using namespace std;
typedef long long ll;
typedef long double ld;	
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const ll MAX = 10000000;
const ll inf = 5e18-1;

ll fact(ll n) {
    if (n < 0) {
        return -1;
    } else if (n == 0 || n == 1) {
        return 1;
    } else {
        return n * fact(n - 1);
    }
}


int main() {
	fastio;
	ll n;
    cin >> n;
    vii p;
    f(i,0,n) {
        ll x, y;
        cin >> x >> y;
        p.pb(mp(x, y));
    }
    sor(p);
    ld sum = 0;
    f(i,0,n-1) {
            sum += sqrt((p[i].fs-p[i+1].fs)*(p[i].fs-p[i+1].fs) + (p[i].sc-p[i+1].sc)*(p[i].sc-p[i+1].sc));
        }
    while (next_permutation(all(p))){
        f(i,0,n-1) {
            sum += sqrt((p[i].fs-p[i+1].fs)*(p[i].fs-p[i+1].fs) + (p[i].sc-p[i+1].sc)*(p[i].sc-p[i+1].sc));
        }
    } 
    ld k = fact(n);
    cout<< setprecision(12) << sum/k << endl;
	return 0;
	}

Measured memory_bytes: 256
//再帰するだけ
//めんどいので一旦解答AC
#include <iostream>
using namespace std;

long long rec(int n, long long x) {
    if (n == 0) return 1;
    long long len = (1LL<<(n+1)) - 3;
    long long num = (1LL<<n) - 1;
    if (x == 1) return 0;
    else if (x <= len + 1) return rec(n-1, x-1);
    else if (x == len + 2) return num + 1;
    else if (x <= (len + 1) * 2) return num + 1 + rec(n-1, x-len-2);
    else return num * 2 + 1;
}

int main() {
    int N; long long X;
    cin >> N >> X;
    cout << rec(N, X) << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  String s = sc.next();
  boolean a = false;
  boolean b = false;
  boolean c = false;
  for(int i = 0;i < 3;i++){
    if(s.charAt(i) == 'a')a = true;
  }
  for(int i = 0;i < 3;i++){
    if(s.charAt(i) == 'b')b = true;
  }
  for(int i = 0;i < 3;i++){
    if(s.charAt(i) == 'c')c = true;
  }
  System.out.println(a && b && c ? "Yes":"No");
}}

Measured memory_bytes: 23636
#include<stdio.h>
int main()
{
    int a,b;
    double c=0.0,e[10];
    char s[10][1000];
    scanf("%d",&a);
  for(b=0;b<a;b++){
    scanf("%lf %s",&e[b],s[b]);
    if(s[b][0]=='B')e[b]*=380000;
  c+=e[b];
  }
   printf("%f",c);   
    return 0;
}

Measured memory_bytes: 128
//Author: AnandRaj doubleux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int in=f;in<f+n;in++) cin>>V[in]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 998244353,MAX = 1e6+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX, true);
vector<int> MinDiv(MAX);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
    		MinDiv[i]=i;
        	for (j = i * i; j <= MAX; j += i)
            {
				is_prime[j] = false;
				MinDiv[j]=i;
    		}
    	}
	}
	for(int i=2;i<=MAX;i++) if(is_prime[i]) MinDiv[i]=i;
}
//////////////////Sieve////////////////////

int main()
{
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll row = c-a;
	ll col = d-b;
	vvl dp(row+1,vl(col+1));
	dp[0][0]=1;
	for(int i=0;i<=row;i++)
	{
		for(int j=0;j<=col;j++)
		{
			if(i==row&&j==col) break;
			if(i<row) dp[i+1][j] = (dp[i+1][j]+(dp[i][j]*(j+b))%MOD)%MOD;
			if(j<col) dp[i][j+1] = (dp[i][j+1]+(dp[i][j]*(i+a))%MOD)%MOD;
			if(i<row&&j<col) dp[i+1][j+1]=((dp[i+1][j+1]-dp[i][j]*(i+a)*(j+b))%MOD+MOD)%MOD;
		}
	}
	// for(int i=0;i<=row;i++)
	// {
	// 	prin(dp[i]);
	// }
	cout<<dp[row][col]<<endl;
}		

Measured memory_bytes: 77700
#include<cstdio>
using namespace std;
int N;
int a[100010],b[100010];

int main(){
	scanf("%d",&N);
	for(int i=1;i<=N;i++){
		scanf("%d",&a[i]);
		b[a[i]]=i;
	}
	for(int i=1;i<=N;i++)
		printf("%d ",b[i]);
	printf("\n");
	return 0;	
}

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

using namespace std;

int main(){
  char c;
  cin >> c;
  if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
#define inf 1000000007
#define double long double
using namespace std;
typedef pair<double, double>P;
bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
ll mod_pow(ll x, ll n, ll mod) {
	ll bit = 1;
	while (n) {
		if (n & 1)bit = bit * x % mod;
		x = x * x % mod;
		n /= 2;
	}
	return bit;
}
ll C(ll a, ll b) {
	ll x = 1, y = 1;
	rep(i, b) {
		x = x * (a - i) % inf;
		y = y * (b - i) % inf;
	}
	rep(i, inf) {
		if (x == y * i % inf) {
			return i;
		}
	}
}
signed main() {
	ll a, b;
	cin >> a >> b;
	cout << max({ a + b,a - b,a * b }) << endl;
	ggr
}


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

int main(){

  double n;

  while(cin >> n){

    if(n > 91) cout << "heavy" << endl;
    else if(n > 81) cout << "light heavy" << endl;
    else if(n > 75) cout << "middle" << endl;
    else if(n > 69) cout << "light middle" << endl;
    else if(n > 64) cout << "welter" << endl;
    else if(n > 60) cout << "light welter" << endl;
    else if(n > 57) cout << "light" << endl;
    else if(n > 54) cout << "feather" << endl;
    else if(n > 51) cout << "bantam" << endl;
    else if(n > 48) cout << "fly" << endl;
    else cout << "light fly" << endl;

  }
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}


int main(){
  ll x; cin>>x;
  ll amari = x%11;
  ll r;
  if(amari==0){
    r = x/11*2;
  }else if(amari<=6){
    r = x/11*2 + 1;
  }else{
    r = x/11*2 + 2;
  }
  cout << r;
}

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

#define INF 1e9
#define llINF 1e18
#define MOD 1e9+7
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
string str[100];
int h,w;
int num;
bool flag;
bool used[100][100];
char moji[10];
int vx[4]={1,0,-1,0};
int vy[4]={0,1,0,-1};
void dfs(int Bit,int depth){
  if(Bit==((1<<num)-1)){
    flag=true;
    return;
  }
  for(int i=0;i<num;i++){
    if(!(Bit&(1<<i))){
      bool used2[100][100]={};
      int lemi=100,lema=0,rimi=100,rima=0;
      for(int j=0;j<h;j++){
	for(int k=0;k<w;k++){
	  if(str[j][k]==moji[i]){
	    used2[j][k]=true;
	    used[j][k]=true;
	    lemi=min(lemi,k);
	    lema=max(lema,k);
	    rima=max(rima,j);
	    rimi=min(rimi,j);
	  }
	}
      }
      bool fll=true;
      for(int j=rimi;j<=rima;j++){
	for(int k=lemi;k<=lema;k++){
	  if(!used[j][k]){
	    fll=false;
	  }
	}
      }
      if(fll)
	dfs(Bit+(1<<i),depth+1);
      for(int j=rimi;j<=rima;j++){
	for(int k=lemi;k<=lema;k++){
	  if(used2[j][k]){
	    used[j][k]=false;
	  }
	}
      }
    }
  }
}
int main(){
  int n;cin>>n;
  for(int i=0;i<n;i++){
    cin>>h>>w;
    num=0;
    for(int i=0;i<55;i++)
      for(int j=0;j<55;j++)
	used[i][j]=false;
    flag=false;
    bool alfa[26]={};
    for(int i=0;i<h;i++){
      cin>>str[i];
      for(int j=0;j<w;j++){
	alfa[str[i][j]-'A']=true;
      }
    }
    int cnt=0;
    for(int i=0;i<26;i++){
      if(alfa[i]){
	num++;
	moji[cnt]=(char)(i+'A');
	cnt++;
      }
    }
    dfs(0,0);
    if(flag)
      cout<<"SAFE"<<endl;
    else 
      cout<<"SUSPICIOUS"<<endl;
  }
  return 0;
}



Measured memory_bytes: 3088
<?php
    $string = str_split(trim(fgets(STDIN)));

    foreach($string as $key => $value) {
        if( preg_match('/[A-Z]/', $value)) {
            $string[$key] = strtolower($value);            
        } elseif( preg_match('/[a-z]/', $value)){
            $string[$key] = strtoupper($value);
        }
    }    

    echo implode("",$string)."\n";
   

Measured memory_bytes: 15592
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int T, card[16];

bool is_same_number(int a, int b, int c){
  return a == b && b == c;
}

bool is_sequence(int a, int b, int c){
  return a+2 == b+1 && b+1 == c;
}

bool is_good_set(int a, int b, int c){
  return is_same_number(a, b, c) || is_sequence(a, b, c);
}

bool is_all_good_set(){
  return (is_good_set(card[0], card[1], card[2]) && is_good_set(card[3], card[4], card[5]) && is_good_set(card[6], card[7], card[8]));
}

int win(){
  sort(card,card+9);
  do {
    if (is_all_good_set())
      return 1;
  } while(next_permutation(card, card+9));
  return 0;
}

int main(){

  cin >> T;
  for(int t=0; t<T; ++t){
    for(int i = 0; i < 9; ++i){
      cin >> card[i];
    }
    string color;
    for(int i = 0; i < 9; i++){
      cin >> color;
        if(color == "G") card[i] += 20;
        else if (color == "B") card[i] += 40;
    }

    cout << win() << endl;
  }

}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


int main() {
  ll n, m; cin >> n >> m;
  Vll S(n+1);
  rep(i, n) {
    int a; cin >> a;
    S[i+1] = (S[i] + a) % m;
  };

  map<int, int> cnt;
  ll ans = 0;
  rep(i, n+1) {
    ans += cnt[S[i]];
    ++cnt[S[i]];
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
    int a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    cout << (a1+a2+a3 >= 22? "bust": "win") << endl;

}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

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

    ll n, k;
    cin >> n >> k;
    ld ret = 0;
    for (int i = 1; i <= n; i++)
    {
        ll num = i, cnt = 0;
        while (num < k)
        {
            num *= 2;
            cnt++;
        }
        ret += pow(0.5, cnt);
    }
    cout << fixed << setprecision(20) << ret / n << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define um unordered_map
#define F first
#define S second
#define MOD 1000000007
#define TC int t; cin >> t; while(t--)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define count_bits(val) __builtin_popcount(val)

int n;
vector<pii> a;
int dp[2005][2005];
int solve(int i, int start){
	if(i >= n){
		return 0;
	}
	if(dp[i][start+1] != -1) {
		return dp[i][start+1];
	}
	int one = 0, two = 0;
	int end = start + i + 1;
	if(start >= 0) one = solve(i+1, start-1) + (a[i].F * (abs(a[i].S - start))); 
	if(end < n) two = solve(i+1, start) + (a[i].F * (abs(a[i].S - end)));
	int ans = max(one, two);

	return (dp[i][start+1] = ans);
}

signed main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin);
	freopen("output.txt" , "w" , stdout);
	#endif
	cin >> n;
	for(int i=0;i<n;i++){
		int x; cin >> x;
		a.pb({x,i});
	}
	sort(a.begin(), a.end());
	memset(dp, -1, sizeof(dp));
	// for(int i=1;i<n;i++){
	// 	for(int j=0;j<n;i++){
	// 		dp[i][j] = max(dp[i-1][j-1], dp[i-1][j+1]);
	// 	}
	// }
	int fans = 0;
	for(int i=0;i<n;i++){
		fans = max(fans, solve(1, i-1) + (a[0].F * (abs(a[0].S - i))));
	}
	cout << fans << endl;
	return 0;
}

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

int main(){

    int A, B;
    cin >> A >> B;

    int ans = 0;
    for(int i = A; i <= B; i++){
        string num(to_string(i));
        if(num[0] == num[4] && num[1] == num[3]) ans++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
S = list(input())
T = list(input())
N = len(S)
dicS={}
dicT={}
for i in range(97,123,1):
    dicS[chr(i)] = []
    dicT[chr(i)] = []

for i in range(0,N,1):
    dicS[S[i]].append(i)
    dicT[T[i]].append(i)

for a2z in dicS:
    if len(dicS[a2z])>0:
        tmp = T[dicS[a2z][0]]
        for i in range(0,len(dicS[a2z]),1):
            if T[dicS[a2z][i]]!=tmp:
                print("No")
                exit()
    if len(dicT[a2z])>0:
        tmp = S[dicT[a2z][0]]
        for i in range(0,len(dicT[a2z]),1):
            if tmp != S[dicT[a2z][i]]:
                print("No")
                exit()

print("Yes")


Measured memory_bytes: 104352
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
using namespace std;

typedef long long int ll; 
typedef pair<int,int> Pii;

int main(){
    long long a,b;
    cin>>a>>b;
    if(a==b){
        cout << "Yes";
    }else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
n,m=map(int,input().split())
g=[[] for _ in range(n+1)]
for _ in range(m):
  u,v=map(int,input().split())
  g[u].append(v)
  g[v].append(u)
flag=True
for i in range(1,n+1):
  if len(g[i])%2==0:
    continue
  else:
    flag=False
    break
if flag==True:
  print('YES')
else:
  print('NO')

Measured memory_bytes: 20656
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}/*char to int*/
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}/*MAX*/
int lcm(ll a,ll b){return a*b/gcd(a,b);}/*MIN*/
bool primecheck(ll n){/*sosuu*/if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int  main(){
int h,n;
cin >> h >> n;
vector<pair<ll,ll>>a(n);
for(int i=0;i<n;i++){
ll aa,b;
cin >> aa >> b;
a.at(i)=make_pair(aa,b);
}
vector<ll>dp(h+1,10e17);//mp 
dp.at(0)=0;
for(int i=0;i<h+1;i++){
    for(int j=0;j<n;j++){
        ll dame = a.at(j).first;
        ll mp = a.at(j).second;
        if(dame+i>h){
           dp.at(h)=min(dp.at(h),dp.at(i)+mp);
           continue;
        }
        dp.at(dame+i)=min(dp.at(dame+i),dp.at(i)+mp);
    }
}
cout << dp.at(h)<<endl;
}





Measured memory_bytes: 384
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef long long ull;
typedef pair<int, int> ii;

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
/*#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("pyramid.in", "r", stdin);
#endif*/
}
const double pi = 2 * acos(0.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 5e3 + 15;
int dx[8] = { -1, 0, 0, 1, 1, -1, 1, -1 };
int dy[8] = { 0, -1, 1, 0, 1, -1, -1, 1 };


int main()
{
	fast();
	string arr[5];
	for (int i = 1; i <= 3; i++)
		cin >> arr[i];
	int res = 0;
	int cur = 1;
	while (1)
	{
		if (!sz(arr[cur]))
		{
			res = cur;
			break;
		}
		if (*arr[cur].begin() == 'a')
		{
			arr[cur].erase(arr[cur].begin());
			cur = 1;
		}
		else if (*arr[cur].begin() == 'b')
		{
			arr[cur].erase(arr[cur].begin());
			cur = 2;
		}
		else if (*arr[cur].begin() == 'c')
		{
			arr[cur].erase(arr[cur].begin());
			cur = 3;
		}
	}
	if (res == 1)
		cout << "A\n";
	else if (res == 2)
		cout << "B\n";
	else
		cout << "C\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define st first
#define nd second                   
#define fori(i, a, b, c) 	for (int i = (int)(a); i <= (int)(b); i += (int)(c))
#define ford(i, a, b, c) 	for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define MOD 998244353

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef long long lol;
typedef vector<lol> vlol;

ifstream in ("input");

const int NR = 2e5 + 5;

string s,p;
int main()	{
	ios::sync_with_stdio(false);
	int i;
	cin >> s;
	ford(i , s.size()-1, 0, 1)
		p.pb(s[i]);
	if (p != s)	return cout << "No\n", 0;
	fori(i, 0, s.size()/2-1, 1)
	if(p[i] != s[i+s.size()/2+1] || s[i] != p[i+s.size()/2+1])	return cout << "No\n", 0;
	cout << "Yes\n";
}












Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
#define fir first
#define sec second
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

const ll LLINF = 1ll << 60;
const int N = 100010;
int n, m, va[N], vb[N], id[N], per[N], uni[N];
ll sum[N], dp[N], ans;
int getfa(int pos) {
  return pos == uni[pos] ? pos : uni[pos] = getfa(uni[pos]);
}
vector<int> vec[N];
int main() {
  int x,y;
  read(n), read(m);
  rep (i, 1, n) read(va[i]), read(vb[i]);
  rep (i, 1, n) per[i] = i;
  sort(per + 1, per + n + 1, [=](int a,int b) -> bool {
      return max(va[a] - vb[a], 0) < max(va[b] - vb[b], 0);
    });
  rep (i, 1, n) id[per[i]] = i;
  rep (i, 1, m) {
    read(x), read(y);
    if (id[x] < id[y]) swap(x, y);
    vec[x].push_back(y);
  }
  rep (i, 1, n) {
    uni[i] = i;
    sum[i] = vb[i];
    dp[i] = max(va[i], vb[i]);
  }
  rep (i, 1, n) {
    int j = per[i];
    vector<int> tmp;
    rep (k, 0, (int)vec[j].size()-1)
      tmp.push_back(getfa(vec[j][k]));
    sort(tmp.begin(), tmp.end());
    tmp.erase(unique(tmp.begin(), tmp.end()), tmp.end());
    ll ssum = 0;
    rep (k, 0, (int)tmp.size()-1)
      ssum += sum[tmp[k]];
    ssum += vb[j];
    dp[j] = LLINF;
    if (tmp.empty()) dp[j] = max(va[j], vb[j]);
    rep (k, 0, (int)tmp.size()-1)
      dp[j] = min(dp[j], max(dp[tmp[k]], (ll)max(va[j] - vb[j], 0)) + ssum - sum[tmp[k]]);
    rep (k, 0, (int)tmp.size()-1) {
      sum[j] += sum[tmp[k]];
      uni[tmp[k]] = j;
    }
  }
  cout << dp[per[n]] << endl;
  return 0;
}


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

using namespace std;
int main() {
#ifndef ONLINE_JUDGE

	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);

#endif
	int n;
	cin >> n;

	if (n % 10 == 2 || n % 10 == 4 || n % 10 == 5 || n % 10 == 7 || n % 10 == 9)
		cout << "hon";
	else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8)
		cout << "pon";
	else
		cout << "bon";


}

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

#define int long long

#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007,INF=1e18;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};

int n,a[111111];
int cnt[111111];
signed main() {
    cin>>n;
    rep(i,0,n){
        cin>>a[i];
        cnt[a[i]]++;
    }
    if(n%2 && cnt[0]!=1){
        cout<<'0'<<endl;
        return 0;
    }
    bool can=true;
    for(int i=1+(n%2);i<n;i+=2){
        if(cnt[i]!=2)can=false;
    }
    if(can){
        int ans=1;
        rep(i,0,n/2){
            ans*=2;
            ans%=MOD;
        }
        cout<<ans<<endl;
        return 0;
    }
    else cout<<'0'<<endl;
    
    return 0;
}

Measured memory_bytes: 1792
pub fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter).map(|e| e.parse().ok().unwrap()).collect::<Vec<T>>()
}

fn main() {
    let nlt = readn::<usize>(" ");
    let n = nlt[0];
    let l = nlt[1];
    let t = nlt[2];
    let mut x = Vec::with_capacity(n);
    let mut w = Vec::with_capacity(n);
    let mut pos = Vec::with_capacity(n);

    for _ in 0..n {
        let xw = readn::<usize>(" ");
        x.push(xw[0]);
        w.push(xw[1]);

        if xw[1] == 1 {
            pos.push((xw[0] + t) % l);
        } else {
            if xw[0] % l < t % l {
                pos.push(l + xw[0] % l - t % l);
            } else {
                pos.push(xw[0] % l - t % l);
            }
        }
    }

    pos.sort();

    let mut count = 0;
    for i in 0..n {
        if w[i] == 1 {
            let cic = (x[i] + t) / l;
            if cic > count {
                count += n - cic;
            } else {
                count -= cic;
            }
        } else {
            count += (t + l - x[i] - 1) / l;
        }
    }

    let zero = (count % n) as usize;
    for i in 0..n {
        if i < zero {
            println!("{}", pos[n + i - zero]);
        } else {
            println!("{}", pos[i-(count%n)]);
        }
    }
}

Measured memory_bytes: 7292
#define DEBUG 0

/**
 * File    : D.cpp
 * Author  : Kazune Takahashi
 * Created : 4/6/2019, 9:15:31 PM
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

ll X, Y, Z, W, K;
ll A[1010];
ll B[1010];
ll C[1010];
vector<ll> D;
vector<ll> ans;

void flush()
{
  assert((ll)ans.size() == K);
  for (auto x : ans)
  {
    cout << x << endl;
  }
}

int main()
{
  cin >> X >> Y >> Z >> K;
  for (auto i = 0; i < X; i++)
  {
    cin >> A[i];
  }
  for (auto i = 0; i < Y; i++)
  {
    cin >> B[i];
  }
  for (auto i = 0; i < Z; i++)
  {
    cin >> C[i];
  }
  W = Y * Z;
  for (auto i = 0; i < Y; i++)
  {
    for (auto j = 0; j < Z; j++)
    {
      D.push_back(B[i] + C[j]);
    }
  }
  sort(A, A + X);
  reverse(A, A + X);
  sort(D.begin(), D.end());
  reverse(D.begin(), D.end());
  ll ind[1010];
  fill(ind, ind + X, 0);
  for (auto i = 0; i < K; i++)
  {
    ll maxi = 0;
    ll index = 0;
    for (auto j = 0; j < X; j++)
    {
      if (ind[j] >= W)
      {
        continue;
      }
      ll t = D[ind[j]] + A[j];
      if (t > maxi)
      {
        maxi = t;
        index = j;
      }
    }
    ans.push_back(maxi);
    ind[index]++;
  }
  flush();
}

Measured memory_bytes: 10604
#include<stdio.h>
#include<math.h>

int main(void)
{
  double group;
  int people;
  char str[8];
  
  fgets(str,sizeof(str),stdin);
  sscanf(str,"%d",&people);
  
  group = floor(people / 3.0);
  
  printf("%d",(int)group);
  
  return 0;
}
  

Measured memory_bytes: 128
/*Author : Hrishi*/

/*When I wrote this, only God and I understood what I was doing.
Now, only God knows.*/

#include <bits/stdc++.h>

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int,int>
#define pl pair<ll,ll> 
#define ff first
#define ss second
#define PB push_back
#define F(i,L,R) for(auto i=L; i<R ;i++)
#define FR(i,R,L) for(auto i=R;i>L;i--)
#define all(x) (x).begin(),(x).end()
#define show(x) cout<<(#x)<<" = "<<(x)<<"\n";
#define show2(x,y) cout<<(#x)<<" = "<<(x)<<" & "<<(#y)<<" = "<<(y)<<"\n";
#define show3(x,y,z) cout<<(#x)<<" = "<<(x)<<" & "<<(#y)<<" = "<<(y)<<" & "<<(#z)<<" = "<<(z)<<"\n";
#define endln "\n"
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define M 1000000000000000000

using namespace std;

int main() 
{
	fastio;
	ll n,ans=1,a;
	cin>>n;
	int flag=0;
	long double m=M;
	F(i,0,n)
	{
	    cin>>a;
	    if(a>M && flag==0)
	        flag=2;
   	    if(a==0)
	        flag=1;
	    if(ans>M)
	    {
	        flag=0;
	        ans=0;
	    }
	    ans*=a;
	    if(a!=0)
	        m/=a;
	    if(m<1 && flag==0)
	        flag=2;
	}
	    if(flag==1)
	        cout<<0;
	    else if(flag==0)
	        cout<<ans;
        else
            cout<<-1;
}




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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;

#define F first
#define S second
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define sz size()
#define all(A)    A.begin(), A.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define f0(i,b)   for(int i=0;i<(b);i++)
#define f1(i,b)   for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
#define mod 1000000007

#define forr(i,n)    for(i=0; i<n; i++)
#define whilee(i,t)  while(i!=t)
#define  sl(a)  scanf("%lld",&a)
#define  pl(a)  printf("%lld\n",a)

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;

//for(auto it =A.begin(); it!=A.end(); it++)
//sort(A.begin(),A.end());
//binary_search(A.begin(),A.end(),x);
//reverse(A.begin(), A.end());
//cout << *max_element(A.begin(), A.end());
//cout << *min_element(A.begin(), A.end());
//count(A.begin(), A.end(), X); //counts the occurrences of X
//distance(A.begin(),A.end());  //distance between first to last element
//accumulate(A.begin(), A.end(), 0); //add
//next_permutation(A.begin(), A.end());
//prev_permutation(A.begin(), A.end());
//swap(S[0], T[0]);

//scanf("%d",&x);
//printf("%d\n",x);
//while (scanf("%d %d", &a, &b) == 2)
//printf("Case %d: %d\n", t++, a);

//vector <int> A;
//deque <int> A;
//queue <int> A;
//stack <int> A;
//set <int> A;
//map <int,int> A;
//pair <int,int> A ;
//vector <pair <int,int>> A ;
//bitset<32> bset1;
//char ch;
//string S, T, U;
ll i, j, k, a, b, c, d, f, g, h, l, m, n, p, q, r, s, t=1, u, v, w, x, y, z, maxx=INT_MIN, minn=INT_MAX, ans=0, sum=0, cnt=0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);//NULL
    cout.tie(nullptr);//NULL

    //scan(n);
    cin>>a>>b>>t;
    i=1;
    x=0;
    while(i*a<=t)
    {
         x+=b;
         i++;
    }
    cout<<x<<endl;

    return 0;
}






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

int main(){
    int n,m;
    cin >> n >> m;
    int a[50],b[50];
    int count;
    for(int i=0;i<m;i++)cin >> a[i] >> b[i];
    for(int i=0;i<n;i++){
        count=0;
        for(int j=0;j<m;j++){
            if(a[j]==i+1||b[j]==i+1)
                count++;
        }
        cout << count << endl;
    }
}

Measured memory_bytes: 256
import math

A, B, H, M = map(int,input().split())

c = 0
timeA = H + (M/60)
argA = (1/12)*timeA

argB = (1/60)*M


sitaA = 360*argA
sitaB = 360*argB



if abs(sitaA-sitaB) == 180:
  print(A+B)
  exit()



if sitaA == sitaB:
  print(abs(B-A))
  exit()
elif sitaA > sitaB:
  c = math.sqrt(A**2 + B**2 - (2*A*B*math.cos(math.radians(sitaA-sitaB))))
elif sitaA < sitaB:
  c = math.sqrt(A**2 + B**2 - (2*A*B*math.cos(math.radians(sitaB-sitaA))))

print(c)  

Measured memory_bytes: 9548
#include <bits/stdc++.h>
using namespace std;
//char型から数値型に変換する関数（z.at(i)などに使用）
int ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
int main() {
  string s;
  cin>>s;
  for(int i=0;i<3;i++){
    if(s.at(i)=='1'){
      s.at(i)='9';
      continue;
    }
    if(s.at(i)=='9'){
      s.at(i)='1';
    }
  }
  cout<<s;
}

Measured memory_bytes: 256