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

#define llint long long int

using namespace std;

int main(){
    int A, B, M;

    cin >> A >> B >> M;

    vector<int> a(A), b(B), x(M), y(M), c(M);

    for(int i = 0; i < A; i ++){
        cin >> a[i];
    }
    for(int i = 0; i < B; i ++){
        cin >> b[i];
    }
    for(int i = 0; i < M; i ++){
        cin >> x[i] >> y[i] >> c[i];
    }
    int min_value = *min_element(a.begin(), a.end()) + *min_element(b.begin(), b.end());

    for(int i = 0; i < M; i ++){
        int kouho = a[x[i] - 1] + b[y[i] - 1] - c[i];

        if(kouho < min_value){
            min_value = kouho;
        }
    }
    cout << min_value << endl;
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
//#define MOD 998244353
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL rou(LL a,LL d){if((a*10/d)%10<5)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int scmp(const void* a,const void* b){return strcmp(*(char**)a,*(char**)b);}

int main(){
  LL N,i,a=INF,ans=0;
  scanf("%lld",&N);
  LL P[N];
  FOR(i,0,N)scanf("%lld",&P[i]);
  FOR(i,0,N){
    if(a>P[i])ans++,a=P[i];
  }

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


Measured memory_bytes: 1664
// Last Change:         11/24/2018 17:47:35.
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <list>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;

int Partition(int A[], int p, int r) {
  int x = A[r];
  int i = p - 1;
  int buf;
  for (int j = p; j < r; j++) {
    if (A[j] <= x) {
      i++;
      buf = A[i];
      A[i] = A[j];
      A[j] = buf;
    }
  }
  buf = A[i + 1];
  A[i + 1] = A[r];
  A[r] = buf;
  return i + 1;
}

int main() {
  int N, A[100000];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int index = Partition(A, 0, N - 1);
  for (int i = 0; i < N; i++) {
    if (i) {
      cout << " ";
    }
    if (i == index) {
      cout << "[";
    }
    cout << A[i];
    if (i == index) {
      cout << "]";
    }
  }
  cout << endl;
}



Measured memory_bytes: 3388
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cassert>
#define InfL 1000000000
#define InfLL 1000000000000000000LL
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=(n-1);(i)>=(0);(i)--)
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<db> vd;

vb is_prime;
void p_ini(int n) {
	is_prime.resize(n, true);
	is_prime[0] = false;
	is_prime[1] = false;
	for (int i = 2; i < n; i++) {
		if (!is_prime[i])
			continue;
		for (int j = i * 2; j < n; j += i)
			is_prime[j] = false;
	}
	return;
}

vl prime_factor(ll n) {
	vl prime_factor_n;
	ll sqrt_n = sqrt(n) + 10;
	rep(i, sqrt_n) {
		if (!is_prime[i])
			continue;
		if (n % i == 0) {
			ll count = 0;
			prime_factor_n.push_back(i);
			while (1) {
				n /= i;
				count++;
				if (n % i != 0)
					break;
			}
		}
	}
	if (n > 1)
		prime_factor_n.push_back(n);
	return prime_factor_n;
}
ll gcd_ll(ll a, ll b)
{
	if (a == 0)
		return 0;
	if (b == 0)
		return 0;
	ll x;
	while (1)
	{
		x = a % b;
		if (x == 0)
			return b;
		else
		{
			a = b;
			b = x;
		}
	}
}

int main() {
	int N;
	cin >> N;
	p_ini(2000000);
	set<int> pnum;
	vl AA(N);
	string ans = "pairwise coprime";
	rep(i, N) {
		ll A;
		cin >> A;
		AA[i] = A;
	}
	rep(i, N) {
		ll A = AA[i];
		vl pl = prime_factor(A);
		for (int ptmp : pl) {
			if (pnum.find(ptmp) != pnum.end()) {
				ans = "setwise coprime";
				break;
			}
			pnum.insert(ptmp);
		}
		if (ans == "setwise coprime")
			break;
	}
	ll G = AA[0];
	rep(i, N - 1) {
		G = gcd_ll(G, AA[i + 1]);
	}
	if(G > 1)
		ans = "not coprime";
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11508
#include <cstdlib>
#include <iostream>
#include <typeinfo>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

//nの各桁の数の和
int sum(int n)
{
  int s = 0;
  while (true)
  {
    s += n % 10;
    n /= 10;
    if (n == 0)
      break;
  }
  return s;
}

int main()
{
  int n, a, b;
  cin >> n >> a >> b;
  int ans = 0;
  for (int i = 1; i <= n; i++)
  {
    if (a <= sum(i) && sum(i) <= b)
    {
      ans += i;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7 ;
const ll N = 1e5 + 10 ;

int main(){
    fastio
    map<char,char>m;
     m['A']='T';
     m['T']='A';
     m['C']='G';m['G']='C';
     char x;
     cin>>x;
     cout<<m[x]<<endl;
    return 0 ;
}

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

// Shortening code
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef tuple<int, int, int> ti;

// Macros
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = a; i >= b; i--)
int log_base(ll base, ll x)
{
    return (int)(log(x) / log(base));
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // Your code
    ll x;
    cin >> x;
    int step = 0;
    ll p = 100;
    while (p < x)
    {
        p += p / 100;
        step++;
    }
    cout << step;
    return 0;
}

Measured memory_bytes: 3692
s = input()
mae = int(s[:2])
usiro = int(s[2:])

ym = 0
my = 0

if (1 <= usiro <= 12): ym = 1
if (1 <= mae <= 12): my = 1

if (ym and my): print("AMBIGUOUS")
elif (ym): print("YYMM")
elif (my): print("MMYY")
else: print("NA")



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

using namespace std;

int gcd(int x,int y)
{
  return (x%y==0?y:gcd(y,x%y));
}

int main()
{
  int n, x;
  cin >> n >> x;
  vector<int> p(n);
  for (int i = 0; i < n; i++)
  {
    cin >> p[i];
    p[i] = abs(p[i] - x);
  }
  int ans = p[0];
  for (int i = 1; i < n; i++)
    ans = gcd(ans, p[i]);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
using namespace std;
signed main(){
    int n,cnt=0;
    string a,b,c;
    cin>>n>>a>>b>>c;
    rep(i,n){
        if(a[i]==b[i]&&a[i]==c[i]);
        else if(a[i]==b[i]||a[i]==c[i]||b[i]==c[i])cnt++;
        else cnt+=2;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int n;
  	cin>>n;
  	ll arr[n];
  	map<ll,ll>mp;
    for(int i=0;i<n;i++) 
    {
      int a;
      cin>>a;
      arr[i]=a;
      mp[a]++;
    }
  	ll count=0;
  	auto itr=mp.begin();
  	for(itr;itr!=mp.end();itr++)
    {
      if((itr->second)%2 !=0)
        count++;
    }
  	cout<<count<<endl;
}

Measured memory_bytes: 7296
//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu) FUNC(printe) FUNC(printe0);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

// // #define NDEBUG
// #include "atcoder/all"
// using namespace atcoder;

struct UnionFind {
	vector<int> elems;
	UnionFind(int n):elems(n){
		for(int i = 0; i < n; i++){
			elems[i] = i;
		}
	}
	bool same(int a, int b){
		return parent(a) == parent(b);
	}
	void unite(int a, int b){
		elems[parent(a)] = parent(b);
	}
	int parent(int a){
		if(a == elems[a]){ return a; }
		return elems[a] = parent(elems[a]);
	}
};


int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    UnionFind uf(n);
    // dsu uf(n);
    for(int i = 0; i < q; i++){
        int t, u, v;
        cin >> t >> u >> v;
        if(t == 0){
            uf.unite(u, v);
            // uf.merge(u, v);
        }else{
            cout << uf.same(u, v) << '\n';
        }
    }
}


Measured memory_bytes: 3524
main :: IO ()
main = do
  [s,t] <- words <$> getLine
  [a,b] <- map (read :: String -> Int) . words <$> getLine
  u <- getLine
  if s == u then putStrLn $ show (a-1) ++ " " ++ show b
    else putStrLn $ show a ++ " " ++ show (b-1)

Measured memory_bytes: 508
#include<bits/stdc++.h>
using namespace std;
int a[100005];
bool cmp(int a,int b)
{
	return a>b;
}
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)  cin>>a[i];
	sort(a+1,a+n+1,cmp);
	int min1=0,min2=2147483647;
	for(int i=2;i<=n;i++)
		if(fabs((a[1]/2)-a[i])<min2)  min1=i,min2=fabs((a[1]/2)-a[i]);
	cout<<a[1]<<' '<<a[min1];
	return 0;
}

Measured memory_bytes: 640
// デバッグ実行：Ctrl+F5

using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        String line;
        line = Console.ReadLine();
        String[] words = line.Split(' ');
        int N = int.Parse(words[0]);
        int M = int.Parse(words[1]);
        List<Tuple<int, int>> datas = new List<Tuple<int, int>>();
        List<Tuple<int, int>> before = new List<Tuple<int, int>>();
        Dictionary<Tuple<int, int>, string> dict = new Dictionary<Tuple<int, int>, string>();

        for (int i = 0; i < M; i++)
        {
            line = Console.ReadLine();
            words = line.Split(' ');
            Tuple<int, int> data = new Tuple<int, int>(int.Parse(words[0]), int.Parse(words[1]));
            datas.Add(data);
            before.Add(data);
            dict.Add(data, "0");
        }

        datas.Sort((a, b) => b.Item1 == a.Item1 ? a.Item2 - b.Item2 : (a.Item1 > b.Item1 ? 1 : -1));
        int now_P = 0;
        int count = 0;
        for (int i = 0; i < M; i++)
        {
            if (now_P != datas[i].Item1)
            {
                // 入れ替え
                now_P = datas[i].Item1;
                count = 0;
            }
            count++;
            dict[datas[i]] = String.Format("{0:D6}{1:D6}", datas[i].Item1, count);

        }
        for(int i = 0; i < M; i++)
        {
            Console.WriteLine(dict[before[i]]);
        }
    }

}

Measured memory_bytes: 35116
import math
n,m=map(int,input().split())
if abs(n-m)>=2:
    print(0)
else:
    if abs(n-m)==1:
        print(math.factorial(n)%(10**9+7)*math.factorial(m)%(10**9+7))
    else:
        print(2*(math.factorial(n))**2%(10**9+7))
        

Measured memory_bytes: 47472
#include <bits/stdc++.h>
int solve(long long n)
{
  for(int i = 1; i != 64; i++){
    n /= 2;
    if(n == 0) return i;
  }
}
int main(void)
{
  unsigned long long x, y;
  std::cin >> x >> y;
  std::cout << solve(y / x) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::{fastout, input, marker::*};

#[fastout]
fn main() {
    input! {
        n: usize,
        l: [u64; n],
    }

    let mut ans = 0;

    for i in 0..n {
        for j in (i+1)..n {
            if l[i] == l[j] {
                continue;
            }
            for k in (j+1)..n {
                if l[i] == l[k] || l[j] == l[k] {
                    continue;
                }

                if l[k] < l[i] + l[j] && l[i] < l[j] + l[k] && l[j] <  l[k] + l[i] {
                    ans += 1;
                }
                // println!("{} {} {} = {} {} {}", i+1, j+1, k+1, l[i], l[j], l[k]);
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2180
#include <bits/stdc++.h>
#define cout if (1) cout

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pii;
#define pb push_back

int x, a, b;

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

	if (abs(x - a) <= abs(x-b)) {
		cout << "A" << endl;
	} else {
		cout << "B" << endl;
	}
}


Measured memory_bytes: 256
#include <stdio.h>

main(){
    long nk[40]={1,};
    int i;
    int n;

    for(i=0;i<30;i++){
        nk[i+1]+=nk[i];
        nk[i+2]+=nk[i];
        nk[i+3]+=nk[i];
    }

    while(scanf("%d",&n)!=EOF){
        if(!n)
            break;
        printf("%ld\n",nk[n]/3650+1);
    }
    return 0;
}

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

N, M = map(int, input().split())
if N >= M:
    print(0)
else:
    X = [int(_) for _ in input().split()]
    X = sorted(X)
    diff = [0]*(M-1)

    for i in range(M-1):
        diff[i] = X[i+1] - X[i]

    diff = sorted(diff)
    print(sum(diff[:(M-N)]))

Measured memory_bytes: 13180
/*
 * じょえチャンネル
 * 高評価・チャンネル登録よろしくおねがいします！
 * https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
 */
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define inf (int)(3e18)
#define P pair<int,int>
#define mod (int)(1e9+7)
template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}

int a[3][3];
int N;
bool b[3][3];
signed main(){
	rep(i,3)rep(j,3)cin>>a[i][j];
	cin>>N;
	rep(_,N){
		int k;cin>>k;
		rep(i,3)rep(j,3){
			if(a[i][j]==k)b[i][j]=true;
		}
	}
	rep(i,3){
		if(b[i][0]&&b[i][1]&&b[i][2]){
			cout<<"Yes"<<endl;return 0;
		}
		if(b[0][i]&&b[1][i]&&b[2][i]){
			cout<<"Yes"<<endl;return 0;
		}
	}
	if(b[0][0]&&b[1][1]&&b[2][2]){
		cout<<"Yes"<<endl;return 0;
	}
	if(b[0][2]&&b[1][1]&&b[2][0]){
		cout<<"Yes"<<endl;return 0;
	}
	cout<<"No"<<endl;
}


Measured memory_bytes: 256
#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 all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int n;
   cin >> n;
   map<string, int> mp;
   rep(i, 0, n) {
      string s;
      cin >> s;
      mp[s]++;
   }
   cout << mp.size() << endl;

   return 0;
}

Measured memory_bytes: 19256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<array>
using namespace std;

int main(){
    string s1, s2, s3;

    cin >> s1 >> s2 >> s3;

    cout <<"A" << s2[0] << "C" << endl;
    return 0;
}


Measured memory_bytes: 256
///
// File:  0546.go
// Author: ymiyamoto
//
// Created on Tue Mar  6 23:19:41 2018
//
package main

import (
	"fmt"
)

var n, k int

func perm(arr []int) [][]int {
	if len(arr) == 1 {
		return [][]int{arr}
	}

	p := perm(arr[1:])
	var ret [][]int
	for _, val := range p {
		for i := 0; i <= len(val); i++ {
			tmp := make([]int, len(val))
			copy(tmp, val)
			tmp = append(tmp, 0)
			copy(tmp[i+1:], tmp[i:])
			tmp[i] = arr[0]
			ret = append(ret, tmp)
		}
	}

	return ret
}

func permutation(n, k int) [][]int {
	ret := [][]int{}

	for i := 0; i < 1<<uint(n); i++ {
		var selects []int
		for j := 0; j < n; j++ {
			if (i>>uint(j))&1 == 1 {
				selects = append(selects, j)
			}
		}
		if len(selects) == k {
			ret = append(ret, perm(selects)...)
		}
	}

	return ret
}

func main() {
	for {
		fmt.Scan(&n, &k)
		if n == 0 && k == 0 {
			break
		}

		cards := make([]string, n)
		for i := 0; i < n; i++ {
			fmt.Scan(&cards[i])
		}

		ret := permutation(len(cards), k)
		nums := map[string]bool{}
		for _, val := range ret {
			var num string
			for i := 0; i < len(val); i++ {
				num += cards[val[i]]
			}
			nums[num] = true
		}

		fmt.Println(len(nums))
	}
}



Measured memory_bytes: 5728
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int h, w;
    cin >> h >> w;
    REP(i,h){
        string s;
        cin >> s;
        cout << s << endl << s << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    string s;
    cin >> s;
    reverse(all(s));
    s = s.substr(8);
    reverse(all(s));
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeSet;

import static java.util.Arrays.binarySearch;

public class Main {

    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;

        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int x = in.nextInt();
        int[] a = new int[n];
        int ans = 1, s = 0;
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            s += a[i];
            if (s <= x) {
                ans++;
            }
        }
        out.println(ans);
    }

}

class InputReader {

    private final BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(nextLine());
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }

}


Measured memory_bytes: 21332
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>

typedef long long ll;

using namespace std;

int main()
{
    ll n;
    cin >> n;
    vector<ll> h(n);

    if (n == 1)
    {
        cout << "Yes" << endl;
        return 0;
    }

    for (auto &i: h)
        cin >> i;

    for (ll i=0; i<n-1; i++)
    {
        if (h[i] < h[i+1])
        {
            h[i+1] = h[i+1] - 1;
        }

        if (h[i] > h[i+1])
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static int[] a = new int[10];
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		for (int i = 0; i < a.length; i++) {
			a[i] = cin.nextInt();
		}
		solve();
	}
	
	public static void solve() {
		Arrays.sort(a);
		for(int i = a.length - 1; i > 6; i--){
			System.out.println(a[i]);
		}
	}
}

Measured memory_bytes: 17324
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1LL<<62;
const int MAX = 1e5;

int main() {
    int n, k; cin >> n >> k;
    int sum = 0;
    rep(i,n) {
        int x; cin >> x;
        sum += 2*min(x,k-x);
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
ll a,b,c;
//ld ;
//string s;
// char c;

int main() {
  cin >> a >> b >> c;
  cout << c << ' ' << a <<  ' ' << b << endl;
  return 0;
}

Measured memory_bytes: 256
module ABC101

  ! <module>s to import
  use, intrinsic :: iso_fortran_env

  ! require all variables to be explicitly declared
  implicit none

  ! accessibility of <subroutine>s and <function>s in this <module>
  public :: task_B

  ! variables for this <module>
  integer(INT32) :: integer_target, integer_buffer
  integer(INT32) :: sum_digits

  ! contained <subroutine>s and <function>s are below
  contains

  subroutine task_B

    ! variables for this <subroutine>
    integer :: iter

    ! STEP.01
    ! read out the target integer string
    read(unit=INPUT_UNIT, fmt=*) integer_target

    ! STEP.03
    ! calculate the summation of the digits of the target integer
    sum_digits     = 0_INT32
    integer_buffer = integer_target

    do while(integer_buffer .gt. 0_INT32)
      ! print *, integer_buffer, mod(integer_buffer, 10_INT32), sum_digits ! for debug
      sum_digits     = sum_digits + mod(integer_buffer, 10_INT32)
      integer_buffer = integer_buffer / 10_INT32
    end do

    ! STEP.04
    ! output the status of the target integer
    if (mod(integer_target, sum_digits) .eq. 0_INT32) then
      write(unit=OUTPUT_UNIT, fmt='(A)', advance='yes') 'Yes'
    else
      write(unit=OUTPUT_UNIT, fmt='(A)', advance='yes') 'No'
    end if

    ! STEP.END
    return

  end subroutine task_B

end module ABC101


program main

  ! <module>s to import
  use, non_intrinsic :: ABC101

  ! require all variables to be explicitly declared
  implicit none

  call task_B

end program main

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
    for(;;){
        int a,b,n,m=0;
        int x;
        int y;
        int map[50][50]={0};
        cin>>a>>b;
        if(a==0&&b==0)break;
        cin>>n;
        map[0][0]=1;
        for(int i=0;i<n;i++){
            cin>>x>>y;
            map[y-1][x-1]=-1;
        }
        for(int i=0;i<b;i++){
            for(int j=0;j<a;j++){
                if(i==0&&j==0);
                else if(i==0){
                    if(map[0][j]==-1)map[0][j]=0;
                    else map[0][j]=map[0][j-1];

                }
                else if(j==0){
                    if(map[i][0]==-1)map[i][0]=0;
                    else map[i][0]=map[i-1][0];
                }
                else {
                    if(map[i][j]==-1)map[i][j]=0;
                    else map[i][j]=map[i][j-1]+map[i-1][j];
                    }
            }
        }
       /* for(int i=0;i<b;i++){
            for(int j=0;j<a;j++){
                printf("%3d",map[i][j]);
            }
            cout<<endl;
        }*/
        cout<<map[b-1][a-1]<<endl;



    }
	return 0;
}

Measured memory_bytes: 1176
def gcd(a, b):
    """最大公約数(Greatest Common divisor)を求める.

    ユークリッドの互除法の実装.
    ああああ

    Parameters
    ----------
    a : int
        自然数.
    b : int
        自然数.

    Returns
    -------
    int
        最大公約数
    """
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    """最小公約数(least common multiple)を求める.

    Parameters
    ----------
    a : int
        自然数.
    b : int
        自然数.

    Returns
    -------
    int
        最小公倍数
    """
    return a * b // gcd(a, b)

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
ans = 1
for t in T:
    ans = lcm(ans, t)
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define lli long long int
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,q,i,j;
	cin>>n>>q;
	vector<vector<int> > adj;
	adj.resize(n);
	lli a,b;
	for(i=0;i<n-1;i++)
	{
		cin>>a>>b;
		adj[a-1].push_back(b-1);
		adj[b-1].push_back(a-1);
	}
	vector<lli> val;
	val.resize(n);
	for(i=0;i<q;i++)
	{
		cin>>a>>b;
		val[a-1] += b; 
	}
	vector<int> par;
	par.resize(n);
	for(i=0;i<n;i++)
		par[i] = -1;
	par[0] = 0;
	queue<int> q1;
	q1.push(0);
	while(!q1.empty())
	{
		int x = q1.front();
		q1.pop();
		for(i=0;i<adj[x].size();i++)
		{
			int y = adj[x][i];
			if(par[y]==-1)
			{
				par[y] = x;
				val[y] += val[x];
				q1.push(y);
			}
		}
	}
	for(i=0;i<n;i++)
		cout<<val[i]<<" ";
	cout<<endl;
	return 0;
}

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

using ll = long long;
//print(fixed << setprecision(10));
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repk(i,n,k) for(int i = k; i < (n); i++)
#define all(n) n.begin(), n.end()
#define print(n) cout << n << endl
double PI = acos(-1.0);
int INF = 1e9;
ll LINF = 1e18;
ll MOD = 1e9+7;


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int a,b;
    cin >> a >> b;
    print(a*b);
    return 0;
}

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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using Pint = pair<int, int>;
const ll mod = 1e9+7;

int main(int argc, char const* argv[])
{
  int n;
  ll d, a;
  cin>>n>>d>>a;

  vector<pair<ll,ll>> es;

  REP(i,n) {
    ll x, h;
    cin>>x>>h;
    es.emplace_back(x,h);
  }

  sort(ALL(es));

  ll ans=0;
  ll total=0;
  queue<pair<ll,ll>> q; // (爆発が届かない範囲の左端, ダメージ)

  for(auto e: es) {
    ll x=e.first, h=e.second;

    // 期限が切れた爆発分のdamageをtotalから引く
    while(q.size() && q.front().first <= x) {
      total -= q.front().second;
      q.pop();
    }

    h -= total;
    if(h>0) {
      // 爆発を落とす
      ll count = (h+a-1)/a;
      ans += count;
      ll damage = count*a;
      total+=damage;
      q.emplace(x+2*d+1, damage);
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 6128
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b=mod-2,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
    oreno_initializer() {
        cin.tie(0);
        ios::sync_with_stdio(0);
    }
} oreno_initializer;



string s;
int a, b;

signed main() {
    while (cin >> s) {
        int n = s.size();
        a = b = 0;
        rep(i,n-2) {
            if (s.substr(i,3)=="JOI") a++;
            if (s.substr(i,3)=="IOI") b++;
        }
        cout << a << endl << b << endl;
    }
}



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

int A[100000], n;

int main() {
    int q, i, t, sum;
    sum = 0;
    cin >> n;
    for (i = 0; i < n; i++) scanf("%d", &A[i]);

    cin >> q;
    for (i = 0; i < q; i++) {
        scanf("%d", &t);
        if (*lower_bound(A, A + n, t) == t) sum++;
    }
    printf("%d\n", sum);

    return 0;
}


Measured memory_bytes: 3600
using namespace std;
#include <bits/stdc++.h>
#define rep(i, s) for (int i = 0; i < s; ++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 all(v) (v.begin(), v.end())
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define EPS (1e-7)
#define INF (1e10)
#define PI (acos(-1))
const ll mod = 1000000007;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  string X;
  cin>>N>>X;
  int cnt=0;
  int ans=0;
  rep(i,X.size()){
    if(X[i]=='I')
      cnt++;
    else
      cnt--;
    ans=max(cnt,ans);
  }
  cout<<ans<<endl;
  
}
     










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


int main() {
	int coin[6]={500,100,50,10,5,1},price,sum;
	while (true)
	{
	    scanf("%d",&price);
		if (price == 0) break;
		sum =0;
		price = 1000-price;
		for (int i = 0; i <= 5; i++)
		{
				while (price>=coin[i]) {
					price-=coin[i];
					sum++;
				}



		}
		printf("%d\n", sum);
	}




	
	return 0;
}


Measured memory_bytes: 3112
def main():
    n, k = map(int, input().split())
    x = list(map(int, input().split()))
    ans = 10000000000
    for i in range(n - k + 1):
        l, r = x[i], x[i + k - 1]
        if l < 0 and r > 0:
            d = max(abs(l), abs(r)) + min(abs(l), abs(r)) * 2
        else:
            d = max(abs(l), abs(r))
        ans = min(d, ans)
    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;

int main() {
	int n, x, y; scanf("%d %d %d", &n, &x, &y);
	vector<int> ans(n);
	vector<vector<int>> graph(n);
	for (int i = 0; i < n - 1; ++i) {
		graph[i].push_back(i + 1);
		graph[i + 1].push_back(i);
	}
	graph[--x].push_back(--y);
	graph[y].push_back(x);
	for (int i = 0; i < n; ++i) {
		vector<int> dist(n, -1);
		queue<int> q;
		q.push(i);
		dist[i] = 0;
		while (!q.empty()) {
			int cur = q.front(); q.pop();
			for (int nxt : graph[cur]) {
				if (dist[nxt] == -1) {
					dist[nxt] = dist[cur] + 1;
					q.push(nxt);
				}
			}
		}
		for (int j = 0; j < n; ++j) {
			ans[dist[j]]++;
		}
	}
	for (int i = 1; i < n; ++i) {
		printf("%d\n", ans[i] / 2);
	}
	return 0;
}


Measured memory_bytes: 384
k,x=map(int,input().split())
if(x+k-1<=1000000 and x-k+1>=-1000000):
    for i in range(x-k+1,x+k):
        print(i,end=" ")
elif(x+k-1<=1000000 and x-k+1<-1000000):
    for i in range(-1000000,x+k):
        print(i)
elif(x+k-1>1000000 and x-k+1>=-1000000):
    for i in range(x-k+1,1000001):
        print(i)

Measured memory_bytes: 38256
#include<iostream>
using namespace std;
int main()
{
  int a,b,c,s;
  cin >> s;
  a = s / 3600;//小时
  b = (s-3600*a)/60;//分钟
  c = (s-3600*a) - b*60;
  cout << a << ":" << b << ":" << c << endl;
  return 0;
}



Measured memory_bytes: 3112
#include <stdio.h>

int bubbleSort(int A[], int n);
void swap(int *a, int *b);

int main(){
	int i,n,a;
	int A[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	a=bubbleSort(A,n);
	for(i=0;i<n;i++){
		if(i>0) printf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
	printf("%d\n",a);
	return 0;
}

int bubbleSort(int A[], int n){
	int i,j;
	int count=0;
	for(i=0;i<n;i++){
		for(j=n-1;j>i;j--){
			if(A[j]<A[j-1]){
				swap(&A[j],&A[j-1]);
				count++;
			}
		}
	}
	return count;
}

void swap(int *a, int *b){
	int c;
	c=*a;
	*a=*b;
	*b=c;
}

Measured memory_bytes: 604
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define int long long
#define SYOU(x) setprecision(x)
#define abs(x,y) (max(x,y)-min(x,y))
#define mp make_pair
#define fi first
#define se second
using namespace std;
int i[111100];
bool ii[11111];
int u;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long a,b,c,d=0,e=0,f=0,g=1,h=2,j;
  string s,w;
  cin >>a>>b>>c;
  if(a<=c&&b>=c) cout <<"Yes\n";
  else{
    if(a>=c&&b<=c) cout <<"Yes\n";
    else cout <<"No\n";
  }
  return (0);
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int K;
int mi[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>K;
	FOR(i,K) mi[i]=1<<30;
	priority_queue<pair<int,int>> P;
	for(i=1;i<=9;i++) {
		mi[i%K]=min(mi[i%K],i);
		P.push({-mi[i%K],i%K});
	}
	
	while(P.size()) {
		int cur=P.top().second;
		int cost=-P.top().first;
		P.pop();
		if(cost!=mi[cur]) continue;
		FOR(i,10) {
			int nc=cost+i;
			int nex=(cur*10+i)%K;
			if(mi[nex]>nc) {
				mi[nex]=nc;
				P.push({-mi[nex],nex});
			}
		}
	}
	
	cout<<mi[0]<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 2804
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#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++)
using namespace std;
typedef long long ll;

int N,Q;
vector<int> G[200001];
int X[200001];
int ans[200000];

void dfs(int from,int parent,int cnt){
    ans[from]=X[from]+cnt;
    rep(i,G[from].size()){
        if(G[from][i]!=parent){
            dfs(G[from][i],from,X[from]+cnt);
        }
    }
}

int main(){
    cin>>N>>Q;
    rep(i,N-1){
        int a,b;
        cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    rep(i,Q){
        int p,x;
        cin>>p>>x;
        X[p]+=x;
    }

    dfs(1,0,0);

    repn(i,N){
        cout<<ans[i]<<' ';
    }
    cout<<endl;
}

Measured memory_bytes: 30336
#include<bits/stdc++.h>
using namespace std;
const int N=55;
int a[N],b[N],f[N],val[N],n;
int check(){
	for (int i=1;i<=n;i++){
		memset(f,0,sizeof(f));
		f[a[i]]=1;
		for (int j=a[i];j&&!f[b[i]];j--)
			if (f[j])
				for (int k=1;k<=j&&!f[b[i]];k++)
					if (val[k]) f[j%k]|=f[j];
		if (!f[b[i]]) return 0;
	}
	return 1;	
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	for (int i=1;i<=n;i++) scanf("%d",&b[i]);
	for (int i=1;i<=50;i++) val[i]=1;
	if (!check()) return puts("-1"),0;
	for (int i=50;i;i--){
		val[i]=0;
		val[i]=1-check();
	}
	long long ans=0;
	for (int i=1;i<=50;i++)
		if (val[i]) ans+=1ll<<i;
	printf("%lld",ans);
}

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

int main(){
    int N, A, B;
    cin >> N >> A >> B;
    if (A + B - N > 0)
        cout << min(A, B) << " " << A + B - N << endl;
    else
        cout << min(A, B) << " " << 0 << endl;
    return 0;    
}


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

int countDigit(long long n) 
{ 
    return floor(log10(n) + 1); 
} 

int main() {
	ll n,count=0;
	cin>>n;
	for(ll i=0;i<=n;i++)
	{
		if(countDigit(i)%2==1)
		++count;
	}
	cout<<count;
	return 0;
}

Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;
int INF = 1 << 30;


int main(void){

    int N,K; cin>>N>>K;
    int sum=0;
    vector<int> A(N+1);
    for (int i = 0; i < K; ++i) {
        int d; cin>>d;
        for (int j = 0; j < d; ++j) {
            int tmp; cin>>tmp;
            A[tmp]++;
        }
    }

    for (int i = 1; i <= N; ++i) {
        if(A[i]==0) sum++;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3632
import math
k = int(input())

lsgcd=[]

for i in range(1,k+1):
    for j in range(1, k +1):
        lsgcd.append(math.gcd(i,j))


ls2 = []
for i in lsgcd:
    for j in range(1,k+1):
        ls2.append(math.gcd(i,j))

print(sum(ls2))

Measured memory_bytes: 71780
import qualified Data.Vector as V (Vector, fromList, (!))
import Control.Applicative


binarySearch :: (V.Vector Int, Int, Int) -> Int -> Bool
binarySearch (vec, s, e) a
  | v == a = True
  | s >= e = False
  | v >  a = binarySearch (vec, s, n - 1) a
  | v <  a = binarySearch (vec, n + 1, e) a
  where
    n = div (s + e) 2
    v = vec V.! n

main :: IO ()
main = do
  _ <- getLine
  s <- map read . words <$> getLine
  _ <- getLine
  t <- map read . words <$> getLine
  let vec = V.fromList s
  let ans = length $ filter (binarySearch (vec, 0, length s - 1)) t
  print ans



Measured memory_bytes: 110104
# ENV[Z = 'RUBY_THREAD_VM_STACK_SIZE'] || exec( { Z => '50000000' },'ruby',$0)
# readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }
k = gets.to_i
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]
puts a[k - 1]


Measured memory_bytes: 1788
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if (a < b) {
      System.out.println("a < b");
    } else if (a > b) {
      System.out.println("a > b");
    } else {
      System.out.println("a == b");
    }
  }
}

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

int main(){
	int n,t,a;
	cin>>n>>t>>a;
	
	double dt = INT_MAX;
	int idx = 0;	
	for(int i = 0; i < n; i++){
		int tmp;cin>>tmp;
		if(dt>abs(a-(t-tmp*0.006))){
			dt = abs(a-(t-tmp*0.006));
			idx = i;
		}
	}
	cout<<idx+1<<endl;
}

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


using namespace std;

const ll mod = 1e9 + 7;
	

int main()
{

	int n;
	cin >> n;

	int ALL_WOMEN = (1<<n);
	vector<ll> dp(ALL_WOMEN);
	int a[200][200];

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


	//memset(dp, 0, sizeof(dp));

	dp[0] = 1;
	for (int mask = 0; mask < ALL_WOMEN - 1; mask++)
	{
		int i = __builtin_popcount(mask); //how many bits have

		for (int j = 0; j < n; j++)
		{
			if(a[i][j] == 1 && !(mask&(1<<j)))
			{
				int m2 = mask^(1<<j);
				dp[m2] = (dp[m2] + dp[mask]) % mod;
			}

		}

	}

	cout << dp[ALL_WOMEN-1] << endl;







    return 0;
}

Measured memory_bytes: 19608
# -*- coding: utf-8 -*-
"""
Created on Sat Oct  6 14:05:15 2018

@author: rgraptin
"""

params = input()

n = int(params.split(' ')[0])
t = int(params.split(' ')[1])

data = []

for i in range(0, n) :
    d = input()
    data.append([int(d.split(' ')[0]),int(d.split(' ')[1])])
    
minimum_cost = 1000000
    
for cost in data :
    if cost[1] <= t : 
        
        if cost[0] < minimum_cost :
            minimum_cost = cost[0]

if minimum_cost == 1000000:
    print ("TLE")
else :
    print (minimum_cost)

Measured memory_bytes: 3064
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
using namespace std;

int main(void){
    int n;
    scanf("%d", &n);

    vector<int> v1;

    for(int i = 0; i < n; i++){
        int num;
        scanf("%d", &num);
        v1.push_back(num);
    }
    sort(v1.begin(), v1.end());

    int n_ = v1[n - 1];
    int diff = 1000000001;
    int index;
    for(int i = 0; i < n; i++){
        if(diff > abs(n_ - v1[i] * 2)){
            diff = abs(n_ - v1[i] * 2);
            index = i;
        }
    }

    printf("%d %d\n", n_, v1[index]);

    return 0;

}



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

class Program
{
    private static readonly Scanner sc = new Scanner();
    static void Main(string[] args)
    {
        int x = sc.Int;
        int y = sc.Int;

        int[] g1 = new int[] {1,3,5,7,8,10,12};
        int[] g2 = new int[] {4,6,9,11};

        int gx = 0;
        int gy = 0;

        foreach(var e in g1)
        {
            if (e == x)
                gx = 1;
            if (e == y)
                gy = 1;
        }

        foreach(var e in g2)
        {
            if (e == x)
                gx = 2;
            if (e == y)
                gy = 2;
        }

        if (gx == gy)
            Console.WriteLine("Yes");
        else
            Console.WriteLine("No");
    }
}

class Scanner
{
    private string[] _str = new string[0];
    private int _i;

    public string Line { get { return Console.ReadLine(); } }

    public string Str
    {
        get
        {
            if (_i >= _str.Length)
            {
                _str = Line.Split(' ');
                _i = 0;
            }
            return _str[_i++];
        }
    }

    public string[] StrArr { get { return Line.Split(' '); } }
    public int Int { get { return int.Parse(Str); } }
    public int[] IntArr { get { return Line.Split(' ').Select(int.Parse).ToArray(); } }
    public long Long { get { return long.Parse(Str); } }
    public long[] LongArr { get { return Line.Split(' ').Select(long.Parse).ToArray(); } }
    public double Double { get { return double.Parse(Str); } }
    public double[] DoubleArr { get { return Line.Split(' ').Select(double.Parse).ToArray(); } }
}

Measured memory_bytes: 11092
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var N = nextInt();
  for(var i = 0; i < 100; i++){
    for(var j = 0; j < 100; j++){
      if((4 * i + 7 * j) == N){
         myout("Yes");
        return;
      }
    }
  }
  myout("No");
}

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

typedef long long int ll;

int main(void){
    // Your code here!
    int n,m;
    cin>>n>>m;
    if(n>m){
        swap(n,m);
    }
    for(int i=0;i<m;i++){
        cout<<n;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int h, w;
	cin >> h >> w;
	
	vector<string> a(h);
	for(int i = 0; i < h; ++i) {
		cin >> a[i];
	}
	
	int cnt = 0;
	for(int i = 0; i < h; ++i) {
		for(int j = 0; j < w; ++j) {
			if( a[i][j] == '#' ) cnt++;
		}
	}
	
	if( cnt == h + w - 1 ) cout << "Possible" << endl;
	else cout << "Impossible" << endl;
	
	return 0;
}


Measured memory_bytes: 3612