akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        if (a == 0) {
            System.out.println(b / x + 1);
        } else {
            System.out.println(b / x - ((a - 1) / x));
        }
    }
}

Measured memory_bytes: 23764
/* 
 * Project: AtCoder Beginners Contest 162 A - Lucky 7
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/04/12
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#pragma GCC optimize("Ofast")
#include <cstdio>
using namespace std;
 
char n[3];
 
void solve() {
 
    if (!(n[0] ^ '7'))
        puts("Yes");
    else if (!(n[1] ^ '7'))
        puts("Yes");
    else if (!(n[2] ^ '7'))
        puts("Yes");
    else
        puts("No");
}
 
int main() {
 
    scanf("%s",n);
 
    solve();
 
}


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

int main() {
  int N,M;
  int max=0;
  
  cin >> N;
  vector<string> Ns(N);
  for (int i=0; i<N; i++)
    cin >> Ns.at(i);
  
  cin >> M;
  vector<string> Ms(M);
  for (int i=0; i<M; i++)
    cin >> Ms.at(i);
  
  for (int i=0; i<N; i++){
    int num=0;
    for (int j=0; j<N; j++){
      if (Ns.at(i)==Ns.at(j)) num++;
    }
    for (int k=0; k<M; k++){
      if (Ns.at(i)==Ms.at(k)) num--;
    }
    if (num>max) max=num;
  }
  
  for (int i=0; i<M; i++){
    int num=0;
    for (int j=0; j<M; j++){
      if (Ms.at(i)==Ms.at(j)) num--;
    }
    for (int k=0; k<N; k++){
      if (Ms.at(i)==Ns.at(k)) num++;
    }
    if (num>max) max=num;
  }
  
  cout << max << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using Graph = vector<vector<int>>;
const int INT_INF = 1001001001;

int main(){
    string s;
    cin >> s;
    int a = s[0] - '0';
    int b = s[1] - '0';
    int c = s[2] - '0';
    int d = s[3] - '0';
    //cout << a << b << c << d << endl;
    vector<int> e(8);
    e[0] = a+b+c+d;
    e[1] = a+b+c-d;
    e[2] = a+b-c+d;
    e[3] = a+b-c-d;
    e[4] = a-b+c+d;
    e[5] = a-b+c-d;
    e[6] = a-b-c+d;
    e[7] = a-b-c-d;
    if(e[0]==7){
        cout << a << '+' << b << '+' << c << '+' << d << "=7" << endl;
        return 0;
    }else if(e[1] == 7){
        cout << a << '+' << b << '+' << c << '-' << d << "=7" << endl;
        return 0;
    }else if(e[2] == 7){
        cout << a << '+' << b << '-' << c << '+' << d << "=7" << endl;
        return 0;
    }else if(e[3] == 7){
        cout << a << '+' << b << '-' << c << '-' << d << "=7" << endl;
        return 0;
    }else if(e[4] == 7){
        cout << a << '-' << b << '+' << c << '+' << d << "=7" << endl;
        return 0;
    }else if(e[5] == 7){
        cout << a << '-' << b << '+' << c << '-' << d << "=7" << endl;
        return 0;
    }else if(e[6] == 7){
        cout << a << '-' << b << '-' << c << '+' << d << "=7" << endl;
        return 0;
    }else if(e[7] == 7){
        cout << a << '-' << b << '-' << c << '-' << d << "=7" << endl;
        return 0;
    }

    
}

Measured memory_bytes: 256
#include <stdio.h>

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

  if(A>=13)
    printf("%d\n", B);
  else if(A>=6)
    printf("%d\n", B/2);
  else
    printf("0\n");

  
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <cstring>
#include <string>
#include <set>
#include <map>
using namespace std;
//ifstream cin();
//ofstream cout();
int main(){
	char a[1001];
	gets(a);
	cout<<a[0]<<strlen(a)-2<<a[strlen(a)-1];
	puts("");
	ios::sync_with_stdio(false);
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int sum = 0;
		while(cin.hasNext()){
			String str = cin.next();
			char[] s = (str + " " ).toCharArray();
			int ans = 0;
			for(int i = 0; i < s.length; i++){
				ArrayList<Integer> list = new ArrayList<Integer>();
				if(Character.isDigit(s[i])){
					while(true){
						list.add(s[i]-'0');
						if(Character.isDigit(s[i+1])){
							i++;
						}
						else{
							break;
						}
					}
					for(int j = 0; j < list.size(); j++){
						sum += list.get(j)*Math.pow(10, list.size()-1-j);
					}
				}
			}
		}
		System.out.println(sum);
	}

}

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

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

    if(n[0] == n[1] and n[0] == n[2]) cout << "Yes" << endl;
    else if(n[1] == n[2] and n[1] == n[3]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
from copy import copy
MOD = int(1e9)+7

def main():
    s = input()
    n = len(s)
    dp = [0 for _ in range(13)]
    dp[0] = 1 
    mul = 1
    for i in reversed(range(n)):
        nextDP = [0 for _ in range(13)]
        if s[i] == '?':
            for j in range(13):
                for k in range(10):
                    nextDP[(k*mul + j)%13] += dp[j]
                    nextDP[(k*mul + j)%13] %= MOD
        else:
            x = ord(s[i]) - ord('0')
            for j in range(13):
                nextDP[(x*mul + j)%13] += dp[j]
                nextDP[(x*mul + j)%13] %= MOD
        dp = copy(nextDP)
        mul *= 10
        mul %= 13
    print(dp[5])
main()


Measured memory_bytes: 44524
/*
Author: Arham_doshi
@quote "Code like there's no tommorow!"
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
#include <bits/stdc++.h>

#define int         long long
#define double      long double
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define bs(v,n)     binary_search(all((v)),(n))
#define lb(v,n)     lower_bound(all((v)),(n))
#define ub(v,n)     upper_bound(all((v)),(n))
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++)
#define _init(b)     memset(b,-1,sizeof(b))
#define _init0(b)     memset(b,0,sizeof(b))
#define MOD         1000000007



using namespace std;

int gcd(int a, int b) {  if (a == 0)  return b; return gcd(b % a, a); }  
bool mod(double a,double b) {return a/b - floor(a/b);}

int occurs(vi v,int n){
auto it=lb(v,n);auto it1=ub(v,n);int x=it1-it;return x;}

int logb(int base, int x) {
    return (log(x) / log(base));
}



signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int i,j,x,m,n;
    string s1,s2;
    cin>>s1>>s2;
    n=s1.length();
    m=s2.length();
    int dp[n+1][m+1];
    _init0(dp);
    fo(i,0,n){
        fo(j,0,m){
            if(s1[i]==s2[j]){
                dp[i+1][j+1]=dp[i][j]+1;
            }
            else{
                dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j]);
            }
        }
    }
    string s3="";
    i=n;
    j=m;
    while(dp[i][j]!=0){
        if(s1[i-1]==s2[j-1]){
            s3+=s1[i-1];
            i--;
            j--;
        }
        else{
            if(dp[i-1][j]>dp[i][j-1]){
                i--;
            }
            else{
                j--;
            }
        }
    }
     reverse(all(s3)); 
    cout<<s3;
    return 0;
}

Measured memory_bytes: 70656
N = int(input())
M = int(input())

target = list(map(int, input().split()))
yosou = [list(map(int, input().split())) for i in range(M)]


ten = [0 for _ in range(N)]
for i in range(M) :
    hazure = 0
    for j in range(N) :
        if target[i] == yosou[i][j] :
            ten[j] += 1
        else :
            hazure += 1
    ten[target[i]-1] += hazure

for i in range(N) :
    print(ten[i])


Measured memory_bytes: 5704
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2001

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

struct Line 
{
	int height;
	int from;
	int to;
	
	bool operator<( const Line& right ) const {
		return height < right.height;
	}
};

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

	while(cin >> N >> M >> A)
	{

		if(N==0 && M==0 && A==0){ break; }
		
		vector<Line> lines(M);

		vector<int> amida(N+1,0);
		rep(i,amida.size()){amida[i] = i;}

		if(M!=0)
		{
			int H,P,Q;
			rep(i,M)
			{
				cin >> H >> P >> Q;
				lines[i] = {H,P,Q};
			}

			sort(ALL(lines));

			rep(i,M)
			{
				int p = lines[i].from;
				int q = lines[i].to; 
				swap(amida[p], amida[q]);
			}
		}
		cout << amida[A] << endl;
	}

	return 0;
}

Measured memory_bytes: 1228
a, b, c, d, e, f = map(int, input().split())

ans = (0, 100*a)
def dfs(c_s,c_w, idx):
    global ans
    if idx == 4:
        if c_w + c_s > f:
            return
        if e*(c_w // 100) < c_s:
            return
        if c_w+c_s == 0:
            return
        if c_s / (c_w+c_s) > ans[0] / (ans[0]+ans[1]):
            ans = (c_s, c_w)
    else:
        t = [a, b, c, d][idx]
        for i in range(((f-(c_s+c_w)) // t)+1):
            if idx <= 1:
                dfs(c_s, c_w + 100 * t * i, idx + 1)
            else:
                dfs(c_s + t*i, c_w, idx + 1)
dfs(0, 0, 0)
print(*[ans[0]+ans[1], ans[0]])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;i<(n);(i)++)
using namespace std;
 
int main(){
  int N; cin>>N; vector <int> M(N);
  rep(i,N)cin>>M[i];
  int L; cin>>L; int S[N];
  rep(i,L)cin>>S[i];
  int count=0;
  rep(i,L){
    if(binary_search(M.begin(),M.end(),S[i]))
    count++;
  }
  cout << count<<endl;
}


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

int main() {
  string s;
  cin>>s;
  int n = s.length() + 1;
  int a1[n], a2[n];
  for (int i=0; i<n; i++) a1[i] = a2[i] = -1;

  int i = 0;
  while (i < n - 1) {
    if (s[i] == '>') {
      ++i;
      continue;
    }
    a1[i] = 0;
    while (i < n - 1 && s[i] == '<') {
      a1[i+1] = a1[i] + 1;
      ++i;
    }
  }
  i = n - 2;
  while (i >= 0) {
    if (s[i] == '<') {
      --i;
      continue;
    }
    a2[i+1] = 0;
    while (i >= 0 && s[i] == '>') {
      a2[i] = a2[i+1] + 1;
      --i;
    }
  }
  long long sum_a = 0;
  for (int i=0; i<n; i++) {
    sum_a += max(a1[i], a2[i]);
  }
  cout<<sum_a<<endl;
}

Measured memory_bytes: 4740
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
 
using namespace std;
using ll = long long;
 
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };


int main()
{
	string w;
	int x[30] = {};

	cin >> w;

	for(int i = 0; i < w.size(); i++){
		x[w[i] - 'a']++;
	}

	for(int i = 0; i < 27; i++){
		if(x[i] % 2 == 1){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

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

#define pb 		push_back
#define mp 		make_pair
#define prior   priority_queue
#define MOD 	1000000007
#define INF64 	(long long)1e18
#define INF 	(int)1e9
#define PI 		3.1415926535897932384626433832795 
#define ll      long long
#define ld		long double
#define ret     return
#define NUM 	1000001
const int SIZE = 2e5+4;
void fastio(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

void input(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
}

int di[] = {-1,1,0,0}, dj[] = {0,0,-1,1};

void dfs(int i, int j, vector<string>& grid, vector<vector<bool>>& visited){
	if(grid[i][j]!='#')
		visited[i][j]=true;
	else
		return;
	for(int d=0;d<4;d++){
		int ni=i+di[d],nj=j+dj[d];
		if(ni>=0&&nj>=0&&ni<grid.size()&&nj<grid[0].size()&&grid[ni][nj]!='#'&&!visited[ni][nj]){
			visited[ni][nj]=true;
			dfs(ni,nj,grid,visited);
		}
	}
}



void solveTest(){
}

int main(){
	fastio();
	//input();

	/*int t;
	cin>>t;
	while(t--){
		solveTest();
	}*/

	int n,m,c;
	cin>>n>>m>>c;
	int b[m];
	for(int i=0;i<m;i++){
		cin>>b[i];
	}
	int a[n][m];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>a[i][j];
		}
	}
	int cnt=0;
	for(int i=0;i<n;i++){
		int sum=c;
		for(int j=0;j<m;j++){
			sum += a[i][j]*b[j];
		}
		if(sum>0)cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}
     

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

class MainClass
{

    public static void Main(string[] args)
    {
        var n = LnStr();
        var N = n.Length;
        var price = new int[N];
        for (int i = 0; i < N; i++)
        {
            price[i] = int.Parse(n[i].ToString());
        }
        var dp = new int[N + 1][];
        for (int i = 0; i < dp.Length; i++)
        {
            dp[i] = new int[2];
        }
        dp[0][1] = 1;
        for (int i = 0; i < N; i++)
        {
            dp[i + 1][0] = Min(dp[i][0] + price[i], dp[i][1] + 10 - price[i]);
            dp[i + 1][1] = Min(dp[i][0] + price[i] + 1, dp[i][1] + 10 - price[i] - 1);
        }
        print(dp[N][0]);
    }

public static long PowLite(long n, long p, int mod = (int)1e9 + 7){long ans = 1;long now = n;for (; p > 0; p >>= 1){if ((p & 1) == 1){ans *= now;ans %= mod;}now *= now;now %= mod;}return ans;}
public static void print(object obj) { Console.WriteLine(obj); }
public static long Gcd(long a, long b) { if (a > b) { var r = a % b; if (r == 0) return b; else return Gcd(b, r); } else { var r = b % a; if (r == 0) return a; else return Gcd(a, r); } }
public static int Gcd(int a, int b) { if (a > b) { var r = a % b; if (r == 0) return b; else return Gcd(b, r); } else { var r = b % a; if (r == 0) return a; else return Gcd(a, r); } }
public static int[] LnInts() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var ins = new int[vs.Length]; for (int i = 0; i < vs.Length; i++) ins[i] = int.Parse(vs[i]); return ins; }
public static int LnInt() { var vs = Console.ReadLine().Trim(); return int.Parse(vs); }
public static long[] LnLngs() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var ins = new long[vs.Length]; for (int i = 0; i < vs.Length; i++) ins[i] = long.Parse(vs[i]); return ins; }
public static long LnLng() { var vs = Console.ReadLine().Trim(); return long.Parse(vs); }
public static string[] LnStrs() { var vs = Console.ReadLine().Trim().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); return vs; }
public static string LnStr() { var vs = Console.ReadLine().Trim(); return vs; }
public static List<T[]> AllPermutation<T>(params T[] array) where T : IComparable{var a = new List<T>(array).ToArray();var res = new List<T[]>();res.Add(new List<T>(a).ToArray());var n = a.Length;var next = true;while (next){next = false;int i;for (i = n - 2; i >= 0; i--){if (a[i].CompareTo(a[i + 1]) < 0) break;}if (i < 0) break;var j = n;do{j--;} while (a[i].CompareTo(a[j]) > 0);if (a[i].CompareTo(a[j]) < 0){var tmp = a[i];a[i] = a[j];a[j] = tmp;Array.Reverse(a, i + 1, n - i - 1);res.Add(new List<T>(a).ToArray());next = true;}}return res;}}



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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr); cout.tie(nullptr);
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	while (k--) {
		if (a >= b) b <<= 1ll;
		else c <<= 1ll;
	}
	if (a < b && b < c) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		int cnt = 0;
 
		int[][] a = new int[H][W];
 
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				a[i][j] = 1;
			}
		}
 
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < W; j++) {
				a[i][j] = 0;
			}
		}
 
		for (int j = 0; j < w; j++) {
			for (int i = 0; i < H; i++) {
				a[i][j] = 0;
			}
		}
 
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (a[i][j] == 1) {
					cnt++;
				}
			}
		}
 
		System.out.println(cnt);
 
	}
}

Measured memory_bytes: 25172
#include <stdio.h>
#include <stdlib.h>
int ctoi(char);
int main(){
    char s[11];
    int i,tmp; 
    scanf("%s",s);
    int min = abs(ctoi(s[0])*100+ctoi(s[1])*10+ctoi(s[2]) -753) ;
    for(i=1;s[i+2]!='\0';i++){
        tmp =abs(ctoi(s[i])*100+ctoi(s[i+1])*10+ctoi(s[i+2]) -753);
        if(tmp < min) min =tmp;
    }
    printf("%d",min);
    
}
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<iostream>
#include<string>

using namespace std;

int main(void) {

	int x, a, b;
	cin >> x >> a >> b;

	if (b <= a)cout << "delicious\n";
	else if (b <= a + x)cout << "safe\n";
	else cout << "dangerous\n";

	return 0;
}

Measured memory_bytes: 256
use proconio::input;

fn main() {
    input!{
        mut x: i64,
        mut k: i64,
        d: i64,
    }

    if x < 0 {
        x = -x;
    }
    
    let initial_steps = x / d;
    if initial_steps > k {
        println!("{}", x - k*d);
        return;
    }

    x -= d * initial_steps;
    k -= initial_steps;
    let ad =
        if k % 2 == 0 {
            x
        } else {
            d - x
        };

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


Measured memory_bytes: 2148
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif

#define ll long long
#define ld long double 
#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (ll)(a.size())
#define all(a) a.begin(), a.end() 
#define fr(i,n) for(i=1;i<=n;i++)
#define rp(i,n) for(i=0;i<n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
typedef pair<ll, ll> ii;
typedef vector<ll> vl;
const ll N = 200010;
ll mod=1e9+7;

ll ffmod(ll x, ll y, ll mod)
{
    ll rt=1;
    while(y)
    {
        if(y&1ll) rt=(rt*x)%mod;
        x=(x*x)%mod, y/=2ll;
    }
    return rt;
}

ll dp[N], a[N];

int main()
{
    FIO;
    ll n,k,i,j;
    cin>>n>>k;
    fr(i,n) cin>>a[i];
    dp[0]=0;
    fr(i,k)
    {
        dp[i]=0;
        for(j=1;j<=n && a[j]<=i;j++)
            dp[i]=max(dp[i], 1ll-dp[i-a[j]]);
    }
    if(dp[k]==1)
        cout<<"First\n";
    else
        cout<<"Second\n";
    return 0;
}


Measured memory_bytes: 1024
from collections import deque

s = deque(input())
q = int(input())

reverse_flag = 1

for _ in range(q):
    query = input().split()
    if query[0] == "1":
        reverse_flag *= -1
    else:
        if (query[1] == "1" and reverse_flag == 1) or (query[1] == "2" and reverse_flag == -1):
            s.appendleft(query[2])
        else:
            s.append(query[2])
if reverse_flag == 1:
    print("".join(s))
else:
    s.reverse()
    print("".join(s))

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

#define MAX 200002

int n;

vector<pair<int, int> > v;

long long int dp[4002][4002];

vector<pair<int, int> > vv;
#define MOD 1000000007

class Combination{
	long long int ppow(long long int i, long long int j){
		long long int res = 1LL;
		while (j){
			if ((j & 1LL)){
				res *= i;
				if (res >= MOD){
					res %= MOD;
				}
			}
			j >>= 1;
			i *= i;
			if (i >= MOD){
				i %= MOD;
			}
		}
		return res;
	}
public:
	vector<long long int> k;
	vector<long long int> r;
	void resize(int N){
		k.resize(N + 2);
		r.resize(N + 2);
		k[0] = 1;
		for (int i = 1; i < N + 2; i++){
			k[i] = k[i - 1];
			k[i] *= i;
			if (k[i] >= MOD)k[i] %= MOD;
		}
		long long int al = k[k.size() - 1];
		long long int iv = ppow(k[k.size() - 1], MOD - 2);
		r[k.size() - 1] = iv;
		for (int i = (int)(r.size()) - 2; i >= 0; i--){
			r[i] = r[i + 1] * (i + 1);
			if (r[i] >= MOD){
				r[i] %= MOD;
			}
		}
	}
	long long int C(int a, int b){
		if (a < b)return 0;
		long long int up = k[a];
		long long int dw = r[b] * r[a - b];
		dw %= MOD;
		up *= dw;
		up %= MOD;
		return up;
	}
	long long int H(int a, int b){
		return C(a + b - 1, b);
	}
	long long int catalan_number(int n){
		return (C(2 * n, n) + MOD - C(2 * n, n - 1)) % MOD;
	}
};

Combination C;

int main(){
	cin >> n;
	C.resize(8002);
	for (int i = 0; i < n; i++){
		int a, b;
		scanf("%d%d", &a, &b);
		v.push_back(make_pair(a, b));
		dp[2000 - a][2000 - b]++;
		vv.push_back(make_pair(2000+a, 2000+b));
	}
	for (int i = 0; i < 4001; i++){
		for (int j = 0; j < 4001; j++){
			if (dp[i][j] >= MOD){
				dp[i][j] %= MOD;
			}
			dp[i + 1][j] += dp[i][j];
			dp[i][j + 1] += dp[i][j];
		}
	}
	long long int ans = 0;
	for (auto i : vv){
		ans += dp[i.first][i.second];
		if (ans >= MOD){
			ans %= MOD;
		}
	}
	ans %= MOD;
	for (auto i : vv){
		ans += MOD - C.C((i.first - 2000) * 2 + (i.second - 2000) * 2, (i.second - 2000) * 2);
		if (ans >= MOD){
			ans %= MOD;
		}
	}
	ans %= MOD;
	ans *= C.r[2];
	ans %= MOD;
	printf("%lld\n", ans);
	return 0;
}

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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int   d,t,s ; 
  cin >> d >> t >> s ;
  
  if( d > t*s  )  cout << "No" ;
  else           cout << "Yes";
      


}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>

using namespace std;

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

	set<long long> nums = {s};
	int ans = 0;
	for (int i = 2; i <= 1000000; i++) {
		if (s % 2 == 0) {
			s /= 2;
		} else {
			s = s * 3 + 1;
		}
		if (nums.count(s) > 0) {
			ans = i;
			break;
		}
		nums.insert(s);
	}

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector< vector<int> > VVI;
typedef pair<int,int> P;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()

int main(){
  string X;
  cin>>X;
  ll cnt=0;
  rep(i,X.size()/2) if(X[i]!=X[X.size()-1-i]) cnt++;
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main (){
  int K ; 
  scanf("%d", &K);
  K=K-1;
  int int_arr1[32] = {1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51};
  printf("%d\n",int_arr1[K]);
}

Measured memory_bytes: 128
#include <cstdio>

int N,M,K;

int main(){
	scanf("%d%d%d",&N,&M,&K);
	for(int i=0;i<=N;i++){
		for(int j=0;j<=M;j++){
			if((M*i+N*j-2*i*j)==K){
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,t;
	cin>>s>>t;
	int A[s.size()+1][t.size()+1];
	for(int i=0;i<=s.size();i++)
	{
		for( int j=0;j<=t.size();j++)
		{
			A[i][j]=0;
		}
	}
	for(int i=0;i<=s.size();i++)
	{
		for(int j=0;j<=t.size();j++)
		{
			if(i==0 || j==0)
				A[i][j]=0;
			else if(s[i-1]==t[j-1])
			{
				A[i][j]=max(A[i-1][j-1]+1,max(A[i][j-1],A[i-1][j]));
			}	
			else
			{
				A[i][j]=max(A[i-1][j],A[i][j-1]);
			}
		}
	}
	int i=s.size(),j=t.size();
	stack<char>c;
	while(i>0 && j>0)
	{
		if(s[i-1]==t[j-1])
		{
			c.push(s[i-1]);
			i-=1;
			j-=1;
		}
		else if(A[i-1][j]>A[i][j-1])
		{
			i-=1;
		}
		else
		{
			j-=1;
		}
	}
	int T=c.size();
	for(int k=0;k<T;k++)
	{
		cout<<c.top();
		c.pop();
	}

		
	
}

Measured memory_bytes: 35456
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class AStrings {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      string s, t; cin >> s >> t;
      cout << t << s << endl;
    }
};

signed main() {
  AStrings solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
import java.util.TreeSet

fun main(args: Array<String>) {
    val s = readLine()!!
    val k = readLine()!!.toInt()
    val n = s.length - 1

    val substringSet = TreeSet<String>()
    for (i in 0..n) {
        var count = 0
        for (j in i..n) {
            if (count >= 5) break
            substringSet.add(s.slice(i..j))
            count++
        }
    }
    println(substringSet.toList()[k - 1])
}



Measured memory_bytes: 40392
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long LL;
const int N=1e6;
int n,l[N+10],r[N+10],loc[N+10],vis[N+10];
LL ans=0;
int main() {
    scanf("%d",&n);
    for (int i=1;i<=n;i++) {
        int x;
        scanf("%d",&x);
        loc[x]=i;
    }
    for (int i=n;i>=1;i--) {
        int k=loc[i];
        vis[k]=1;
        int nowl=k,nowr=k;
        if (vis[k-1]) nowl=l[k-1];
        if (vis[k+1]) nowr=r[k+1];
        r[nowl]=nowr;
        l[nowr]=nowl;
        ans+=(LL)(nowr-k+1)*(k-nowl+1)*i;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 13312
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

int n;

vector<PII> x;

vector<int> res;

int main() {
    GI(n);

    x.resize(n);

    for (int i = 0; i < n; i++) {
        GI(x[i].FF);
        x[i].SS = i;
    }

    res.resize(n);

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

    for (int i = 0; i < n/2; i++) {
        res[x[i].SS] = x[n/2].FF;
    }
    for (int i = n/2; i < n; i++) {
        res[x[i].SS] = x[n/2-1].FF;
    }

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


Measured memory_bytes: 4480
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 998244353;
//
bool used[200001]={},iro[200001]={};
  vector<int> hen[200001];
  void dfs(int a,bool x){
    iro[a]=x;
    for(int i=0;i<hen[a].size();i++){
      if(!used[hen[a][i]]){
        used[hen[a][i]]=true;
        dfs(hen[a][i],!x);
      }
    }
  }

        signed main() {
        int n;
        cin>>n;
      
        int a,b;
        for(int i=0;i<n-1;i++){
          cin>>a>>b;a--;b--;
          hen[a].push_back(b);
          hen[b].push_back(a);
        }
        used[0]=true;
        dfs(0,false);
        int p,q;
        if(n%3==0)p=n/3;
        else p=n/3+1;
        if(n%3<=1)q=n/3;
        else q=n/3 +1;
        int r=n/3;
        int k=0;
        for(int i=0;i<n;i++)if(iro[i])k++;
        if(k<p||n-k<q){
          if(k<q||n-k<p){
           if(k<n-k){
             for(int i=0;i<n;i++){
          if(p&&(!iro[i])){
            cout<<p*3-2<<' ';
            p--;
            continue;
          }
          if(q&&(!iro[i])){
            cout<<q*3-1<<' ';
            q--;
            continue;
          }
          cout<<r*3<<' ';
          r--;
        }
           }else{
             for(int i=0;i<n;i++){
          if(p&&(iro[i])){
            cout<<p*3-2<<' ';
            p--;
            continue;
          }
          if(q&&(iro[i])){
            cout<<q*3-1<<' ';
            q--;
            continue;
          }
          cout<<r*3<<' ';
          r--;
        }
           }
            return 0;
          }
          for(int i=0;i<n;i++){
          if(p&&(!iro[i])){
            cout<<p*3-2<<' ';
            p--;
            continue;
          }
          if(q&&(iro[i])){
            cout<<q*3-1<<' ';
            q--;
            continue;
          }
          cout<<r*3<<' ';
          r--;
        }
return 0;
        }
        for(int i=0;i<n;i++){
          if(p&&iro[i]){
            cout<<p*3-2<<' ';
            p--;
            continue;
          }
          if(q&&(!iro[i])){
            cout<<q*3-1<<' ';
            q--;
            continue;
          }
          cout<<r*3<<' ';
          r--;
        }

        


      }


        


Measured memory_bytes: 18176
#include<bits/stdc++.h>
#include<algorithm>
#include<string>

using namespace std;

#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pi acos(-1.0)
#define scan(a) scanf("%d",&a)
#define scanll(a) scanf("%lld",&a)
#define print(a) printf("%d\n",a)
#define printll(a) printf("%lld\n",a)
#define stll(a) stoll(a,nullptr,10)
#define PII pair<ll,ll>
#define mp(a,b) make_pair(a,b)

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    string str;
    cin>>str;
    ll len = str.length();
    ll ans=0;
    string st="",tmp="";
    st+=str[0];
    ans++;
    for(int i=1 ;i<len;i++)
    {
        tmp+=str[i];
        if(tmp==st)
        {
            continue;
        }
        else
        {
            st=tmp;
            ans++;
            tmp="";
        }
    }
    cout<<ans<<endl;


}






Measured memory_bytes: 640
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>

using namespace std;

int main()
{
	int n, a[100];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	cout << a[n - 1] - a[0] << endl;
	return 0;
}



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

void f(int A, int K, vector<double> &P) {
  if (K>A) P.at(A)=P.at(2*A)/2;
}

int main() {
  int N, K;
  cin >> N >> K;
  double S=0;
  int SS=max(K, N);
  vector<double> P(SS*2+2, 1);
  if (K-1>N) 
    for (int i=K-1; i>N; i--) {
      P.at(i)=P.at(2*i)/2;
    }
  for (int i=N; i>0; i--) {
    f(i, K, P);
    //cout << i << ":" <<P.at(i) << endl;//////
    S+=P.at(i)/N;
  }
  cout <<std::setprecision(12)<<S <<endl;
  return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int  t[]=new int[5];
        t[0] = scan.nextInt();
        t[1] = scan.nextInt();
        t[2] = scan.nextInt();
        t[3] = scan.nextInt();
        t[4] = scan.nextInt();
        
            for(int i = 0; i<4;i++){
                for(int j =0;j<4-i;j++){
                    if(t[j]<t[j+1]){
                        int temp =  t[j];
                        t[j] = t[j+1];
                        t[j+1]=temp;
                        
                    }
                }
        }
            System.out.println(t[0]+" "+t[1]+" "+t[2]+" "+t[3]+" "+t[4]);
    }
}




Measured memory_bytes: 26140
#include<iostream>
#include<iomanip>
#include<functional>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<vector>
#include<utility>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	cout<<min(min(a+b,b+c),a+c);
	return 0;
}

Measured memory_bytes: 256
//
// Created by Aditya Bhadoo on 19/08/20.
//
#include <bits/stdc++.h>

using namespace std;


int main(){
    string s;
    cin>>s;
    int cnt=0;
    int m=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='R'){
            cnt++;
        }else
            cnt=0;
        m=max(m,cnt);

    }
    cout<<m;
    return 0;

}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main() {
  ll n, k, ans = -1e18;
  cin >> n >> k;
  vector<ll> p(n), c(n), M;
  rep(i, n) cin >> p[i], --p[i];
  rep(i, n) cin >> c[i];
  rep(i, n) {
    ll x = i;
    vector<ll> s;
    ll tot = 0;
    do {
      x = p[x];
      s.push_back(c[x]);
      tot += c[x];
    } while (x != i);
    ll l = s.size();
    ll t = 0;
    rep(j, l) {
      t += s[j];
      if (j + 1 > k) break;
      ll now = t;
      if (tot > 0) {
        ll e = (k - j - 1) / l;
        now += tot * e;
      }
      ans = max(ans, now);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3764
// D - Integer Cards
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rp(i,n) for(int i=0;i<(n);i++)

int main(){
	int N,M; cin>>N>>M;

	vector<ll> A(N);
	rp(i,N) cin>>A[i];
	sort(A.begin(), A.end());

	vector<pair<ll,int>> B;
	rp(i,M){
		int b; ll c; cin>>b>>c;
		B.push_back(make_pair(c,b));
	}
	sort(B.begin(), B.end());

	ll ans = 0;
	int ans_count = 0;
	int n=N-1;
	ll value; int count;
	for(int m=M-1; m>=0 && ans_count<N; --m){
		tie(value, count) = B[m];

		while(ans_count<N && n>=0 && value <= A[n]){
			ans += A[n--];
			++ans_count;
		}
		if(n<0 || ans_count>=N) break;

		while(ans_count<N && 0<count--){
			ans += value;
			++ans_count;
		}
		if(ans_count>=N) break;
	}

	if(ans_count<N)
		while(n && ans_count<N){ ans += A[n--]; ++ans_count; }

	cout<< ans <<endl;
}

Measured memory_bytes: 3188
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    if(N==M){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
  

  
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  int t,m,n;
  cin >> n >> m >> t;
  if(n==m){ if(t!=m) cout << "Yes";
          else cout << "No";
          }
  else if(m==t){if(n!=m) cout << "Yes";
          else cout << "No";}
  else if(n==t){if(n!=m) cout << "Yes";
          else cout << "No";}
  else cout << "No";

}

Measured memory_bytes: 3620
N,C = gets.split.map(&:to_i)
d = C.times.map{gets.split.map(&:to_i)}
c = N.times.map{gets.split.map(&:to_i)}

cnt = 3.times.map{[0]*C}

N.times{|i|
  N.times{|j|
    cnt[(i+j)%3][c[i][j]-1] += 1
  }
}

min = 10**9
C.times{|i|
  C.times{|j|
    next if i==j
    C.times{|k|
      next if k==i || k==j
      
      res = 0
      [i,j,k].each.with_index{|y,i|
        cnt[i].each.with_index{|t,x|
          res += d[x][y] * t
        }
      }
      min = res if min > res
    }
  }
}

p min

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

using namespace std;
 
int main()
{
    string str;
     
    getline(cin, str);
     
    int cnt = 0, flg = 0;
    string key = "";
    for (int i = 0; i < (int)str.size(); i++) {
        cnt++;
         
        if (str[i] == ' '|| str[i] == ',' || str[i] == '.') {
            if (3 <= cnt-1 && cnt-1 <= 6) {
                if (!flg) {
                    cout << key;
                    flg = 1;
                } else {
                    cout << ' ' << key;
                }
            }
            cnt = 0;
            key = "";
        } else {
            key += str[i];
        }
    }
    cout << endl;     
    return 0;
}

Measured memory_bytes: 3004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod998 = 998244353;
const ll intmax = 2147483647;
const ll llmax = 9223372036854775807;
const char sp = ' ';

int N;

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) {
		if (N <= i*1.08&&i*1.08 < N + 1) {
			cout << i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;
}

Measured memory_bytes: 256
N = int(input())
cards = [0] + [int(input()) for i in range(N)] + [0]
ans = 0
for i in range(N+1):
  min1 = min(cards[i-1],cards[i])
  ans += min1
  cards[i] -= min1
  
  ans += cards[i]//2
  cards[i] -= cards[i]//2*2
  
  min2 = min(cards[i],cards[i+1])
  ans += min2
  cards[i] -= min2
  cards[i+1] -= min2
  
print(ans)

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

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;

const int mod = 998244353;
const ll inf = 3e18 + 5;

int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }  

int main(){
    int n;
    string s;
    cin >> n;
    cin >> s;
    if(n%2 != 0)
        cout << "No";
    else{
        bool check=true;
        for(int i=0; i<n/2; i++){
            if(s[i] != s[i+n/2]){
                check = false;
                break;
            }
        }
        if(check)
            cout << "Yes";
        else
            cout << "No";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<vector<int>> E(N);
  for (int i = 0; i < N - 1; i++){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    E[a].push_back(b);
    E[b].push_back(a);
  }
  vector<int> d(N, -1);
  vector<int> prev(N);
  d[0] = 0;
  queue<int> Q;
  Q.push(0);
  while (!Q.empty()){
    int v = Q.front();
    Q.pop();
    for (int w : E[v]){
      if (d[w] == -1){
        d[w] = d[v] + 1;
        prev[w] = v;
        Q.push(w);
      }
    }
  }
  int x = N - 1;
  for (int i = 0; i < (d[N - 1] - 1) / 2; i++){
    x = prev[x];
  }
  vector<bool> c(N, 0);
  c[0] = true;
  queue<int> Q2;
  Q2.push(0);
  while (!Q2.empty()){
    int v = Q2.front();
    Q2.pop();
    for (int w : E[v]){
      if (!c[w] && w != x){
        c[w] = true;
        Q2.push(w);
      }
    }
  }
  vector<int> cnt(2, 0);
  for (int i = 0; i < N; i++){
    if (c[i]){
      cnt[1]++;
    } else {
      cnt[0]++;
    }
  }
  if (cnt[1] > cnt[0]){
    cout << "Fennec" << endl;
  } else {
    cout << "Snuke" << endl;
  }
}

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

long long int attack(long long int N)
{
    long long int ans = 0;
    if(N == 1){
        ans += 1;
    }else{
        ans += 1 + attack(N/2) * 2;
    }
    return ans;
}

int main()
{
    long long int N;
    cin >> N;

    cout << attack(N);
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <queue>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

    int n, k;
    cin >> n >> k;

    vector<int> p(n);
    REP(i, n) cin >> p[i];

    vector<double> ex(n);
    REP(i, n) ex[i] = (1.0 + p[i]) / 2.0;

    queue<double> q;
    double maxi = 0.0;
    double sum = 0.0;
    REP(i, n) {
        sum += ex[i];
        q.push(ex[i]);
        if (q.size() > k) {
            sum -= q.front();
            q.pop();
        }
        if (q.size() == k)
            maxi = max(maxi, sum);
    }

    printf("%.10f\n", maxi);
    return 0;
}


Measured memory_bytes: 4224
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

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

    int r, g, b;
    read(r, g, b);

    int x = r * 100 + g * 10 + b;

    if (x % 4 == 0) {
        print("YES");
    } else {
        print("NO");
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define mfill(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(), v.end()
#define in(x,y,h,w) if(0<=x&&x<h&&0<=y&&y<w)
#define y0 y12345
#define y1 y54321

#ifdef LOCAL
#define debug(...) fprintf(stderr,__VA_ARGS__)
#else
#define debug(...) 42
#endif

using ul = unsigned long;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;using vvint = vector<vector<int>>;
using vll = vector<ll>;using vvll = vector<vector<ll>>;
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(a>b){a=b;return 1;}return 0;}
template <class T>void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}
template <class T>T gcd(T &a, T &b){if(a<b){swap(a,b);} T r = a%b; while(r!=0){a=b;b=r;r=a%b;} return b;}

vint dx = {-1, 0, 1, 0}, dy = {0, -1, 0, 1};
vint dx8 = {-1, -1, -1, 0, 1, 1, 1, 0}, dy8 = {-1, 0, 1, 1, 1, 0, -1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    debug("debug test\n");
    int n,m;
    cin>>n;
    vint p(n);
    rep(i, n)cin>>p[i];
    ll ans = 0;
    rep(i, n-2){
        if(p[i+1]>p[i]&&p[i+2]>p[i+1]){
            ans++;
        }else if(p[i+1]<p[i]&&p[i+2]<p[i+1]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define lint long long

int S(lint n){
    int sum = 0;
    for(int i = 0; i < 10; ++i){
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

signed main() {
    int N;
    cin >> N;

    if(N % S(N) == 0){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int a,b;
		while(true) {
			a = sc.nextInt();
			b = sc.nextInt();
			if(a == 0 && b == 0) break;
			
			if(a < b){
			    System.out.println(a + " " + b);
			}else{
			    System.out.println(b + " " + a);
			}
		}
	}
}


Measured memory_bytes: 36136
#include <algorithm>
#include <iostream>

constexpr int MOD = 1000000007;
constexpr int MAX_N = 100000;
const int R_LOOP[6] = {1, 10, 9, 12, 3, 4};
int num_digits[6];
long long all_num_possibles[MAX_N + 1][13];

long long ComputePossibles(long long prev_possibles, int prev_r, int target_r, int index) {
  if (index == 5) {
    long long possibles = 0;
    int r = (target_r + 13 - prev_r) % 13;
    for (int i = 0; i < 13; ++i) {
      if (R_LOOP[index] * i % 13 == r) {
        possibles = (possibles + prev_possibles * all_num_possibles[num_digits[index]][i]) % MOD;
      }
    }
    return possibles;
  }
  long long possibles = 0;
  for (int i = 0; i < 13; ++i) {
    long long cur_possibles = prev_possibles * all_num_possibles[num_digits[index]][i] % MOD;
    int cur_r = (prev_r + R_LOOP[index] * i) % 13;
    possibles = (possibles + ComputePossibles(cur_possibles, cur_r, target_r, index + 1)) % MOD;
  }
  return possibles;
}

int main() {
  std::string S;
  std::cin >> S;
  int fixed_r = 0;
  for (int i = 0; i < 6; ++i) {
    num_digits[i] = 0;
  }
  for (int i = 0; i < S.length(); ++i) {
    char ch = S[S.length() - i - 1];
    if (ch != '?') {
      int d = ch - '0';
      fixed_r = (fixed_r + d * R_LOOP[i % 6]) % 13;
    } else {
      num_digits[i % 6]++;
    }
  }
  int target_r = (18 - fixed_r) % 13;
  int max_num_digits = 0;
  for (int i = 0; i < 6; ++i) {
    max_num_digits = std::max(max_num_digits, num_digits[i]);
  }
  all_num_possibles[0][0] = 1;
  for (int j = 1; j < 13; ++j) {
    all_num_possibles[0][j] = 0;
  }
  for (int i = 1; i <= max_num_digits; ++i) {
    for (int j = 0; j < 13; ++j) {
      all_num_possibles[i][j] = 0;
    }
    for (int j = 0; j <= 9; ++j) {
      for (int k = 0; k < 13; ++k) {
        all_num_possibles[i][(j + k) % 13] = (all_num_possibles[i][(j + k) % 13] + all_num_possibles[i - 1][k]) % MOD;
      }
    }
  }
  std::cout << ComputePossibles(1, 0, target_r, 0) << std::endl;
  return 0;
}

Measured memory_bytes: 2176