akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

template <class... Args>
struct tuple_input_impl;
template <std::size_t i, std::size_t... tail>
struct tuple_input_impl<std::index_sequence<i, tail...>>
{
    template <class... Args>
    static void f(std::tuple<Args...>& x)
    {
        std::cin >> std::get<i>(x);
        tuple_input_impl<std::index_sequence<tail...>>::f(x);
    }
};
template <>
struct tuple_input_impl<std::index_sequence<>>
{
    static void f(...) {}
};

template <class... Args>
std::istream& operator>>(std::istream& in, std::tuple<Args...>& x)
{
    tuple_input_impl<std::index_sequence_for<Args...>>::f(x);
    return in;
}
template <class T1, class T2>
std::istream& operator>>(std::istream& in, std::pair<T1, T2>& x) { return in >> x.first >> x.second; }

template <class T>
T read()
{
    T res;
    std::cin >> res;
    return res;
}
template <class T>
std::vector<T> read(std::size_t n)
{
    std::vector<T> res(n);
    for (std::size_t i = 0; i < n; ++i) std::cin >> res[i];
    return res;
}

template <class T>
void out_impl(T&& v) { std::cout << std::forward<T>(v); }
template <class T, class... Args>
void out_impl(T&& v, Args&&... args)
{
    std::cout << std::forward<T>(v) << ' ';
    out_impl(std::forward<Args>(args)...);
}
template <class... Args>
void out(Args&&... args)
{
    out_impl(std::forward<Args>(args)...);
    std::cout << '\n';
}
template <class... Args>
void out_noreturn(Args&&... args) { out_impl(std::forward<Args>(args)...); }

template <class T>
void print(const T& container)
{
    bool first = true;
    for (auto&& x : container) {
        if (!first) std::cout << ' ';
        std::cout << x;
        first = false;
    }
    std::cout << '\n';
}

void prog()
{
    int n, m;
    std::cin >> n >> m;

    int l = 1, r = n + 1;
    for (auto range : read<std::pair<int, int>>(m)) {
        if (r <= range.first ||
            range.second + 1 <= l) {
            out(0);
            return;
        }
        l = std::max(l, range.first);
        r = std::min(r, range.second + 1);
    }
    out(r - l);
}

int main()
{
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    prog();
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>
int main(){
    int N;
    int V[50],C[50];
    int value = 0;
    int i,j;
    
    scanf("%d",&N);
    for(i = 0 ; i < N ; i++){
        scanf("%d",&V[i]);
    }
    for(i = 0 ; i < N ; i++){
        scanf("%d",&C[i]);
    }
    for(i = 0 ; i < N ; i++){
        if(V[i] - C[i] >= 0){
            value += (V[i]-C[i]);
        }
    }
    printf("%d\n",value);
    return 0;
    
}

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

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;}

int main() {
  vector<vector<ll>> c(3, vector<ll>(3));
  rep(i, 3) rep(j, 3) cin >> c[i][j];

  for(int i = 0; i < 2; ++i){
    int sub = 0;
    for(int j = 0; j < 3; ++j){
      if(j == 0){
        sub = c[i+1][j] - c[i][j];
      }
      else{
        if(sub != c[i+1][j] - c[i][j]){
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }

  for(int j = 0; j < 2; ++j){
    int sub = 0;
    for(int i = 0; i < 3; ++i){
      if(i == 0){
        sub = c[i][j+1] - c[i][j];
      }
      else{
        if(sub != c[i][j+1] - c[i][j]){
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;


int main(){	
	ll H,W,st=0;
	cin >> H >> W;
	string S[H];
	FOR(i,0,H){
		cin >> S[i];
		FOR(j,0,W){
			if(S[i][j] == '#')st++;
		}
	}
	queue<P> Q;
	bool did[501][501] = {};
	Q.push({0,0});
	did[0][0]=true;
	queue<int> dep;
	dep.push(1);
	while(not Q.empty()){
		int x = Q.front().first;
		int y = Q.front().second;
		if(x==(H-1)&&y==(W-1)){
			cout << H*W-dep.front()-st << endl;
			return 0;
		}
		if(x+1<H && not did[x+1][y] && S[x+1][y]!='#'){
			Q.push({x+1,y});
			dep.push(dep.front()+1);
			did[x+1][y] = true;
		}
		if(y+1<W && not did[x][y+1] && S[x][y+1]!='#'){
			Q.push({x,y+1});
			dep.push(dep.front()+1);
			did[x][y+1] = true;
		}
		if(x>0 && not did[x-1][y] && S[x-1][y]!='#'){
			Q.push({x-1,y});
			dep.push(dep.front()+1);
			did[x-1][y] = true;
		}
		if(y>0 && not did[x][y-1] && S[x][y-1]!='#'){
			Q.push({x,y-1});
			dep.push(dep.front()+1);
			did[x][y-1] = true;
		}
		dep.pop();
		Q.pop();
	}
	cout << -1 << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include <climits>
#include <vector>
using namespace std;

long long int Knapsack(int n, int * val, int * wt, int w){
	long long int dp[n+1][w+1];

	for(int i = 0; i <= n; i++){
		for(int j = 0; j <= w; j++){
			if(i == 0 || j == 0){
				dp[i][j] = 0;
			}else if(wt[i] > j){
				dp[i][j] = dp[i-1][j];
			}else{
				dp[i][j] = max(val[i] + dp[i-1][j-wt[i]], dp[i-1][j]);
			}
		}
	}
	return dp[n][w];
}



int main(){


	int n, w;
	cin>>n>>w;

	int * value = new int[n+1];
	int * weight = new int[n+1];

	for(int i = 1; i <= n; i++){
		cin>>weight[i]>>value[i];
	}

	cout<<Knapsack(n, value, weight, w);



	return 0;
}

Measured memory_bytes: 82004
from sys import stdin
def main():
  from builtins import range
  readline = stdin.readline
  h, w = map(int, readline().split())
  s = [readline().rstrip('\r\n') + '#' for _ in range(h)]
  s.append('#' * w)
  yoko = [[0] * w for _ in range(h)]
  for i in range(h):
    start = -1
    si = s[i]
    yokoi = yoko[i]
    for j in range(w + 1):
      if si[j] == '#':
        if start != -1:
          t = j - start
          for k in range(start, j):
            yokoi[k] = t
          start = -1
      else:
        if start == -1:
          start = j
  result = 0
  for i in range(w):
    start = -1
    for j in range(h + 1):
      if s[j][i] == '#':
        if start != -1:
          t = yoko_max + j - start - 1
          if t > result:
            result = t
          start = -1
      else:
        yji = yoko[j][i]
        if start == -1:
          start = j
          yoko_max = yji
        else:
          if yji > yoko_max:
            yoko_max = yji
  print(result)
main()

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

int main () {
  int N;
  cin >> N;
  int i;
  int A=1;
  int H[N];
  for (i=1; i<=N; ++i) {
    cin >> H[i];
  }
  int HM=H[1];
  for (i=1; i<N; ++i) {
    if (HM <= H[i+1]) {
      HM = H[i+1];
      A = A+1;
    }
  }
  cout << A << endl;
}

Measured memory_bytes: 256
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      HashMap<String, Integer> map = new HashMap<String, Integer>();
      map.put("SUN", 7);
      map.put("MON", 6);
      map.put("TUE", 5);
      map.put("WED", 4);
      map.put("THU", 3);
      map.put("FRI", 2);
      map.put("SAT", 1);
      myout(map.get(next()));
	}
	//Method addition frame start

  
  
	//Method addition frame end
}


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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

i64 n, a, b, c;
vector<string> ss;
vector<char> ans;

bool dfs(i64 depth, i64 x, i64 y, i64 z) {
    if (x < 0 || y < 0 || z < 0) return false;
    if (depth == n) return true;

    i64 na, nb, nc;
    if (ss[depth] == "AB") {
        na = x + 1, nb = y - 1, nc = z;
    } else if (ss[depth] == "AC") {
        na = x + 1, nb = y, nc = z - 1;
    } else {
        na = x, nb = y + 1, nc = z - 1;
    }

    ans.push_back(ss[depth][0]);
    if (dfs(depth + 1, na, nb, nc)) return true;
    ans.pop_back();

    if (ss[depth] == "AB") {
        na = x - 1, nb = y + 1, nc = z;
    } else if (ss[depth] == "AC") {
        na = x - 1, nb = y, nc = z + 1;
    } else {
        na = x, nb = y - 1, nc = z + 1;
    }

    ans.push_back(ss[depth][1]);
    if (dfs(depth + 1, na, nb, nc)) return true;
    ans.pop_back();

    return false;
}

void solve() {
    cin >> n >> a >> b >> c;
    ss.resize(n);
    for (auto& e : ss) cin >> e;

    if (dfs(0, a, b, c)) {
        cout << "Yes" << endl;
        for (auto& e : ans) cout << e << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 14476
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

int sum(int x){
    int ret = 0;
    while(x){
        ret += x%10;
        x /= 10;
    }
    return ret;
}

double f(int n){
    return double(n)/sum(n);
}

signed main(void) {
    int k;
    cin >> k;
    int n = 1, a = 1;
    while(k--){
        cout << n << endl;
        while(f(n+a) > f(n+2*a)){
            a *= 10;
        }
        n += a;
    }
}


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

#define n 26

int main (void)
{
	char ei;	// input data
	int data[26]={0}, i, j;

	while (scanf("%c", &ei) != EOF ){

		if (ei >= 'A' && ei <= 'Z')
			data[ei-'A']++;
		else if (ei >= 'a' && ei <= 'z')
			data[ei-'a']++;

	}

	for (i=0; i<n; i++)
		printf("%c : %d\n", i+'a', data[i]);
	return 0;
}

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

using namespace std;

typedef long long ll;

int main(){

	string s;
	cin >> s;
	int size = (int)s.size();
	int half;
	if(size%2 != 0) half = size/2+1;
	else half = size/2;
	int count = 0;

	for (int i = 0; i < half; ++i){
		if(s[i] == s[size-i-1])continue;
		else count ++;
	}
	cout << count << endl;

	return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    set<int> st;
    for(int i=0; i<N; i++){
        int A;
        cin >> A;
        if(st.find(A) == st.end()) st.insert(A);
        else st.erase(A);
    }
    cout << st.size() << endl;
    return 0;
}


Measured memory_bytes: 4992
import sys
from collections import *
import heapq
import math
from math import gcd
import bisect
import copy
from itertools import permutations,accumulate,combinations,product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,k=map(int,input().split())
# tmp1=(k-1+0)*k//2
# tmp2=(n+0)*(n+1)//2
# print(tmp2,tmp1)
# print((tmp2-tmp1+1)%mod)
ans=0
for i in range(k,n+2):
    tmp1=(i-1+0)*i//2
    tmp2=(n+(n-(i-1)))*i//2
    # print(tmp1,tmp2)
    ans+=tmp2-tmp1+1
    ans%=mod
print(ans%mod)

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

H,W,N=map(int,input().split())
sr,sc=map(int,input().split())
S=input().strip()
T=input().strip()

#高橋君が右に動かすとき
rest=W-sc+1

for i in range(N):
    if S[i]=="R":
        rest-=1

    if rest==0:
        print("NO")
        sys.exit()

    if T[i]=="L":
        rest=min(W,rest+1)

#左

rest=sc

for i in range(N):
    if S[i]=="L":
        rest-=1

    if rest==0:
        print("NO")
        sys.exit()

    if T[i]=="R":
        rest=min(W,rest+1)

#上

rest=sr

for i in range(N):
    if S[i]=="U":
        rest-=1

    if rest==0:
        print("NO")
        sys.exit()

    if T[i]=="D":
        rest=min(H,rest+1)

#下

rest=H-sr+1

for i in range(N):
    if S[i]=="D":
        rest-=1

    if rest==0:
        print("NO")
        sys.exit()

    if T[i]=="U":
        rest=min(H,rest+1)


print("YES")





Measured memory_bytes: 44752
import static java.lang.System.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(in);

        int p = sc.nextInt();
        int q = sc.nextInt();
        int r = sc.nextInt();
        
        out.println(Math.min(Math.min(p+q, p+r), q+r));
    }
}



Measured memory_bytes: 21332
#include<iostream>
#include<math.h>
using namespace std;
int main() {
	int N,i;
	double xa, ya, ra, xb, yb, rb,r;
	cin >> N;
	for (i = 0; i < N; i++) {
		cin >> xa >> ya >> ra >> xb >> yb >> rb;
		r =pow(xb - xa, 2.0) + pow(yb - ya, 2.0);
		if (sqrt(r) > ra + rb) {
			cout << 0 << endl;
		}
		else if (sqrt(r) <ra-rb){
			cout << 2 << endl;
		}
		else if (sqrt(r) < rb - ra) {
			cout << -2 << endl;
		}
		else {
			cout << 1 << endl;
		}
	}
	return 0;
}

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

int n;
string s, t;

int main() {
  cin >> n >> s >> t;
  for (int i = n; i >= 0; --i) {
    if (s.substr(n - i, i) == t.substr(0, i)) {
      cout << 2 * n - i << endl;
      break;
    }
  }
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

const lint INF=1LL<<61;

int main(){
	int n,m,L; cin>>n>>m>>L;
	lint d1[300][300];
	rep(u,n) rep(v,n) d1[u][v]=(u==v?0:INF);
	rep(i,m){
		int u,v,c; cin>>u>>v>>c; u--; v--;
		d1[u][v]=d1[v][u]=c;
	}

	rep(w,n) rep(u,n) rep(v,n) d1[u][v]=min(d1[u][v],d1[u][w]+d1[w][v]);

	lint d2[300][300];
	rep(u,n) rep(v,n) d2[u][v]=(u==v?0:d1[u][v]<=L?1:INF);
	rep(w,n) rep(u,n) rep(v,n) d2[u][v]=min(d2[u][v],d2[u][w]+d2[w][v]);

	int q; cin>>q;
	rep(_,q){
		int s,t; cin>>s>>t; s--; t--;
		cout<<(d2[s][t]<INF?d2[s][t]-1:-1)<<endl;
	}
	return 0;
}


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

namespace ABC129C
{
    class Program
    {
        static void Main(string[] args)
        {
            const int LN = 1000000007;
            var nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            nm[0]++;
            bool[] broken = new bool[nm[0]];
            for (int i = 0; i < nm[1]; i++)
            {
                var a = int.Parse(Console.ReadLine());
                broken[a] = true;
            }
            int[] dp = new int[nm[0]];
            dp[0] = 1;
            if (!broken[1])
            {
                dp[1] = 1;
            }
            for (int i = 2; i< nm[0]; i++)
            {
                if (broken[i])
                {
                    dp[i] = 0;
                }
                else
                {
                    dp[i] = (dp[i - 1] + dp[i - 2]) % LN;
                }
            }
            Console.WriteLine(dp.Last());

        }
    }
}


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

// clang-format off
#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

#define rep(i, n) for (int i = 0; i < (int)(n); ++(i))
#define reps(i, n) for (int i = 1; i <= (int)(n); ++(i))
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --(i))
#define rreps(i, n) for (int i = (int)(n); i > 0; --(i))

#define range(i, l, r) for (int i = (int)l; i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = ((int)(r) - 1); i >= (int)l; --(i))

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define rwhole(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ## __VA_ARGS__); })(x)

using int32 = int;
using int64 = long long;

constexpr int mod     = 1e9 + 7;
constexpr int32 inf   = 1001001001;
constexpr int64 infll = 1001001001001001001ll;
constexpr int dx[]    = {0, -1, 1, 0, -1, 1, -1, 1},
              dy[]    = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); cerr << fixed << setprecision(10); } } iosetup;

template<typename T = int64> T input() { T x; cin >> x; return x; }

template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

void solver() {
  string s = input<string>();

  cout << ((s.size() & 1) ^ (s.front() == s.back()) ? "First" : "Second") << endl;
}

signed main(int argc, char *argv[]) {
    solver();
}


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

// Define
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
using pii = pair<int, int>;
const ll MOD = 1e9 + 7;
const ll INF = LONG_MAX;
const ul MAX = ULONG_MAX;
const char nl = '\n';

#define elif else if
#define def inline auto
#define run __attribute__((constructor)) def _

// Debug
#define debug(x) cerr << (x) << " (L:" << __LINE__ << ")" << '\n'

// Loop
#define inc(i, a, n) for (ll i = (a), _##i = (n); i < _##i; ++i)
#define dec(i, a, n) for (ll i = (a), _##i = (n); i > _##i; --i)
#define rep(i, n) inc(i, 0, n)
#define be(c) begin(c), end(c)

// Stream
#define fout(n) cout << fixed << setprecision(n)
#define fasten cin.tie(0), ios::sync_with_stdio(0)

// Speed
run() { fasten, fout(10); }
#pragma GCC optimize("-O3")
#pragma GCC target("avx")

// Math
inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

signed main(){
    int N;
    cin >> N;
    set<int> ds;
    rep(i, N) {
        int d;
        cin >> d;
        ds.insert(d);
    }
    cout << ds.size() << nl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define N 200001
#define ll long long
#define int ll 
#define pi pair<int , int>
#define pip pair<pair ,int>
#define mp make_pair 
#define f first
#define s second
#define mod 998244353
ll Mod(ll x, ll y, int p) 
{ll res = 1; x = x % p;
while (y > 0) 
{if(y & 1) res = (res*x) % p; 
y = y>>1;x = (x*x) % p; 
}return res; 
}
int* getlps(string pattern){
 int len = pattern.length();
 int * lps = new int[len];
 lps[0] = 0;
 int i = 1 , j = 0;
 while(i < len){
  if(pattern[i] == pattern[j]){
	  lps[i] = j+1;
   i++;
   j++;
  }
  else{
		if(j != 0){
		 j = lps[j-1];
		}
		else{
		 lps[i] = 0;
		 i++;
		}
  }
 }
 return lps;
}
class Triplet{
 public:
 int x ;
 int y ;
 int gcd;
};
Triplet extendedEuclid(int a , int b){
 if(b == 0){Triplet ans; ans.gcd = a;ans.x = 1;ans.y = 0;return ans;}
 Triplet smallAns = extendedEuclid(b , a%b);
 Triplet ans;
 ans.gcd = smallAns.gcd;
 ans.x = smallAns.y;
 ans.y = smallAns.x - (a/b)*smallAns.y;
 return ans;
}
int mmInverse(int a , int m){
 Triplet ans = extendedEuclid(a , m);
 return ans.x;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a , b;
cin>>a>>b;
for(int i = 1 ; i <= 100000; i++){
 int val = (int)(i*0.08);
 int val2 = i*(0.1);
 if(val == a && val2 == b){
  cout<<i<<endl;
  return 0;
 }
 
}
cout<<"-1"<<endl;
}




Measured memory_bytes: 256
a,b,c,x = [int(input()) for _ in range(4)]
# 500 100 50

result = 0
for aa in range(a+1):
  for bb in range(b+1):
    for cc in range(c+1):
      if x == aa*500 + bb * 100 + cc * 50:
        result = result + 1

print(result)

Measured memory_bytes: 3060
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include<cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include<iostream>
#include<queue>
#include<set>
#include<string>
#include <vector>

#define ll long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define FORL(i,a,b) for(ll i=(a);i<(b);++i)
#define REPL(i,n) FORL(i,0,n)

using namespace std;

/*
1 partition(A, p, r)
2   x = A[r]
3   i = p-1
4   for j = p to r-1
4     if A[j] <= x
5       i = i+1
6       A[i] と A[j] を交換
7   A[i+1] と A[r] を交換
8   return i+1
*/

int partition(int A[], int p, int r){
	int x = A[r], i = p - 1, tmp;
	FOR(j, p, r){
		if (A[j] <= x){
			i++;
			tmp = A[i];
			A[i] = A[j];
			A[j] = tmp;
		}
	}
	tmp = A[i + 1];
	A[i + 1] = A[r];
	A[r] = tmp;
	return i + 1;
}

int main(){
	int n, A[100000];

	scanf("%d", &n);
	REP(i, n){
		scanf(" %d", &A[i]);
	}

	int k;
	k = partition(A, 0, n - 1);

	REP(i, n){
		if (i != 0){
			printf(" ");
		}
		if (i == k){
			printf("[");
		}
		printf("%d", A[i]);
		if (i == k){
			printf("]");
		}
	}printf("\n");


	return 0;
}


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

using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	long long s=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(i>0){
			if(a[i]<a[i-1]){
				s+=(long long)(a[i-1]-a[i]);
				a[i]=a[i-1];
			}
		}
	}
	cout<<s<<endl;
}


Measured memory_bytes: 3976
#include <bits/stdc++.h>
#define INF 100000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main()
{
  string S, T;
  cin >> S >> T;
  ll N = S.size();
  for (ll i = 0; i < N; ++i) {
    if (S[i] == T[0]) {
      bool ok = true;
      for (ll j = 0; j < N; ++j) {
        if (S[(i + j) % N] == T[j]) {
          continue;
        }
        ok = false;
        break;
      }
      if (ok) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <cstring>
#include <limits>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX (numeric_limits<int>::max()-1)/2

int dfs(int s, int *v, int *pa, vector<int> *dag){
  if(s<0)return 1;
  rep(i,dag[s].size()){
    if(!v[dag[s][i]]){
      v[dag[s][i]]=1;
      if(dfs(pa[dag[s][i]],v,pa,dag)){
        pa[dag[s][i]]=s;
        return 1;
      }
    }
  }
  return 0;
}

int main(){
  int N,M,L;
  while(scanf("%d%d%d",&N,&M,&L),N){
    int d[N][N];
    rep(i,N)rep(j,N)d[i][j]=MAX;
    rep(i,N)d[i][i]=0;
    rep(i,M){
      int u,v,w;scanf("%d%d%d",&u,&v,&w);
      d[u][v]=d[v][u]=w;
    }

    int p[L],t[L];
    rep(i,L)scanf("%d%d",&p[i],&t[i]);
    rep(k,N)rep(i,N)rep(j,N)d[i][j]=(d[i][j]>d[i][k]+d[k][j])?(d[i][k]+d[k][j]):d[i][j];

    vector<int> dag[L];
    rep(i,L)rep(j,L){if(i!=j && d[p[i]][p[j]]<=t[j]-t[i])dag[i].push_back(j);}

    int num=L;
    int pa[L]; memset(pa,-1,sizeof(pa));
    rep(i,L){
      int v[L]; memset(v,0,sizeof(v));
      if(dfs(i,v,pa,dag)){num--;}
    }
    printf("%d\n",num);
  }
  return 0;
}

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

int main() {
  string s;
  cin >> s;
  int l = s.size();
  
  char a, b;
  int x=0,y=0;
  
  for(int i=0; i<l; i++){
    if(i%2==0){
      a = '0'; b = '1';
    }
    else{
      a = '1'; b = '0';
    }
    
    if(s[i]!=a) x++;
    if(s[i]!=b) y++;
    
  }
  
  cout << min(x,y) <<endl;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;

int main(int argc, char *argv[]) {

	int N,M,C; cin >> N >> M >> C;
	vector<int> B(N,0);

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

	int ans = 0;
	for (int i = 0; i < N; i++) {
		int sum = 0;
		for (int j = 0; j < M; j++) {
			int a; cin >> a;
			sum += a * B[j];
		}
		if (sum + C > 0) {
			ans++;
		}
	}
	cout << ans << endl;
	


	return 0;
}


Measured memory_bytes: 3564
#include<stdio.h>
int main()
{
	long long int n,r=0,i=0,j;
	char a[100];
	scanf("%lld",&n);
	while(1){
		if(n==0) break;
		n--;
		r=n%26;
		n=n/26;
		a[i]='a'+r;
		i++;
	}
	for(j=i-1;j>=0;j--){
		printf("%c",a[j]);
	}
	return 0;
}


Measured memory_bytes: 1664
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n, k = i_map()
    p = i_list()


    sowa = [0]
    for i in range(1,1001):
        sowa.append(sowa[i-1]+i)

    l = [sowa[p[0]]/p[0]]

    for i in range(1,n):
        l.append(l[i-1] + sowa[p[i]]/p[i])


    ans = l[k-1]
    for i in range(k,n):
        s = l[i] - l[i-k]
        ans = max(ans,s)
    print(ans)


if __name__=="__main__":
    main()


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

using namespace std;
using ll = int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using tpi = tuple<int, int, int>;

using vqi = vector<queue<int>>;
using vpi = vector<pii>;
using bs = bitset<60>;
using vbi = vector<bs>;

ll gcd(ll a, ll b) {
  if (a < b) {
    swap(a, b);
  }

  /* ユークリッドの互除法 */
  ll r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

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

constexpr int64_t __pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
  if (p == 0) {
    return 1;
  }
  if (p % 2 == 0) {
    int64_t t = __pow_mod(n, p / 2, mod);
    return (t * t) % mod;
  }
  return (n * (__pow_mod(n, p - 1, mod) % mod)) % mod;
}

constexpr int64_t pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
  int64_t res = __pow_mod(n, p, mod);
  if (res == 0) {
    res = mod;
  }
  return res;
}

void solve(long long N, long long K, std::vector<long long> H) {
    sort(H.begin(),H.end());
    ll ans=0;
    for(int i=0;i<N-K;i++){
        ans+=H[i];
    }
    cout<<ans<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You
// use the default template now. You can remove this line by using your custom
// template)
int main() {
  long long N;
  std::cin >> N;
  long long K;
  std::cin >> K;
  std::vector<long long> H(N);
  for (int i = 0; i < N; i++) {
    std::cin >> H[i];
  }
  solve(N, K, std::move(H));
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	string s;
	Int t;

	vector<string> S(N);
	vector<Int> T(N);
	for (Int i = 0; i < N; i++) {
		cin >> s >> t;
		S[i] = s;
		T[i] = t;
	}
	string X;
	cin >> X;

	Int ans = 0;
	Int flag = 0;
	for (Int i = 0; i < N; i++) {
		if (flag==0) {
			if (S[i]==X) {
				flag = 1;
			}
		}
		else {
			ans += T[i];
		}
	}
	cout << ans << "\n";
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a, b, c, d, n = 0, ans = 0, ans2 = 0;
	string s;
	cin >> a>>b;
	ans = max(a, b);
	if (a > b)a--;
	if (a < b)b--;
	ans2 = max(a, b);
	ans = ans + ans2;
	cout << ans << endl;
}

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

int main() {
	int n; cin >> n;
	vector<int> t(n);
	int total = 0;
	for (int i = 0; i < n; i++) {
		cin >> t.at(i);
		total += t.at(i);
	}
	int m; cin >> m;
	vector<int> p(m), x(m);
	for (int i = 0; i < m; i++) {
		cin >> p.at(i) >> x.at(i);
		p.at(i)--;
	}
	for (int i = 0; i < m; i++) {
		cout << total - (t.at(p.at(i)) - x.at(i)) << endl;
	}

	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>
#include <type_traits>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

//~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

int main() {

    string S;
    cin >> S;

    sort(S.begin(), S.end());

    if(S[0] == S[1] && S[2] == S[3] && S[0] != S[3]){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

































Measured memory_bytes: 256
import sys
# input = sys.stdin.readline

def main():
    S = input() + "🐦"
    l = 0
    r = 0
    for i in range(len(S)):
        if S[i:i+2] == "><" or S[i:i+2] == ">🐦":
            r += 1
            yield r
            yield -min(l, r)
            l = 0
            r = 0
        else:
            if S[i] == "<":
                l += 1
                yield l
            elif S[i] == ">":
                r += 1
                yield r
    

    # 0<1<2<(3|7)>6>5>4>3>2>1>0
    # 0<1<2<3<4<5<(6|4)>3>2>1>0
    # >>0<<<<
    # >>>>0<<


print(sum(main()))

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

int main() {
  int N,cnt,ans=0;
  cin >> N;
  for (int i=1; i<=N; i+=2) {
    cnt=0;
    for (int j=1; j<=i; j++) {
      if (i%j==0) {
        cnt++;
      }
    }
    if (cnt==8) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int N, tmp;
    int A[101];

    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];

    for(int j = 2; j <= N; j++){
        for(int i = 0; i < N; i++){
            cout << A[i];
            if(i == N - 1) cout << endl;
            else cout << " ";
        }
        tmp = A[j - 1];
        int k = (j - 1) - 1;
        while(k >= 0 && A[k] > tmp){
            A[k + 1] = A[k];
            k--;
        }
        A[k + 1] = tmp;
    }

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



Measured memory_bytes: 3084
#include <stdio.h>

int main() {

  int num_1, num_2, num_3, num_4;
  char str[101];

  scanf("%d %d", &num_1, &num_2);
  scanf("%d %d", &num_3, &num_4);
  //scanf("%s", str);

  printf("%d\n", (num_1 * num_2) - (num_2 * num_3 + num_1 * num_4 - num_3 * num_4));
  return 0;
}


Measured memory_bytes: 128
#include<iostream>

using namespace std;

int w, h;
int m[50][50];
void paint(int x, int y) {
	if (x < 0 || x >= w || y < 0 || y >= h) return;
	if (m[y][x] == 0) return;
	m[y][x] = 0;
	for (int dx = -1; dx <= 1; ++dx) for (int dy = -1; dy <= 1; ++dy) {
		paint(x + dx, y + dy);
	}
}
int main() {
	while (cin >> w >> h, w || h) {
		for (int y = 0; y < h; ++y) {
			for (int x = 0; x < w; ++x) {
				cin >> m[y][x];
			}
		}
		int ans = 0;
		for (int y = 0; y < h; ++y) {
			for (int x = 0; x < w; ++x) {
				if (m[y][x]) {
					paint(x, y);
					++ans;
				}
			}
		}
		cout << ans << endl;
	}
}

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

int main() {
  int N,M;
  cin>>N>>M;
  vector<vector<uint64_t>> v(N,vector<uint64_t>(2));
  rep(i,N) cin>>v[i][0]>>v[i][1];
  sort(v.begin(),v.end());//安い順に買う
  int btl=0;
  uint64_t cst=0;
  rep(i,N){
    btl += v[i][1];
    cst += v[i][0]*v[i][1];
    if(btl==M){
      cout<<cst<<endl;
      return 0;
    }
    else if(btl>M){
      rep(j,v[i][1]){
        cst -= v[i][0];
        btl--;
        if(btl==M){
          cout<<cst<<endl;
          return 0;
        }
      }
    }
  }
}

Measured memory_bytes: 5760
def main():
    h,w = map(int,input().split())
    a = []
    for i in range(h):
        a.append(input())
 
    used = [True]*(h*w)
 
    p = []
    for i in range(h):
        for j in range(w):
            if a[i][j] == '#':
                p.append(i*w+j)
                used[i*w+j] = False
 
 
    
    res = 0
    while p:
        tank = []
        for e in p:
            if (e-w)>=0 and used[e-w]:
                tank.append(e-w)
                used[e-w] = False
            if e%w-1 >= 0 and used[e-1]:
                tank.append(e-1)
                used[e-1] = False
            if e+w<w*h and used[e+w]:
                tank.append(e+w)
                used[e+w] = False
            if e%w+1<w and used[e+1]:
                tank.append(e+1)
                used[e+1] =  False
        p = tank
        res += 1
    print(res-1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 51584
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> G;
vector<int> parent;
vector<int> deep;
vector<int> height;
int N;
void dfs(int kizyun,int v,int d){
    deep[v] = max(deep[v],d);
    if(G[v].size()==0){
        height[kizyun] = max(height[kizyun],d);
    }
    for(int s=0;s<G[v].size();s++){
        dfs(kizyun,G[v][s],d+1);
        parent[G[v][s]] = v;
    }
}
signed main(){
    cin >> N;
    
    vector<int> use(N);
    vector<int> sibling(N,-1);
    vector<int> degree(N);
    
    G.resize(N);
    deep.resize(N);
    height.resize(N);
    parent.assign(N,-1);

    for(int i=0;i<N;i++){
        int id,a,b;cin >> id >> a >> b;
        int deg = 2;
        if(a==-1) deg--;
        if(b==-1) deg--;
        degree[id] = deg;
        G[id].resize(deg);
        if(deg==1){
            if(a==-1) G[id][0] = b;
            else G[id][0] = a;
            use[id] = 1;
        }
        if(deg==2){
        G[id][0] = a;
        G[id][1] = b;
        use[id] = 1;
        sibling[b] = a;
        sibling[a] = b;
        }
    }
    for(int i=0;i<N;i++){
        if(use[i]) dfs(i,i,0);
    }
    for(int i=0;i<N;i++){
        cout << "node " << i << ": parent = " << parent[i] << ", sibling = " << sibling[i] << ", degree = " << degree[i] << ", depth = " << deep[i] << ", height = " << height[i] << ", ";
        if(parent[i]==-1) cout << "root" << endl;
        else if(G[i].size()>=1) cout << "internal node" << endl;
        else cout << "leaf" << endl; 
    }
}


Measured memory_bytes: 3104
from collections import Counter

n = int(input())
integer = list(map(int, input().split()))
length = len(integer)
counter = Counter(integer)
keys = counter.keys()
total = 0
for key in keys:
  total += counter[key] * ( counter[key] -1 ) / 2
total = int(total)

for i in integer:
  tmp = total
  tmp -= counter[i] - 1
  print(tmp)
  


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int n,q;
vector<vector<int>> tree(200000, vector<int>());

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

    if(a == b) cout << "Draw" << endl;
    else if(a == 1) cout << "Alice" << endl;
    else if(b == 1) cout << "Bob" << endl;
    else if(a > b) cout << "Alice" << endl;
    else cout << "Bob" << endl;
    
}


Measured memory_bytes: 4992
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    from collections import Counter
    c = Counter(A)
    mc = c.most_common()
    ans = len(mc)
    need = 0
    for cnt in mc:
        if cnt[1] > 1:
            need += cnt[1] - 1
    print(ans if need % 2 == 0 else ans - 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 64552
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define MOD 1e9+7
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int x;
	cin >> x;
	if(x<1200)
	{
		cout << "ABC";
	}
	else
	{
		cout << "ARC";
	}
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
class Main {
 public static void main(String[] args) throws IOException{
	try ( BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) ){
      	String[] arr = br.readLine().split(" ");
      	int x1 = Integer.parseInt(arr[0]);
      	int y1 = Integer.parseInt(arr[1]);
      	int x2 = Integer.parseInt(arr[2]);
      	int y2 = Integer.parseInt(arr[3]);
      	int len_x,len_y = 0;
      	String result = null;
		if( x1 <= x2 ){
          if( y1 <= y2 ){//case1
			len_x = x2 - x1;
			len_y = y2 - y1;
            result = String.format("%d %d %d %d", x2-len_y, y2+len_x, x1-len_y, y1+len_x);
          } else {//case2
			len_x = x2 - x1;
			len_y = y1 - y2;
            result = String.format("%d %d %d %d", x2+len_y, y2+len_x, x1+len_y, y1+len_x);
          }
        } else if( y1 <= y2 ){//case3
			len_x = x1 - x2;
			len_y = y2 - y1;
            result = String.format("%d %d %d %d", x2-len_y, y2-len_x, x1-len_y, y1-len_x);
        } else {//case4
			len_x = x1 - x2;
			len_y = y1 - y2;
            result = String.format("%d %d %d %d", x2+len_y, y2-len_x, x1+len_y, y1-len_x);
        }          
		System.out.println(result);
	}
 }
}

Measured memory_bytes: 21204
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

N, K = map(int, raw_input().split())
A = map(int, raw_input().split())

cnt = [0] * 50

for p in A:
    hoge = p
    for i in range(50):
        cnt[i] += hoge % 2
        hoge /= 2

rec = [0] * 50
S = 0
for i in range(50):
    if N - cnt[i] < cnt[i]:
        S += cnt[i] * (2 ** i)
    else:
        S += (N - cnt[i]) * (2 ** i)
    rec[i] = S

rec = [0] + rec

ans = 0
S = 0
cur = 0

for i in range(50)[::-1]:
    if cur + (2 ** i) <= K:
        ans = max(ans, S + cnt[i] * (2 ** i) + rec[i])
        cur += (2 ** i)
        S += (N - cnt[i]) * (2 ** i)
    else:
        S += cnt[i] * (2 ** i)
ans = max(ans, S)

print ans

Measured memory_bytes: 12292
def main():
    [N, K] = [int(num) for num in input().split()]
    h_list = [int(h) for h in input().split()]
    cost = [10**10] * N
    cost[0] = 0
    cost[1] = abs(h_list[1] - h_list[0])

    for i in range(2, N):
        min_cost = 10**10
        for j in range(1, K+1):
            if i-j >= 0:
                min_cost = min(min_cost, cost[i-j] + abs(h_list[i] - h_list[i-j]))

        cost[i] = min_cost


    print(cost[N-1])


if __name__ == '__main__':
    main()


Measured memory_bytes: 52448
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int Maxn=100;
char s[4][Maxn+5];
int main() {
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%s %s %s",s[1]+1,s[2]+1,s[3]+1);
	int i=1,j=1,k=1,nxt=1;
	int len1=strlen(s[1]+1),len2=strlen(s[2]+1),len3=strlen(s[3]+1);
	while(true) {
		switch(nxt) {
			case 1:
				nxt=s[1][i]-'a'+1;i++;
				break;
			case 2:
				nxt=s[2][j]-'a'+1;j++;
				break;
			case 3:
				nxt=s[3][k]-'a'+1;k++;
				break;
		}
	//	printf("%d %d %d %d\n",nxt,i,j,k);
		if(i>len1+1) {
			puts("A");break;
		}
		if(j>len2+1) {
			puts("B");break;
		}
		if(k>len3+1) {
			puts("C");break;
		}
	}
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main()
{
  int n=0,y=0,sen=0,gosen=0,man=0;
  scanf("%d %d",&n,&y);
  for(sen=0;sen<=n;sen++){
    for(gosen=0;gosen<=n;gosen++){
      man=n-(sen+gosen);
      if(sen*1000+gosen*5000+man*10000==y&&
         sen+gosen+man==n&&man>=0){        
  printf("%d %d %d",man,gosen,sen); return 0; }
    }    
  }
  printf("-1 -1 -1");
    return 0;
  }


Measured memory_bytes: 1708
#include<bits/stdc++.h>
using namespace std;
int main()
{
	cin.tie(0); 	
	cout.tie(0); 
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int nums[n];
	long long sum[n];
	cin>>nums[0];
	sum[0]=nums[0]; 
	for(int i = 1; i < n; i++)
	{
		cin >> nums[i];
        sum[i]=sum[i-1]+nums[i];
	}
	
	long long min = abs(sum[n-1] - 2*sum[0]);
	for(int i = 1; i < n-1; i++)
	{
		if(min>abs(sum[n-1] - 2*sum[i]))
			min = abs(sum[n-1] - 2*sum[i]);		
	}	
	cout << min;		
}

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

using namespace std;

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i=(a); i<(n); i++)

int n;
char s[300010];

int main() {
	cin >> n;
	int ne = 0, nw = 0;
	rep(i, n) {
	    cin >> s[i];
	    if(s[i] == 'E') ne++;
	}
	
	int ans = 400000;
	rep(i, n) {
	    if(s[i] == 'E') ne -= 1;
	    ans = min(ans, ne+nw);
	    if(s[i] == 'W') nw +=1;
	}
	cout << ans << endl;
}


Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool can(ll x, ll p) {
  while(x % p == 0) {
    x /= p;
  }
  return x % p == 1;
}
set<ll>s;
int main()
{
    ll n;
    scanf("%lld",&n);
    ll m=n-1;
    for(ll i=1;i*i<=m;i++)
    {
        if(m%i==0)
        {
            s.insert(m/i);
            s.insert(i);
        }
    }
    for(ll i=1;i*i<=n;i++)
    {
        if(i != 1) if(can(n, i)) s.insert(i);
      if((n / i) != 1) if(can(n, n / i)) s.insert(n / i);
    }
    s.erase(1);
    printf("%d\n",s.size());
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
int main() {
	int N, M, ans[101] = {};
	std::string S[101], T[101];

	std::cin >> N;
	for (int i = 0; i < N; i++)
		std::cin >> S[i];

	std::cin >> M;
	for (int i = 0; i < M; i++)
		std::cin >> T[i];

	for (int i = 0; i < N; i++)
		for (int j = 0; j < N; j++)
			if (S[i] == S[j])
				ans[i]++;

	for (int i = 0; i < N; i++)
		for (int j = 0; j < M; j++)
			if (S[i] == T[j])
				ans[i]--;

	std::sort(ans, ans + N);
	if (ans[N - 1] > 0)
		std::cout << ans[N - 1] << std::endl;
	else
		std::cout << 0 << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;

int main(){
	cin>>n;
	int res=0;
	for(int i=0;i<n;i++){
		int A;
		cin>>A;
		while(A%2==0) res++,A/=2;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 256