akhauriyash/Code-Regression huggingface dataset:
s=input()
listA=[0,0,0,0]
i=0
for x in s:
    listA[i]=int(x)
    i+=1
a=listA[0]
b=listA[1]
c=listA[2]
d=listA[3]
if(a+b+c+d==7):
    print("%d+%d+%d+%d=7"% (a,b,c,d))
elif(a+b+c-d==7):
    print("%d+%d+%d-%d=7"% (a,b,c,d))
elif(a+b-c+d==7):
    print("%d+%d-%d+%d=7" % (a, b, c, d))
elif(a+b-c-d==7):
    print("%d+%d-%d-%d=7" % (a, b, c, d))
elif(a-b+c+d==7):
    print("%d-%d+%d+%d=7" % (a, b, c, d))
elif(a-b-c+d==7):
    print("%d-%d-%d+%d=7" % (a, b, c, d))
elif(a-b-c-d==7):
    print("%d-%d-%d-%d=7" % (a, b, c, d))
elif(a-b+c-d==7):
    print("%d-%d+%d-%d=7" % (a, b, c, d))

Measured memory_bytes: 3064
#include<stdio.h>

int main(void){

    int count1[50000]={0};
    int count2[50000]={0};
    int count3[50000]={0};
    int i=0;
    int j;
    int x,y,z;

    while(1){
        scanf("%d %d",&count1[i],&count2[i]);
        if(count1[i]==0 && count2[i]==0) break;
        else if(count1[i]%100!=0 || count2[i]%100!=0){
            ;
        }
        else{
            count3[i]=count2[i]-count1[i];
            i++;
        }
    }
    
    for(i=0;count1[i]!=0;i++){
        printf("%d %d %d\n",((count3[i]%1000)%500)/100,(count3[i]%1000)/500,count3[i]/1000);
    }

    return 0;
}

 

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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

const ll INF = 1LL << 60;

ll mod=1000000007;

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


int main() {
  int n;cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  sort(rALL(a));
  ll h=n/2;
  ll sum=0;
  rep(i,h)sum+=a[i];
  sum*=2;
  if(n%2==0)cout<<sum-a[0];
  else cout<<sum-a[0]+a[n/2];
}

Measured memory_bytes: 4784
def contest(N, str):
    a_str = []
    a = []

    a_str= map(int,str.split(' '))
    for char in a_str:
        a.append(int(char))

    result = True

    for i in range(int(N)):
        if a[i] % 2 == 0:
            if a[i] % 3 != 0 and a[i] % 5 != 0:
                result = False

    if result == True:
        return 'APPROVED'
    else:
        return 'DENIED'


if __name__ == "__main__":
    N = int(input())
    str = input()

    print(contest(N, str))

Measured memory_bytes: 3188
import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().rstrip().split())
    As = list(map(int, input().rstrip().split()))
    bound = sum(As) / (4 * M)
    res = 0
    for a in As:
        if a >= bound:
            res += 1
    if res >= M:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <assert.h>
#include <limits.h>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << i << "\n"

//const ll MOD = 998244353;
const ll MOD = 1e9+7;
 
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n,k;
  std::string s;

  std::cin >> n >> k;
  std::cin >> s;
  k--;
  s[k] = s[k] - 'A' + 'a';
  std::cout << s;

  debug(3);

  return 0;
}

Measured memory_bytes: 256
/*https://atcoder.jp/contests/dp/tasks/dp_g*/
#include <bits/stdc++.h>
#include <sstream> 
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
#define endl "\n"
#define pi 2*acos(0.0)
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repe(i,a,b) for(ll i=a;i<=b;++i)
#define CPrint(c)  for(auto i:(c)) { cout<<i<<" "; } nl 
#define eb   emplace_back
#define ef   emplace_front
#define pb   push_back
#define pf   push_front
#define popb pop_back
#define popf pop_front
#define mp   make_pair
#define sz(a) int((a).size())
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
//Allows to traverse any type of macro
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
//debuggers
#define trace2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl
#define trace3(x,y,z) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
#define trace4(w,x,y,z) cout<<#w<<"="<<w<<" "<<#x<<"="<<x<<" "<<#y<<"="<<y<<" "<<#z<<"="<<z<<endl
typedef long long ll;
using namespace std;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair<ll,ll> pll;
const int lim = 1e5+5;
ll n,m;
vector<ll>dist(lim);
/*
DAG as input
add a fake vertex and carry out path and
 for every vertex we need the longest distance to the vertex
*/
ll in_degree[lim];
vector<ll>adj[lim];
vector<bool> visited(lim,false);
void dfs(ll a)
{
	if(!visited[a])
	{
		visited[a] = true;
for(ll b:adj[a])
{
	dist[b] = max(dist[b],dist[a]+1);
	--in_degree[b];
	if(in_degree[b]==0)
	{
		dfs(b);
	}
	}
}
}
int main()
{
	cin >> n >> m;
	ll a,b;
	for(int i=0;i<m;i++)
	{
		cin >> a >> b;
		adj[a].eb(b);
		++in_degree[b];
	}
	for(int i=1;i<=n;i++)
	{
		if(!visited[i] && in_degree[i]==0)
		{
			dfs(i);
		}
	}
	ll ans = 0;
	for(int i=1;i<=n;i++)
	{
		ans = max(ans,dist[i]);
	}

cout << ans << endl;
}


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

using namespace std;

const int max_n = 200222, inf = 1000111222;

int n, a[max_n], b[max_n];

int triv() {
    int res = 0;
    while (true) {
        bool ok = true;
        for (int i = 0; i < n; ++i) {
            if (a[i] != b[i]) {
                ok = false;
                break;
            }
        }
        if (ok) {
            return res;
        }
        int pos = 0;
        for (int i = 0; i < n; ++i) {
            if (b[i] > b[pos]) {
                pos = i;
            }
        }
        int sum = b[(pos + n - 1) % n] + b[(pos + 1) % n];
        if (b[pos] <= sum) {
            return -1;
        }
        b[pos] -= sum;
        ++res;
    }
}

long long solve() {
    long long res = 0;
    set<pair<int, int>> q;
    for (int i = 0; i < n; ++i) {
        q.insert({b[i], i});
    }
    while (!q.empty()) {
        pair<int, int> p = *q.rbegin();
        q.erase(p);
        int pos = p.second;
        if (p.first < a[pos]) {
            return -1;
        }
        if (p.first == a[pos]) {
            continue;
        }
        int x = b[(pos + n - 1) % n];
        int y = b[(pos + 1) % n];
        //cout << "$" << pos << " " << x << " " << y << endl;
        if (b[pos] <= x + y) {
            return -1;
        }
        int c = b[pos] % (x + y);
        res += b[pos] / (x + y);
        if (c < a[pos]) {
            if ((a[pos] - c) % (x + y)) {
                return -1;
            }
            res -= (a[pos] - c) / (x + y);
            c = a[pos];
        }
        b[pos] = c;
        //cout << "$ " << pos << " " << b[pos] << endl;
        q.insert({b[pos], pos});
    }
    return res;
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < n; ++i) {
        scanf("%d", &b[i]);
    }
    cout << solve() << "\n";
    //cout << triv() << endl;
    return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

// DON'T USE THESE MACROS DURING ICPC PRACTICE
#define For(i,n) for (int i=0; i<n; i++)
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define Down(i,n) for (int i=n-1; i>=0; i--)
#define DOWN(i,a,b) for (int i=b; i>=a; i--)

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef complex<ld> pt;
typedef vector<pt> pol;
typedef vector<int> vi;

const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1e-10;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());



int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cout << fixed << setprecision(10);

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

	int ans = 0;
	for (int i=0; i<n; i++) {
		for (int j=0; j<i; j++) {
			int cur = 0;
			int a = x[i]-x[j];
			int b = y[i]-y[j];
			for (int ii=0; ii<n; ii++) {
				for (int jj=0; jj<n; jj++) {
					cur += (x[ii]-x[jj]==a && y[ii]-y[jj]==b);
				}
			}
			ans = max(ans, cur);
		}
	}
	cout << n-ans << nl;

	return 0;
}


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

long long gcd(long long x, long long y){
  while(y!=0){
    long long tmp;
    tmp = y;
    y = x % y;
    x = tmp;
  }
  return x;
}
// n以下でcでもdでも割り切れない数の個数を返す
long long antidivision(long long n, long long c, long long d){
  long long lcm = c*d/gcd(c,d);
  long long re = n - (n/c + n/d - n/lcm);
  return re;
}
   
int main(){
  long long a,b;
  long long c,d;
  cin >> a >> b >> c >> d;
  long long ans = antidivision(b, c, d) - antidivision(a-1, c, d);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#define SF scanf
#define PF printf
#define MAXN 3010
#define MOD 1000000007
using namespace std;
typedef long long ll;
ll dp[MAXN][MAXN];
int n,m;
char s[MAXN];
int endx[MAXN],pre[MAXN];
int main(){
	SF("%d%d",&n,&m);
	SF("%s",s+1);
	for(int i=1;i<=n+1;i++)
		pre[i]=pre[i-1]+(s[i]=='1');
	int las=1;
	int u,v;
	for(int i=1;i<=n+1;i++)
		endx[i]=max(endx[i],i);
	for(int i=1;i<=m;i++){
		SF("%d%d",&u,&v);	
		endx[u]=max(endx[u],v);
	}
	for(int i=1;i<=n+1;i++)
		endx[i]=max(endx[i],endx[i-1]);
	dp[1][pre[endx[1]]]=1;
	for(int i=1;i<=n;i++)
		for(int j=0;j<=n;j++)
			if(dp[i][j]){
				int l=endx[i];
				int r=endx[i+1];
				int one=j;
				int zero=endx[i]-i+1-j;
				if(zero)
					(dp[i+1][j+pre[r]-pre[l]]+=dp[i][j])%=MOD;
				if(one)
					(dp[i+1][j-1+pre[r]-pre[l]]+=dp[i][j])%=MOD;
			}
	PF("%lld",dp[n+1][0]);
}

Measured memory_bytes: 68352
#include <iostream>
#include <unordered_set>
#include <cstdint>
#include <vector>
#include <string>
#include <climits>
#include <set>
#include <algorithm>
#include <math.h>
#include <iomanip>
using namespace std;

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

	double res = l / 3.0;

	cout << fixed << setprecision(12) << res * res * res;
}

Measured memory_bytes: 3784
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int A = input[0];
            int B = input[1];
            if (A + B < 10)
            {
                Console.WriteLine(A + B);
            }
            else
            {
                Console.WriteLine("error");
            }
        }
    }
}

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

const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const int MOD=1000000007;

int main(){
	int n;cin>>n;
	int cnt=0;
	rep(i,n){
		string s;cin>>s;
		if(s=="E869120")cnt++;
	}
	cout<<cnt<<endl;
}


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

int main(){
  long long A, B; cin >> A >> B;
  long long s = min(A,B);
  int ans = 1;
  for (long long i=2; i*i<=min(A,B); i++){
    bool cA, cB;
    cA = false; cB = false;
    while (A%i == 0){
      cA = true;
      A /= i;
    }
    while (B%i == 0){
      cB = true;
      B /= i;
    }
    if (cA && cB) ans += 1;
  }
  if (A > 1 && B > 1 && (A % B == 0 || B % A == 0)) ans += 1;

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

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

using namespace std;

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

    vector<int> v(N,0);
    for (auto& e : v) cin>>e;

    int s = accumulate(v.begin(), v.end(), 0); 

    int a = static_cast<int>(round((double)s/N));

    long long cost = 0;
    for (auto& e : v) {
        cost += (a - e) * (a-e);
    }

    cout<<cost<<endl;


    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
  
int a;
int b;
int menseki;
int shu;
  
int main(){
scanf("%d %d", &a, &b);
menseki = a * b;
shu = a * 2 + b * 2;
printf("%d %d\n", menseki, shu);
return 0;
}

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

#define debug(n) cerr << #n << ':' << n << endl;

using namespace std;

using  ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
using  vi = vector<int>;
using  vl = vector<ll>;
using  vd = vector<double>;
template<class T,class U>
using umap = unordered_map<T,U>;
template<class T>
using uset = unordered_set<T>;

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

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

template<class T>
inline void putv(const vector<T>&v,char c = '\n'){
  for(auto&&e:v){
    cout << e << c;
  }
}

bool comp(int a, int b){
  return a>b;
}

int main(){
  int n;cin >> n;
  vi v;
  int ans = 0;
  for(int i = 0; i < n; ++i){
    int x; cin >> x;
    auto it = upper_bound(v.begin(), v.end(), x, comp);
    if(it == v.end()){
      ans++;
      v.push_back(x);
    }else{
      *it = x;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 892
from itertools import accumulate

n = int(input())
a = [int(x) for x in input().split()]
p = list(accumulate(a))
m = 10 ** 9 + 7

result = 0
for i, x in enumerate(a):
  result += x * (p[-1] - p[i])
  result %= m

print(result)

Measured memory_bytes: 31328
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long int
int main(){
  ull n,k,s;
  cin>>n>>k>>s;
  n-=k;
  if(s<1e9){
  while(k--) cout<<s<<" ";
  while(n--) cout<<s+1<<" ";}
  else{
    while(k--) cout<<s<<" ";
  while(n--) cout<<1<<" ";
  }
    
}
  


Measured memory_bytes: 1280
//
// ~oisín~ C++ Template
//

#include                <bits/stdc++.h>
#define MX_N            5001
#define mp              make_pair
#define mod7            1000000007
#define modpi           314159
#define PI              3.141592653589793238
#define pb              push_back
#define FastIO          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define All(a)          a.begin(),a.end()
#define fi              first
#define se              second
#define ll              long long int
#define ull             unsigned long long int

int kx[8]  =            {+2, +2, -2, -2, +1, +1, -1, -1};
int ky[8]  =            {+1, -1, +1, -1, +2, -2, +2, -2};
int d9x[9] =            {+1, +1, +1, +0, +0, +0, -1, -1, -1};
int d9y[9] =            {+1, +0, -1, +1, +0, -1, +1, +0, -1};
int dx4[4] =            {+0, +0, +1, -1};
int dy4[4] =            {+1, -1, +0, +0};

ll gcd(ull a, ull b){
    return (a==0)?b:gcd(b%a,a);
}

ll lcm(ull a, ull b){
    return a*(b/gcd(a,b));
}

const long long INF = 1e18;

using namespace std;

int main(){
    int x, n;
    cin >> x >> n;
    map<int, bool> m;
    for(int i=0;i<n;++i){
        int tmp;
        cin >> tmp;
        m[tmp] = 1;
    }
    for(int i=0;true;++i){
        if(m[x - i] == 0){
            cout << x - i << endl;
            return 0;
        }
        if(m[x + i] == 0){
            cout << x + i << endl;
            return 0;
        }
    }
}


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

typedef long long ll;

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


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int height;
	int width;
	int area;
	int length;

	scanf("%d %d", &height, &width);

	//??¢???
	area = height * width;
	//????????????
	length = 2 * (height + width);

	printf("%d %d\n", area, length);

	return 0;
}

Measured memory_bytes: 596
#include <iostream>
using namespace std;
int a[200006];
int main () {
    int N;
    cin >> N;
    long long int sum=0;
    for (int i=0; i<N; i++) {
        cin >> a[i];
    }
    for (int i=0; i<N-1; i++) {
        if (a[i]>a[i+1]) {
            sum=sum+(a[i]-a[i+1]);
            a[i+1]=a[i];
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 4340
N = int(input())
A = [int(input()) for _ in range(N)]

def main(N, A):
    if A[0] != 0: return -1
    if any([A[i+1] - A[i] > 1 for i in range(N-1)]): return -1
    A.reverse()
    ans = 0
    before = -1
    for a in A:
        if a+1 != before:
            ans += a
        before = a
    return ans

print(main(N, A))


Measured memory_bytes: 18484
from math import ceil

N = int(input())
A = [int(i) for i in input().split()]
n = [0]*N
for a in A:
    n[a] += 1
# print(n)
if N&1:
    t = 0
    for a in range(len(n)):
        if a == 0:
            if n[a] != 1:
                print(0)
                break
        elif a&1:
            if n[a] != 0:
                print(0)
                break
        else:
            if n[a] != 2:
                print(0)
                break
            else:
                t += 1
    else:
        print(2**t%(10**9+7))
else:
    t = 0
    for a in range(len(n)):
        if a&1:
            if n[a] != 2:
                print(0)
                break
            else:
                t += 1
        else:
            if n[a] != 0:
                print(0)
                break
    else:
        print(2**t%(10**9+7))

Measured memory_bytes: 13812
//abc154_c.cpp
//Sat Mar 28 17:47:44 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

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

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

	sort(a,a+n);

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

	cout << "YES" << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 1024
#include <stdio.h>

main(){
  char data[101], sign;
  int i;

  while(1){
    scanf("%s", &data);
    getchar();
    scanf("%c", &sign);
    if(sign=='X') break;

    if(sign=='U'){
      if(data[0]>='a' && data[0]<='z') data[0]-=('a'-'A');

      for(i=0;;i++){
	if(data[i]=='\0') break;
	if(data[i]=='_'){
	  if(data[i+1]!='\0'){
	    if(data[i+1]>='a' && data[i+1]<='z'){
	      data[i+1]-=('a'-'A');
	    }
	  }
	  continue;
	}
	printf("%c", data[i]);
      }
      printf("\n");
    }

    else if(sign=='L'){
      if(data[0]<'a') data[0]+=('a'-'A');

      for(i=0;;i++){
	if(data[i]=='\0') break;
	if(data[i]=='_'){
	  if(data[i+1]!='\0'){
	    if(data[i+1]>='a' && data[i+1]<='z'){
	      data[i+1]-=('a'-'A');
	    }
	  }
	  continue;
	}
	printf("%c", data[i]);
      }
      printf("\n");
    }

    else if(sign=='D'){
      if(data[0]<'a') data[0]+=('a'-'A');

      for(i=0;;i++){
	if(data[i]=='\0') break;
	if(data[i]<='Z' && data[i]>='A'){
	  data[i]+=('a'-'A');
	  printf("_");
	}
	printf("%c", data[i]);
      }
      printf("\n");
    }
  }
  return 0;
}

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

int main() {
char C;
cin>>C;
     if(C=='a')
cout<<"b"<<endl;
else if(C=='b')
cout<<"c"<<endl;
else if(C=='c')
cout<<"d"<<endl;
else  if(C=='d')
cout<<"e"<<endl;
else  if(C=='e')
cout<<"f"<<endl;
else  if(C=='f')
cout<<"g"<<endl;
else  if(C=='g')
cout<<"h"<<endl;
else  if(C=='h')
cout<<"i"<<endl;
else  if(C=='i')
cout<<"j"<<endl;
else  if(C=='j')
cout<<"k"<<endl;
else  if(C=='k')
cout<<"l"<<endl;
else  if(C=='l')
cout<<"m"<<endl;
else  if(C=='m')
cout<<"n"<<endl;
else  if(C=='n')
cout<<"o"<<endl;
else  if(C=='o')
cout<<"p"<<endl;
else  if(C=='p')
cout<<"q"<<endl;
else  if(C=='q')
cout<<"r"<<endl;
else  if(C=='r')
cout<<"s"<<endl;
else if(C=='s')
cout<<"t"<<endl;
else if(C=='t')
cout<<"u"<<endl;
else if(C=='u')
cout<<"v"<<endl;
else  if(C=='v')
cout<<"w"<<endl;
else if(C=='w')
cout<<"x"<<endl;
else if(C=='x')
cout<<"y"<<endl;
else if(C=='y')
cout<<"z"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<int, int> pii;
int n;
vector<pii> ans;
int main(void) {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int a, b; scanf("%d %d", &a, &b);
		ans.push_back({ b, a });
	}
	sort(ans.begin(), ans.end());
	int time = 0;
	for (pii e : ans) {
		int cost = e.second;
		int dead = e.first;
		time += cost;
		if (dead < time) {
			return !printf("No\n");
		}
	}
	return !printf("Yes\n");
}

Measured memory_bytes: 2548
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i,j,k;
    cin >> n >> k;
    long long cost[n],height[n],t;
    for(i = 0; i < n; i++)
        cost[i] = LONG_LONG_MAX;
    for(i = 0; i < n; i++)
        cin >> height[i];
    cost[0] = 0;
    cost[1] = abs(height[1] - height[0]);
    for(i = 2; i < n; i++)
    {
        for(j = 1; j <= k; j++)
        {
            if((i - j) >= 0)
            {
                t = cost[i - j] + abs(height[i] - height[i - j]);
                cost[i] = min(cost[i],t);
            }
            else
                break;
        }
    }
    cout<<cost[n - 1]<<endl;
}

Measured memory_bytes: 1920
from heapq import heappush, heappop
 
 
class Dijk:
    def __init__(self, n):
        self.table = [[] for i in range(n+1)]
        self.n = n+1
 
    def add(self, x, y, f):
        self.table[x].append((y, f))
 
    def di(self, s):
        inf = float('inf')
        self.val = [inf] * self.n
        self.val[s] = 0
        h = []
        heappush(h, (0, s))
        while h:
            q, i = heappop(h)
            if self.val[i] < q:
                continue
            for x, c in self.table[i]:
                if self.val[x] > self.val[i] + c:
                    self.val[x] = self.val[i] + c
                    heappush(h, (self.val[x], x))
 
    def dist(self, s, t):
        return self.val[t]
 
n, m, s, t = map(int, input().split())
en=Dijk(n)
snu=Dijk(n)
for i in range(m):
    a,b,c,d=map(int,input().split())
    en.add(a,b,c)
    en.add(b,a,c)
    snu.add(a,b,d)
    snu.add(b,a,d)
en.di(s)
snu.di(t)

mod=10**15
t=float('inf')
ans=[]
for i in range(n,0,-1):
    t=min(t,en.dist(s,i)+snu.dist(t,i))
    ans.append(mod-t)
for i in ans[::-1]:
    print(i)


Measured memory_bytes: 80992
#include <bits/stdc++.h>
#define ll long long
#define fast cin.tie(0);cout.tie(0);
#define order ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);
using namespace std;
ll tw=26;
vector<int>v;
int main()
{
    fast order
    ll n,o=1;
    cin>>n;
    while(n>o-1){n-=o;o*=tw;}
    //cout<<o<<" "<<n<<"\n";
    o/=26;
    while(o)
    {
        ll x=n/o;
        cout<<char('a'+x);
        n%=o;
        o/=tw;
    }
}


Measured memory_bytes: 3584
#pragma GCC target("avx2")
#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std; typedef long double ld; typedef long long ll;
typedef unsigned long long ull;
#define endl "\n"
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define ALL(x) (x).begin(), (x).end()
constexpr int INF=1<<30; constexpr ll LINF=1LL<<60; constexpr ll mod=1e9+7; constexpr int NIL = -1;
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
template<class T>inline int popcount(T a) {return __builtin_popcount(a);}
//-------------------
constexpr int MX = 1e5+3;
vector<vector<int>> G(MX);
vector<vector<ll>> dp(MX, vector<ll>(2, -1));
int n;

void dfs(int node, int par) {
    if(dp[node][0]!=-1) return ;
    dp[node][0] = 1;
    dp[node][1] = 1;
    for(auto &e: G[node]) {
        if(e != par) {
            dfs(e, node);
            dp[node][0] *= dp[e][0] + dp[e][1];
            dp[node][0] %= mod;
            dp[node][1] *= dp[e][0];
            dp[node][1] %= mod;
        }
    }
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false); //cout << fixed << setprecision(15);
    cin >> n;
    rep(i,n-1) {
        int x,y; cin >> x >> y; x--; y--;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    dfs(0, -1);
    cout << (dp[0][0] + dp[0][1])%mod << endl;
    return 0;
}


Measured memory_bytes: 19540
#include <bits/stdc++.h>
//↓✟MLE魔、TLE魔✟
#define int long long
//↑✟MLE魔、TLE魔✟
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
int gcd(int a,int b){
    if(a%b==0)return b;
    else return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
signed main(){
    int n,l[200],ans=0;
    cin>>n;
    rep(i,n*2)cin>>l[i];
    sort(l,l+n*2);
    rep(i,n)ans+=l[i*2];
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
    char s1[10],s2[10],s3[10];
    int a,b;
    scanf("%s %s\n",s1,s2);
    scanf("%d %d",&a,&b);
    scanf("%s",s3);
    if(strcmp(s1,s3)==0){
        a--;
        printf("%d %d\n",a,b);
    }
    else if(strcmp(s2,s3)==0){
        b--;
        printf("%d %d\n",a,b);
    }
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>

#define INF 999999999

#define llong long long

#define pb(a) push_back(a)

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

using namespace std;

typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){
  int n=0;
  int l;
  vector<int> L;
  cin >> n;

  for(int i=0;i<2*n;i++){
    cin >>l;
    L.pb(l);;
  }
  VSORT(L);
  int ans = 0;
  for(int i=0;i<2*n;i+=2){
    ans += L[i];
  }

  printf("%d \n",ans);
  return 0;
}

Measured memory_bytes: 888
object Main extends App {
  import scala.io.StdIn._

  val Array(n, k) = readLine.trim.split(' ')
  val numbers = readLine.trim.split(' ').map(_.toLong)
  val bitCount = Array.tabulate(64){_ ⇒ 0}
  for (num ← numbers){
    for (i ← bitCount.indices) {
      if ((num & (1L << i)) != 0){
        bitCount(i) += 1
      }
    }
  }
  println(calMin(asBinaryDigit(k.toLong)))
  def asBinaryDigit(number: Long): List[Int] = {
    (0 until 64).reverse.map(i ⇒ if ((number & (1L << i)) != 0) 1 else 0).toList
  }
  def calMin(constraintDigits: List[Int]): Long = {
    val count = n.toInt
    def nonConstraint(digit: Int, result: Long = 0): Long = {
      digit match {
        case -1 ⇒ result
        case _ ⇒
          if (bitCount(digit) > count - bitCount(digit)) nonConstraint(digit - 1, result * 2 + bitCount(digit))
          else nonConstraint(digit - 1, result * 2 + count - bitCount(digit))
      }
    }
    def constraint(const: List[Boolean], digit: Int, prev: Long = 0): Long = {
      const match {
        case Nil ⇒ prev
        case true::t ⇒ List(constraint(t, digit - 1, prev * 2 + count - bitCount(digit)), nonConstraint(digit - 1, prev * 2 + bitCount(digit))).max
        case false::t ⇒ constraint(t, digit -  1, prev * 2 + bitCount(digit))
      }
    }
    constraint(constraintDigits.map(_ == 1), constraintDigits.length - 1)
  }
}

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

long long N, M;
//           id      ,  distance
vector<pair<long long, long long> >vec[100005];
long long pos[100005];
set<long long> done;

bool dfs(long long curpos){
	if(done.count(curpos) != 0)
		return true;
	done.insert(curpos);
	for(long long i = 0; i < vec[curpos].size(); i++){
		long long nextpos = vec[curpos][i].first;
		long long diff = vec[curpos][i].second;
		if(pos[nextpos] != INT_MAX && pos[nextpos] != pos[curpos] + diff){
			return false;
		}
		pos[nextpos] = pos[curpos] + diff;
		if(dfs(nextpos) == false){
			return false;
		}
	}
	done.insert(curpos);
	return true;
}

int main(){
	cin >> N >> M;
	for(long long i = 0; i < M; i++){
		long long L, R, D;
		cin >> L >> R >> D;
		L--;R--;
		vec[L].push_back(make_pair(R, D));
		vec[R].push_back(make_pair(L, -1*D));
	}

	for(long long i = 0; i < N; i++)
		pos[i] = INT_MAX;


	for(long long i = 0; i < N; i++){
		if(done.count(i) != 0)
			continue;
		pos[i] = 0;
		if(dfs(i) == false){
			cout << "No" << endl;
			return 0;
		}

	}

	cout << "Yes" << endl;
	return 0;
}

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

#define B_MAX 200001

char in_bit[200002];
int org_bit[200001];//先頭が最下位bit

long long int q_list[200001];//10進数
//int divid_list[200001];//q_listの余りから入れていく
int a_list[200001];//q_listの対

int main()
{
	int n, org_b = 0;
    long long int x = 1, x_p_m = 1, x_m_m = 1, x_p_f = 0, x_m_f = 0;


	scanf("%d", &n);
	scanf("%s", in_bit);

	for (int i = 0; i<n; i++)
	{
		if (in_bit[(n - 1) - i] == '0')
		{
			org_bit[i] = 0;
		}
		else {
			org_bit[i] = 1;
			org_b++;
		}

	}

    for (int i = 0; i<n; i++)
    {
        if (org_bit[i] == 1)
        {
            x_p_f += x_p_m;
            x_m_f += x_m_m;

            q_list[i] = -x_m_m;
        } else {
            q_list[i] = +x_p_m;
        }

        x_p_m *= 2;
        if (x_p_m > B_MAX)
         x_p_m = x_p_m % (org_b + 1);

        x_m_m *= 2;
        if (x_m_m > B_MAX)
        {
            if (org_b != 1)
                x_m_m = x_m_m % (org_b - 1);
            else
                x_m_m = 0;
                a_list[i] = 0;
        }

    }

	for (int i = 0; i<n; i++)
	{
		long long int target;
        int answer = 0, tmp_bit;

		tmp_bit = org_b + 1 - 2 * org_bit[i];

        if (tmp_bit == 0)
        {

            target = 0;
        } else {
            if (org_bit[i] == 0)
            {
                target = ((q_list[i] + x_p_f) % (tmp_bit));
            } else {
                target = ((q_list[i] + x_m_f) % (tmp_bit));
            }

		    answer++;
        }

		while (target != 0)
		{
			int tmp_tmp_bit = 0;
            long long int tmp_tmp_target = target;

			for (; tmp_tmp_target > 0;)
			{
				tmp_tmp_bit += (1)&(tmp_tmp_target);
                tmp_tmp_target = tmp_tmp_target >> 1;
			}

			target = target % tmp_tmp_bit;
			answer++;
			tmp_bit = tmp_tmp_bit;
		}

		a_list[i] = answer;

	}


	for (int i = (n - 1); i >= 0; i--)
	{
		printf("%d\n", a_list[i]);
	}


	return 0;
}

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


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int mini = *min_element(a.begin(), a.end()),
        maxi = *max_element(a.begin(), a.end());

    ll ans = 1e18;
    for(int x = mini; x <= maxi; x++){
        ll sum = 0;
        rep(i,n){
            sum += (a[i] - x) * (a[i] - x);
        }
        ans = min(ans, sum);
    }
    cout << ans << endl;
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long

typedef pair<lint, lint> P;
const lint MOD = 1e9+7;
const lint INF = MOD * MOD;

const int MAX = 201;
lint d[MAX][MAX];
int n;
void warshall_floyd(){
    rep(i, n) rep(j, n) rep(k, n){
        d[j][k] = min(d[j][k], d[j][i]+d[i][k]);
    }
}

int main(){
    int m, r; cin >> n >> m >> r;
    vector<int> vr; rep(i, r){ int x; cin >> x; x--; vr.push_back(x);}
    
    rep(i, n)rep(j, n) d[i][j] = INF;
    rep(i, n) d[i][i] = 0;
    rep(i, m){
        int a, b; lint c; cin >> a >> b >> c;
        a--; b--; d[a][b] = c; d[b][a] = c;
    }
    warshall_floyd();

    vector<int> perm; lint ans = INF;
    rep(i, r) perm.push_back(i);
    do{
        lint cost = 0;
        rep(i, r - 1){
            cost += d[vr[perm[i]]][vr[perm[i+1]]];
        }
        ans = min(ans, cost);
    } while(next_permutation(all(perm)));

    cout << ans << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <tuple>
#include <algorithm>
using namespace std;
#define REP(n) for(int i=0;i<n;i++)

int flowers[101] = { 0 };

int main() {
	long long N;
	cin >> N;
	REP(N) {
		cin >> flowers[i];
	}

	int ans = 0;
	int l = 0;
	int r = 0;
	do {
		for (; l < N; l++) {
			if (flowers[l] > 0)
			{
				break;
			}
		}
		for (r = l; r < N; r++) {
			if (flowers[r] == 0) {
				break;
			}
		}
		if (l == N) {
			break;
		}

		int* sub = std::min_element(&flowers[l], &flowers[r - 1]);
		int sub_v = *sub;
		for (int i = l; i < r; i++) {
			flowers[i] -= sub_v;
		}
		ans += sub_v;
	} while ( true);

	cout << ans;

	return 0;
}

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

using namespace std;

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

  vector<int> G;
  set<int> sub;
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    if (a == 1) {
      G.push_back(b);
    }
    if (b == n) {
      sub.insert(a);
    }
  }

  bool ok = false;
  for (int i = 0; i < G.size(); i++) {
    if (sub.find(G[i]) != sub.end()) {
      ok = true;
      break;
    }
  }
  if (ok) {
    cout << "POSSIBLE\n";
  } else {
    cout << "IMPOSSIBLE\n";
  }

  return 0;
}

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

int main() {
    int64_t a,b,x;
    cin >> a >> b >> x;

    int64_t bd = b / x;
    int64_t ad;
    if(a != 0){ad = (a-1) / x;}
    else {ad = -1;}

    cout << bd - ad;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var sx, sy, tx, ty int
	fmt.Scan(&sx, &sy, &tx, &ty)

	var wr = bufio.NewWriter(os.Stdout)
	dx, dy := tx-sx, ty-sy
	for i := 0; i < dy; i++ {
		wr.WriteString("U")
	}
	for i := 0; i < dx; i++ {
		wr.WriteString("R")
	}

	for i := 0; i < dy; i++ {
		wr.WriteString("D")
	}
	for i := 0; i < dx; i++ {
		wr.WriteString("L")
	}

	wr.WriteString("L")
	for i := 0; i < dy+1; i++ {
		wr.WriteString("U")
	}
	for i := 0; i < dx+1; i++ {
		wr.WriteString("R")
	}
	wr.WriteString("D")

	wr.WriteString("R")
	for i := 0; i < dy+1; i++ {
		wr.WriteString("D")
	}
	for i := 0; i < dx+1; i++ {
		wr.WriteString("L")
	}
	wr.WriteString("U")
	wr.WriteString("\n")
	wr.Flush()
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;cin>>a>>b;
  if(a<b){
    for(int i=0;i<b;i++)cout<<a;
    cout<<endl;
  }
  else{
    for(int i=0;i<a;i++)cout<<b;
    cout<<endl;
  }
}


Measured memory_bytes: 256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long X, Y;
    scan(X, Y);
    writeln(X + Y / 2);
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int sum,i,n,a[100000],b[100000],c[100000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d",&a[i],&b[i]);
	}
	sum=0;
	for(i=0;i<n;i++){
		c[i]=0;
		c[i]=b[i]-a[i];
		if(a[i]==b[i]){
			c[i]=1;
		}
		else{
			c[i]=c[i]+1;
		}
		sum=sum+c[i];
	}
	printf("%d\n",sum);
	return 0;
}

Measured memory_bytes: 128
import math

N = int(input())

fact = set()
counter = 0

for i in range(2, int(math.sqrt(N))+1):
    if N % i != 0:
        continue
    powt = 0
    while N % i == 0:
        powt += 1
        N /= i
    fact.add((i, powt))

if N != 1:
    fact.add((N, 1))

for base, e in fact:
    for t in range(1, e+1):
        if t <= e:
            e -= t
            counter += 1
print(counter)


Measured memory_bytes: 9248
#include <iostream>
using namespace std;
int main(){
	string s, t, u;
	cin >> s >> t;
	int a, b;
	cin >> a >> b;
	cin >> u;
	if(u==s)cout << a-1 << ' ' << b << endl;
	else cout << a << ' ' << b-1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
ll n;
cin>>n;
ll a[n]={};
for(ll i=0; i<n; i++){
cin>>a[i];}
sort(a,a+n);
ll counter=a[n/2]-a[n/2-1];
cout<<counter<<endl;}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	
	vector<int> rev(n);
	for (int i = 0; i < n; i++)
		rev[a[i] - 1] = i + 1;
	for (int i = 0; i < n; i++) cout << rev[i] << endl;
	return 0;
}

Measured memory_bytes: 1536
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	scanner.Split(bufio.ScanWords)
	x := nextInt()

LABEL:
	for i := -120; i < 120; i++ {
		for j := -120; j < 120; j++ {
			if int(math.Pow(float64(i), 5))-int(math.Pow(float64(j), 5)) == x {
				fmt.Println(i, j)
				break LABEL
			}
		}
	}
}

func next() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	i, err := strconv.Atoi(next())
	if err != nil {
		fmt.Println(err)
	}
	return i
}


Measured memory_bytes: 1756
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // fixed, setprecision 
#include <math.h> // double sqrt
#define rep(i,n) for(int i=0;i<(n);++i)
#define ll long long
using namespace std;
int main(){
string s;
cin>>s;
if(s=="ABC")cout<<"ARC";
else cout<<"ABC";
return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

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

  set<lint> st[4];
  for(lint i=0; i<N; i++) {
    lint x, y;
    cin >> x >> y;
    st[0].insert(x+y);
    st[1].insert(-(x-y));
    st[2].insert(x-y);
    st[3].insert(-(x+y));
  }

  lint ans = -1e18;
  for(lint i=0; i<4; i++) {
    lint mn = *st[i].begin();
    lint mx = *st[i].rbegin();
    ans = max(ans, mx - mn);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 41112
#include<stdio.h>
#define N 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n, M[N][N];
int color[N], d[N], f[N], tt;

void dfs_visit(int u){
    int v;
    color[u] = GRAY;
    d[u] = ++tt;
    for(v = 0; v < n; v++){
        if(M[u][v] == 0) continue;
        if(color[v] == WHITE){
            dfs_visit(v);
        }
    }
    color[u] = BLACK;
    f[u] = ++tt;
}

void dfs(){
    int u;
    for(u = 0; u < n; u++) color[u] = WHITE;
    tt = 0;
    for(u = 0; u < n; u++){
        if(color[u] == WHITE) dfs_visit(u);
    }
    for(u = 0; u < n; u++){
        printf("%d %d %d\n", u + 1, d[u], f[u]);
    }
}

int main(){
    int u, v, k, i, j;
    
    scanf("%d", &n);
    for(i = 0; i < n; i++){
        for(j = 0; j < n; j++) M[i][j] = 0;
    }
    
    for(i = 0; i < n; i++){
        scanf("%d %d", &u, &k);
        u--;
        for(j = 0; j < k; j++){
            scanf("%d", &v);
            v--;
            M[u][v] = 1;
        }
    }
    
    dfs();
    
    return 0;
}


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

int main(void)
{
  int x,y;

  scanf("%d%d",&x,&y);
  if((x==2)||(y==2)) printf("No\n");
  else if(((x==4)||(x==6)||(x==9)||(x==11))){
    if((y==6)||(y==9)||(y==11)) printf("Yes\n");
    else printf("No\n");
  }
  else {
    if((y==3)||(y==5)||(y==7)||(y==8)||(y==10)||(y==12)) printf("Yes\n");
    else printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> inline void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T> inline T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int h,w,n;cin>>h>>w>>n;
  vector<vector<int>> mn(w,vector<int>(0));
  rep(i,0,n){
    int g,r;cin>>g>>r;
    if(g<r)continue;

    g--;r--;
    mn[r].pb(g);
  }

  rep(i,0,w){
    mn[i].pb(h);
    sort(all(mn[i]));
  }

  ll ans=INF,ue=0,st;
  rep(i,0,w){
    ue=max(ue,i);
    auto itr=lb(all(mn[i]),ue);
    while(ue==*itr && itr!=mn[i].end()){
      ue++;
      itr++;
    }
    st=*ub(all(mn[i]),ue);
    st--;
    if(st<ue)continue;
    chmin(ans,st);
    ue++;
    //cerr<<st<<endl;
  }
  cout<<ans+1<<endl;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 11392
n=int(input())
p=list(map(int,input().split()))

c=0
d=0
for i in range(n):
    if p[i]==i+1:
        continue
    else:
        c=c+1
        if c>=3:
            break
        if d==0:
            d=i+1
            continue
        if d!=0:
            if d!=p[i]:
                c=3
                break

if c<=2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 38256
#include <iostream>

int main() {
  int N, K;
  std::cin >> N >> K;
  int h;
  int num_ok = 0;
  for (int i = 0; i < N; ++i) {
    std::cin >> h;
    if (h >= K) {
      ++num_ok;
    }
  }
  std::cout << num_ok << std::endl;
  return 0;
}

Measured memory_bytes: 256
<?php
$N = intval(trim(fgets(STDIN)));
$A = array_map("intval", explode(" ", trim(fgets(STDIN))));
$B = array_map("intval", explode(" ", trim(fgets(STDIN))));
$dp = array_fill(0, 1<<$N, array_fill(0,51,PHP_INT_MAX));
$dp[0][0] = 0;
for($bit = 0, $NN = (1<<$N); $bit < $NN; ++$bit){
    $con = 0;
    for ($i = 0; $i < $N; ++$i) if ($bit & (1<<$i)) ++$con;
    $ords = [];
    $iter = $con;
    for($i = 0; $i < $N; ++$i)
        if(!($bit & (1<<$i)))
            $ords[$i] = $iter++;
    for($s = 0; $s <= 50; ++$s){
        if($dp[$bit][$s] == PHP_INT_MAX)continue;
        foreach($ords as $p0 => $p1){
            $ns = ($p0-$con) & 1 ? $B[$p0] : $A[$p0];
            if($ns >= $s){
                $dp[$bit | (1<<$p0)][$ns] = min($dp[$bit|(1<<$p0)][$ns], $dp[$bit][$s] + abs($p1 - $con));
            }
        }
    }
}
$min = min($dp[(1<<$N)-1]);
if($min == PHP_INT_MAX){
    echo -1;
}else{
    echo $min;
}


Measured memory_bytes: 682488
s=input()
n=len(s)
# for i,si in enumerate(s[:(n-1//2)//2]):
#     if i+1 <len((n-1//2)//2):
def res():
    fr=(n-1//2)//2
    # for i in s[:fr//2]:
    sf=s[:(n-1)//2]
    for i,sft in enumerate(sf[:len(sf)//2]):
        if sft != sf[len(sf)-1-i]:
            return "No"
    
    sb=s[:(n+3)//2]
    for i,sbt in enumerate(sb[:len(sb)//2]):
        if sbt != sb[len(sf)-1-i]:
            return "No"
    
    for i,st in enumerate(s[:len(s)//2]):
        if st != s[len(s)-1-i]:
            return "No"
    
    return "Yes"

print(res())

Measured memory_bytes: 3064
times = [int(input()) for _ in range(5)]

total_time = 0
while times:
    if len(times) != 1:
        for i in range(len(times)):
            if times[i] % 10 == 0:
                total_time += times[i]
                times.remove(times[i])
                break
        else:
            rem = 0
            re_time = 0
            for time in times:
                if time % 10 > rem:
                    rem = time % 10
                    re_time = time
            total_time += re_time + (10 - rem)
            times.remove(re_time)
    else:
        total_time += times.pop()
        
print(total_time)

Measured memory_bytes: 8972
#include<stdio.h>

int fib(int);

int dp[50];

int main(){
int i,n;

 for ( i = 0; i < 50; i++ ){
   dp[i]=-1;
 }
scanf("%d", &n);

 printf("%d\n",fib(n));

 return 0;
}

int fib(int n){
  if (n==0 || n==1){
     return dp[n]=1;
   } 
   if (dp[n]!=-1){
     return dp[n];
   }
  return dp[n]=fib(n-1)+fib(n-2);
}

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

using namespace std;
char a[555555] ;
int n , q;
set<int> st[27] ;
int main()
{  // freopen("ABC157E.out","w",stdout);

    cin >> n >> a;
    for ( int i = 0; i< n; i++){
        st[a[i]-'a'].insert(i+1) ;
    }
    cin >> q;
    int  l , r , x , y;
    char k ;
    while ( q--){
        cin >> x ;
        if ( x ==1) {
            cin >>y >> k ;
            st[a[y-1]-'a'].erase(y);
            a[y-1] = k ;
            st[k - 'a'].insert(y);
        }
        else{
            int ans = 0;
            cin >> l >> r;
            for ( int i = 0; i<26 ; i++)
            {
                set<int> :: iterator it;
                it = st[i].lower_bound(l);
                if ( it != st[i].end() && *it <= r ) ans++;
            }
        cout<<ans<<"\n";
        }

    }
    return 0;
}


Measured memory_bytes: 24192
mod = 10**9 + 7
N, M = map(int,input().split())
if 1 < abs(N-M):
    print(0)
    exit()
N_ans = 1
M_ans = 1
for i in range(1,N+1):
    N_ans *= i
    N_ans %= mod
for i in range(1,M+1):
    M_ans *= i
    M_ans %= mod
if N == M:
    print((N_ans*M_ans*2)%mod)
else:
    print((N_ans*M_ans)%mod)

Measured memory_bytes: 3064
//2つの整数a,bを読み取り、次の計算を出力する
//a ÷ b: d (整数で)
//a ÷ bの残りr(整数で)
//a ÷ b: f (実数で)

#include <stdio.h>

#define INPUT_MAX 1000000000
#define INPUT_MIN 1

int main(void){

    int a = 0, b = 0;
    int d = 0, r = 0;   //整数用
    double f = 0;      //実数用

    scanf("%d %d",&a,&b);

    if(a < INPUT_MIN || a > INPUT_MAX || b < INPUT_MIN || b > INPUT_MAX)
    {
        //エラーメッセージを表示して終了する
        printf("Invalid Input\n");
        return 0;
    }

    d = a / b;
    r = a % b;
    f = (double)a/b;

    printf("%d %d %lf\n",d,r,f);

    return 0;
} 


Measured memory_bytes: 2064