akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int juli(int x,int y)
{
	if(x>y)
	return (x-y);
	else
	return (y-x);
}
int main()
{
	int a[5];
	int k;
	scanf("%d %d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4],&k);
	int i,j,l=1;
	for(i=0;i<5;i++)
		for(j=0;j<5;j++)
			if(juli(a[i],a[j])>k)
			{l=0;goto loo;}
	loo:
	if(l)
		printf("Yay!\n");
	else
		printf(":(\n");
	return 0;
}

Measured memory_bytes: 128
def main():
    n, k = map(int, input().split())

    if k % 2 == 1:
        print((n // k) ** 3)
        return

    k2 = k // 2
    even = n // k
    odd = (n - k2) // k + 1 if n >= k2 else 0
    print(even ** 3 + odd ** 3)


main()


Measured memory_bytes: 3064
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
item = []
for key,value in c.items():
    item.append([key,value])
cnt = 0
for i in range(len(item)):
    if item[i][0] == item[i][1]:
        continue
    elif item[i][0] < item[i][1]:
        cnt += item[i][1] - item[i][0]
    else:
        cnt += item[i][1]
print(cnt)

Measured memory_bytes: 23664
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int r;
  cin >> r;
  const double PI = acos(-1);
  double ans = PI*r*2;
  printf("%.10f\n",ans);
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int num2 = 0, num4 = 0;
    rep(i,n){
        if (a[i] % 4 == 0) num4++;
        else if (a[i] % 2 == 0) num2++;
    }

    if (num4*2+1 >= n){
        cout << "Yes" << endl;
    }else if(num4*2 >= n-num2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

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

	string ans(n,'a');
	for(int i=0; i<m; ++i){
		int s; 
		char c;
		cin >> s >> c;
		--s;

		if((n!=1 && s==0 && c=='0') || (ans[s]!='a' && ans[s]!=c)){
			ans="-1";
			goto OUT;
		}
		ans[s]=c;
	}
	if(ans[0]=='a'){
		if(n==1) ans="0";
		else ans[0]='1';
	}

	for(int i=1; i<n; ++i){
		if(ans[i]=='a') ans[i]='0';
	}

OUT:	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long int ll;

ll *dp;
ll *a;
/*
ll solution(int s)
{

    if (dp[s] != 0)
    {
        return dp[s];
    }

    dp[s] += min(solution(s+1), (solution(s+2)));
    return dp[s];
}
*/
int main()
{
    int n;// a1=0,b1=0,c1=0;
    cin >> n;
     ll a[n], b[n], c[n];
     ll dp[n + 1];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i]>>c[i];
        //dp[i] = INT_MIN;
        //a[i] = t;
    }
    dp[0] = 0;
    for(int i=1;i<n;i++){
        a[i]+= max(b[i-1],c[i-1]);
        b[i]+= max(a[i-1],c[i-1]);
        c[i]+= max(a[i-1],b[i-1]);
    }
    cout<<max(a[n-1], max(b[n-1],c[n-1]))<<endl;

    return 0;
}


Measured memory_bytes: 5848
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = int64_t;
using pii = pair<int, int>;
using pll = pair<int64_t, int64_t>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}

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

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

  int64 m, n; cin >> m >> n;
  cout << mod_pow(m, n) << '\n';

  return 0;
}


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

#define IOS             ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define watch(x);       cout << "\n" <<  #x << " is: " << x << "\n";
#define ll              long long int
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define pb              push_back
#define nl              cout<<"\n"
#define gcd(a,b)        __gcd(a,b)
#define sq(a)           (a)*(a)
#define loop(i,a,b)     for (int i = a; i <= b; i++)
#define rloop(i,a,b)    for (int i = a; i >= b; i--)
#define sz(a)           a.size()
#define mod             1000000007
#define PI              2*acos(0.0)


int main()
{
    IOS
    int T=1;
    //cin>>T;
    while(T--)
    {
        int a,b,c,k;
        cin>>a>>b>>c>>k;
        while(b<=a)
        {
            b*=2;
            k--;
        }
        while(c<=b)
        {
            c*=2;
            k--;
        }
        if(k>=0) cout<<"Yes";
        else cout<<"No";
        nl;

    }
    return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int count = 0; //約数の数
		int count2 = 0;

		for(int i=1 ; i<=n ; i++) {
			for(int j=1 ; j<=i ; j++) {
				if(i % 2 == 1 && i % j == 0) {
					count ++;
				}
			}
			if(count == 8) {
				count2++;
			}
			count = 0;
		}

		System.out.println(count2);


		sc.close();

	}

}


Measured memory_bytes: 35788
import sys

input = sys.stdin.readline

n = int(input())
graph = [[] for i in range(n + 1)]
for i in range(n - 1):
    u, v, w = map(int, input().split())
    graph[u].append((v, w))
    graph[v].append((u, w))


def dfs(a):
    dist = [-1] * (n + 1)
    stack = [a]
    dist[a] = 0
    while stack:
        v = stack.pop()
        for b, w in graph[v]:
            if dist[b] == -1:
                dist[b] = (dist[v] + w) % 2
                stack.append(b)
            else:
                continue
    return dist


dist = dfs(1)
print(*dist[1:], sep="\n")


Measured memory_bytes: 40352
#include<algorithm>
#include<functional>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
#include<climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

typedef unsigned long long UInt64;
typedef long long Int64;

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

using namespace std;

typedef pair<int ,int > P;

void solve(int n)
{
	rep(i,n)
	{
		int a,b,c;
		cin>>a>>b>>c;

		string res="";

		if(a==100||b==100||c==100) res="A";
		else if(90 <= (a+b)/2) res="A";
		else if(80 <= (a+b+c)/3) res="A";
		else if(70 <= (a+b+c)/3) res="B";
		else if(50 <= (a+b+c)/3 &&(80<=a || 80<=b)) res="B";
		else res="C";

		cout<<res<<endl;

	}

}

int main()
{
	int n;
	while(cin>>n)
	{
		if(n==0) return 0;
		solve(n);

	}
		return 0;
}

Measured memory_bytes: 1196
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int a,x;
	cin >> x >> a;
	cout << ((x>=a)*10) << endl;
	return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
            #pragma comment(linker, "/stack:200000000")
            #pragma GCC optimize("unroll-loops")
             
            #include <algorithm>
            #include <bitset>
            #include <cassert>
            #include <chrono>
            #include <cmath>
            #include <complex>
            #include <cstdio>
            #include <cstdlib>
            #include <cstring>
            #include <ctime>
            #include <deque>
            #include <functional>
            #include <iomanip>
            #include <iostream>
            #include <iterator>
            #include <limits>
            #include <climits>
            #include <list>
            #include <map>
            #include <numeric>
            #include <queue>
            #include <random>
            #include <ratio>
            #include <set>
            #include <sstream>
            #include <stack>
            #include <string>
            #include <unordered_map>
            #include <unordered_set>
            #include <utility>
            #include <vector>
            using namespace std;
             
            typedef long long ll;
            typedef long double LD;
            #define int ll
            #define double LD
            #define pb push_back
            #define mp make_pair
            #define REP(i,n) for (int i = 0; i < n; i++)
            #define loop(i,n) for (int i = 0; i < n; i++)
            #define FOR(i,a,b) for (int i = a; i < b; i++)
            #define REPD(i,n) for (int i = n-1; i >= 0; i--)
            #define FORD(i,a,b) for (int i = a; i >= b; i--)
            #define remax(a,b) a = max(a,b)
            #define remin(a,b) a = min(a,b)
            #define mem(a, b) memset(a, b, sizeof a)
            #define append push_back
            #define all(v) v.begin(),v.end()
            #define F first
            #define S second
            #define print(x) cout << (x) << endl
            #define PRECISION(x) cout << fixed << setprecision(x)
            #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
            #define N 505
            #define pb push_back
            const double PI=acos(-1);
            const int MOD = 1000000007;
            const int FMOD = 998244353;
            const double eps = 1e-9;
             
            mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
            
         
           signed main()
           {
           		double r;
           		cin>>r;
           		double ans=2*3.14*r;
           		cout<<fixed<<setprecision(6)<<ans;
		   }

Measured memory_bytes: 3788
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(M)]

class Union_Find():
    def __init__(self, n):
        """
        要素数n
        """
        self.n = n
        self.par = [-1] * n

    def find(self, x):
        """
        要素xが属するグループの根を返す
        return int
        """
        if self.par[x] < 0:
            return x

        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        要素xが属するグループと要素yが属するグループを併合する
        return null
        """
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.par[x] > self.par[y]:
            x, y = y, x

        self.par[x] += self.par[y]
        self.par[y] = x

    def size(self, x):
        """
        要素xが属するグループの要素数を取得する
        return int
        """
        return - self.par[self.find(x)]
        
    def same(self, x, y):
        """
        要素xと要素yが同じグループに属するかどうかを返す
        return bool
        """
        return self.find(x) == self.find(y)

    def members(self, x):
        """
        要素xが属するグループに属する要素を返す
        return array
        """
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        """
        すべての根の要素を返す
        return array
        """
        return [i for i, x in enumerate(self.par) if x < 0]

    def group_count(self):
        """
        グループ数を返す
        return int
        """
        return len(self.roots())

    def all_group_members(self):
        """
        全てのグループに対してそれぞれ属する要素を返す
        return dict[array]
        """
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

UF = Union_Find(N)

for a, b in AB:
    UF.union(a-1, b-1)

ans = 0

for i in UF.roots():
    ans = max(ans, UF.size(i))

print(ans)

Measured memory_bytes: 50184
// Marcin Knapik
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

//#include <ext/pb_ds/assoc_container.hpp>
// Including tree_order_statistics_node_update
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
 
typedef long double             ld;
typedef long long               ll;
typedef unsigned long long      ull;
typedef pair<ll, ll>            pll;
typedef pair<int, int>          ii;
typedef vector<int>             vi;
typedef vector<ii>              vii;
typedef vector<vi>              vvi;
typedef vector<vector<ii>>      vvii;
typedef vector< ll >            vll;
typedef vector< pll >           vpll;
 
#define boost                   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(a)                   (int)(a).size()
#define pb                      push_back
#define all(c)                  (c).begin(), (c).end()
#define rall(c)                 (c).rbegin(), (c).rend()
#define REP(i, a, b)            for (int i = (a); i <= (b); i++)
#define FOR(i, a)               for (int i = 0; i < (a); i++)
#define TRAV(i, n)              for(auto&i:n)
#define beg(x)                  (*(x.begin()))
#define re(x)                   int x; cin >>x;   
#define f                       first
#define s                       second
 
template <class T> inline bool setmin(T &a, T b){if (a > b)return a = b, 1;return 0;}
template <class T> inline bool setmax(T &a, T b){if (a < b)return a = b, 1;return 0;}
 
template<class T> inline T fast(T a,T b,T mod) {ll res = 1; while(b){if(b&1) res = (res*a)%mod;a = (a*a)%mod;b >>= 1;}return res;}
template<class T> inline T russian(T a, T b, T mod) {ll res = 0; while(b){if(b&1) res = (res + a)%mod; a = (a+a)%mod; b>>=1;}return res;}
template <class T> istream &operator>>(istream &os, vector<T> &container){for (auto &u : container)os >> u;return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &container){for (auto &u : container)os << u << " ";return os;}
template<typename T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; }
 
const ll INF = 1e9 + 7;
const ll mod = 998244353;
const ll BIG_INF = 1e18 + 7;
const ll N = 1e6+7;
const int LOG = 17;

ll n, m, k, q;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll a, b;
	cin >> n >> a >> b;

	ll diff = b-a;
	
	if(diff%2 == 0){
		cout << diff/2 << '\n';
		exit(0);
	}

	ll dol = a-1;
	ll gora = n-b;

	// cout << dol << ' ' << gora << endl;
	ll A = dol + 1 + (b - dol - 2)/2; 
	ll B = gora + 1 + (n - (a + gora + 1))/2;

	// cout << A << ' ' << B << endl;
	cout << min(A, B) << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647

int main() {
  kyun;
  int a,b,c;
  cin >> a >> b >> c;
  if(a < c && c < b) cout << "Yes";
  else if(b < c && c < a) cout << "Yes";
  else cout << "No";
  hinata;
}

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

int main(){
  long long a,b,k;
  cin >> a >> b >> k;
    if(a>k){
      cout << a-k << " " << b;
    }else if(b>k-a){
      cout << 0 << " " << b-k+a;
    }else{
      cout << 0 << " " << 0;
    }
}

Measured memory_bytes: 256
def cand(amari, a, count):
    #print("first", amari, a, count)
    if len(a)!=0:
        ma=min(a)
        a.remove(ma)
    else:
        print(count)
        exit()
    if amari>=ma:
        amari-=ma
        count+=1
        if len(a)==0 and amari!=0:
            count-=1
        #print("111", amari, ma, a, count)
        cand(amari, a, count)
    else:
        cand(amari, a, count)




[n, x]=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
count=0
cand(x, a, count)


Measured memory_bytes: 3064
#include <cstdlib>
#include <iostream>
#include <limits>
#include <sstream>
#include <vector>
using namespace std;

int main()
{
    int N;
    cin >> N;
    auto prices = vector<int>(4);
    auto cups = vector<int>(4);

    cin >> prices[0] >> prices[1] >> prices[2] >> prices[3];
    cin >> cups[0] >> cups[1] >> cups[2] >> cups[3];

    // cout << N << endl;
    // cout << prices[0] << prices[1] << prices[2] << prices[3] << endl;
    // cout << cups[0] << cups[1] << cups[2] << cups[3] << endl;

    int cost = numeric_limits<int>::max();

    int ans0 = 0;
    int ans1 = 0;
    int ans2 = 0;
    int ans3 = 0;

    for (int na = 0; na <= N / cups[0] + 1; na++)
    {
        for (int nb = 0; nb <= N / cups[1] + 1; nb++)
        {
            for (int nc = 0; nc <= N / cups[2] + 1; nc++)
            {
                int nd = (N - (na * cups[0] + nb * cups[1] + nc * cups[2]) + cups[3] - 1) / cups[3];
                if (nd < 0) nd = 0;
                int temp = na * prices[0] + nb * prices[1] + nc * prices[2] + nd * prices[3];
                if (cost > temp)
                {
                    cost = temp;
                    ans0 = na;
                    ans1 = nb;
                    ans2 = nc;
                    ans3 = nd;
                }
            }
        }
    }

    cout << cost << endl;

    return 0;
}



Measured memory_bytes: 3104
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

string s;
int K;

int main(){
    cin>>s>>K;

    int size=s.size();
    rep(i,size){
        int x=('z'-s[i]+1)%26;
        if(x<=K){
            s[i]='a';
            K-=x;
        }
    }
    K%=26;
    s[size-1]+=K;
    if(s[size-1]>'z') s[size]-=26;

    cout<<s<<endl;
}

Measured memory_bytes: 512
def main():
    K = int(input())
    Kstr = str(K)
    
    if Kstr[-1] in ('0','2','4','6','8','5'):
        print(-1)
    else:
        if K%7 == 0:
            L = (9*K)/7
        else:
            L = 9*K
        S = 10
        for i in range(1,100000000000):
            S = S%L
            if S == 1:
                print(i)
                break
            S = S*10
    
if __name__ == '__main__':
    main()
    
#def test():
#    K = int(input())
#    S = 7
#    
#    for K in range(1,200):
#        S = 7
#        for i in range(1,200):
#            if S % K == 0:
#                print(str(K)+' '+str(i))
#                break
#            S = S*10 + 7

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long int n,d;
  cin >> n >> d;
  long long int counter = 0;
  for(int i=0;i<n;i++){
      long long int a,b;
      cin >> a >> b;
      long long int t = a*a + b*b;
      if(d*d >= t){
          counter++;
      }
  }
  cout << counter;
}

Measured memory_bytes: 3632
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right #func(リスト,値)
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def perm(n,mod=None):
    ans = 1
    for i in range(1,n+1):
        ans *= i
        if mod!=None:
            ans %= mod
    return ans
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]

N,M = mint()
A = set()
for _ in range(M):
    A.add(intput())
dp = [1]+[0]*N
for i in range(N):
    if i+1 not in A:
        dp[i+1] += dp[i]
    if i+2<=N and i+2 not in A:
        dp[i+2] += dp[i]
print(dp[N]%MOD)

Measured memory_bytes: 515552
package main
 
import (
  "fmt"
  "os"
  "bufio"
  "strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
    sc.Scan()
    i, e := strconv.Atoi(sc.Text())
    if e != nil {
        panic(e)
    }
    return i
}

func main() {
  sc.Split(bufio.ScanWords)
  A := nextInt()
  B := nextInt()
  C := nextInt()
  
  count := 0
  if A != B {
    count++
  }
  if A != C {
    count++
  }
  if B != C {
    count++
  }
  
  if count == 2 {
    fmt.Println("Yes")
  } else {
    fmt.Println("No")
  }
}

Measured memory_bytes: 640
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Queue;

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

        int[] wait = new int[n+1];
        wait[n] = n;

        Queue<Integer>[] deq = new Queue[n];

        for (int i=0; i<n; i++){
            deq[i] = new ArrayDeque<>();
            wait[i] = sc.nextInt()-1;
            for (int j=0; j<n-2; j++){
                deq[i].add(sc.nextInt()-1);
            }
        }

        int[] lastMatch = new int[n];

        int memo = n;

        while (memo>0){
            boolean updated = false;
            for (int i=0; i<n; i++){
                if (wait[wait[i]]==i){
                    lastMatch[i] = lastMatch[wait[i]] = Math.max(lastMatch[i], lastMatch[wait[i]])+1;
                    updated = true;

                    if (!deq[wait[i]].isEmpty()){
                        wait[wait[i]] = deq[wait[i]].poll();
                    }else{
                        wait[wait[i]] = n;
                        memo--;
                    }

                    if (!deq[i].isEmpty()){
                        wait[i] = deq[i].poll();
                    }else{
                        wait[i] = n;
                        memo--;
                    }
                }
            }
            if (!updated){
                System.out.println(-1);
                return;
            }
        }
        Arrays.stream(lastMatch).max().ifPresent(System.out::println);
    }
}

Measured memory_bytes: 261916
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i =(b)-1;i>=(a);--i)
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
typedef vector<int> vi;
const int mod = 1e9 + 7;
const int maxn = 2e6 + 10;
set<ll> st;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	rep(i,0,n){
		string s;
		cin >> s;
		ll ans = 0;
		for(auto it:s){
			ans *= 26;
			ans += it - 'a' + 1;
		}
		st.insert(ans);
	}
	cout << sz(st);
	return 0;
}


Measured memory_bytes: 12952
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << x << endl

using ld = double;
using P = complex<ld>;
using G = vector<P>;
const ld pi = acos(-1);
const ld eps = 1e-10;
const ld inf = 1e12;

ld cross(const P& a, const P& b) { return a.real()*b.imag() - a.imag()*b.real(); }
ld dot(const P& a, const P& b) { return a.real()*b.real() + a.imag()*b.imag(); }

using C = pair<ld, P>;
#define rad first
#define pnt second

C smallest_enclosing_disc(vector<P> ps){
  auto c3 = [](const P &a, const P &b, const P &c){
    ld A = norm(b - c);
    ld B = norm(c - a);
    ld C = norm(a - b);
    ld S = abs(cross(b - a, c - a));
    P p = (A*(B+C-A)*a + B*(C+A-B)*b + C*(A+B-C)*c) / (4*S*S);
    ld r = abs(p - a);
    return make_pair(r, p);
  };

  auto c2 = [](const P &a, const P &b){
    P c = (a + b) / (ld)2;
    ld r = abs(a - c);
    return make_pair(r, c);
  };

  auto in_circle = [](const P &a, const C &c){
    return norm(a - c.pnt) <= c.rad*c.rad + eps;
  };

  int n = ps.size();
  random_shuffle(ps.begin(), ps.end());
  C c = c2(ps[0], ps[1]);
  for(int i = 2; i < n; ++i){
    if(!in_circle(ps[i], c)){
      c = c2(ps[0], ps[i]);
      for(int j = 1; j < i; ++j){
        if(!in_circle(ps[j], c)){
          c = c2(ps[j], ps[i]);
          for(int k = 0; k < j; ++k){
            if(!in_circle(ps[k], c)){
              c = c3(ps[i], ps[j], ps[k]);
            }
          }
        }
      }
    }
  }
  return c;
}

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

  G g(n);
  rep(i, n){
    ld x, y;
    cin >> x >> y;
    g[i] = P(x, y);
  }

  double r = smallest_enclosing_disc(g).rad;
  double ans = r;

  printf("%.12f\n", ans);

  return 0;
}

//#include <bits/stdc++.h>
//using namespace std;
//
//#define int long long
//#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
//#define all(x) (x).begin(),(x).end()
//#define sz(x) ((int)x.size())
//template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
//template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}
//
///*
// */
//
//using vi = vector<int>;
//using vvi = vector<vi>;
//using P = pair<int,int>;
//
//signed main() {
//  return 0;
//}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define BT (1<<9)
using namespace std;
typedef pair <int,int> P;

char A[BT];
string ans;
int n;

int popcount(int S)
{
	int cnt=0;
	for(int i=0;i<n;i++) if(S>>i&1) cnt++;
	return cnt;
}
string get(int S)
{
	int cnt=popcount(S);
	if(cnt==2)
	{
		vector <int> v;
		for(int i=0;i<n;i++) if(S>>i&1) v.push_back(i);
		string ret="";
		ret+='0'+v[0];
		ret+='0'+v[1];
		ret+='0'+v[0]+n;
		ret+='0'+v[1]+n;
		return ret;
	}
	for(int i=0;i<n;i++)
	{
		if(S>>i&1)
		{
			string A=get(S-(1<<i));
			string ret="";
			ret+='0'+i;
			ret+=A;
			ret+='0'+i+n;
			for(int j=(int) (A.size())-1;j>=0;j--)
			{
				int y=A[j]-'0';
				if(y>=n) y-=n;
				else y+=n;
				ret+='0'+y;
			}
			return ret;
		}
	}
	return "";
}
void print(string ret)
{
	int x=0;
	vector <P> ans;
	for(int i=0;i<ret.size();i++)
	{
		int y=ret[i]-'0';
		if(y<n)
		{
			while(x<y)
			{
				ans.push_back(P(x,0));
				x++;
			}
			while(x>y)
			{
				ans.push_back(P(x,0));
				x--;
			}
			ans.push_back(P(x,0));
			ans.push_back(P(x,1));
			x++;
			ans.push_back(P(x,1));
		}
		else
		{
			y-=n;
			while(x<=y)
			{
				ans.push_back(P(x,0));
				x++;
			}
			while(x>y+1)
			{
				ans.push_back(P(x,0));
				x--;
			}
			ans.push_back(P(x,0));
			ans.push_back(P(x,1));
			x--;
			ans.push_back(P(x,1));
		}
	}
	while(x>=0)
	{
		ans.push_back(P(x,0));
		x--;
	}
	puts("Possible");
	printf("%d\n",ans.size()-1);
	for(int i=0;i<ans.size();i++) printf("%d %d\n",ans[i].first,ans[i].second);
}
int main()
{
	scanf("%d",&n);
	scanf("%s",&A);
	for(int S=0;S<(1<<n);S++)
	{
		for(int T=0;T<(1<<n);T++)
		{
			if((T|S)==S&&A[S]=='1'&&A[T]=='0')
			{
				puts("Impossible");
				return 0;
			}
		}
	}
	ans="";
	for(int S=0;S<(1<<n);S++)
	{
		if(A[S]=='0')
		{
			bool up=true;
			for(int i=0;i<n;i++)
			{
				if(S>>i&1)
				{
					if(A[S-(1<<i)]=='0')
					{
						up=false;
					}
				}
			}
			if(!up) continue;
			if(popcount(S)>=2) ans+=get(S);
			else
			{
				int x;
				for(int i=0;i<n;i++) if(S>>i&1) x=i;
				ans+='0'+x;
			}
			//printf("%d %s\n",S,get(S).c_str());
		}
	}
	//printf("%s\n",ans.c_str());
	print(ans);
	return 0;
}

Measured memory_bytes: 512
N = int(input())
S = input()
original_index = [ord(c) for c in S]
def trans(index, N):
    if index + N < (65 + 26):
        return chr(index + N)
    else:
        return chr(index + N - 26)

transformed = [trans(ind, N) for ind in original_index]
print("".join(transformed)) 


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

using namespace std;

long long int v[45], w[45];

int main()
{
    int N;
    long long int W;
    cin >> N >> W;
    for(int i = 0; i < N; ++i){
        cin >> v[i] >> w[i];
    }
    map<long long int, long long int> m1, m2;
    int half = N / 2;
    for(int i = 0; i < (1 << half); ++i){
        long long int nv = 0, nw = 0;
        int now = i;
        for(int j = 0; now; j++){
            if(now % 2){
                nv += v[j];
                nw += w[j];
            }
            now /= 2;
        }
        if(nw > W) continue;
        m1[nw] = max(m1[nw], nv);
    }
    for(int i = 0; i < (1 << (N - half)); ++i){
        long long int nv = 0, nw = 0;
        int now = i;
        for(int j = half; now; j++){
            if(now % 2){
                nv += v[j];
                nw += w[j];
            }
            now /= 2;
        }
        if(nw > W) continue;
        m2[nw] = max(m2[nw], nv);
    }
    long long int mx;
    mx = 0;
    for(auto& p : m1){
        mx = max(mx, p.second);
        p.second = mx;
    }
    mx = 0;
    for(auto& p : m2){
        mx = max(mx, p.second);
        p.second = mx;
    }
    long long int ans = 0;
    for(auto& p : m1){
        if(p.first <= W){
            auto it = m2.upper_bound(W - p.first);
            it = prev(it);
            if(m2.find(W - p.first) != m2.end()){
                it = m2.find(W - p.first);
            }
            //cout << W - p.first << " " << it->first << endl;
            ans = max(ans, p.second + it->second);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 134164
// I'm a f*cking looser
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fasino ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
#define input(A) for(auto &i:A) cin>>i;
signed main()
{
    fasino
    ll n; string a;
    cin>>n;
    map<string, ll> mp;
    mp["AC"] = 0;
    mp["WA"] = 0;
    mp["TLE"] = 0;
    mp["RE"] = 0;
    while(n--){
        cin>>a;
        mp[a]++;
    }
    cout<<"AC x "<<mp["AC"]<<'\n';
    cout<<"WA x "<<mp["WA"]<<'\n';
    cout<<"TLE x "<<mp["TLE"]<<'\n';
    cout<<"RE x "<<mp["RE"]<<'\n';
    return 0;
}

Measured memory_bytes: 3664
N,M= map(int, input().split())
L,R= map(int, input().split())
flag = True
for i in range(M-1):
    a,b= map(int, input().split())
    if a >= L and b <= R:
        L = a
        R = b
    elif L <= b and R >= b:
        R = b
    elif L <= a and R >= a:
        L = a
    elif a < L and R < b:
        L = L
    else:
        flag = False
        break
if flag:
 print(R-L+1)
else:
    print(0)

Measured memory_bytes: 9152
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n = ri()
if n % 2 == 1:
    print(0)
    exit()

res = 0
x = 10
while x <= n:
    res += n // x
    x *= 5
print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
long long INF = INT64_MAX;
int idir[4] = {1, 0, -1, 0};
int jdir[4] = {0, 1, 0, -1};
typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    vector<vector<pair<ll, ll>>> d(N);
    vector<vector<ll>> dir(N);

    rep(i, N - 1)
    {
        ll a, b, c;
        cin >> a >> b >> c;
        d[a - 1].push_back(make_pair(b - 1, c));
        d[b - 1].push_back(make_pair(a - 1, c));
    }
    ll Q, K;
    cin >> Q >> K;
    vector<ll> dist(N, INF);
    queue<ll> que;
    auto update = [&](ll i, ll x) { //点(i,j)のコスト更新+queへの代入
        if (dist[i] != INF)
            return;
        dist[i] = x;
        que.push(i);
    };
    update(K - 1, 0); //初期値
    while (!que.empty())
    {
        ll i = que.front();
        que.pop();
        rep(j, d[i].size())
        {
            ll next = d[i][j].first;
            ll cost = d[i][j].second;
            update(next, dist[i] + cost);
        }
    }

    vector<ll> ans(Q, 0);
    rep(i, Q)
    {
        ll x, y;
        cin >> x >> y;
        ans[i] = dist[x - 1] + dist[y - 1];
    }

    rep(i, Q) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 13184
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll n, x;
	cin >> n >> x;
	vector<ll> p(n);
	rep(i, n) cin >> p[i];
	ll g = 0;
	rep(i, n) g = gcd(g, abs(p[i] - x));
	cout << g << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

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

    vec res;

    int pos = n;

    while (pos > 0) {
        bool update = false;
        for (int mv = m; mv > 0; mv--) {
            if (pos - mv < 0) continue;
            if (s[pos-mv] == '1') continue;

            res.push_back(mv);
            pos -= mv;
            update = true;
            break;
        }

        if (!update) {
            cout << "-1" << endl;
            exit(0);
        }
    }

    reverse(all(res));
    int v = res.size();
    rep(i, v) {
        if (i != 0) cout << " ";
        cout << res[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("badhair.gir","r",stdin);freopen ("badhair.cik","w",stdout);
#define mod 1000000007
#define fs(x,y) for(ll i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(ll i=x;i<=y;i++)
#define INF 1000000000005
#define ull unsigned long long int
using namespace std;

ll n,m,ar[N],sum,t,k;



int main()
{
	fast;
	cin>>n>>m>>k;
	sum=1;
	int l=1;
	fo(i,1,n)
		cin>>ar[i];
	sort(ar+1,ar+n+1);
	fo(i,1,n)
	{
		if(i-l+1>m || ar[i]-ar[l]>k)
			l=i,sum++;
	}
	cout<<sum<<endl;
}



/*     cd onedrive\desktop\kod
cls

Sinav:21-22 aralik
Aciklama: Muhtemelen 25 aralik
*/

Measured memory_bytes: 1024
n = int(input())
li = []
for i in range(n):
  li.append([str(i+1),input().split()])
li = sorted(li,key = lambda x:int(x[1][1]),reverse=True)
li = sorted(li,key = lambda x:x[1][0])
for j in li:
  print(int(j[0]))

Measured memory_bytes: 3060
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}

int main(){
  ll n;
  cin >> n;
  ll a;
  vector<ll> b;
  
  for (int i = 1; i < n+1; i++){
    cin >> a;
    b.push_back(a - i);
  }
  
  sort(b.begin(),b.end());
  
  ll med = b[n/2];
  ll ans = 0;
  rep(i,n){
    ans += abs(b[i] - med);
  }
  cout << ans;
  
  return 0;
}

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

void file(bool opt)
{
	if (opt&&fopen("in.txt", "r"))
	{
		freopen("in.txt", "r", stdin);
		//freopen("out.txt", "w", stdout);
	}
}

const long long mod = 1e9 + 7;
long long dp[2000 + 5][2000+5];
long long a[2000 + 5], b[2000 + 5];
long long check[100000 + 5];
long long check2[100000 + 5];
int main()
{
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)cin >> a[i], dp[i][0] = 1;
	for (int i = 1; i <= m; i++)cin >> b[i], dp[0][i] = 1;
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++)
	{
		check[a[i]]++;
		memset(check2, 0, sizeof check2);
		for (int j = 1; j <= m; j++)
		{
			check2[b[j]]++;
			dp[i][j] = (dp[i][j] + dp[i][j - 1] + dp[i - 1][j]-dp[i-1][j-1]+mod) % mod;
			if (a[i] == b[j])
			{
				dp[i][j] = (dp[i][j] +dp[i-1][j-1]) % mod;
			}
		}
	}
	cout << dp[n][m] << endl;
	return 0;
}


Measured memory_bytes: 32384
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

const double EPS=1e-8;
const double INF=1e10;

struct Point {
    double x, y;
    Point(double x=0, double y=0) : x(x), y(y) {}
    double distance (const Point &o) const {
        return sqrt((x - o.x) * (x - o.x) + (y - o.y) * (y - o.y));
    }

    Point operator+(const Point &o) const {
        return Point(x+o.x, y+o.y);
    }

    Point operator-(const Point &o) const {
        return Point(x-o.x, y-o.y);
    }

    Point operator*(const double m) const {
        return Point(x*m, y*m);
    }

    Point operator/(const double d) const {
        return Point(x/d, y/d);
    }

    bool operator==(const Point &o) const {
        return (x - o.x < EPS && y - o.y < EPS);
    }

    // 外積
    double cross(const Point &o) const {
        return x * o.y - y * o.x;
    }

    // 内積
    double dot(const Point &o) const {
        return x * o.x + y * o.y;
    }

    // ベクトルがx軸となす角
    double atan() const {
        return atan2(y, x);
    }

    // ベクトルの長さの二乗
    double norm() const {
        return dot(*this);
    }

    double abs() const {
        return fabs(x*x+y*y);
    }
};

int main() {
    Point a, b, c, d;
    while (cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y) {
        Point ab(b-a), cd(d-c);
        if (fabs(ab.dot(cd)) < EPS) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }
    return 0;
}

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

int64_t dp[2010][2010];
int main() {
	int n; cin >> n;
	pair<int64_t, int64_t> a[n];
	for(int i = 0; i < n; ++i) {
		cin >> a[i].first;
		a[i].second = i;
	}
	sort(a, a + n);
	reverse(a, a + n);
	for(int i = 0; i < n; ++i) {
		int64_t val, idx;
		tie(val, idx) = a[i];
		for(int j = 0; j <= i; ++j) {
			dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + val * abs(j - idx));
			dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + val * abs((n - 1) - (i - j) - idx));
		}
	}
	int64_t ans = 0;
	for(int j = 0; j <= n; ++j) {
		ans = max(ans, dp[n][j]);
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 26312
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
const ll INF = (ll)1e18 + 1;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int a, b, c; cin >> a >> b >> c;
    
    if(a>=b){
        if(a>=c) cout << a*10+b+c << ln;
        else cout << c*10+a+b << ln;
    }
    else{
        if(b>=c) cout << b*10+a+c << ln;
        else cout << c*10+a+b << ln;
    }
    return 0;
}

Measured memory_bytes: 256
/**
*    created: 15.07.2020 18:18:30
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

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

    string s; cin >> s;
    map<char,int> mp;
    rep(i,s.size()) mp[s[i]]++;
    bool ok = true;
    for (auto p : mp) if (p.second % 2 == 1) ok = false;
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3680
import Foundation

let str = readLine(stripNewline: true)
var no_oper = Int(readLine(stripNewline: true)!)!

let characterString = str!
var numbers: [Int] = Array<Int>()

for (i, character) in characterString.utf8.enumerate() {
    let stringSegment: String = "\(character)"
    let anInt: Int = Int(stringSegment)! % 97
    
    if anInt != 0 {
        if (26 - anInt) <= no_oper {
            numbers.append(0)
            no_oper -= (26 - anInt)
        } else {
            numbers.append(anInt)
        }
    } else {
        numbers.append(anInt)
    }
}

numbers[numbers.count - 1] = (numbers[numbers.count - 1] + no_oper) % 26

var string = ""
for number in numbers {
    let char = Character(UnicodeScalar(number + 97))
    string.append(char)
}

print(string)

Measured memory_bytes: 4344
{-# LANGUAGE OverloadedLists     #-}
{-# LANGUAGE OverloadedStrings   #-}
{-# LANGUAGE ScopedTypeVariables #-}

import           Control.Monad
import           Data.IORef
import           Data.Maybe
import qualified Data.Text     as T
import qualified Data.Text.IO  as T
import           GHC.Base
import           System.IO

import qualified Data.Array    as A
import qualified Data.IntMap   as I
import           Data.List
import qualified Data.Map      as M
import qualified Data.Set      as S
import qualified Data.Vector   as V

-- for Vector
count :: (a -> Bool) -> V.Vector a -> Int
count p = V.length . V.filter p

-- main
main :: IO ()
main = march

march :: IO ()
march = do
  n  :: Int <- readLn
  ss :: V.Vector T.Text <- V.replicateM n T.getLine
  let m = count (\s -> T.head s == 'M') ss
      a = count (\s -> T.head s == 'A') ss
      r = count (\s -> T.head s == 'R') ss
      c = count (\s -> T.head s == 'C') ss
      h = count (\s -> T.head s == 'H') ss
      rc = r + c
      ma = m + a
  print $ m * a * (rc + h) + r * c * (ma + h) + h * rc * ma

Measured memory_bytes: 26108
#include<stdio.h>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 1e6+20;
ll a[maxn],b[maxn],c[maxn];

int main()
{
    ll n;
    scanf("%lld",&n);
    for(int i = 1 ; i <= n ; i ++) scanf("%lld",&a[i]);
    for(int i = 1 ; i <= n ; i ++) scanf("%lld",&b[i]);
    for(int i = 1 ; i <= n ; i ++) scanf("%lld",&c[i]);
    sort(a+1,a+n+1);
    sort(b+1,b+n+1);
    sort(c+1,c+n+1);
    ll ans = 0;
    ll numa = 0,numc = 0;
    for(int i = 1 ; i <= n ; i ++)
    {
        while(a[numa+1] < b[i] && numa+1 <= n) numa ++;
        while(c[numc+1] <= b[i] && numc+1 <= n) numc ++;
        ans += numa*(n-numc);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 9088
#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 ll;

typedef long double ld;
typedef pair<ll,ll> pp;
typedef tree<pp,null_type,less<pp>,rb_tree_tag,tree_order_statistics_node_update> super_set;

#define x1 dfds
#define y1 dsfdsfe
#define pb push_back
#define forn(i,n) for(ll i = 1;i<=n;++i)
#define fi first
#define sc second
#define endl '\n'
#define po(x) (1ll<<x)
#define log sdfdsfdsf

const ll DIM = 1E6+7;
const ll MOD = 1e9+7;

const ll INF = 1E17;
const ld eps = 0.00000000000001;
const ld PI = 3.14159265358979323846;
int getInt(int a = 0, int b = INT_MAX){
    static mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    return uniform_int_distribution <int> (a, b)(rng);
}
ll dp[DIM][4];
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n;
    cin>>n;
    dp[0][0] = 1;
    forn(i,n){
        dp[i][0] = (dp[i-1][0]*8)%MOD;
        dp[i][1] = (dp[i-1][0]+dp[i-1][1]*9)%MOD;
        dp[i][2] = (dp[i-1][0]+dp[i-1][2]*9)%MOD;
        dp[i][3] = (dp[i-1][3]*10+dp[i-1][2]+dp[i-1][1])%MOD;
    }
    cout<<dp[n][3]<<endl;
    return 0;
}


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

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

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

int main()
{
	char a, b;
	cin >> a >> b;
	if (a == 'H' && b == 'H') {
		cout << 'H' << endl;
	}
	else if (a == 'H' && b == 'D') {
		cout << 'D' << endl;
	}
	else if (a == 'D' && b == 'H') {
		cout << 'D' << endl;
	}
	else {
		cout << 'H' << endl;
	}
	return 0;
}

Measured memory_bytes: 256