akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
priority_queue<long long>que;
int main() {
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		long long tmp;
		cin >> tmp;
		que.push(tmp);
	}
	for (int i = 0; i < m; i++) {
		long long tmp = que.top();
		que.pop();
		que.push(tmp / 2);
	}
	long long ans = 0;
	for (int i = 0; i < n; i++) {
		ans += que.top();
		que.pop();
	}cout << ans << endl;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int x[4]={};
    string s[n];
    for(int i=0;i<n;i++){
        cin>>s[i];
        if(s[i][0]=='A')x[0]++;
        if(s[i][0]=='W')x[1]++;
        if(s[i][0]=='T')x[2]++;
        if(s[i][0]=='R')x[3]++;
    }
    cout<<"AC x "<<x[0]<<endl;
    cout<<"WA x "<<x[1]<<endl;
    cout<<"TLE x "<<x[2]<<endl;
    cout<<"RE x "<<x[3]<<endl;
    return 0;
}

Measured memory_bytes: 6720
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define reps(i,n) for (int i=1;i<=(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rreps(i,n) for (int i=(n);i>0;i--)
#define all(v) (v).begin(),(v).end()
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>
template<class T> inline bool chmin(T &a, T b) {if (a>b) {a = b; return 1;} return 0;};
template<class T> inline bool chmax(T &a, T b) {if (a<b) {a = b; return 1;} return 0;};
typedef long long int ll;
const long long INF = 1LL << 60;

int main(){
  ll N, D; cin >> N >> D;
  ll x[N], y[N];
  rep(i,N) cin >> x[i] >> y[i];

  int ans = 0;
  rep(i,N){
    ll d2 = x[i]*x[i] + y[i]*y[i];
    if (d2<=D*D) ans++;
  }
  cout << ans << endl;
  //cout << fixed << setprecision(10);
  
  return 0;
}


Measured memory_bytes: 6736
#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define INF 1000000007
using namespace __gnu_pbds;
using namespace std;

int n,_n,cnt,a[200010],ans[200010],dat[800010];
vector<int> v[200010];
map<int,int> mp,pm;

inline void init(int x)
{
	_n=1;
	while(_n<x) _n*=2;
	for(int i=1;i<=_n*2;i++) dat[i]=0;
}

inline void update(int k,int val)
{
	k+=_n-1;
	dat[k]=val;
	while(k>1){
		k=k/2;
		dat[k]=max(dat[k*2],dat[k*2+1]);
	}
}

inline int query(int a,int b,int k,int l,int r)
{
	if(r<a||b<l) return -INF;
	if(a<=l&&r<=b) return dat[k];
	int mid=(l+r)/2;
	int vl=query(a,b,k*2,l,mid);
	int vr=query(a,b,k*2+1,mid+1,r);
	return max(vl,vr);
}

inline void dfs(int x,int pr)
{
	ans[x]=query(1,a[x]-1,1,1,_n)+1;
	int now=query(a[x],a[x],1,1,_n);
	update(a[x],ans[x]);
	if(pr!=-1) ans[x]=max(ans[x],ans[pr]);
	for(int i=0;i<v[x].size();i++) if(v[x][i]!=pr){
		int u=v[x][i];
		dfs(u,x);
	}
	update(a[x],now);
}

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i],mp[a[i]]=1;
	cnt=1;
	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++){
		cnt++;
		pm[it->first]=cnt;
	}
	init(cnt);
	for(int i=1;i<=n;i++) a[i]=pm[a[i]];
	for(int i=1;i<n;i++){
		int x,y;cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x); 
	}
	dfs(1,-1);
	for(int i=1;i<=n;i++) cout<<ans[i]<<'\n';
	return 0;
}

Measured memory_bytes: 54100
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    string s;
    cin>>s;
    int A,Z;
    rep(i,s.size()) {
        if(s.at(i)=='Z') {
            Z=i;
        }
    }
    rep(i,s.size()) {
        if(s.at(i)=='A') {
            A=i;
            break;
        }
    }
    cout<<Z-A+1<<endl;
}

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



int main()
{   
    int x;
    
    for (int i = 1; ; i++)
    {   
        cin >> x;
        if(x == 0) break;
        cout << "Case " << i << ": " << x << endl;
    }
    
    
    
    return 0;


}



Measured memory_bytes: 3076
#include <iostream>
#include <map>
#include <string>

int N;

int main() {
  std::cin >> N;
  std::map<std::string, int> freq;
  for (int i = 0; i < N; ++i) {
    std::string s;  std::cin >> s;
    freq[s]++;
  }

  std::cout << "AC x " << freq["AC"] << "\n";
  std::cout << "WA x " << freq["WA"] << "\n";
  std::cout << "TLE x " << freq["TLE"] << "\n";
  std::cout << "RE x " << freq["RE"] << "\n";

  return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector< int > d(n);
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            ans += d[i] * d[j];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp>
//#include <functional> // for less
#define PI acos(-1.0)
#define eps 1e-9
#define ll long long
#define ull unsigned long long
#define nl printf("\n")
#define sf scanf
#define pf printf
#define INF (ll)1e15
#define mod 1000000007

///#define isValid(n,m,nx,ny)nx>=0&&nx<n&&ny>=0&&ny<m
///int kx[]={1, 1, -1, -1, 2, 2, -2, -2}; //knight moves
///int ky[]={2,-2,  2, -2, 1,-1,  1, -1}; //knight moves
///int dx[]={1,-1,0,0,1,-1,1,-1};//eight direction
///int dy[]={0,0,1,-1,1,-1,-1,1};//eight direction
 
///using namespace __gnu_pbds;
using namespace std;
 
///inline double toRad(double deg){return deg*PI/180;}
///inline double toDeg(double rad){return rad*180/PI;}
///typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
 
const int S=123456;
int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt","r",stdin);
    #endif
    string s;
    while(cin>>s)
    {
        int l=0;
        for(int i=0;i<s.size();i++)
        {
            if(s[i]=='A')
            {
                l=i;
                break;
            }
        }

        int r=0;
        for(int i=s.size()-1;i>=0;i--)
        {
            if(s[i]=='Z')
            {
                r=s.size()-i-1;
                break;
            }
        }
        pf("%d\n",s.size()-l-r);
    }
    return 0;
}
 









 




























Measured memory_bytes: 640
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())


void print(int x) {
	for (int i = 7; i >= 0; i--)
		cout << (x >> i & 1);
}


#define MOD 1000000007

int dp[61][2][2][2];


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

	long long L, R;
	cin >> L >> R;


	dp[0][0][0][0] = 1;
	rep(i, 60) {
		rep(fs, 2)rep(fl, 2)rep(f1,2)if (dp[i][fs][fl][f1]) {

			rep(yb, 2) rep(xb, 2) {
				if (fs == 0 && yb > (R >> 59 - i & 1) 
					|| fl == 0 && xb < (L >> 59 - i & 1)
					|| f1 == 0 && xb != yb
					|| xb > yb) {
					continue;
				}

				(dp[i + 1][fs || yb < (R >> 59 - i & 1)][fl || xb > (L >> 59 - i & 1)][f1 || xb] += dp[i][fs][fl][f1] ) %= MOD;

			}
		}
	}



	long long ans = 0;
	rep(fs, 2)rep(fl, 2)ans += dp[60][fs][fl][1];

	cout << ans % MOD << endl;
	

	return 0;
}

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

int main(){
    string s; cin >> s;
    int f;
    if(s[0] == 'W'){f = 0;}
    else{f = 1;}
    int ans = 0;
    for(int i = 0; i < s.size(); i++){
        if(f == 0 && s[i] == 'B'){
            ans++;
            f = 1;
        }else if(f == 1 && s[i] == 'W'){
            ans++;
            f = 0;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

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

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int l[n];
  for(int i=0; i<n; i++) cin >> l[i];
  sort(l, l+n, cmp);
  int ans = 0;
  for(int i=0; i<k; i++) ans += l[i];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <vector>
const int inf = 1000000000;
using namespace std;
int main(){
  int x; cin >> x;
  cout << ( x/100 == (x%100)%10 ? "Yes":"No" ) << endl;
}

Measured memory_bytes: 256
n=gets.to_i
a=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)

oneans = a.sort.zip(b.sort)
if oneans.any?{|ai,bi|ai>bi}
  puts "No"
  exit
end

if oneans.each_cons(2).any?{|(a1,b1),(a2,b2)|b1>=a2}
  puts "Yes"
  exit
end

l=a.zip(b).sort_by{|ai,bi|bi}
a2 = l.map.with_index{|(ai,bi),i|[ai,i]}.sort

cnt = 1
i = 0
until a2[i][1] == 0
  i = a2[i][1]
  cnt += 1
end

puts cnt == n ? "No" : "Yes"

Measured memory_bytes: 22812
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;
const ll INF = 1001001001;

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

  cout << (b % a == 0 ? a + b : b - a);
  return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(){

int n;
int i;

scanf("%d", &n);

int array[n];

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

for ( i = 0; i < n - 1 ; i++){
        printf("%d ", array[n-1-i]);
}
        printf("%d\n", array[0]);
return 0;
}

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

using namespace std;

string s, t;
int dp[3005][3005];
//뒤에서부터

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>s>>t;
    int sl = s.length(), tl = t.length();
    for(int i=0;i<sl;i++){
        for(int j=0;j<tl;j++){
            dp[i+1][j+1] = max(dp[i][j+1], max(dp[i+1][j], dp[i][j]+(s[i]==t[j])));
        }
    }
    int find = dp[sl][tl];
    string ans;
    for(int i=sl;i>0;i--){
        for(int j=tl;j>0;j--){
            if(dp[i][j] == find && dp[i-1][j] == find -1 && dp[i-1][j-1] == find-1 && dp[i][j-1] == find-1){
                find--;
                ans = s[i-1] + ans;
                break;
            }
        }
    }
    cout<<ans;

    return 0;
}

Measured memory_bytes: 35456
N = int(input())
a = list(map(int,input().split()))
    
count = 0
flag = True
while flag:
    for i in range(N):
        if a[i] % 2 ==0:
            a[i] = a[i] / 2
        else:
            flag = False
            break
    if flag:
        count = count + 1

print(count)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

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

		int ans = c - (a - b);

		if (ans <= 0) {
			System.out.println(0);
		} else {
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 21844
def array_integer(a)
	0.upto(a.count) {|x|
		a[x] = a[x].to_i
	}
	return a
end

x,y = STDIN.gets.chomp.split(' ')
x = x.to_i
y = y.to_i

if y > x then
	v = x
	x = y
	y = v
end

while x % y != 0
	v = x % y
	x = y
	y = v
end

print y, "\n"



Measured memory_bytes: 8864
#include <iostream>
#include <cstdio>

using namespace std;

long long a, b;
long long ans;

int main()
{
    scanf("%lld%lld", &a, &b);
    a--;
    if(a % 2 == 0) ans ^= a;
    ans ^= ((a + 1) / 2 % 2);
    if(b % 2 == 0) ans ^= b;
    ans ^= ((b + 1) / 2 % 2);
    printf("%lld", ans);
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	static boolean isPrime(int n) {
		for(int i = 2; i*i <= n; i++) {
			if(n%i == 0) return false;
		}
		return true;
	}

	public static void main(String[] args) throws IOException {
		ReaderWriter r = new ReaderWriter(); 	// Class to read/write input.
		String ans = "";			// Final answer to be printed.

		int n = r.rInt();		// Number of elements.
		int count = 0;
		for(int i = 0; i < n; i++) {
			if(isPrime(r.rInt())) count++;
		}

		ans += count;

		// Outputs final answer.
		r.pAns(ans);
		r.out.close();
	}


}

class ReaderWriter {
	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;

	public ReaderWriter() {
		// br = new BufferedReader(new FileReader("in.txt"));
		// out = new PrintWriter(new FileWriter("out.txt"));
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(new OutputStreamWriter(System.out));
	}

	String next() throws IOException  {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}

	long rLong() throws IOException  {
		return Long.parseLong(next());
	}

	int rInt() throws IOException  {
		return Integer.parseInt(next());
	}

	int[] rIntArray(int n) throws IOException  {
		int[] ret = new int[n];
		for(int i = 0; i < n; i++) {
			ret[i] = rInt();
		}
		return ret;
	}

	double rDouble() throws IOException  {
		return Double.parseDouble(next());
	}

	char rChar() throws IOException  {
		return next().charAt(0);
	}

	String rLine() throws IOException  {
		return br.readLine().trim();
	}

	String wArray(int[] a) throws IOException {
		if(a == null || a.length == 0) {
			return "";
		}
		String ret = "" + a[0];
		for(int i = 1; i < a.length; i++) {
			ret = ret + " " + a[i];
		}
		ret = ret + "\n";
		return ret;
	}

	void pAns(String ans) {
	//	if(ans.charAt(ans.length()-1) == '\n')
	//		ans = ans.substring(0,ans.length()-1);
		System.out.println(ans);
	}
}




Measured memory_bytes: 31044
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>

#define max 10

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}

int main()
{
    int l, r;
    
    scanf("%d", &r);
    
    printf("%d", 3*(int)pow(r, 2));
     
    return 0;
}





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

int N, a[200005];

signed main(){
  
  cin >> N;
  
  int X = 0;
  
  for(int i=0;i<N;i++){
    cin >> a[i];
    X ^= a[i];
  }

  for(int i=0;i<N;i++){
    if( i ) cout << ' ';
    cout << ( X ^ a[i] );
  }

  cout << endl;
  
  return 0;
}


Measured memory_bytes: 5188
#include<iostream>

using namespace std;

int main(){
  int n, m;

  while(cin >> n >> m && n+m){
    int status = 0;
    int taro[n], hana[m];
    int sumt = 0, sumh = 0;
    for(int i = 0; i < n; i++){
      cin >> taro[i];
      sumt += taro[i];
    }
    for(int i = 0; i < m; i++){
      cin >> hana[i];
      sumh += hana[i];
    }
    int sum = sumt - sumh;
    int t = 100, h = 100;

    for(int i = 0; i < n; i++){
      for(int j = 0; j < m; j++){
	if((taro[i] - hana[j]) *2 == sum && t+h > taro[i] + hana[j]){
	  t = taro[i];
	  h = hana[j];
	  status = 1;
	}
      }
    }
    
    if(!status) cout << "-1" << endl;
    else cout << t<<" " << h << endl;
  }
  return 0;
}

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

using namespace std;

using I = long long;
static constexpr size_t L = 2;
static constexpr I bs[L] = {1007, 2009};
static constexpr I ms[L] = {1000000007, 1000000009};
class RollingHash {
    using T = pair<I, I>;

    vector<I> hs[L], pws[L];
    
    public:
    RollingHash(const string &s) {
        size_t n = s.size();
        for(size_t i=0; i<L; i++) {
            hs[i].assign(n+1, 0);
            pws[i].assign(n+1, 0);
            pws[i][0] = 1;
            for(size_t j=0; j<n; j++) {
                pws[i][j+1] = (pws[i][j]*bs[i]) % ms[i];
                hs[i][j+1] = (hs[i][j]*bs[i] + s[j]) % ms[i];
            }
        }
    }

    // [l, r)
    inline T hash(size_t l, size_t r) const {
        return {
            (((hs[0][r] - hs[0][l] * pws[0][r-l]) % ms[0]) + ms[0]) % ms[0],
            (((hs[1][r] - hs[1][l] * pws[1][r-l]) % ms[1]) + ms[1]) % ms[1],
        };
    }
};

int main(void) {
    long n;
    cin >> n;
    string s;
    cin >> s;

    RollingHash rh(s);

    long ok = 0, ng = n;
    while(ng - ok > 1) {
        long m = (ok+ng)/2;

        for(int i=0; i+m<=n; i++) {
            for(int j=i+m; j+m<=n; j++) {
                if(rh.hash(i, i+m) == rh.hash(j, j+m))
                    goto ok;
            }
        }
        ng = m;
        continue;
ok:
        ok = m;
    }

    cout << ok << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
int main(void){
    int n,min,max;
    long long sum;
    sum=0;
    int a[10010];
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a,a+n);
    min=a[0];
    max=a[n-1];
    for(int i=0;i<n;i++){
        sum=sum+a[i];
    }
    cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3192
package main

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

func wordScanner() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	return sc
}

func get_int(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func format(nums []int) string {
	s := fmt.Sprint(nums)
	return s[1 : len(s)-1]
}

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n-1)
	bs := make([]int, n-1)
	cs := make([]int, n)
	sc := wordScanner()
	for i := range as {
		as[i] = get_int(sc)
		bs[i] = get_int(sc)
	}
	for i := range cs {
		cs[i] = get_int(sc)
	}

	g := make([][]int, n)
	for i := range cs {
		g[i] = make([]int, 0)
	}
	for i, a := range as {
		b := bs[i]
		g[a-1] = append(g[a-1], b-1)
		g[b-1] = append(g[b-1], a-1)
	}

	ds := make([]int, n)
	for i, l := range g {
		ds[i] = len(l)
	}

	q := make([]int, n)
	q_in := 0
	q_out := 0
	for i, d := range ds {
		if d == 1 {
			q[q_in] = i
			q_in++
		}
	}

	sort.Ints(cs)
	ans := make([]int, n)
	for q_out < n {
		node := q[q_out]
		ans[node] = cs[q_out]
		for _, neigh := range g[node] {
			ds[neigh]--
			if ds[neigh] == 1 {
				q[q_in] = neigh
				q_in++
			}
		}
		q_out++
	}

	score := 0
	for i, a := range as {
		b := bs[i]
		score += min(ans[a-1], ans[b-1])
	}
	fmt.Println(score)
	fmt.Println(format(ans))
}


Measured memory_bytes: 2560
while True:
    n, x = map(int, input().split())

    if n == x == 0:
        break

    cnt = 0

    for i in range(1, n + 1):
        for j in range(1, n + 1):
            
            if i <= j:
                break

            for k in range(1, n + 1):
                
                if j <= k:
                    break
                
                if i + j + k == x:
                    cnt += 1
    
    print(cnt)



Measured memory_bytes: 5596
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def TUPLE(): return tuple(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

A, B, C = MAP()
K = INT()

cnt = 0
while A >= B:
	B *= 2
	cnt += 1

while B >= C:
	C *= 2
	cnt += 1

if cnt <= K:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 10564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef long double ld;

ll inv(ll a, ll b){
    return (a > 1 ? b - inv(b%a, a)*b/a : 1);
}

#define rc(s) return cout << s, 0
#define fi first
#define se second
#define L (nod << 1)
#define R (L | 1)
#define smax(X, Y) ((X) > (Y) ? (X) : (Y))
#define smin(X, Y) ((X) < (Y) ? (X) : (Y))
#define N 110

const ld e = 2.71828182845904523536028747;
const ld PI = 3.14159265359;
const ll inf = (1LL<<62);
const int iinf = (1<<30);

int n;
struct lol{
    string s;
    int x, id;
    bool operator<(const lol &aux)const{
        return (s < aux.s || (s == aux.s && x > aux.x));
    }
} a[N];

int main(){
    cin >> n;
    for (int i=1; i<=n; i++) cin >> a[i].s >> a[i].x, a[i].id = i;
    sort(a+1, a+1+n);
    for (int i=1; i<=n; i++) cout << a[i].id << '\n';
    return 0;
}


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

int main(){
	int D; cin >> D;
	string out;
	if (D == 22)
	{out = "Christmas Eve Eve Eve";}
	else if (D == 23)
	{out = "Christmas Eve Eve";}
	else if (D == 24)
	{out = "Christmas Eve";}
	else if (D == 25)
	{out = "Christmas";}
	
	cout << out << endl;
	return 0;
}


Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7; //924844033 1000000000 + 9;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum[500], ans, a[220000], b[220000], dp[500][500];
string str, ss;
bool f[220000];
char c[4000][4000];
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge {
	LL from, to, cost;
};
vector<vector<Edge>>vec,rvec;
vector<edge>ed;
vector<LL>v;
map<string, LL>ma;
set<LL>st;

void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
LL func(int l, int r) {
	if (l == r)return dp[l][r]=0;
	if (dp[l][r] != -1)return dp[l][r];
	LL res =INF;
	for (int i = l; i < r; i++) {
		res = min(res, func(l, i)+ func(i + 1, r));
	}
	return dp[l][r] = res + sum[r+1] - sum[l];
}
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		sum[i + 1] += a[i] + sum[i];
	}
	rep(i, n)rep(j, n)dp[i][j] = -1;
	cout << func(0, n - 1) << endl;
	return 0;
}


Measured memory_bytes: 6400
#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
using namespace std;
typedef complex<double> Point;

Point rot(Point p, Point center) {
	p -= center;
	p *= Point(0, 1);
	p += center;
	return p;
}

vector<Point> reverse(vector<Point> oresen) {
	int l = 0, r = oresen.size() - 1;
	while (l < r) {
		swap(oresen[l], oresen[r]);
		l++;
		r--;
	}
	return oresen;
}

bool isMatch(vector<Point> sen1, vector<Point> sen2) {
	if (sen1.size() != sen2.size()) return false;
	int n = sen1.size();
	int i;
	
	for (int dir = 0; dir < 4; dir++) {
		for (i = 0; i < n; i++) {
			sen2[i] = rot(sen2[i], sen2[0]);
		}
		
		Point diff = sen1[0] - sen2[0];
		for (i = 1; i < n; i++) {
			if (diff != sen1[i] - sen2[i]) {
				break;
			}
		}
		if (i == n) return true;
	}
	return false;
}

vector<Point> getOresen() {
	vector<Point> ret;
	
	int m;
	cin >> m;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		ret.push_back(Point((double)x, (double)y));
	}
	return ret;
}

int n;
vector<Point> oresen[51];

int main() {
	while (cin >> n) {
		if (n == 0) break;
		for (int i = 0; i <= n; i++) oresen[i] = getOresen();
		for (int i = 1; i <= n; i++) {
			if (isMatch(oresen[0], oresen[i]) || isMatch(oresen[0], reverse(oresen[i]))) {
				cout << i << endl;
			}
		}
		cout << "+++++" << endl;
	}
	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;
typedef pair <ll, int> P;
const ll INF = 1LL << 60;

vector <ll> dijkstra(vector<vector<P>> &edge, int s) {
    vector <ll> dist(edge.size(), INF);
    priority_queue <P, vector<P>, greater<P>> q;
    q.push({0, s});
    dist[s] = 0;

    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int cur = p.second;
        ll cost = p.first;
        if (dist[cur] < cost) continue;
        for (P nxt : edge[cur]) {
            int next_node = nxt.second;
            ll cost_sum = cost + nxt.first;
            if (dist[next_node] > cost_sum) {
                dist[next_node] = cost_sum;
                q.push({cost_sum, next_node});
            }
        }
    }

    return dist;
}


// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A&lang=jp
void AOJ_GLR_1_A() {
    int V, E, r;
    cin >> V >> E >> r;

    vector<vector<P>> edge(V);
    for (int i = 0; i < E; i++) {
        int s, t;
        ll d;
        cin >> s >> t >> d;
        edge[s].push_back({d, t});
    }

    vector <ll> dist = dijkstra(edge, r);
    for (ll d : dist) {
        if (d == INF) {
            cout << "INF\n";
        } else {
            cout << d << "\n";
        }
    }
}

int main() {
    AOJ_GLR_1_A();
    return 0;
}


Measured memory_bytes: 19332
H,W=map(int,input().split())
while(H,W)!=(0,0):
    
    for i in range(H):
        for j in range(W):
            if i==0 or i==H-1 or j==0 or j==W-1:
                print('#',end='')
            else:
                print('.',end='')
        print()
    print()
    H,W=map(int,input().split())


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

int main()
{
  char bb[4];
  int aa[4], tmp;
  for(int ii = 0;ii < 4;ii++)
  {
    scanf("%1d", &aa[ii]);
  }
  for(int bit = 0;bit < (1 << 3);bit++)
  {
    tmp = aa[0];
    for(int ii = 0;ii < 3;ii++)
    {
      if(bit & (1 << ii))
      {
        tmp -= aa[ii + 1];
        bb[ii] = '-';
      }
      else
      {
        tmp += aa[ii + 1];
        bb[ii] = '+';
      }
    }
    if(tmp == 7)
    {
      for(int ii = 0;ii < 3;ii++)
      {
        printf("%d%c", aa[ii], bb[ii]);
      }
      printf("%d=7\n", aa[3]);
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {

    double R; cin >> R;
    R *= 2 * M_PI;
    cout << R << endl;

    return 0;
}

Measured memory_bytes: 3780
A,B,C,D = map(int,input().split())
#print(A,B,C,D)
def judge(A,B,C,D):
    while(True):
        C = C-B
        A = A - D
        if C<=0:
            return 1
            break
        elif A<=0:
            return 0
            break
if judge(A,B,C,D)==1:
    print("Yes")
else:
    print("No")



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

int main() {

  int A;
  cin >> A;
  
  char op;
  cin >> op;
  
  int B;
  cin >> B;
  
  int ans;
  
  if (op=='+'){
  	ans = A + B;
  }
  
  if (op=='-'){
  	ans = A - B;
  }
  
  cout << ans << endl;
}



Measured memory_bytes: 256
sq = list(map(int, input().split()))
sq.sort()

if sq[0] == 1 and sq[1] == 1:
    print(1)
elif sq[0] == 1:
    print(sq[1] - 2)
elif sq[0] == 2:
    print(0)
else:
    print((sq[0] - 2) * (sq[1] - 2))

Measured memory_bytes: 3060
N, M = map(int, input().split())
c = 0
d = 0
for _ in range(min(M, 1000)):
    a, b = map(int, input().split())
    d += a * 5 + b * 7
    c += a * 2 + b * 3
    d %= 100
    c %= 100
if c * 100 + d in [15, 238, 639, 1008, 1870, 2773, 3072, 3622, 4911, 4939, 5062, 5915, 6158, 6669, 7997, 8237, 8289, 9023, 9120, 9182, 9863, 9992]:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3064
//https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/2/DSL_2_A

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

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

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

typedef struct segtree{
	int n;
	vector<int> a;
	segtree(){};
	segtree(int n){init(n);};

	void init(int n_){
		n = 1;
		while(n<n_)n*=2;
		a.resize(2*n-1,INT_MAX);
	}

	void update(int pos,int x){
		pos += n-1;
		a[pos]=x;
		while(pos>0){
			pos = (pos-1)/2;
			a[pos] = min(a[2*pos+1], a[2*pos+2]);
		}
	}

	int findMinValue(int ll,int rr){
		int vl=INT_MAX,vr=INT_MAX;
		for (int l=ll+n, r=rr+n ; l<r ; l=(l>>1),r=(r>>1)){
			if(l&1) vl=min(vl,a[l-1]),l++;
			if(r&1) r--,vr=min(vr,a[r-1]);
		}
		return min(vl,vr);
	}

}segtree;

int main()
{
	int n,q;
	cin>>n>>q;
	segtree seg(n);
	rep(qq,q){
		int query,x,y;
		cin>>query>>x>>y;
		if(query==0)seg.update(x,y);
		else cout<<seg.findMinValue(x,y+1)<<endl;
	}
	return 0;
}


Measured memory_bytes: 3880
n,r,k,m[101][101],t[101];i,j,s,d,V,v,f;main(){scanf("%d",&n);for(i=0;i<n;i++){scanf("%d%d",&r,&k);for(;k--;m[r][d]=1)scanf("%d",&d);}scanf("%*d");for(;~scanf("%d%d%d",&s,&d,&V);){memset(t,0,sizeof(t));t[s]=v=V;f=1;while(f&&!t[d]&&--v>0){f=0;for(i=1;i<=n;i++)if(t[i]==v+1)for(j=1;j<=n;j++)if(m[i][j]&&!t[j])t[j]=v,f=1;}t[d]?printf("%d\n",V-t[d]+1):puts("NA");}}

Measured memory_bytes: 0
#include<stdio.h>

/* 履歴(上が最新)
・scanfだと入力終了判定ができない可能性に配慮して
  fgets と sscanf を使うようにした
・問題文の解釈ミスってたので修正(データセットの意味を取り違えていた) → TLE
・wikipediaの解説に従って組んでみた → TLE
・------- わからないので調べた エラストレネスのふるい を使ってみる --------
・IsPrimeWithCache をシンプルに(処理の順序を変えたらif一個で済んだ) → TLE
・キャッシュサイズを算出できてなかったのを修正
  sizeof(array) じゃなくて sizeof(array)/sizeof(int) だよね。
・ちょっとセコイかもだが, あらかじめ計算しといたデータを使って高速化(キャッシュサイズは適当) → TLE
・入力受付をfgetsとsscanfからscanfにして高速化 → TLE
・試し割り法を導入 → TLE
*/

#define MAX 1000000
char searchlist[MAX]; //探索リスト…要素iの値が1なら, 数値iは探索リスト内にある
char primelist[MAX]; //素数リスト…要素iの値が1なら, 数値iは素数リスト内にある

int main(){
  //int size; //与えられるデータセットのサイズ
  char line[80]; //入力行
  int n; //現在読み込んだデータの値
  int i,j; //カウンタ変数
  int count; //素数の数
  int index = 2; //探索リストの先頭を表すインデックス
  int max_search = MAX-1; //探索リストの最大値
  int max_prime = 2; //素数リストの最大値

  //配列を初期化
  for(i=index ; i<MAX ; i++){
    searchlist[i] = 1;
    primelist[i] = 0;
  }
  
  //エラストテレスのふるいを適用する
  for(i=index ; i<MAX ; ){
    //探索リストの先頭の数を素数リストへ
    primelist[i] = 1;
    
    //素数リストに加えた数の全ての倍数を、探索リストから削除する
    for(j=i ; j<MAX ; j+=i){
      searchlist[j] = 0;
    }
    
    //素数リストの最大値を更新する
    max_prime = i;
    
    //探索リストの最大値を更新する
    for(j=max_search ; searchlist[j]==0 ; j--)
      ;
    max_search = j;
    
    //探索リストの最大値が素数リストの最大値の平方よりも小さい場合、
    //素数リストおよび探索リストに残っている数が素数となる
    if(max_search < max_prime*max_prime){
      break;
    }
    
    //探索リストの最大値が素数リストの最大値の平方よりも大きい場合、
    //次の探索リストの先頭から上記ステップを継続する。
    //探索リストの先頭インデックスを更新する
    for(j=index ; searchlist[j]==0 ; j++)
      ;
    i = j;
    
  }
  
  //適用したデータから素数を作る
  for(i=0 ; i<MAX ; i++){
    primelist[i] |= searchlist[i];
  }

  /*
  //問題文の解釈ミスってた
  //データセット1の要素数n1, データセットの要素1, … 要素n1, データセット2の要素数n2, …
  //↑こうだと思ってた
  
  // 入力データ読み込み
  // 最初にデータセットの個数が与えられる
  while(scanf("%d", &size)){
    //与えられた個数だけ入力を受け付ける
    for(i=0 ; i<size ; i++){
      scanf("%d", &n);
      
      //素数を素数リストから数える
      count = 0;
      for(j=n ; j>1 ; j--){
        if(primelist[j] == 1)
          count++;
      }
      
      //数えた結果を表示
      printf("%d\n",count);
    }
  }
  */

  /*
  //これでもダメ
  //scanfが入力終了を判定できないんかもしれん
  
  // 入力データ読み込み
  while(scanf("%d", &n)){
    //素数を素数リストから数える
    count = 0;
    for(j=n ; j>1 ; j--){
      if(primelist[j] == 1)
        count++;
    }
    
    //数えた結果を表示
    printf("%d\n",count);
  }
  */
  
  while(fgets(line, sizeof(line), stdin) != NULL){
    sscanf(line, "%d", &n);
    //素数を素数リストから数える
    count = 0;
    for(j=n ; j>1 ; j--){
      if(primelist[j] == 1)
        count++;
    }
    
    //数えた結果を表示
    printf("%d\n",count);
  }
  

  return 0;
}

Measured memory_bytes: 2556
#include <bits/stdc++.h>
#define re return
#define ll long long
using namespace std;
ll n,b,c,a[51],dp[51][5000],p;
ll solve (int i,int sum){
   if (i==n){
    if (sum%2==p)re 1;
    re 0;
   }
   if (dp[i][sum]!=-1)re dp[i][sum];
   re dp[i][sum]=solve(i+1,sum)+solve(i+1,sum+a[i]);
}
int main(){
     cin>>n>>p;
     memset(dp,-1,sizeof(dp));
     for (int i=0;i<n;++i)cin>>a[i];
     cout<<solve(0,0);
    re 0;
}


Measured memory_bytes: 2176
N = int(input())

MAX = 200000;
NEVER_T = (MAX + 1) * 10;

planesH = [[] for _ in range(MAX + 1)]
planesV = [[] for _ in range(MAX + 1)]
planes45 = [[] for _ in range(MAX * 2 + 1)]
planes135 = [[] for _ in range(MAX * 2 + 1)]

for _ in range(N):
	X, Y, U = input().strip().split()
	X = int(X)
	Y = int(Y)
	planes45[MAX + X - Y].append((X, U));
	planes135[X + Y].append((X, U));
	if U == 'U' or U == 'D':
		planesV[X].append((Y, U));
	else:
		planesH[Y].append((X, U));

def search(group, U1, U2, minT, t):
	last = -1;
	for plane in group:
		U = plane[1]
		if U == U1:
			last = plane[0]
		elif U == U2:
			if last >= 0:
				T = (plane[0] - last) * t
				if minT > T:
					minT = T
	return minT

minT = NEVER_T
for group in planes45:
	if len(group) > 0:
		group.sort()
		minT = search(group, 'U', 'L', minT, 10);
		minT = search(group, 'R', 'D', minT, 10);

for group in planes135:
	if len(group) > 0:
		group.sort()
		minT = search(group, 'D', 'L', minT, 10);
		minT = search(group, 'R', 'U', minT, 10);

for group in planesH:
	if len(group) > 0:
		group.sort()
		minT = search(group, 'R', 'L', minT, 5);

for group in planesV:
	if len(group) > 0:
		group.sort()
		minT = search(group, 'U', 'D', minT, 5);


if minT < NEVER_T:
	print(minT)
else:
	print("SAFE")


Measured memory_bytes: 163360
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define INF 100000000000
#define all(x) (x).begin(),(x).end()
int main(){
  int A,B,Q;
  cin>>A>>B>>Q;
  vector<ll> S(A+2),T(B+2),X(Q);
  rep(i,A) cin>>S[i+1];
  rep(i,B) cin>>T[i+1];
  S[0]=T[0]=-INF;
  S[A+1]=T[B+1]=INF;
  rep(i,Q){
    cin>>X[i];
    ll SA=X[lower_bound(all(S),X[i])-X.begin()];
    ll SB=X[lower_bound(all(S),X[i])-X.begin()-1];
    ll TA=X[lower_bound(all(T),X[i])-X.begin()];
    ll TB=X[lower_bound(all(T),X[i])-X.begin()-1];
    ll L[4];
    L[0]=max(SA,TA)-X[i];
    L[1]=X[i]-min(SB,TB);
    L[2]=SA-TB+min(SA-X[i],X[i]-TB);
    L[3]=TA-SB+min(TA-X[i],X[i]-SB);
    sort(L,L+4);
    cout<<L[0]<<endl;
  }
}

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

int main() {
  int W, a, b;
  cin >> W >> a >> b;
  if (a + W < b) {
    cout << b - (a + W) << endl;
  } else if (b + W < a) {
    cout << a - (b + W) << endl;
  } else {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
<?php
  
fscanf(STDIN,"%d",$N);

$input = explode(" ",trim(fgets(STDIN)));

$n = max($input);

$r = 1;
$distance = $n-1;
foreach($input as $elem){
  $dist = abs($n/2-(int)$elem);
  if($dist <= $distance){
    $distance = $dist;
    $r = (int) $elem;
  }
}

echo "$n $r";

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

// @author: pashka

int main() {
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
#define out(n) cout << (n) << endl;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

int main(void)
{
    IOS
    int n; cin >> n;
    int tmp = n;
    int div = 0;

    while(tmp != 0) {
        div += tmp % 10;
        tmp /= 10;
    }

    ATYN(n % div == 0)

    return 0;
}

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

Measured memory_bytes: 580
n=gets.to_i
s=Array.new(4,0)
n.times do
  c=gets[0]
  case c
  when 'A'
    s[0]+=1
  when 'W'
    s[1]+=1
  when 'T'
    s[2]+=1
  when 'R'
    s[3]+=1
  end
end

print <<"EOS"
AC x #{s[0]}
WA x #{s[1]}
TLE x #{s[2]}
RE x #{s[3]}
EOS

Measured memory_bytes: 14348
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 100100)

	s := getString()
	Q := getInt()

	S := make([]byte, 100000*7)
	start := 300000
	end := start + len(s)
	for i := 0; i < len(s); i++ {
		S[i+start] = s[i]
	}

	rev := false
	for i := 0; i < Q; i++ {
		t := getInt()
		if t == 1 {
			rev = !rev
		} else {
			f, c := getInt(), getString()[0]
			if f == 1 {
				if rev == true {
					S[end] = c
					end++
				} else {
					start--
					S[start] = c
				}
			} else {
				if rev == true {
					start--
					S[start] = c
				} else {
					S[end] = c
					end++
				}
			}
		}
	}

	len := end - start
	ans := make([]byte, len)
	if rev == false {
		for i := 0; i < len; i++ {
			ans[i] = S[start+i]
		}
	} else {
		for i := 0; i < len; i++ {
			ans[i] = S[end-1-i]
		}
	}
	out(string(ans))
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int N;cin>>N;
    vector<int>A(N);
    int X=0,Y=0,Z=0;
    for(int i=0;i<N;i++){
        cin>>A[i];
        if(A[i]%4==0){
            X++;
        }
        else if(A[i]%2==0){
            Y++;
        }
        else{
            Z++;
        }
    }
    if(X>=Z){
        cout<<"Yes"<<endl;
        return 0;
    }
    if(X>=Z-1&&Y==0){
        cout<<"Yes"<<endl;
        return 0;
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
 
const ll mod=1000000007;
 
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
 
int test = 1;
const int N = 2e5+10;
 
long long int maxi[N];
vector<ll> size(N,1);
ll comp[N];
vector<ll> adj[N];
vector<int> vis(N);
 
void solve(){
 	long long int n;
 	cin >> n;
 	long long int sum = 0;
 	for(int i=1;i<=n;i++){
 		if(i%3==0 || i%5==0)
 			continue;
 		else sum+=i;
 	}
	cout << sum << endl;
}
 
 
int main() {
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt","r",stdin);
	// 	freopen("output.txt","w",stdout);
 
	// #endif
	// int t;cin >> t;while(t--)
	solve();
	
	}

Measured memory_bytes: 10240
using System;
using System.Linq;

namespace ConsoleApp8
{
	class Program
	{
		static void Main(string[] args)
		{
			Console.ReadLine();
			var array = Console.ReadLine().Split(' ').Select(v => int.Parse(v)).OrderByDescending(k => k).ToArray();
			int alice = 0;
			int bob = 0;
			for (int i = 0; i < array.Count(); i++)
			{
				if (i % 2 == 0)
				{
					alice += array[i];
				}
				else
				{
					bob += array[i];
				}
			}
			Console.WriteLine(alice - bob);
		}
	}
}


Measured memory_bytes: 13396
#include <cstdio>
typedef long long ll; 
ll pos[100005], cnt[100005], ans; 
void work(int l, int r, int s)
{
	if (pos[r] < s)
		ans += s - pos[l]; 
	else if (pos[l] > s)
		ans += pos[r] - s; 
	else
	{
		ans += pos[r] - pos[l];
		if (cnt[l] >= cnt[r])
		{
			while (l < r && cnt[l] >= cnt[r])
				cnt[l] += cnt[r--]; 
		}
		else
		{
			while (l < r && cnt[l] < cnt[r])
				cnt[r] += cnt[l++]; 
		}
		work(l, r, s); 
	}
}
int main()
{
	// freopen("AGC023-D.in", "r", stdin); 
	int n, s; 
	scanf("%d%d", &n, &s); 
	for (int i = 0; i < n; i++)
		scanf("%lld%lld", pos + i, cnt + i); 
	work(0, n - 1, s); 
	printf("%lld\n", ans);
	return 0; 
}


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


ll mod=1e9+7;
vector<pair<ll,ll>> p;

void pf(int n) {
    int i=0;
    while (n>1) {
        int fi=p[i].first;
        if (i==p.size()) {
            p.push_back(make_pair(n,1));
            break;
        }
        int c=0;
        while (n%fi==0) {
            n/=fi;
            c++;
        }
        p[i].second+=c;
        p[i].second=p[i].second%mod;
        i++;
    }
}

int main() { 
    int n;
    cin >> n;
    ll ans=1;
    p.push_back(make_pair(2,0));
    for (int i=1;i<=n;i++) pf(i);
    for (int j=0;j<p.size();j++) {
        ans*=(p[j].second+1);
        ans=ans%mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = (int)1e9+7;
const double PI = 3.14159265359;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t;
	//ctrl + /cin>>t;
	t = 1;
	while(t--){
		
		int x,y,z;
		cin>>x>>y>>z;
		swap(x,y);
		swap(x,z);
		cout<<x<<" "<<y<<" "<<z;
		
	}
	return 0;
}
































Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
a = sorted([a[i]-i-1 for i in range(n)])
ans = 0
if n%2 == 0:
  b = a[n//2 - 1]
else:
  b = a[n//2]
for i in range(n):
  ans += abs(a[i] - b)
print(ans)

Measured memory_bytes: 26360
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < n; ++i)
#define repe(i, n) for(int i=0; i <= n; ++i)
#define repr(i, n) for(int i=n-1; i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb(x) push_back(x)
#define eb(x,y) emplace_back(x,y)
#define PI 3.14159265359
using namespace std;
template <class T> bool chmax(T &a, const T &b) {if (a<b) {a = b; return 1;} return 0;}
template <class T> bool chmin(T &a, const T &b) {if (b<a) {a = b; return 1;} return 0;}
template <class T> using V=vector<T>;
typedef long long ll;
const int INF = 1e9;
const ll MOD = 1000000007;
const ll MAX = 510000;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
vector<int> Eratosthenes(const int N)
{
    vector<bool> is_prime(N+1, true);
    vector<int> P;
    for(int i=2; i<=N; i++) {
        if (is_prime[i]) {
            for(int j=2*i; j<=N; j+=i) {
                is_prime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    int mx = b*b+b;
    for(int i=a; i<=mx; i+=a) {
        if (i%b == c) {
            cout << "YES" << "\n";
            return 0; 
        }
    }
    cout << "NO" << "\n";
}


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

namespace AtCoder
{
    class Program2
    {

        static void Main(string[] args)
        {
            //lee una linea con numeros
            var numeros = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            //separar numeros
            int X = numeros[0];
            int Y = numeros[1];
            int Z = numeros[2];

            Console.WriteLine(String.Concat(Z.ToString() + " " + X.ToString() + " " + Y.ToString()));

        }


    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
#define dd(x) cout<<#x<<" = "<<x<<" "
#define de(x) cout<<#x<<" = "<<x<<"\n"
#define sz(x) int(x.size())
#define All(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef priority_queue<int> BQ;
typedef priority_queue<int,vector<int>,greater<int> > SQ;
const int maxn=3e5+10,mod=1e9+7,INF=0x3f3f3f3f;

int main()
{
	int h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	cout<<h2*60+m2-h1*60-m1-k; 
	return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a * n, b) << endl;
    return 0;
}


Measured memory_bytes: 256