akhauriyash/Code-Regression huggingface dataset:
using System;
 
class a 
{
 static void Main(string[] args)
 {
 
   string[] input = Console.ReadLine().Split(' ');
   int monsterHP = int.Parse(input[0]);
   int sarvalPower = int.Parse(input[1]);
   int counter = monsterHP / sarvalPower;
   if(monsterHP % sarvalPower != 0) counter++;
   
   Console.WriteLine(counter);
 
 }
}

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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define SPACEREP(lst,itr) for(auto itr=lst.begin(); itr!=lst.end();++itr){cout<<*itr<<(++itr!=anslist.end()?" ":"\n");itr--;}
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

int main(){
    char c1,c2;
    int cnt1=0,cnt2=0;
    string s,ans="Yes";
    cin >> s;
    c1=s[0];
    if(s[1]==c1){
        cnt1++;
    }else{
        c2=s[1];
    }
    if(cnt1==1){
        c2=s[2];
    }
    else if(s[2]==c1){
        cnt1++;
    }else if(s[2]==c2){
        cnt2++;
    }else {
        ans="No";
    }

    if(s[3]==c1){
        cnt1++;
    }else if(s[3]==c2){
        cnt2++;
    }else{
        ans="No";
    }

    if(!(cnt1==1 && cnt2==1))ans="No";
    p(ans);

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;

int main(){
int n;
cin>>n;
if(n%2==0){
  cout<<n/2<<endl;
}else{
  cout<<n/2+1<<endl;
}
}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main{
  public static long m_pow(long a, long n) {
    long ans = 1;
    while(n >= 1) {
      if((n & 1) == 1) {
        ans = ans * a;
      }
      a = a * a;
      n >>= 1;
    }
    return ans;
  }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long H = sc.nextLong();
   	double cmp = Math.log(H) / Math.log(2);
    int count = (int) cmp;
    System.out.println(m_pow(2, count + 1) - 1);
  }
}

Measured memory_bytes: 23892
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

vector<int> solve(ll K, ll N) {
  if (K == 1) {
    return vector<int>((N + 1) / 2, 1);
  }
  if (K % 2 == 0) {
    vector<int> res(N);
    REP(i,N) res[i] = K;
    res[0] = K / 2;
    return res;
  }
  vector<int> res(N);
  REP(i,N) res[i] = (K + 1) / 2;
  REP(loop,N/2) {
    for (int i = N - 1; i >= 0; --i) {
      if (res[i] == 0) continue;
      if (res[i] == 1) { res[i] = 0; break; }
      res[i] = res[i] - 1;
      for (int j = i + 1; j < N; ++j) res[j] = K;
      break;
    }
  }
  while (res.back() == 0) res.pop_back();
  return res;
}

vector<vector<int>> all(ll K, ll N) {
  vector<vector<int>> res;
  REP(i,K) res.push_back(vector<int>(1, i + 1));
  if (N == 1) return res;
  auto vec = all(K, N - 1);
  REP(i,K) {
    auto vec2 = vec;
    for (auto &v: vec2) {
      v.push_back(i + 1);
      res.push_back(v);
    }
  }
  return res;
}

vector<int> solve2(ll K, ll N) {
  auto vec = all(K, N);
  sort(ALL(vec));
  // for (auto &v: vec) {
  //   for (int i: v) cout << i << " ";
  //   cout << endl;
  // }
  const int m = vec.size();
  return vec[(m + 1) / 2 - 1];
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll K;
	ll N;
  // REP(K_,5) REP(N_,10) {
  //   K = K_ + 1; N = N_ + 1;
  //   // if (K % 2 == 0) continue;
  //   cout << K << " " << N << endl;
  //   vector<int> res = solve(K, N);
  //   for (int i: res) cout << i << " ";
  //   cout << endl;
  //   vector<int> res2 = solve2(K, N);
  //   for (int i: res2) cout << i << " ";
  //   cout << endl;
  //   assert (res == res2);
  //   cout << "ok" << endl;
  // }
	scanf("%lld", &K);
	scanf("%lld", &N);
  vector<int> res = solve(K, N);
  const int n = res.size();
  REP(i,n) cout << res[i] << " \n"[i == n - 1];
	return 0;
}


Measured memory_bytes: 3456
#include <stdio.h>

int main()
{
  int n,m;
  scanf("%d%d",&n,&m);
  int a[m];
  int i;
  i = 0;
  int sum;
  sum = 0;
  while (i < m)
  {
    scanf("%d",&a[i]);
    sum += a[i];
    i++;
  }
  if (sum <= n)
    printf("%d",n-sum);
  else
    printf("%d",-1);
  
}

Measured memory_bytes: 1760
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;
 
int a[20001];
int main(){
    int n;
    cin>>n;
    int cnt=0;
    FOR(i,2,30000){
        if(i%2==0||i%3==0) a[cnt]=i,++cnt;
        if(cnt==n-1) break;
    }
    int sum=0;
    rep(i,n-1) sum+=a[i];
    int sub;
    for(int i=30000;i>=3;--i)if((sum+i)%6==0&&__gcd(sum,i)!=1){
        sub=i;break;
    }
    a[n-1]=sub;++cnt;
    rep(i,n) cout<<a[i]<<" ";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
const double PI = 3.1415926535897932;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

ll md = (ll)1e9 + 7;

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

	int ans = -1;
	if (1 <= A && A <= 9 && 1 <= B && B <= 9) {
		ans = A * B;
	}

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


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#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 INF 2e9
#define IMAX 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long llong;

int main()
{
	string S, T;
	cin >> S >> T;

	int sLen = S.size();
	int cnt = 0;

	REP(idx, sLen) {
		if (S[idx] == T[idx]) {
			++cnt;
		}
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            if (s.Length > n) s = s[0..n] + "...";
            Console.WriteLine(s);
        }
    }
}

Measured memory_bytes: 27496
#include <stdio.h>
 
struct Node { int o, p, q;};
struct Node x[10000];
int n;
void pre( int u) {
    if ( u == -1) {
        return ;
    }
    printf(" %d", u);
    pre( x[u].p);
    pre( x[u].q);
     
}
 
void in( int u) {
    if ( u == -1) {
        return ;
    }
    in( x[u].p);
    printf(" %d", u);
    in( x[u].q);
     
}
 
void post( int u) {
 
    if ( u == -1){
        return ;
    }
    post( x[u].p);
    post( x[u].q);
    printf(" %d", u);
     
}
 
int main() {
    int i, v, p, q, way;
     
    scanf("%d", &n);
    for ( i = 0; i < n; i++) {
        x[i].o = -1;
    }
     
    for ( i = 0; i < n; i++) {
        scanf("%d %d %d", &v, &p, &q);
        x[v].p = p;
        x[v].q = q;
        if ( p != -1) {
            x[p].o = v;
        }
        if ( q != -1) {
            x[q].o = v;
        }
    }
     
    for ( i = 0; i < n; i++) {
        if ( x[i].o == -1) {
            way = i;
        }
    }
    printf("Preorder\n");
    pre(way);
    printf("\n");
    printf("Inorder\n");
    in(way);
    printf("\n");
    printf("Postorder\n");
    post(way);
    printf("\n");
     
    return 0;
}

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

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    sort(A.begin(), A.end());
    ll sum = 0;
    ll ans = N;
    for (int i = 0; i < N-1; i++) {
        sum += A[i];
        if (sum*2 < A[i+1]) ans = N-1-i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

	int N;
	cin >> N;
	cout << N / 3;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  unordered_set<int> s;
  unordered_map<int, int> m;
  for (int &x : a) {
    scanf("%d", &x);
    m[x]++;
    if (x <= 1000) {
      s.insert(x);
    }
  }
  int ans = 0;
  for (int x : a) {
    if (m[x] > 1) continue;
    bool ok = true;
    for (int y : s) {
      if (x != y && x % y == 0) {
        ok = false;
        break;
      }
    }
    for (int i = 2; i <= 1000 && i <= x; ++i) {
      if (x % i == 0 && m.count(x / i)) {
        ok = false;
        break;
      }
    }
    ans += ok;
  }
  printf("%d\n", ans);
  return 0;
}



Measured memory_bytes: 12168
n = int(input())
a = list(map(int,input().split()))
b = [0]*(max(a)+2)

for i in range(n):
  b[a[i]] += 1
  b[a[i]+1] += 1
  if a[i] > 0:
    b[a[i]-1] += 1

print(max(b))



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

typedef pair<int,int> P;

int sum(vector<int> v){
	int s=0;
	for(int i=0 ; i < v.size(); i++ ){
		s += v[i];
	}
	return s;
}

int main(){
	int n,m;
	while( cin >> n >> m, n || m ){
		vector<int> a(n);
		vector<int> b(m);
		for(int i=0 ; i < n ; i++ ){
			cin >> a[i];
		}
		for(int i=0 ; i < m ; i++ ){
			cin >> b[i];
		}
		vector<P> ans;
		for(int i=0 ; i < n ; i++ ){
			for(int j=0 ; j < m ; j++ ){
				swap( a[i] , b[j] );
				if( sum(a) == sum(b) ){
					ans.push_back( P(a[i],b[j]) );
				}
				swap( a[i] , b[j] );
			}
		}
		if( ans.size() == 0 ){
			cout << -1 << endl;
		}else{
			int mi = 10000;
			for(int i=0 ; i < ans.size(); i++ ){
				mi = min( mi , ans[i].first + ans[i].second );
			}
			for(int i=0 ; i < ans.size(); i++ ){
				if( mi == ans[i].first + ans[i].second ){
					cout << ans[i].second << " " << ans[i].first << endl;
					break;
				}
			}
		}
	}
}

Measured memory_bytes: 0
MOD = 1000000007

def m():
    N = int(input())
    if N == 1:
        return 3
    s = str(input())
    s2 = str(input())
    a = []
    past = s[0]
    point = 0
    while point < len(s):
        if s[point] == s[point+1]:
            a.append('y')
            point += 2
        else:
            a.append('x')
            point += 1

        if point == len(s) -1:
            a.append('x')
            break

    ans = 0
    if a[0] == 'x':
        ans = 3
    else:
        ans = 6

    for j in range(1, len(a)):
        if a[j-1] == 'x' and a[j] == 'x':
            ans *=2 % MOD
        elif a[j-1] == 'y' and a[j] == 'x':
            ans *=1 % MOD
        elif a[j-1] == 'x' and a[j] == 'y':
            ans *=2 % MOD
        elif a[j-1] == 'y' and a[j] == 'y':
            ans *=3 % MOD

    return ans % MOD
print(m())

Measured memory_bytes: 3064
N=int(input())
dic={}
ans=0
for i in range(N):
    s=list(input())
    s.sort()
    S=''.join(s)
    if S not in dic:
        dic[S]=1
    else:
        dic[S]+=1
for v in dic.values():
    if v>=2:
        ans+=v*(v-1)//2
print(ans)


Measured memory_bytes: 17932
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 2000
using namespace std;

int n,k,ans;
int a[MAXN+5][MAXN+5];

void Add(int x,int y,int ex,int ey)
{
	++a[x][y];
	++a[ex][ey];
	--a[x][ey];
	--a[ex][y];
}

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		int x,y;char c;
		scanf("%d %d %c",&x,&y,&c);
		x %= 2*k;y %= 2*k;
		if(((x<k&&y<k)||(x>=k&&y>=k))==(c=='B'))
		{
			int nx=x % k,ny=y % k;
			Add(0,0,nx+1,ny+1);
			Add(nx+k+1,0,2*k,ny+1);
			Add(0,ny+k+1,nx+1,2*k);
			Add(nx+k+1,ny+k+1,2*k,2*k);
			Add(nx+1,ny+1,nx+k+1,ny+k+1);
		}
		else
		{
			int nx=x % k,ny=y % k;
			Add(nx+1,0,nx+k+1,ny+1);
			Add(nx+1,ny+k+1,nx+k+1,2*k);
			Add(0,ny+1,nx+1,ny+k+1);
			Add(nx+k+1,ny+1,2*k,ny+k+1);
		}
	}
	for(int i=0;i<MAXN;i++)
		for(int j=1;j<MAXN;j++)
			a[i][j]+=a[i][j-1];
	for(int i=1;i<MAXN;i++)
		for(int j=0;j<MAXN;j++)
            a[i][j]+=a[i-1][j];
	for(int i=0;i<2*k;i++)
		for(int j=0;j<2*k;j++)
			ans=max(ans,a[i][j]);
	printf("%d",ans);
}


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

int main () {
  int N;
  cin >> N;
  if (N%(N/100000000+N%100000000/10000000+N%10000000/1000000+N%1000000/100000+N%100000/10000+N%10000/1000+N%1000/100+N%100/10+N%10) == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
input = gets.split.map(&:to_i)
#minim=input[1],maxim=input[0]+input[1]-1
minim = input[1]
maxim = input[0]+input[1]-1
if input[1]<=0 then
  minim = minim*(-1)
  if input[0]+input[1]-1 > 0 then
    print (maxim*(maxim+1)/2) - (minim*(minim+1)/2)
  else
    maxim = maxim*(-1)
    print (minim*(minim+1)/2)*(-1) - (maxim*(maxim+1)/2)*(-1)
  end
else
   print (maxim*(maxim+1)/2) - (minim*(minim+1)/2)
end

Measured memory_bytes: 1788
#include <algorithm>
#include <cassert>
// #include <chrono>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
// #include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

/*
unsigned seed1 = std::chrono::system_clock::now().time_since_epoch().count();
mt19937 g1.seed(seed1);
*/
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppiipii;
typedef pair<int, ppiipii> pippiipii;
typedef pair<int, pii> pipii;
typedef pair<pii, int> ppiii;
typedef pair<int, ppiii> pippiii;
typedef pair<int, ll> pill;
typedef pair<int, double> pid;
typedef pair<string, string> pss;
// note to self, the below two triggers someone
typedef pair<ll, ll> pll;
typedef pair<ll, int> plli;
typedef long double ld;

int main() {
  int n;
  scanf("%d", &n);
  map<int, int> dp;
  while(n--) {
    int x;
    scanf("%d", &x);
    dp[x-1]++;
    dp[x-0]++;
    dp[x+1]++;
  }
  int ret = 0;
  for(auto xx: dp) {
    ret = max(ret, xx.second);
  }
  printf("%d\n", ret);
}


Measured memory_bytes: 4736
fun main(args: Array<String>) {
    val mod = 1000000007
    val (H,W) = readIntList()
    val list = mutableListOf<String>()
    for (h in 0 until H) {
        val line = readString()
        if (line.any { it == '#' }) list.add(line)
    }
    if (list.size == 0) {
        println()
        return
    }
    val set = mutableSetOf<Int>()

    loop@for (i in 0 until list.first().length) {
        for (s in list) {
            if (s[i] == '#') continue@loop
        }
        set.add(i)
    }

    for (l in list) {
        var ans = ""
        for ((i,c) in l.withIndex())
            if (i !in set) ans+=c

        println(ans)
    }
}

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

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

int main(){
	int n, ans;
	while( cin >> n , n ){
		map<int,int> a;
		for(int i=0 ; i<n ; ++i ){
			int p,d1,d2;
			cin >> p >> d1 >> d2;
			a[p] = d1 + d2;
		}
		typedef map<int,int>::iterator Iter;
		int foo = 0;
		for(Iter it = a.begin() ;it!=a.end();++it){
			if( foo <= it->second ){
				foo = it->second;
				ans = it->first;
			}
		}
		cout << ans << " " << a[ans] << endl;
	}
}

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s, t;
    cin >> s >> t;
    ll a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if (u == s) {
        cout << a - 1 << " " << b;
    }
    else {
        cout << a << " " << b - 1;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    System.out.println(Math.min(A, B) + " " + Math.max(0, A+B-N));
  }
}

Measured memory_bytes: 22868
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;

class Main {
    public static void main (String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        StringBuilder sb = new StringBuilder("");
        int[] sides = new int[3];
        for (int i = 0; i < n; i++) {
            sides[0] = sc.nextInt();
            sides[1] = sc.nextInt();
            sides[2] = sc.nextInt();
            Arrays.sort(sides);
            sb.append((sides[2] * sides[2] == sides[1] * sides[1] + sides[0] * sides[0]) ? "YES" : "NO");
            sb.append('\n');
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 32440
import math
a, b, h, m = map(int , input().split())
tyousin = 30 * h + (30 * m / 60)
tansin = 6 * m
shita = abs(tyousin - tansin)
x = (a*a) + (b*b) - (a * b * 2 * math.cos(math.radians(shita)))
x = pow(x, 0.5)
print(x)

Measured memory_bytes: 62588
A, B, C, X = int(input()), int(input()), int(input()), int(input())

X //= 50
answer = 0
for a in range(A + 1):
  if a * 10 > X:
    continue
  for b in range(B + 1):
    if a * 10 + b * 2 > X:
      continue
    for c in range(C + 1):
      if a * 10 + b * 2 + c == X:
        answer += 1

print(answer)


Measured memory_bytes: 3060
fun main(args: Array<String>) {
    val (D, N) = readLine()!!.split(" ").map(String::toInt)

    var cnt = 0
    for (i in 1..Int.MAX_VALUE) {
        if (calc(i) == D) {
            cnt++
            if (cnt == N) {
                println(i)
                return
            }
        }
    }
}

private fun calc(x: Int): Int {
    if (x % 100 != 0) {
        return 0
    }
    return calc(x / 100) + 1
}



Measured memory_bytes: 37904
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
  string O, E;
  cin >> O >> E;

  int len = E.length();
  REP (i, len) {
    cout << O[i] << E[i];
  }
  if (O.length() > len) {
    cout << O[len];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
I = input().split()
         
K = int(I[0])
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print( A[K-1] )

Measured memory_bytes: 3060
// Problem : C - Cat Snuke and a Voyage
// Contest : AtCoder Regular Contest 079
// URL : https://atcoder.jp/contests/arc079/tasks/arc079_a
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define cerr if(1)cerr
#define size(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define temptts template <class T, class... Ts>

const int N = 1e6 + 1, mod = 1e9 + 7, inf = 2e9;

bool vis[N];
int n, m, dist[N];
vector<int> adj[N];
priority_queue<pair<int, int>> pq;

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> n >> m;
	for (int i = 1, u, v; i <= m; i++) {
		cin >> u >> v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	memset(dist, 0x3f, sizeof dist);
	dist[1] = 0;
	pq.push({0, 1});
	while (!pq.empty()) {
		int v = pq.top().second;
		pq.pop();
		if (vis[v]) {
			continue;
		}
		vis[v] = 1;
		for (auto u : adj[v]) {
			if (dist[v] + 1 < dist[u]) {
				dist[u] = dist[v] + 1;
				pq.push({-dist[u], u});
			}
		}
	}
	cout << (dist[n] == 2 ? "POSSIBLE" : "IMPOSSIBLE");
}


Measured memory_bytes: 35824
import java.util.*;

public class Main {
    
    public static boolean[] alr;
    
    public static List<List<Integer>> list = new ArrayList<>();

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        alr = new boolean[N];
        for (int i = 0; i < N; i++) {
            list.add(new ArrayList<>());
        }
        for (int i = 0; i < M; i++) {
            int A = sc.nextInt()-1;
            int B = sc.nextInt()-1;
            list.get(A).add(B);
            list.get(B).add(A);
        }
        long count = 0;
        for (int i = 0; i < list.size(); i++) {
            if (alr[i]) {
                continue;
            } else {
                alr[i] = true;
                count++;
            }
            List<Integer> lst = list.get(i);
            count(lst);
        }
        System.out.println(count-1);
    }
    
    private static void count(List<Integer> lst) {
        int friends = 0;
        for (Integer i : lst) {
            if (alr[i]) {
                continue;
            } else {
                alr[i] = true;
            }           
            count(list.get(i));
        }
    }
}


Measured memory_bytes: 73428
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>
#include <cctype>
//小文字を大文字 c-0x20;


#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define vvll(z,a,b) vector<vector<ll>>z(a,vector<ll>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
using namespace std;


int main(){
  int n;cin>>n;
  int taro=0,hanako=0;
  int flag=0;
  rep(i,n){
    string t,h;
    cin>>t>>h;
    if(t==h){
      taro++;
      hanako++;
      continue;
    }
    size_t ta=t.length();
    size_t hana=h.length();
    if(ta>hana){
        rep(j,hana){
          if(h[j]>t[j]){
            hanako+=3;
          
          break;}else if(t[j]>h[j]){
            taro+=3;
            break;
          }
          if(j==hana-1)taro+=3;

        }
    }else{
      rep(j,ta){
          if(t[j]>h[j]){
            taro+=3;
          break;}else if(h[j]>t[j]){
             hanako+=3;
          
          break;
          }
          if(j==ta-1)hanako+=3;
          
        }

    }
  }
cout<<taro<<" "<<hanako<<endl;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1001001001001001001;
const ll mod = 1000000007;
const int MAX = 1000100;
// to means the destination and cost is the weight of an edge
struct Edge{ll from, to, cost;};

struct graph{
    ll num;
    vector<Edge> edges;
    vector<ll> d;
    // constructor for initialization
    graph(ll n) : num(n), d(n){}
    // assembling a graph whose edge is coming from s to t
    void add_edge(ll s, ll t, ll cost){
        Edge e;
        e.from = s;
        e.to = t;
        e.cost = cost;
        edges.push_back(e);
    }    
    // Bellman-Ford algorithm
    // O(|V||E|)
    // you can use this even when a graph contains a negative weighted path
    void Bellman_Ford(ll s){
        for(int i = 0; i < num; i++){
            d[i] = INF;
        }
        bool ok = true;
        d[s] = 0;
        for(int i = 0; i < num; i++){
            for(int j = 0; j < edges.size(); j++){
                Edge e = edges[j];
                if(d[e.to] > d[e.from] + e.cost){
                    d[e.to] = d[e.from] + e.cost;
                    if(i == num - 1 && e.to == num - 1){
                        cout << "inf" << endl;
                        ok = false;
                        break;
                    }
                }
            }
        }
        if(ok) cout << -d[num - 1] << endl;
    }
};

int main(){
    int n, m; cin >> n >> m;
    graph G(n);
    for(int i = 0; i < m; i++){
        ll a, b, c; cin >> a >> b >> c;
        --a; --b;
        G.add_edge(a, b, -c);
    }
    G.Bellman_Ford(0);
}

Measured memory_bytes: 3656
import sys

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    A = int(read_func().strip().split()[0])
    B = int(read_func().strip().split()[0])
    C = int(read_func().strip().split()[0])
    D = int(read_func().strip().split()[0])

    print min(A+C, A+D, B+C, B+D)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2568
import sys
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
import itertools as it
from collections import Counter
#======================================================#
def main():
    n = II()
    aa = MII()
    cum = list(it.accumulate([0]+aa))
    c = Counter(cum)
    print(sum([(n*(n-1))//2 for n in c.values()]))

if __name__ == '__main__':
    main()

Measured memory_bytes: 41612
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  vector<int> v1(n + 2), v2(n + 2);
  rep(i, 1, n + 1) cin >> v1[i];

  rep(i, 1, n + 2) {
    v2[i] += v2[i - 1];
    v2[i] += abs(v1[i] - v1[i - 1]);
  }

  rep(i, 1, n + 1) {
    int x = v2[n + 1];
    x -= abs(v1[i] - v1[i - 1]);
    x -= abs(v1[i + 1] - v1[i]);
    cout << x + abs(v1[i - 1] - v1[i + 1]) << endl;
  }
}


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

#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

// order statistics tree
typedef tree<pii, null_type, less<pii>, rb_tree_tag,
             tree_order_statistics_node_update> indexed_set;

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define rrep(i, b, a) for(int i = b; i >= a; --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
const int N = 1e5+10;
int n;
ll dams[N], mountains[N];
int main() {
  cin.tie(0); cin.exceptions(cin.failbit);
  scanf("%d", &n);

  rep(i, 1, n+1){
    scanf("%lld", dams+i);
    mountains[1] += dams[i]*(i%2==1 ? 1 : -1);
  }

  rep(i, 2, n+1){
    mountains[i] = 2*dams[i-1] - mountains[i-1];
  }

  rep(i, 1, n+1){
    printf("%lld\n", mountains[i]);
  }
  puts("");
}


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

int main(){
	
	vector<int> T,S;
	int buffer,n,q,c = 0;
	
	cin >> n;
	for(int N = 0;N < n;N++){
		cin >> buffer;
		S.push_back(buffer);
	}sort(S.begin(),S.end());
	
	cin >> q;
	for(int Q = 0;Q < q;Q++){
		cin >> buffer;
		T.push_back(buffer);
	}
	
	for(auto value : T){
		if(binary_search(S.begin(),S.end(),value)){
			c++;
		}
	}
	
	cout << c << "\n";
	
	return 0;
}

Measured memory_bytes: 3412
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priotity_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int h,w,a[210][210],cost[10][10];

int main(){
	cin >> h >> w;
	REP(i,0,10) REP(j,0,10) cin >> cost[i][j];
	REP(i,0,h) REP(j,0,w) cin >> a[i][j];
	
	REP(k,0,10){
		REP(i,0,10){
			REP(j,0,10){
				cost[i][j]=min(cost[i][j], cost[i][k]+cost[k][j]);
			}
		}
	}
	
	int s=0;
	REP(i,0,h){
		REP(j,0,w){
			if(a[i][j]==-1) continue;
			s+=cost[a[i][j]][1];
		}
	}
	
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
using namespace std;
struct Node{
	struct Node *p;
	struct Node *cl;
	struct Node *cr;
	int key;
};
typedef struct Node *node;
node root;
int cnt;
void insert(int v){
	node y = NULL;
	node x = root;
	node z;
	z = (node)malloc(sizeof(Node));
	z->cl= NULL;
	z->cr= NULL;
	z->key = v;
	while(x!=NULL){
		y = x;
		if(z->key < x->key) x = x->cl;
		else x = x->cr;
	}
	z->p = y;
	if(y== NULL){
		root = z;
	}
	else if(z->key < y->key) y->cl = z;
	else y->cr = z;
}
void print_preorder(node x){
	if(x == NULL) return;
	printf(" %d", x->key);
	print_preorder(x->cl);
	print_preorder(x->cr);
}
void print_inorder(node x){
	if(x == NULL) return;
	print_inorder(x->cl);
	 printf(" %d", x->key);
	print_inorder(x->cr);
}
int main(){
	int n;
	int tmp;
	string t;
	scanf("%d", &n);
	for(int i=0; i<n;i++){
		cin >> t;
		if(t=="insert"){
			cin >> tmp;
			insert(tmp);
		}else if(t=="print"){
			cnt = 0;
			print_inorder(root);
			printf("\n");
			cnt = 0;
			print_preorder(root);
			printf("\n");
		}
	}
}







Measured memory_bytes: 26748
//B - Sum of Three Integers: 15Min/ Me enrolei um pouco na implementacao/ Pensei primeiro em fazer n^3 mas percebi que dava para fazer em n^2;
//Assunto: Adhoc;
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100050
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    int k, s, ans = 0, aux;
    cin >> k >> s;
    for(int i = 0; i <= k; i++) {
        for(int j = 0; j <= k; j++) {
            if((i + j) > s) break;
            aux = s - (i+j);
            if(aux <= k) ans++;
        }
    }
    cout << ans << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int n,r,g,b;cin>>r>>g>>b>>n;
	int cnt=0;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			int m=n;
			m-=(i*r+j*g);
			if(m<0) break;
			if(m%b==0&&m/b>=0) {
				cnt++;
				//cout<<i<<" "<<j<<" "<<m/b<<"\n";
			}
		}
	}
	cout<<cnt<<"\n";
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    
   int a,b;
   char op;
   
   while(1){
       scanf("%d %c %d",&a,&op,&b);
       if(op=='?') break;
       else{
           if(op=='+') printf("%d\n",a+b);
           else if(op=='-') printf("%d\n",a-b);
           else if(op=='*') printf("%d\n",a*b);
           else if(op=='/') printf("%d\n",a/b);
       }
   }

   
    return 0;
    
}


Measured memory_bytes: 2072
#include <iostream>
#include <vector>

using namespace std;

int main(){
    string S;
    cin >> S;
    int Zeronum = 0;
    int Onenum = 0;
    for(int i = 0;S[i] != '\0';i++){
        if(S[i] == '0'){
            Zeronum+= 2;
        }else{
            Onenum+= 2;
        }
    }
    if(Zeronum > Onenum){
        cout << Onenum << endl;
    }else{
        cout << Zeronum << endl;
    }
}

Measured memory_bytes: 512
import sys
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7

a = LIR(3)
n = I()
b = IR(n)


def check(A, B):
   S = set(b)
 
   # check each row
   for r in range(3):
      cnt = 0
      for c in range(3):
         if A[r][c] in S:
            cnt += 1
      if cnt == 3:
         return True
 
   # check each colum
   for c in range(3):
      cnt = 0
      for r in range(3):
         if A[r][c] in S:
            cnt += 1
      if cnt == 3:
         return True
 
   # check back diagonal
   cnt = 0
   for i in range(3):
      if A[i][i] in S:
         cnt += 1
   if cnt == 3:
      return True
 
   # check forward diagonal
   cnt = 0
   for i in range(3):
      if A[i][2-i] in S:
         cnt += 1
   if cnt == 3:
      return True
 
   return False
 
 
print('Yes' if check(a, b) else 'No')


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

int main(){
  int K,A,B;
  cin >> K >> A >> B;
  for(int i=A;i<B+1;i++){
    if(i%K==0){
      cout << "OK" << endl;
      return 0;
    }
  }
  cout << "NG" << endl;
}
  

Measured memory_bytes: 3596
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main (void) {
    int n;

    cin >> n;
    vector<int> v;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (i % 2 == 0) {
            v.push_back(a);
        } else {
            v.insert(v.begin(), a);
        }
    }

    if (n % 2 == 1) {
        reverse(v.begin(), v.end());
    }

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


Measured memory_bytes: 3060
import java.util.*;
import java.io.PrintWriter;
public class Main{
	static long mod=1000000007;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int a=sc.nextInt();
		int b=sc.nextInt();
		long ans=(pow(2,n)-1+mod)%mod;
		ans=(ans-C(n,a,mod)+mod)%mod;
		ans=(ans-C(n,b,mod)+mod)%mod;
		System.out.println(ans);
	}
	static long C(long left,long right,long mod){
		long ans=1;
		for(int i=0; i<right; i++){
			ans*=(left-i);
			ans%=mod;
		}
		for(int i=2; i<=right; i++){
			long tmp=mod-2;
			long mul=i;
			while(tmp>0){
				if((tmp&1)==1){
					ans*=mul;
				}
				tmp>>=1;
				mul*=mul;
				ans%=mod;
				mul%=mod;
			}
		}
		return ans;
	}
	static long pow(long p,long q){
		long res=1;
		while(q>0){
			if((q & 1)==1){
				res*=p;
				res%=mod;
			}
			q>>=1;
			p*=p;
			p%=mod;
		}
		return res;
	}
}


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

signed main(){
    //cout << setprecision(12) ;
    ios::sync_with_stdio(false);
	cin.tie(0);
 
    ll n;
    cin>>n;
    map<string,ll> mp;
    for(ll i=0;i<n;i++){
        string s;
        cin>>s;
        sort(s.begin(),s.end());
        mp[s]++;
    }
    ll ans=0;
    for(auto i:mp){
        ans += i.second*(i.second-1)/2;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 11264
//05, 05, 2018, 09:01:21 Rafaelcs cpp
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;

int main(){
    int a, b;

    cin >> a >> b;

    if(b >= a){
        cout << a << endl;
    }else{
        cout << a - 1 << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

const int maxn=100000;

int main(){
    
    int p,q,r;
    cin >> p>>q>>r;
    cout << min(p+q,min(p+r,r+q))<<endl;
    
    
    return 0;
}


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

int main(void)
{
    int n, i, j;
     
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        unsigned intp, decp;
        double dec;
        int hex, max;

        scanf("%x", &hex);
        intp = (hex >> 7) & 0xFFFFFF;
        decp = hex & 0x7F;

        dec = max = 0;
        for (j = 0; j < 7; j++){
            if (decp & (1 << (6 - j))){
                dec += pow(.5, j + 1);
                max = j;
            }
        }
        if (hex < 0) putchar('-');
        printf("%.*lf\n", max + 1, intp + dec);
    }

    return (0);
}

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

int main(){
    ll n;
  	cin >> n;
  	for(ll i=0;i<n;i++){
      	ll a;
      	cin >> a;
      	if(a%2 == 1){
          	cout << "first" << endl;
          	return(0);
        }
    }
  	cout << "second" << endl;

    return(0);
}

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

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int H = inpt[0];
        int W = inpt[1];

        for (int i = 1; i <= H; i++)
        {
            string[] txt = Reader.ReadLine().Split(' ');

            int idx = txt.ToList().FindIndex(a => a.Equals("snuke"));

            if (idx >= 0)
            {
                Console.WriteLine(((char)('A' + idx)).ToString() + i);
                return;
            }
        }

    
    }



    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"





";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 3032
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
//#define i_7 (ll)(1E9+7)
#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
//template<class T>void max(T a,T b){if(a<b)return b;else return a;}
//template<class T>void min(T a,T b){if(a>b)return b;else return a;}
//template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}
//template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}

//////////////////////////

#define N 100005
vector<ll>v[N];
ll n;
bool ans=false;
ll dp[N];
ll dfs(ll id,ll par){
    if(ans)return 0;
    ll count=0;
    for(auto x:v[id]){
        if(x==par)continue;
        count+=dfs(x,id);
    }
    if(count>=2){
        ans=true;
    }
    return dp[id]=1-count;
}
int main(){fastio
    cin>>n;
    rep(i,1,n-1){
        ll a,b;cin>>a>>b;
        v[a].pb(b);
        v[b].pb(a);
    }
    
    if(dfs(1,-1)||ans)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
    
    //rep(i,1,n)cout<<dp[i]<<" ";cout<<endl;
    
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    int A[N];
    rep(i,0,N) cin >> A[i];

    map<int, int> counts;
    rep(i,0,N) counts[A[i]]++;

    int ex = 0;
    for(auto x : counts) {
        int key = x.first;
        int val = x.second;
        ex += (val-1);
    }

    cout << (ex%2?N-ex-1:N-ex) << endl;
}

Measured memory_bytes: 5376
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC042A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B, C;
            var word = Console.ReadLine().Split(' ');
            A = int.Parse(word[0]);
            B = int.Parse(word[1]);
            C = int.Parse(word[2]);
            if(A==5&&B==7&&C==5||A==7&&B==5&&C==5||A==5&&B==5&&C==7)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");

                

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n - 1);
  REP(i, n)
  {
    cin >> a[i];
  }
  REP(i, n)
  {
    cin >> b[i];
  }
  REP(i, n - 1)
  {
    cin >> c[i];
  }

  int ans = 0;
  REP(i, n)
  {
    ans += b[a[i] - 1];
  }
  REP(i, n - 1)
  {
    if (a[i] + 1 == a[i + 1])
      ans += c[a[i] - 1];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ALL(obj) (obj).begin(),(obj).end()
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n) 
#define SIZE(x) ((int)(x).size())
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef pair<int, int> pint;
typedef pair<lint, lint> plint;
typedef vector<lint> vec;
typedef vector<vector<lint>> matrix;
typedef priority_queue<lint> p_que;
typedef priority_queue<lint, vector<lint>, greater<lint>> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

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

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

lint power(lint x, lint n, lint mod = MOD) {
    lint ret = 1;
    while(n > 0) {
        if(n & 1){
            (ret *= x) %= mod;
        }
        (x *= x) %= mod;
        n >>= 1;
    }
    return ret;
}

vector<lint> make_power(int n, lint base){
    lint num = 1;
    vector<lint> ret;
    for (int i=0; i<=n; ++i){
        ret.push_back(num);
        num *= base;
    }
    return ret;
}

// vars
string s;

void input(){
    cin >> s;
}

void solve(){
    if(s == "ABC"){
        cout << "ARC" << endl;
    }
    else {
        cout << "ABC" << endl;
    }
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3108
#include <stdio.h>
 
using namespace std;
 
int main(){
    int a,b;
    char op;
    while(true){
        scanf("%d %c %d",&a,&op,&b);
        if(op == '?') break;
        switch(op){
        case '+':
            printf("%d\n",a+b);
            break;
        case '-':
            printf("%d\n",a-b);
            break;
        case '/':
            printf("%d\n",a/b);
            break;
        case '*':
            printf("%d\n",a*b);
            break;
        }
    }
}




Measured memory_bytes: 2704
import java.util.*;

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

        if (a <= b) {
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    }
}

Measured memory_bytes: 22996
import bisect

N = int(input())
L = sorted(map(int, input().split()))

res = 0
for i in reversed(range(1, N)):
    for j in reversed(range(i)):
        index = bisect.bisect_left(L, L[i] + L[j])
        n = N - index
        res += (N - 1 - i) - n

print(res)


Measured memory_bytes: 43996