akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;


int main(){

  int n;
  cin >> n;

  map<string, int> s;
  string x;
  for (int i=0; i!=n; ++i){
    cin >> x;
    ++s[x];
  }

  cout << "AC x " << s["AC"] << endl;
  cout << "WA x " << s["WA"] << endl;
  cout << "TLE x " << s["TLE"] << endl;
  cout << "RE x " << s["RE"] << endl;

	return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int arr[10];
	for(int i=0; i<10; i++)
	cin>>arr[i];
	sort(arr, arr+10, greater<int>());
	for(int i=0; i<3; i++) {
		cout<<arr[i]<<endl;
	}
}

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

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    ll x = min(b - 1, n);
    cout << (a * (x % b) - ((a * x) % b)) / b << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <string>
#include <cmath>
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    double a,b,x;
    double result;
    cin >> a >> b >> x;
    if((a*a*b/2)<x){
        result = atan((2.0*b/a)-(2.0*x/(a*a*a)));
    }
    else{
        result = M_PI/2 - atan(2.0*x/(a*b*b));
    }
    result = result * 180 / M_PI;
    cout << fixed << setprecision(10) << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
int n,cnt;
ll ksm(ll a,ll n){
	ll ans=1;
	while(n){
		if(n&1) ans=ans*a%mod;
		a=a*a%mod;
		n>>=1;
	}
	return ans;
}
int main(){
	map<pair<ll,ll>,pair<int,int> >mp;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		ll a,b;
		scanf("%lld%lld",&a,&b);
		if(!a&&!b){
			cnt++;
			continue;
		}
		ll g=__gcd(a,b);
		a/=g,b/=g;
		if(b<0) a=-a,b=-b;
		if(a<=0) mp[{b,-a}].second++;
		else mp[{a,b}].first++;	
	}
	ll ans=1;
	for(auto it:mp){
		ans=(ans*(mod+ksm(2,it.second.first)+ksm(2,it.second.second)-1)%mod)%mod;
	}
	printf("%lld\n",(mod+ans+cnt-1)%mod);
	return 0;
}  

Measured memory_bytes: 16172
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

typedef tree <ll, null_type, less <ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl "\n"

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) 
{
    os << "{ ";
    for(auto& y : x) 
    {
        os << y << " ";
    }
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) 
{
    return os << "[" << p.ff << ", " << p.ss << "]";
}

ll gcd(ll a, ll b)
{
    if(b==0)
    {
        return a;
    }

    return gcd(b, a%b);
}

ll modexp(ll a, ll b, ll c)
{   
    a%=c;

    ll ans = 1;

    while(b)
    {
        if(b&1)
        {
            ans = (ans*a)%c;
        }

        a = (a*a)%c;
        b >>= 1;
    }

    return ans;
}

ll nxt()
{
    ll x;
    cin >> x;
    return x;
}

const ll L = 1e5+5;

void solve()
{
    ll N = nxt(), M = nxt();

    cout << (N*(N-1))/2 + (M*(M-1))/2 << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    
    ll T = 1;
    // T = nxt();

    while(T--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
/*~~~~~~~~~~~~~~~~~ K++ code ~~~~~~~~~~~~~~~~~~~
in(string s, t)
@:
cs[26] <<
ct[26] <<
:@
for(i in s){
    cs[s[i]-'a']++;
}
for(i in t){
    ct[t[i]-'a']++;
}
sort(cs)
sort(ct)
for(i, 26){
    if(cs[i]!=ct[i]) no(); return 0
}
yes()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

;;;
;
int cs[26];;
int ct[26];;
;;
;
int main(){
  ;;;
    string s, t;
    cin >> s >> t;
    ;
    ;
    for(int i = 0; i < s.size(); ++i){;;;;
        cs[s[i]-'a']++;;
    ;};;;
    for(int i = 0; i < t.size(); ++i){;;;;
        ct[t[i]-'a']++;;
    ;};;;
    sort(cs, cs+sizeof(cs)/sizeof(cs[0]));;
    sort(ct, ct+sizeof(ct)/sizeof(ct[0]));;
    for(int i = 0; i <  26; ++i){;;;;
        if(cs[i]!=ct[i]) {;;cout << "No" << endl;; return (0);;};
    ;};;;
    cout << "Yes" << endl;;
    ;
}

Measured memory_bytes: 1020
n,m,x = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(n)]
prices = []
for i in range(2**n):
  buy = [[] for _ in range(m+1)]
  for j in range(n):
    if ((i >> j) & 1):
      for k in range(m+1):
        buy[k].append(c[j][k])
  for k in range(1,m+1):
    if sum(buy[k]) < x:
      break
  else:
    prices.append(sum(buy[0]))
if len(prices) == 0:
  print(-1)
else:
  print(min(prices))

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

main() {
    int A[3]; rep(i,3){ cin >> A[i];}
    sort(A,A+3); reverse(A,A+3);
    cout << A[0]*10+A[1]+A[2] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <string>
 
using namespace std;
typedef long long ll;


int main()
{
	int N, R;
	scanf("%d %d", &N, &R);
	
	if(N >= 10){
		printf("%d\n", R);
	}else{
		printf("%d\n", R + 100 * (10 - N));
	}
	
	return 0;
}

Measured memory_bytes: 128
n,w = map(int,input().split())
dp = [[0]*(w+1) for _ in range(n+1)]#[[0]*(w+1)] *(n+1)
for i in range(1,n+1):
    wi,vi = [int(i) for i in input().split()]
    #DPテーブルの更新
    for j in range(w+1):
        if j >= wi : #選べるかどうか
            dp[i][j] = max(dp[i-1][j] , dp[i-1][j-wi]+vi) #選ぶ場合
        else:
            dp[i][j] = max(dp[i-1][j] , dp[i][j]) #選ばない場合
print(dp[n][w])

Measured memory_bytes: 120172
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

//mod計算用のクラス
// ModInt a = {1,1000000007}みたいな定義もできる.
//modがデフォルト(1000000007)じゃない場合は(ModInt)a+(int)xみたいなものに注意.デフォルトを書き換えれば大丈夫.
//「各メンバーに対して、コピーコンストラクターあるいは代入演算子を順に呼び出す」 という仕様になっている.
// (int)1 + (ModInt)10 みたいなことは出来ない.非メンバで定義する必要がある（と思う）.
class ModInt{
public:
    long long int x;
    long long int mod;
	ModInt(){}
    ModInt(long long int _x, long long int _mod = 1000000007){
        this->x = ((_x % _mod) + _mod) % _mod;
        this->mod = _mod;
    }
	ModInt operator-() const {
		return ModInt(-this->x, this->mod);
	}
	ModInt operator+(const ModInt &other) const {
		return ModInt(this->x + (other.x % this->mod), this->mod);
	}
	ModInt operator+=(const ModInt &other){
		*this = *this + other;
		return *this;
	}
	ModInt operator-(const ModInt &other) const {
		long long int res = this->x - (other.x % this->mod);
		if (res < 0) return ModInt(res + this->mod, this->mod);
		return ModInt(res, this->mod);
	}
	ModInt operator-=(const ModInt &other) {
		*this = *this - other;
		return *this;
	}
	ModInt operator*(const ModInt &other) const {
		return ModInt(this->x * (other.x % this->mod),this->mod);
	}
	ModInt operator*=(const ModInt &other) {
		*this = *this * other;
		return *this;
	}
	ModInt operator/(const ModInt &other) const {
		return ModInt(*this * other.inv());
	}
	ModInt operator/=(const ModInt &other) {
		*this = *this / other;
		return *this;
	}
	ModInt pow(long long int n) const {
		ModInt res(1, this->mod), a(this->x, this->mod);
		while (n){
			if (n & 1){
				res = res * a;
			}
			n >>= 1;
			a = a * a;
		}
		return res;
	}
	ModInt inv() const {
		return ModInt(this->pow(this->mod - 2));
	}
	void disp(){
		cout << this->x << endl;
	}
};
ostream& operator<<(ostream& stream, const ModInt m){
	stream << to_string(m.x);
	return stream;
}


int main(){
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	s[k - 1] = tolower(s[k - 1]);
	cout << s << endl;
}

Measured memory_bytes: 3640
#include<iostream>

#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
typedef long long int lli;

using namespace std;

int main(){
  int N, K;
  cin >> N >> K;
  lli ans = K;
  REP(i, 1, N) {
    ans *= (K - 1);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

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

    int min = 999999999;
    int ans;
    for (int i = 0; i < n; i++) {
        int temp = t * 1000 - h[i] * 6;
        if (abs(a * 1000 - temp) < min) {
            min = abs(a * 1000 - temp);
            ans = i + 1;
        }
    }

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

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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i = 0;i < n;i++){
    cin >> s.at(i);
  }
  sort(s.begin(), s.end());
  int c = 1;
  int z = 1;
  
  for(int i = 1;i < n;i++){
    if (s.at(i - 1) == s.at(i)){
      z++;
      c = max(c, z);
    }
    else{
      z = 1;
    }
  }
  
  z = 1;
  if (n == 1){
    cout << s.at(0) << endl;
  }
  else if (c == 1){
    for(int i = 0;i < n;i++){
    cout <<  s.at(i) << endl;
    }
  }
  else{
    for(int i = 1;i < n;i++){
      if (s.at(i - 1) == s.at(i)){
        z++;
      }
      else{
        z = 1;
      }
    
      if (c == z){
        cout << s.at(i - 1) << endl;
      }
    }
  }
}

Measured memory_bytes: 9600
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    N = int(input())
    s = "abcdefghijklmnopqrstuvwxyz"
    ans = ""
    a = N-1
    x = 26
    i = 1
    while True:
        if a < x:
            break
        a -= x
        x *= 26
        i += 1

    while a:
        a, b = divmod(a, 26)
        ans = s[b] + ans


    print(s[0]*(i-len(ans)) + ans)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 61904
#include<bits/stdc++.h>
using namespace std;
int min(int x, int y){
    if(x>=y) return y;
    else return x;
}
int main(){
    int n;
    cin>>n;
    int sum=0;

    vector<int>  b(n-1);
    for(int i=0; i<n-1;i++){
        cin>>b.at(i);
    }
    sum+=b.at(0);
    for(int j=0;j<n-2;j++){
        sum+=min(b.at(j), b.at(j+1));
    }
    sum+=b.at(n-2);
    cout<<sum;



}

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

int main(){
	int a[10000];
	int i = 0;
	cin >> a[i];
	while (a[i] != 0){
		cout << "Case " << i + 1 << ": " << a[i] << endl;
		i++;
		cin >> a[i];
	}
	return 0;
}

Measured memory_bytes: 3080
#include <iostream>

using namespace std;
#define rep(i, n) for(int i=0;i<(int)n; ++i)

int main()
{
  string N;
  cin >> N;
  if((N[0] == N[1]) && (N[1] == N[2])) cout << "Yes";
  else if((N[1] == N[2]) && (N[2] == N[3])) cout << "Yes";
  else cout << "No";
  cout << endl;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> L(87);

    ;
    L[1] = 1;

    REP(i, N+1){
        if(i == 0){
            L[0] = 2;
            continue;
        }
        if(i == 1){
            L[1] = 1;
            continue;
        }
        L[i] = L[i-1] + L[i-2];
    }

    cout << L[N] << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define SIZE 305

struct Info{
	Info(int arg_node_id,int arg_min_dist_from_S){
		node_id = arg_node_id;
		min_dist_from_S = arg_min_dist_from_S;
	}
	bool operator<(const struct Info &arg) const{

		return min_dist_from_S < arg.min_dist_from_S;
	}
	int node_id,min_dist_from_S;
};

int V;
int S,T;
int min_dist;
int min_dist_from_S[SIZE],min_dist_from_T[SIZE];

int main(){

	scanf("%d %d %d",&V,&S,&T);

	printf("? %d %d\n",S,T);
	cout.flush();
	scanf("%d",&min_dist);

	for(int i = 1; i <= V; i++){

		if(i == S || i == T)continue;
		printf("? %d %d\n",S,i);
		cout.flush();
		scanf("%d",&min_dist_from_S[i]);
	}

	for(int i = 1; i <= V; i++){

		if(i == S || i == T)continue;
		printf("? %d %d\n",T,i);
		cout.flush();
		scanf("%d",&min_dist_from_T[i]);
	}

	vector<Info> info;

	for(int i = 1; i <= V; i++){

		if(i == S || i == T)continue;

		if(min_dist_from_S[i]+min_dist_from_T[i] == min_dist){

			info.push_back(Info(i,min_dist_from_S[i]));
		}
	}
	sort(info.begin(),info.end());

	printf("! %d",S);

	for(int i = 0; i < info.size(); i++){

		printf(" %d",info[i].node_id);
	}

	printf(" %d\n",T);
	cout.flush();

	return 0;
}



Measured memory_bytes: 4664
#include<stdio.h>

int main(void){
  int n,i,sum=0;
  int l[100];
  scanf("%d", &n);
  for(i=0;i < n;i++){
    scanf("%d", &l[i]);
  }
  for(i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        if(l[i] != l[j] && l[i] != l[k] && l[j] != l[k]){
          if(l[i]+l[j]>l[k] && l[i]+l[k]>l[j] && l[j]+l[k]>l[i]){
            sum++;
          }
        }
      }
    }
  }
  printf("%d", sum);
  
  return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,x,n) for(int i=(x);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define int long long
using namespace std;
const int MOD=1e9+7;
const int INF=1e10;
template<typename T> void cmax(T &a, T b) {a = max(a, b);}
template<typename T> void cmin(T &a, T b) {a = min(a, b);}

int eulerPhi(int n){
  if(n==0)return 0;
  int ret=n;
  for(int i=2;i*i<=n;i++){
    if(n%i==0){
      ret-=ret/i;
      while(n%i==0)n/=i;
    }
  }
  if(n>1)ret-=ret/n;
  return ret;
}

signed main(){
  int n;
  cin>>n;
  cout<<eulerPhi(n)<<endl;
  return 0;
}



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

int main(void){
  vector<string> s(3);

  rep(i,3) cin >> s[i];

  rep(i,3) cout << s.at(i).at(i);
  cout << endl;
  
  return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn main() {
    input! {
        X: i32,
    }

    if 400 <= X && X < 600 {
        println!("8");
        return;
    } else if 600 <= X && X < 800 {
        println!("7");
        return;
    } else if 800 <= X && X < 1000 {
        println!("6");
        return;
    } else if 1000 <= X && X < 1200 {
        println!("5");
        return;
    } else if 1200 <= X && X < 1400 {
        println!("4");
        return;
    } else if 1400 <= X && X < 1600 {
        println!("3");
        return;
    } else if 1600 <= X && X < 1800 {
        println!("2");
        return;
    } else if 1800 <= X && X < 2000 {
        println!("1");
        return;
    }
}


Measured memory_bytes: 2168
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>
#include<time.h>
typedef long long int ll;
//#include<bits/stdc++.h>


using namespace std;



int main()
{
   
    string p;
    cin >> p;
    if (p[1] == 'B')p[1] = 'R';
    else p[1] = 'B';

    cout << p << endl;


    return 0;

}

Measured memory_bytes: 3532
N=int(input())
A=input()
B=input()
C=input()


ans = 0
for a,b,c in zip(A,B,C):
	if a==b:
		if b==c:
			continue
		else:
			ans+=1
	else:
		if a==c:
			ans+=1
		elif b==c:
			ans+=1
		else:
			ans+=2
print(ans)



Measured memory_bytes: 3060
s = input()
t = input()
n = len(s)

for i in range(n):
    f  = False
    for j in range(n):
        if t[j] == s[(i+j)%n]:
            pass
        else:
            break
    else:
        f = True
        break
if f:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
import heapq

N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(reverse=True)

ans = 0
work = []
# 最終日からさかのぼっていって、できるバイトの中で一番収入が多いやつをする
for i in range(1, M + 1):
    while AB:
        if AB[-1][0] <= i:
            _, b = AB.pop()
            heapq.heappush(work, -b)
        else:
            break

    if work:
        ans -= heapq.heappop(work)

print(ans)


Measured memory_bytes: 28080
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


class Program {

	static int testN=3;
	static long mod = 1000000007;
	//static long mod =998244353; 
	static System.IO.StringReader sr;
	static void Main(string[] args) {
		char[] cs = new char[] { ' ' };
		//char[] cs = new char[] { ' ', ',' };

		//int n = int.Parse(Console.ReadLine());
		//int val = int.Parse(Console.ReadLine());
		//int[] vals = parseAry(Console.ReadLine().Split(cs));
		//string str = Console.ReadLine();
		//string[] strs = Console.ReadLine().Split(cs);

		//string res = "";
		long res = long.MaxValue; ;


		int[] vals = parseAry(Console.ReadLine().Split(cs));
		long n=vals[0];

		long all = mod_pow(2, n);
		all -= combination(n, vals[1]);
		all -= combination(n, vals[2]);

		all--;
		all %= mod;
		if ( all < 0 ) { all += mod; }
			Console.WriteLine(all);

		return;

	}


	static long combination(long n, long r) {
		if ( r * 2 > n ) r = n - r;
		long dividend = 1;
		long divisor = 1;
		for ( long i = 1; i <= r; ++i ) {
			dividend *= ( n - i + 1 );
			dividend %= mod;

			divisor *= i;
			divisor %= mod;
		}

		return (dividend * mod_pow(divisor, mod - 2)) % mod;
	}

	static public long mod_pow(long x, long n) {
		long mod = 1000000007;
		long res = 1;
		while ( n > 0 ) {
			if ( ( n & 1 ) == 1 ) { res = res * x % mod; }
			x = x * x % mod;
			n >>= 1;
		}
		return res;
	}

  


	//	文字列strをindex番目からdで上書き
	static string strOverWrite(string str, int i, string s) {
		return str.Remove(i, s.Length).Insert(i, s);
	}

	//　String[]  ----->  int[]
	static int[] parseAry(string[] str) {
		int[] nums = new int[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = int.Parse(str[i]); }
		return nums;
	}
	//　String[]  ----->  long[]
	static long[] parseAryL(string[] str) {
		long[] nums = new long[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { nums[i] = long.Parse(str[i]); }
		return nums;
	}

	//文字列を1文字ずつString[]に入れる
	static string[] strAry(String str) {
		string[] re = new string[str.Length];
		for ( int i = 0; i < str.Length; i++ ) { re[i] = str[i].ToString(); }
		return re;
	}



}

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

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<Pli> L;
    for (int i = 0; i < N; ++i) {
        ll A;
        cin >> A;
        L.emplace_back(A, 1);
    }
    for (int i = 0; i < M; ++i) {
        ll B,C;
        cin >> B >> C;
        L.emplace_back(C, B);
    }
    sort(L.rbegin(), L.rend());
    ll ans = 0, ct = 0;
    for (Pli p : L) {
        ans += p.first * p.second;
        ct += p.second;
        if(ct >= N){
            ans -= p.first * (ct - N);
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6384
// Problem : A - Kth Term
// Contest : AtCoder - Panasonic Programming Contest 2020
// URL : https://atcoder.jp/contests/panasonic2020/tasks/panasonic2020_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a) for (int i=0; i<(a); i++)
#define rep1(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rep(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
#define imax INT_MAX
#define imin INT_MIN
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
	 
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	cin>>k;
	cout<<a[k-1];
	
    
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

signed main(){
    int N,A;
    cin>>N>>A;

    int ans=N;

    for(int i=2;i<50;i++){
        int lb=1,ub=1000001;
        while(ub-lb>1){
            int mid=(ub+lb)/2;
            int tmp=1;
            rep(j,i){
                tmp*=mid;
                if(tmp>N)break;
            }
            if(tmp>N)ub=mid;
            else lb=mid;
        }

        rep(j,i+1){
            int tmp=1;
            rep(k,j)tmp*=lb;
            rep(k,i-j)tmp*=lb+1;
            if(tmp>=N){
                chmin(ans,lb*i+i-j+A*(i-1));
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int n,i;
    
    cin >> n;
    int a[n];

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

    for(i=0;i<n;i++){
        if(i<(n-1)){
            cout << a[n-(i+1)] << " ";
        }
        else{
            cout << a[0] << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 3080
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
int DBG = 1;										/* デバッグプリント 提出時は0 */
/* main *************************************************************/
int main()
{
	int		a,b,c,i,j,k,n,m,x,y,ans = 0;
	char	str[256];
	
	scanf("%s", str);
	
	if ( strcmp(str,"SUN") == 0) printf("7\n");
	if ( strcmp(str,"MON") == 0) printf("6\n");
	if ( strcmp(str,"TUE") == 0) printf("5\n");
	if ( strcmp(str,"WED") == 0) printf("4\n");
	if ( strcmp(str,"THU") == 0) printf("3\n");
	if ( strcmp(str,"FRI") == 0) printf("2\n");
	if ( strcmp(str,"SAT") == 0) printf("1\n");
	

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>

using namespace std;

const int N = 501;

int main()
{
	int H, W;
	cin >> H >> W;
	string g[N];
	for(int i = 0; i != H; ++i){
		cin >> g[i];
	}
	for(int i = 0; i != H; ++i){
		for(int j = 0; j != W; ++j){
			if(g[i][j] == '#' || j == 0){
				cout << '#';
			}
			else if(i % 2 == 0 && j != W - 1){
				cout << '#';
			}
			else{
				cout << '.';
			}
		}
		cout << endl;
	}
	for(int i = 0; i != H; ++i){
		for(int j = 0; j != W; ++j){
			if(g[i][j] == '#' || j == W - 1){
				cout << '#';
			}
			else if(i % 2 == 1 && j != 0){
				cout << '#';
			}
			else{
				cout << '.';
			}
		}
		cout << endl;
	}
}



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

int main(){
    ll N,K; cin>>N>>K;
    vector<ll> A(N);
    for(ll i=0;i<N;i++){
        cin>>A[i];
    }
    sort(A.begin(),A.end());
    ll sum=0;
    for(ll i=0;i<K;i++){
        sum+=A[i];
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 3632
import sys
import os
import itertools
import numpy as np
from collections import deque

def main():
    if os.getenv("ENV")=='LOCAL':
        sys.stdin = open(os.path.dirname(__file__)+'/input.txt', 'r')

    S=input()
    T=input()

    ans=0
    for i in range(len(S)):
        if S[i]!=T[i]:
            ans+=1

    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 27248
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define rep(i, a, b) for (int i=a; i<(b); i++)
#define rp(i, a) for (int i=0; i<(a); i++)
#define repd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define rpd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    string s;
    cin >> s;
    s[5] = ' ';
    s[13] = ' ';
    cout << s << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
int n,D1,D2;
int vis[605][605],vst[605][605],dx[4]={1,1,-1,-1},dy[4]={1,-1,1,-1},num[5][5];
void dfs(int x,int y,int D)
{
	for(int i=0;i*i<=D;i++)
	{
		int len=D-i*i;
		int j=sqrt(len);if(j*j!=len) continue;
		for(int k=0;k<4;k++)
		{
			int nx=x+i*dx[k],ny=y+j*dy[k];
			if(nx<1||nx>n||ny<1||ny>n) continue;
			if(!vis[nx][ny])
			{
				vis[nx][ny]=3-vis[x][y];
				dfs(nx,ny,D);
			}
		}
	}
}
int main()
{
	scanf("%d%d%d",&n,&D1,&D2);
	n<<=1;
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	{
		if(!vis[i][j])
		{
			vis[i][j]=1;
			dfs(i,j,D1);
		}
	}
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++) vst[i][j]=vis[i][j];
	memset(vis,0,sizeof(vis));
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++)
	{
		if(!vis[i][j])
		{
			vis[i][j]=1;
			dfs(i,j,D2);
		}
	}
	for(int i=1;i<=n;i++)
	for(int j=1;j<=n;j++) num[vis[i][j]][vst[i][j]]++;
	bool flag=1;
	for(int a=1;a<=2;a++)
	for(int b=1;b<=2&&flag;b++)
	{
		if(num[a][b]<n*n/4) continue;
		int nums=0;
		for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			if(nums==n*n/4) break;
			if(vis[i][j]==a&&vst[i][j]==b) printf("%d %d\n",i-1,j-1),nums++;
		}
		flag=0;
	}
	return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if (A+B == C+D) {
    cout << "Balanced" << endl;
  }

  else if(A+B > C+D){
    cout << "Left"<< endl;
  }

  else {
    cout << "Right"<< endl;
  }
}


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

#define int long long int
const int N=1e4;

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

	long double k,a,b,temp;
	cin>>k>>a>>b;
	temp = ceil(a/k);
	if(a <= temp*k && temp*k <= b)
		cout<<"OK";
	else
		cout<<"NG";

	return 0;
}

Measured memory_bytes: 3744
import java.util.Scanner;

public class Main {
    public static void main(String [] args) {
        final Scanner scanner = new Scanner(System.in);
        final int age = scanner.nextInt();
        if (age == 7 || age == 5 || age == 3) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 23252
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>
#include <vector>
#include <queue>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

typedef long long llong;
typedef unsigned long long ullong;
// -2.1e-9 <= int <= 2.1e9
// -9.2e-18 <= long long <= 9.2e18
// 0 <= unsigned int <= 4.2e9
// 0 <= unsigned long long <= 18.4e18
// cout << fixed << setprecision(10);

int main() {
    string S;
    cin >> S;
    llong sum = 0;
    for (size_t i=0; i<S.size(); ++i) {
        size_t j = S.size() - 1 - i;
        llong n = llong(S[j]) - 48;
        sum += n;
    }
    if (sum % 9 == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3748
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            S[i][j] = 0
            for k in range(-1, 2):
                for l in range(-1, 2):
                    if k != 0 or l != 0:
                        if 0 <= i+k < H and 0 <= j+l < W and S[i+k][j+l] == "#":
                            S[i][j] += 1

            S[i][j] = str(S[i][j])

    print("".join(S[i]))

Measured memory_bytes: 3188
loop do
  n, k = gets.split.map(&:to_i)
  break if n == 0
  points =
    k.times.map do
      c, a, b = gets.split
      a = a.to_i; b = b.to_i
      case c
      when 'xy'
        [a, b, 0]
      when 'yz'
        [0, a, b]
      when 'xz'
        [a, 0, b]
      end
    end

  cross_points = {}
  points.combination(2).each do |a, b|
    c = a.zip(b)
    if c.all?{ |p, q| !(p == 0 && q == 0) } && c.any?{ |p, q| p == q }
      p = c.map{ |p, q| [p, q].max }
      cross_points[p] ||= 0
      cross_points[p] += 1 if cross_points[p] < 2
    end
  end
  puts n * n * n - k * n + (cross_points.values.reduce(:+) || 0)
end

Measured memory_bytes: 8788
#include<stdio.h>
int main(void)
{
	int n,i;
	char s[101],t[101];
	scanf("%d",&n);
	scanf("%s",s);
	scanf("%s",t);
	for(i=0;i<n;i++){
		printf("%c",s[i]);
		printf("%c",t[i]);
	}
	printf("\n");
	return 0;
}


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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while(a > 0 || c > 0){
    c = c - b;
    if(c <= 0){
      cout << "Yes" << endl;
      return 0;
    }
    a = a - d;
    if(a <= 0){
      cout << "No" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3556
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	vector<int> n,m;
	int a,b,co=0;
	while(1)
	{
		cin>>a>>b;
		if(a==0&&b==0)break;
		n.push_back(min(a,b));
		m.push_back(max(a,b));
		co++;
	}
	for(a=0;a<co;a++)
	{
		cout<<n[a]<<" "<<m[a]<<endl;
	}
	return 0;
}

Measured memory_bytes: 3160
# 169A
# A ×　B を整数として出力せよ

# 1.入力をプログラムで扱えるように受け取ること
a, b = map(int, input().split())

# 2.受け取った入力値を使って、適切に処理（計算）すること
answer = a * b

# 3.計算した結果を出力すること
print(answer)

Measured memory_bytes: 9084
#define ll long long
#define MOD 1000000007 
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define T long long t;cin>>t;while(t--)
#define foe(i) for(int i=1;i<=n;i++)
#define fo(i) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
using namespace std;
ll a[200009]={0};
ll vis[200009]={0};
 vector<ll>v[200009];
void dfs(ll s,ll val)
{
	vis[s]=1;
	for(ll i:v[s])
		if(!vis[i])
			{
        a[i]+=val;
        dfs(i,a[i]);
      }
}


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n,q,x,y;
  cin>>n>>q;
  for(ll i=1;i<n;i++)
  {
    cin>>x>>y;
    v[x].pb(y);
    v[y].pb(x);
  }
  for(ll i=1;i<=q;i++)
  {
    cin>>x>>y;
    a[x]+=y;
  }
  dfs(1,a[1]);
  for(ll i=1;i<=n;i++)
  cout<<a[i]<<" ";
}

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

int main() {
    int N;
    int t[100010], x[100010], y[1000010];
    cin >> N;
    t[0] = x[0] = y[0] = 0; 
    for (int i = 0; i < N; ++i) cin >> t[i+1] >> x[i+1] >> y[i+1];  

    bool ans = true;
    for (int i = 0; i < N; ++i) {
        int dt = t[i+1] - t[i];
        int dis = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if (dt < dis) ans = false;
        if (dis % 2 != dt % 2) ans = false;  
    }

    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 2560
import scala.io.{StdIn => in}

object Main extends App {
  val Array(x, y, z, k) = in.readLine.split(" ").map(_.toInt)
  val a = in.readLine.split(" ").map(_.toLong).sorted(Ordering[Long].reverse)
  val b = in.readLine.split(" ").map(_.toLong).sorted(Ordering[Long].reverse)
  val c = in.readLine.split(" ").map(_.toLong).sorted(Ordering[Long].reverse)

  val ab = {
    for {
      i <- 0 until x
      j <- 0 until y
    } yield {
      a(i) + b(j)
    }
  }.toArray.sorted(Ordering[Long].reverse).take(k)

  val ans = {
    for {
      j <- 0 until z
      i <- 0 until ab.size
      if i * j <= k
    } yield {
      ab(i) + c(j)
    }
  }.toArray.sorted(Ordering[Long].reverse).take(k)

  val out = new java.io.PrintWriter(System.out)
  out.println(ans.mkString("\n"))
  out.flush
}

Measured memory_bytes: 158056
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int64_t modpow(int64_t a, int64_t b, int64_t MOD) {
	int64_t ret = 1;
	while (b > 0) {
		if (b & 1) { (ret *= a) %= MOD; }
		(a *= a) %= MOD;
		b >>= 1;
	}
	return ret % MOD;
}

int main() {
	Int N, P;
	cin >> N >> P;
	string s;
	cin >> s;

	if (P < 100) {
		vector<Int> curr(P, 0);
		curr[(int)(s[0] - '0') % P] = 1;
		Int ans = curr[0];
		for (int i = 1; i < N; ++i) {
			vector<Int> nxt(P, 0);
			int x = s[i] - '0';
			nxt[x % P] += 1;
			for (int j = 0; j < P; ++j) {
				nxt[(j * 10 + x) % P] += curr[j];
			}
			ans += nxt[0];
			curr = nxt;
		}
		cout << ans << endl;

		return 0;
	}

	Int x = 0, y = 1;
	map<Int, Int> mp;
	mp[0] = 1;
	for (int i = 0; i < N; ++i) {
		(x = x * 10 + (s[i] - '0')) %= P;
		Int z = x * modpow(y, P - 2, P) % P;
		mp[z] += 1;
		y = y * 10 % P;
	}
 
	Int ans = 0;
	for (auto it = mp.begin(); it != mp.end(); ++it) {
		ans += it->second * (it->second - 1) / 2;
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1028
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)

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

    int n;
    cin >> n;
    vector<int> X(n), Y(n);
    REP(i, n){
        cin >> X[i];
        Y[i] = X[i];
    }

    sort(Y.begin(), Y.end());
    REP(i, n){
        int idx = lower_bound(Y.begin(), Y.end(), X[i]) - Y.begin();
        cout << Y[(idx < n / 2 ? n / 2 : n / 2 - 1)] << endl;
    }

    return 0;
}

Measured memory_bytes: 3840
//nani?
#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
#include <ext/pb_ds/detail/standard_policies.hpp>
#define pi acos(-1);
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define f(i,a,b) for( int i = a; i < b ; i++ )
#define sor(a) sort( a.begin(), a.end() )
#define rsor(a) sort( a.rbegin(), a.rend() )
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
//#define inf 1LL<<62
typedef long long ll;
typedef double ld;
using namespace std;
using namespace __gnu_pbds;
const int inf=1e7;
const ll MOD=1e9+7;
const ll mod=998244353;
// ac cmtr;
const int MAX_N = 2e5+5;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;

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

ll a[MAX_N];
ll b[MAX_N];
ll cnt[MAX_N][4];

int main(){
    fastio;
    ll n,m;
  	cin>>n>>m;
  	if(n>m) cout<<"safe"<<endl;
  	else cout<<"unsafe"<<endl;

    
} 


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;

int main() {
   double A,B,H,M;
   cin >> A >> B >> H >> M;
   double minutes = 360 * (M/60);
   double times = (360 * H/12)+M*1/2;
   double kakudo = min(abs(times-minutes),360-abs(times-minutes));
   double ans = sqrt(A*A+B*B-2*A*B*cos(M_PI*kakudo/180));
   printf("%.10lf",ans);
}


Measured memory_bytes: 4228
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {

    static final int MOD = 1000000007;
    static final int INF = 1 << 30;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int H = sc.nextInt();
        int W = sc.nextInt();
        for(int i=0;i<H;i++){
            String s = sc.next();
            System.out.println(s);
            System.out.println(s);
        }
    }
}


Measured memory_bytes: 22740
#include<iostream>
#include<unordered_map>
using namespace std;
int n;
unordered_map<string,int>m;
string s,k[4]={"AC","WA","TLE","RE"};
int main(){
    cin>>n;
    while(n--){
        cin>>s;
        m[s]++;
    }
    for(n=0;n<4;n++){
        cout<<k[n]<<" x "<<m[k[n]]<<"\n";
    }
}


Measured memory_bytes: 3628
# include <iostream>
using namespace std;
const int N=100006;
int a[N];
int n,s;
void work (void)
{
	int i;
	i=1;
	while (i<=n)
	if (a[i]==i)
	{
		s++;
		i+=2;
	}
else i++;
    cout<<s;
}
int main (void)
{
	int i;
	cin>>n;
	for (i=1;i<=n;i++)
	cin>>a[i];
	work ();
	return 0;
}


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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/




signed main()
{
	int64_t n; cin >> n;
	vector<int> p(n);
	for(int i = 0, i_len = (int)n; i < i_len; ++i) cin >> p[i];

	auto ISascending = [&]() -> bool{
		for(int k = 0; k < n-1; ++k){
			if(p[k] > p[k+1]){
				return false;
			}
		}
		return true;
	};

	if(ISascending()){
		cout << "YES" << endl;
		return 0;
	}
	for(int i = 0; i < n-1; ++i){
		for(int j = 1; j < n; ++j){
			swap(p[i], p[j]);
			if(ISascending()){
				cout << "YES" << endl;
				return 0;
			}
			swap(p[i], p[j]);
		}
	}


	cout << "NO" << endl;
}

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

int main(){
  int N, K;
  vector<int> h;
  vector<long> dif;
  long a = 0;
  long ans = 1000000000;
  
  cin >> N >> K;
  for(int i = 0; i < N; ++i){
    cin >> a;
    h.push_back(a);
  }
  
  sort(h.begin(),h.end());
  a = 0;
  dif.push_back(0);
  for(int i = 0; i < N - 1; ++i){
    a += h[i + 1] - h[i];
    dif.push_back(a);
  }

  for(int i = K - 1; i < N; ++i){
    if(ans > dif[i] - dif[i - (K - 1)]) ans = dif[i] - dif[i - (K - 1)];
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1784
n, data = int(input()), list(map(int, input().split()))
i, t = 0, 0
while i != n-1:
    for j in range(n-1, i, -1):
        if data[j-1] > data[j]:
            data[j-1], data[j] = data[j], data[j-1]
            t += 1
    i += 1
print(" ".join(map(str, data)))
print(t)



Measured memory_bytes: 5600
// C++11
#include "bits/stdc++.h"
#include <sys/time.h>
#include <emmintrin.h>
#include <string>
#include <sstream>
#include <fstream>
#include <random>
#include <bitset>
#include <chrono>
#include <map>

using namespace std;

std::chrono::system_clock::time_point start = std::chrono::system_clock::now();

inline double GetSeconds() {
   std::chrono::system_clock::time_point end = std::chrono::system_clock::now();
  return std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
}

struct XorShift {
  uint64_t x = 88172645463325252ULL;

  XorShift() {}

  void setSeed(uint64_t seed) {
    x = seed;
  }

  uint64_t next() {
    x ^= x << 13;
    x ^= x >> 7;
    x ^= x << 17;
    return x;
  }

  int nextInt(int n) {
    uint64_t upper = 0xFFFFFFFFFFFFFFFFULL / n * n;
    uint64_t v = next();
    while (v >= upper) {
      v = next();
    }
    return v % n;
  }

  double nextDouble() {
    uint64_t v = next() >> 11; // 53bit
    return (double)v / (1ULL << 53);
  }
};

XorShift xs;

const int M = 1e5+5;
const int mod = 1000000000+7;
tuple<int, int> P[M];

int main() {
  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    int p;
    cin >> p;
    P[i] = make_tuple(p, i);
  }
  sort(&P[0], &P[n]);
  vector<int> a;
  a.push_back(-1);
  a.push_back(n);
  long long r = 0;
  for(int pi=n-1; pi>=0; pi--){
    long long c = get<1>(P[pi]);
    int pc = get<0>(P[pi]);
    auto it = lower_bound(a.begin(), a.end(), c);
    int i = it - a.begin();
    long long b = a[i-1];
    long long d = a[i];
    if(d < n){
      r += (c-b) * (a[i+1]-d) * pc;
    }
    if(b >= 0){
      r += (b-a[i-2]) * (d-c) * pc;
    }
    a.insert(it, c);
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 1660
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let a: usize = read();
    println!("{}", n * n - a);
}

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


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

typedef long long ll;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

// bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
//     return arg1.first > arg2.first;
// }

// template<class T> void chmin(T& a, T b) {
//     if (a > b) {
//         a = b;
//     }
// }

// template<class T> void chmax(T& a, T b) {
//     if (a < b) {
//         a = b;
//     }
// }

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

    vector<int> l(n);
    for(int in=0;in<n;in++) {
        cin >> l.at(in);
    }

    sort(l.begin(), l.end(), greater<int>());

    int sum=0;
    for(int in=1;in<n;in++) {
        sum += l.at(in);
    }

    if(l.at(0)<sum) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


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

int main() {
  
  string s;
  cin >> s;
  vector<char> L(0);
  
  if(s.at(0) == '0'){
      L.push_back('0');
    }
    if(s.at(0) == '1'){
      L.push_back('1');
    }
  
  for(int i = 1; i < s.size(); i++){
    if(s.at(i) == '0'){
      L.push_back('0');
    }
    if(s.at(i) == '1'){
      L.push_back('1');
    }
    if(s.at(i) == 'B'){
      if(L.size() == 0){
        continue;
      }
      else{
        L.pop_back();
      }
    }
  }
  
  for(int i = 0; i < L.size(); i++){
    cout << L.at(i);
  }
  
}


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

using namespace std;
#define int long long
const int maxn=1e6+5;
bool used[maxn];
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;++i) cin>>a[i];
    map <int,int> h;
    for(int i=0;i<n;++i)
    {
        if(!h.count(a[i]))
        {
            h[a[i]]=1;
            for(int j=2*a[i];j<maxn;j+=a[i])
            {
                used[j]=true;
            }
        }
        else 
        {h[a[i]]++;}
    }
    int sum=0;
    for(int i=0;i<n;++i)
    {
        if(!used[a[i]] && h[a[i]]==1)
        {
            ++sum;
        }
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 18536