akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}



  








int main() {         
	int n, m;
	cin >> n >> m;
	char v[n][m];
    bool d = 1;
    for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			cin >> v[i][j];
		}
	}
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < m; ++j) {
			if (v[i][j] == '#') {
				int cnt = 0;
				if (i + 1 < n && v[i + 1][j] == '#')cnt++;
				if (i - 1 >= 0 && v[i - 1][j] == '#')cnt++;
				if (j + 1 < m && v[i][j + 1] == '#')cnt++;
				if (j - 1 >= 0 && v[i][j -1] == '#')cnt++;
				if (!cnt) {
					d = 0;
				} 
			}
		}
	}
    if (d) {
		cout << "Yes";
	}else {
		cout << "No";
	}
}

Measured memory_bytes: 3640
MOD = 1000000007

def conv(a,b)
  if b > a/2
    b = a - b
  end
  ans = 1
  for i in 1..b
    ans = ((ans * (a - (i - 1))) * INV[i]) % MOD
  end
  ans % MOD
end

def pow(x,n)
  if n == 0
    1
  elsif n % 2 == 0
    pow(x*x%MOD, n/2) % MOD
  else
    x * pow(x, n-1) % MOD
  end
end

INV = []
def calc_fact(n)
  INV[0] = pow(1, MOD-2)
  for i in 1..n
    INV[i] = pow(i, MOD-2)
  end
end

n,a,b=gets.chomp.split(" ").map(&:to_i)

all = (pow(2,n) - 1) % MOD
calc_fact(2 * (10 ** 5))

all = all - conv(n,a) - conv(n,b)
all %= MOD

puts all

Measured memory_bytes: 3528
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextLong()
    var m = n
    val pf = mutableMapOf<Long, Int>()
    var d = 2L
    while (d * d <= m) {
        var count = 0
        while (m % d == 0L) {
            m /= d
            count++
        }
        if (count > 0) {
            pf[d] = count
        }
        d++
    }
    if (m > 1) {
        pf[m] = 1
    }
    var ans = 0L
    for (e in pf.values) {
        var rem = e
        for (i in 1..e) {
            if (rem >= i) {
                rem -= i
                ans++
            } else {
                break
            }
        }
    }
    println(ans)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 34420
#include <stdio.h>

int main()
{
  int a,b;
  scanf("%d %d", &a, &b);
  if(a < b){
    printf("a < b\n");
  }
  else if(a > b){
    printf("a > b\n");
  }
  else{
    printf("a == b\n");
  }
  return 0;
}
  

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

ll gcd(ll a, ll b)
{
    if(b == 0) return a;
    else return gcd(b, a%b);
}

int main()
{   
    ll N, K;
    cin >> N >> K;
    vec A(N);
    REP(i,0,N) cin >> A[i];

    ll G = A[0];
    REP(i,1,N) G = gcd(G, A[i]);
    
    bool f = false;
    REP(i,0,N) {
        if(A[i] >= K && (A[i] - K) % G == 0) {
            f = true;
            break;
        }
    }

    if(f) PR("POSSIBLE");
    else PR("IMPOSSIBLE");

    return 0;
}

/*



*/

Measured memory_bytes: 4048
/*
AOJ - ITP1_8_c
Date: 20181005
Author: Mikoron * ♡mikoiwate♡
 */

#define MAX 1200

#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>

int main(void) {
        char ch[MAX];
        int al_nums[26];
        int i;

        for(i = 0; i < 26; i++) al_nums[i] = 0;

        while(fgets(ch, MAX, stdin)) {
                i = 0;
                while(ch[i] != '\0') {
                        if(isalpha(ch[i])) {
                                if(isupper(ch[i])) ch[i] = tolower(ch[i]);
                                al_nums[ch[i]-97]++;
                        }
                        i++;
                }
        }

        for(i = 0; i < 26; i++) {
                printf("%c : %d\n", 97+i, al_nums[i]);
        }

        return 0;
}



Measured memory_bytes: 2060
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;

#define amen ;
#define vec vector
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef double d;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;
typedef unsigned int ui;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int a, b;
    cin >> b >> a;
    if (a % b)
    {
        cout << a - b;
    }
    else
    {
        cout << a + b;
    }



    return 0;
}

Measured memory_bytes: 256
# -*- config: utf-8 -*-
 
 
 
 
a,b,c = map(int,raw_input().split())
j = 0
 
 
if a + b == c or a + c == b or b + c== a:
    j=1
 
if(j == 1):
    print 'Yes'
else:
    print 'No'
 

Measured memory_bytes: 2696
#include<bits/stdc++.h>
#define LLI long long int
#define ULTRA 2134567890
#define de(x) if(x!=0 && MODE==x)
#define MODE 1
using namespace std;

char s[107];
char t[107];

int main()
{
    int i,j;
    int N;

    scanf("%d", &N);
    scanf("%s %s", s, t);
    for( i=0; i<N; i++)
    {
        printf("%c%c", s[i], t[i]);
    }
    printf("\n");

    return 0;
}

//
//          ___ ___  __________  __________
//         /////\  \/\   ______\/\\\\\\\\\\\  Code by ~Ice Tea~ of
//        //// \ \  \ \  \_____/\ \\\\_____/      New Empire of CHSH ...
//       ////   \ \  \ \  \      \ \\\\\\\\\\\
//      ////__   \ \  \ \  \      \ \\\\_____/
//     ///////\   \ \  \ \  \______\ \\\\_______   ________
//    ////____/    \ \__\ \___   ___\ \\\\\\\\\\\ _\  ___  \_
//   /__/           \/__/\/__/\  \__/\ \\\\_____//\  .\_/\_  \
//                           \ \  \   \ \\\\\\\\\\\\  \_\/_\  \
// ... with the AC Power of   \ \  \   \ \\\\_____/ \   _____  \
//   The Great Tsundere Doggy. \ \  \   \ \\\\     \ \  \  \ \  \
//                              \ \__\   \ \\\\\\\\\\ \__\  \ \__\
//                               \/__/   \/_________/\/__/   \/__/
//


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int h = sc.nextInt();



		System.out.println((a+b)*h/2);

		sc.close();
	}

}


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

int main() {
	// your code goes here
	int n,k;cin >> n >> k;
	vector<int> v(n,0);
	for(int i=0;i<n;i++) cin >> v[i];
	vector<int> ans(n,INT_MAX);ans[0]=0;
	for(int i=1;i<n;i++){
	    for(int j=i-1,count=0;count<k&&j>=0;j--){
	        ans[i]=min(ans[i],ans[j]+abs(v[i]-v[j]));count++;
	    }
	} 
	cout << ans[n-1];
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  string s;cin >> s;
  if(s.size()==3)reverse(all(s));
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
lst = list(map(int, input().split()))
cnt = 0
for i in range(30):
    flag = True
    for i in range(len(lst)):
        if lst[i] % 2 != 0:
            flag = False
        else:
            lst[i] /=  2
    if flag:
        cnt += 1
    else:
        break

print(cnt)

Measured memory_bytes: 3060
using System;
using System.Linq;
using System.Collections.Generic;

class P
{
    static void Main()
    {
        string[] a = Console.ReadLine().Split();

        Console.WriteLine(a[0].ToUpper()[0].ToString() + a[1].ToUpper()[0].ToString() + a[2].ToUpper()[0].ToString());
    }
}

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

int main(){
    int d, n;
    cin >> d >> n;
    int p = 1;
    for(int i = 0; i < d; i++)
    {
        p *= 100;
    }
    if (n==100) {
        cout << p * 101 << endl;
    }
    else
    {
        cout << p * n << endl;
    }
}

Measured memory_bytes: 256
// Problem : D - Knapsack Queries on a tree
// Contest : AtCoder - Tokio Marine & Nichido Fire Insurance Programming Contest 2020
// URL : https://atcoder.jp/contests/tokiomarine2020/tasks/tokiomarine2020_d
// Memory Limit : 1024 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef complex<double> cd;
typedef pair<int,int> pii;
typedef pair<int,ll > pil;
typedef pair<ll ,int> pli;
typedef pair<ll ,ll > pll;
typedef vector<int> vi;
typedef vector<ll > vl;
#define pque priority_queue
#define rep(i,l,r) for(i=(l);i<=(r);++i)
#define per(i,l,r) for(i=(l);i>=(r);--i)
#define REP(i,l,r) for(i=(l);i< (r);++i)
#define PER(i,l,r) for(i=(l);i> (r);--i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define fi first
#define se second
#define bugf(...) fprintf(stderr,__VA_ARGS__);
#define bugs(x) cerr<<"    "<<(x);
#define bugx(x) cerr<<"    "<<(#x)<<" = "<<(x);
#define bugl cerr<<"\n";
#define bugL cerr<<"\n================================================\n";
#define bugt bugx(clock());bugl;
template<class IT>inline void cmax(IT &a,IT b){if(a<b)a=b;}
template<class IT>inline void cmin(IT &a,IT b){if(b<a)a=b;}
template<class IT>inline bool bmax(IT &a,IT b){if(a<b){a=b;return true;}else return false;}
template<class IT>inline bool bmin(IT &a,IT b){if(a>b){a=b;return true;}else return false;}
const int N=1<<18,l=10;
vector<pii> Q[N];
int S[N];
pii A[N],X[1<<l],XX[1<<l],Y[N>>l],YY[N>>l];
int n,x,y;
inline void dfs(int v){
	if(v>n)return;
	int wei=A[v].fi,val=A[v].se,i,j,k,s,W,D;
	if(x==l){
		REP(i,0,1<<y)Y[1<<y|i]=mp(Y[i].fi+wei,Y[i].se+val);
		++y;
	}else{
		REP(i,0,1<<x)X[1<<x|i]=mp(X[i].fi+wei,X[i].se+val);
		++x;
		REP(i,0,1<<x)XX[i]=X[i];
		sort(XX,XX+(1<<x));
		REP(i,1,1<<x)cmax(XX[i].se,XX[i-1].se);
	}
	/*bugx(v) bugl
	REP(i,0,1<<x){bugx(X[i].fi) bugx(X[i].se) bugl}
	REP(i,0,1<<y){bugx(Y[i].fi) bugx(Y[i].se) bugl}*/
	//Add v
	if(Q[v].size()){
		REP(i,0,1<<y)YY[i]=Y[i];
		sort(YY,YY+(1<<y));
		reverse(YY,YY+(1<<y));
		/*if(v==13){
			bugx(v) bugl
			REP(i,0,1<<x){bugx(XX[i].fi) bugx(XX[i].se) bugl}
			REP(i,0,1<<y){bugx(YY[i].fi) bugx(YY[i].se) bugl}
		}*/
		REP(j,0,Q[v].size()){
			W=Q[v][j].fi;
			D=Q[v][j].se;
			k=s=0;
			REP(i,0,1<<y){
				while(k!=(1<<x)-1&&XX[k+1].fi+YY[i].fi<=W)++k;
				if(XX[k].fi+YY[i].fi<=W)cmax(s,XX[k].se+YY[i].se);
			}
			S[D]=s;
		}
	}
	//Answer
	dfs(v<<1  );
	dfs(v<<1|1);
	if(y)--y;else --x;
	//Del v
}
inline void ac(){
	int q,i,v,x;
	scanf("%d",&n);
	rep(v,1,n)scanf("%d%d",&A[v].se,&A[v].fi);
	scanf("%d",&q);
	REP(i,0,q){
		scanf("%d%d",&v,&x);
		Q[v].pb(mp(x,i));
	}
	dfs(1);
	REP(i,0,q)printf("%d\n",S[i]);
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	
	ac();
	return 0;
}
#undef pque
#undef rep
#undef per
#undef REP
#undef PER
#undef mp
#undef pb
#undef pf
#undef pob
#undef pof
#undef fi
#undef se
#undef bugs
#undef bugx
#undef bugl

Measured memory_bytes: 15472
class SegmentTree:
    def __init__(self, n, f, gen):
        self.n = n
        self.size = 1
        self.gen = gen
        self.f = f
        while self.size < n:
            self.size *= 2
        self.seg = [gen] * (2 * self.size)

    def set(k, x):
        self.seg[k + self.size] = x

    def build(self):
        k = self.size - 1
        while k>0:
            self.seg[k] = self.f(self.seg[2 * k], self.seg[2 * k + 1])
            k -= 1

    def update(self, i, x):
        k = i + self.size
        self.seg[k] = x
        while k > 0:
            k >>= 1
            self.seg[k] = self.f(self.seg[2 * k], self.seg[2 * k + 1])
    
    def query(self, a, b):
        """
        [a,b)
        """
        L = self.gen
        R = self.gen
        A = a + self.size
        B = b + self.size
        while A<B:
            if A%2:
                L = self.f(L, self.seg[A])
                A += 1
            if B%2:
                B -= 1
                R = self.f(self.seg[B], R)
            A >>= 1
            B >>= 1
        return f(L, R)
    


def f(a, b):
    return min(a,b)

def main():
    n, q = map(int, input().split())
    seg = SegmentTree(n, f, 2**31-1)
    seg.build()

    for _ in range(q):
        t, x, y = map(int, input().split())
        if t==0:
            seg.update(x, y)
        else:
            print(seg.query(x, y+1))


if __name__ == "__main__":
    main()    




Measured memory_bytes: 8704
# -*- coding: utf-8 -*-

import sys
from collections import deque

sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
INF=float('inf')

class Dinic:
    def __init__(self, n):
        self.n = n
        self.links = [[] for _ in range(n)]
        self.depth = None
        self.progress = None
 
    def add_link(self, _from, to, cap):
        self.links[_from].append([cap, to, len(self.links[to])])
        self.links[to].append([0, _from, len(self.links[_from]) - 1])
 
    def bfs(self, s):
        depth = [-1] * self.n
        depth[s] = 0
        q = deque([s])
        while q:
            v = q.popleft()
            for cap, to, rev in self.links[v]:
                if cap > 0 and depth[to] < 0:
                    depth[to] = depth[v] + 1
                    q.append(to)
        self.depth = depth
 
    def dfs(self, v, t, flow):
        if v == t:
            return flow
        links_v = self.links[v]
        for i in range(self.progress[v], len(links_v)):
            self.progress[v] = i
            cap, to, rev = link = links_v[i]
            if cap == 0 or self.depth[v] >= self.depth[to]:
                continue
            d = self.dfs(to, t, min(flow, cap))
            if d == 0:
                continue
            link[0] -= d
            self.links[to][rev][0] += d
            return d
        return 0
 
    def max_flow(self, s, t):
        flow = 0
        while True:
            self.bfs(s)
            if self.depth[t] < 0:
                return flow
            self.progress = [0] * self.n
            current_flow = self.dfs(s, t, float('inf'))
            while current_flow > 0:
                flow += current_flow
                current_flow = self.dfs(s, t, float('inf'))

N,M=MAP()
dinic=Dinic(N)
for i in range(M):
    u,v,c=MAP()
    dinic.add_link(u, v, c)

print(dinic.max_flow(0, N-1))



Measured memory_bytes: 6248
#include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)

typedef long long ll;
#define INF 1e18

int main(){
	ll n; cin>>n;
	ll k; cin>>k;
	ll ans=0;
	while(n!=0){
		ans++;
		n/=k;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;

int main(){
   ll n,k;
   cin>>n>>k;
   ll v[n];
   rep(i,n)cin>>v[i];
   ll ans = -INFL;
   rep(i,n+1){
       rep2(j,i+1,n+2){
           vl s;
           int le = k-i;
           //cout<<le<<endl;
           if(le<0)continue;
           rep(a,i){
               s.push_back(v[a]);
           }
           for(int a = n-1;a>=j&&le>=0;a--,le--){
               s.push_back(v[a]);
           }
           if(le<0)continue;
           sort(been(s));
           ll sum =0;
           rep(a,le){
               if(a>=s.size())break;
               if(s[a]>=0)break;
               sum-=s[a];
           }
           rep(a,s.size()){
               sum+=s[a];
           }
           ans=max(ans,sum);
       }
   }
   cout<<ans<<endl;
}

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

char grid[410][410];
bool seen[410][410];
vector<P> gr[1001001];
int ans;
int h,w;

void dfs(int i, int j, int &g, int pi=-1, int pj=-1){
  if(seen[i][j]==1) return;
  if(i<0 || i>=h || j<0 || j>=w) return;
  if(pi!=-1 && grid[pi][pj]==grid[i][j]) return;
  seen[i][j]=1;
  gr[g].push_back(make_pair(i,j));
  dfs(i+1,j,g,i,j);
  dfs(i-1,j,g,i,j);
  dfs(i,j+1,g,i,j);
  dfs(i,j-1,g,i,j);
}

main(){
  cin>>h>>w;
  rep(i,h)rep(j,w){
    cin>>grid[i][j];
    seen[i][j]=0;
  }
  int tmp=0;
  rep(i,h)rep(j,w){
    if(seen[i][j]) continue;
    else{
      dfs(i,j,tmp);
      tmp++;
    }
  }
  ans=0;
  rep(i,tmp){
    int b=0, w=0;
    for(auto p : gr[i]){
      int hi=p.first, wi=p.second;
      if(grid[hi][wi]=='#') b++;
      else w++;
    }
    ans+=b*w;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 39588
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i <= g; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1e9 + 7;

int main(void)
{
    int K, X;

    cin >> K >> X;

    if (K * 500 >= X)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define MREP() for(ll j = 0; j < m; j++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MSG(x) cout << x << endl;
#define IPT(t, x) t ipt; cin >> ipt; x.push_back(ipt);
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

const static ll MOD = 1e9 + 7;
ll n, cnt, ans, tmp, sum, a, b, c, d, k, m, h, w, q, x, y;
string s, t;

int main() {
    cin >> a >> b >> s;
    REP(i, s.size()) {
        if (i == a) {
            if (s.at(i) != '-') {
                MSG("No")
                exit(0);
            }
        } else {
            if (s.at(i) == '-') {
                MSG("No")
                exit(0);
            }
        }
    }
    MSG("Yes")
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <string>

typedef unsigned long ul;
using namespace std;

ul cal(string s, vector<int> p) {
    ul result = 0;

    int pcount = 0;
    for (int i: p) {
        s.insert(i+1+pcount, "+");
        pcount++;
    }

    ul tmp = 0;
    for (int i = 0; i < s.length() ; i++ ) {
        if (s[i] == '+') {
            result += tmp;
            tmp = 0;
        } else {
            tmp *= 10;
            tmp += s[i] - '0';
        }
    }
    result += tmp;

    return result;
}

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int len = s.length();

    ul result = 0;

    for (int bit=0 ; bit < (1<<(len-1)) ; bit++) {
        vector<int> pos;
        for (int i = 0; i < len ; i++) {
            if (bit & (1<<i)) {
                pos.push_back(i);
            }
        }
        result += cal(s, pos);
    }

    cout << result << "\n";
}


Measured memory_bytes: 256
def gcd_e(x, y):
  if y == 0:
    return x
  else:
    return gcd_e(y,x%y)      

def lcm(x, y):
  return (x * y) // gcd_e(x, y)

n,m=list(map(int,input().split()))
A=list(map(int,input().split()))
a,b=A[0],0

for i in range(1,n):
  b = A[i]
  a = lcm(a,b)
  
for i in range(n):
  if (a // A[i]) % 2 == 0:
    print('0')
    exit()    
  
if a // 2 > m:
  print('0')
else:
  print((m-a//2)//a+1)

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

int main() {
  int k, x;
  cin >> k >> x;
  cout << (k * 500 >= x ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mxn = 22;
vector< pair<int , int > > adj[mxn];
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	int pw[22];
	pw[0] = 1;
	for(int i = 1; i < 22; i++)
	{
		pw[i] = pw[i-1] *2;
	}
	vector< int > vt;
	while(n)
	{
		vt.push_back(n%2);
		n/=2;
	}
	//reverse(vt.begin() , vt.end());
	n = vt.size();
	int edge = 0;
	for(int i = 1; i < n; i++)
	{
		adj[i].push_back(make_pair(i+1 , 0));
		adj[i].push_back(make_pair(i+1 , pw[i-1]));
		edge +=2;
	}
	int last = pw[n-1];
	for(unsigned int i = 0; i < vt.size()-1; i++)
	{
		if(vt[i]==1)
		{
			adj[i+1].push_back(make_pair(n , last));
			last += pw[i];
			edge+=1;
		}
	}
	cout<<n<<" "<<edge<<endl;
	for(int i = 1; i <= n; i++)
	{
		for(auto v: adj[i])
		{
			cout<<i<<" "<<v.first<<" "<<v.second<<endl;
		}
	}
	return 0;
}


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

template<typename Abel> struct BIT {
    const Abel UNITY_SUM = 0;
    vector<Abel> dat;
    BIT(int n) : dat(n, UNITY_SUM) { }  // [0, n)
    inline void add(int i, Abel x) {
        while (i < dat.size()) { dat[i] += x; i |= i + 1; }
    }
    inline Abel sum(int i) {    // [0, i]
        Abel res = UNITY_SUM;
        while (i >= 0) { res += dat[i]; i = (i & (i + 1)) - 1; }
        return res;
    }
    inline Abel sum(int a, int b) { return sum(b - 1) - sum(a - 1); }   // [a, b)
    Abel operator[](int i) { return sum(i, i + 1); }
    friend ostream& operator<<(ostream& os, BIT<Abel> &bit) {
        for (int i = 0; i < bit.dat.size(); i++) os << bit[i] << " ";
        return os;
    }
};

int main() {
    string s; cin >> s;
    int k; cin >> k;
    int n = s.size();
    vector<queue<int>> idx(26);
    BIT<int> bit(n);
    for (int i = 0; i < n; i++) idx[s[i] - 'a'].emplace(i), bit.add(i, 1);
    string ans = "";
    for (int i = 0; i < n; i++) {
        for (int c = 0; c < 26; c++) if (!idx[c].empty()) {
            int top = idx[c].front();
            int req = bit.sum(0, top);
            if (req <= k) {
                ans += char('a' + c); k -= req;
                idx[c].pop(); bit.add(top, -1);
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5108
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll a[100010];
int main()
{
	ll n,i;
	bool ok = 0;
	scanf("%lld",&n);
	for(i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
		if(a[i]==0)
		{
			ok = 1;
		}
	}
	if(ok)
	{
		printf("0");
		return 0;
	}
	long long int ans = 1;
	for(i=0;i<n;i++)
	{
		if(1000000000000000000/ans<a[i]||ans<0)
		{
			printf("-1");
			return 0;
		}
		ans = ans*a[i];
	}
	printf("%lld",ans);
}

Measured memory_bytes: 4604
w, h, n = map(int, input().split())
L = []
for i in range(n):
  L.append([int(i) for i in input().split()])
Z = [[1]*w for i in range(h)]

for i in range(n):
  if L[i][2] == 1:
    for j in range(h):
      for k in range(w):
        if k < L[i][0]:
          Z[j][k] = 0
  elif L[i][2] == 2:
    for j in range(h):
      for k in range(w):
        if k >= L[i][0]:
          Z[j][k] = 0
  elif L[i][2] == 3:
    for j in range(h):
      for k in range(w):
        if j < L[i][1]:
          Z[j][k] = 0
  elif L[i][2] == 4:
    for j in range(h):
      for k in range(w):
        if j >= L[i][1]:
          Z[j][k] = 0
          
out = 0
for i in range(h):
  for j in range(w):
    out += Z[i][j]
print(out)

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

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

    int n; cin >> n;
    vector<ll> a(n,0);

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

    vector<ll> s(n+1, 0);
    map<ll, ll> nums;

    for (int i=0; i<n; i++) s[i+1] = s[i] + a[i];
    for (int i=0; i<n+1; i++) nums[s[i]]++;

    ll res = 0;
    for (auto it : nums) {
        ll num = it.second;
        res += num * (num-1) / 2;
    }

    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <string>
using namespace std;

int main(){
	int n,H=0,T=0;
	string str1,str2;
	cin >> n;

	for(int i=0; i<n; i++){
        cin >> str1 >> str2;
        if( str1 > str2)T+=3;
        else if( str1 < str2)H+=3;
        else T+=1,H+=1;
	}

	cout << T << " " << H << endl;

	return 0;
}

Measured memory_bytes: 3080
use std::io;

fn main() {
    let ab: Vec<String> = read_input_vec();
    if ab[0] == ab[1] {
        println!("H");
    } else {
        println!("D");
    }
}

fn read_input<T: std::str::FromStr>() -> T {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    return input.parse::<T>().ok().unwrap();
}

fn read_input_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    return input
        .split_whitespace()
        .map(|x| x.parse::<T>().ok().unwrap())
        .collect();
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);

    bool jud = true;

    rep(i,n){
        cin >> a[i];
        if(a[i] %2 == 0){
            if(a[i] %3 == 0 || a[i] %5 ==0){

            }
            else{
                jud = false;
                break;
            }
        }
    }

    if(jud){
        dunk("APPROVED");
    }

    else{
        dunk("DENIED");
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <numeric>
#include <tuple>

using namespace std;
typedef int64_t LL;

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

Measured memory_bytes: 256
main(x,y,i,c){int a[100]={};while(~scanf("%d%d",&x,&y)){if(x){a[x]++;a[y]++;}else{for(c=i=0;++i<100;)c+=a[i]%2;printf("%s\n",c==2&&a[1]%2==1&&a[2]%2==1?"OK":"NG");memset(a,0,101);}}return 0;}

Measured memory_bytes: 584
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {

        int n = int.Parse(Console.ReadLine());
        string s = "1008288677408720767 539403903321871999 1044301017184589821 215886900497862655 504277496111605629 972104334925272829 792625803473366909 972333547668684797 467386965442856573 755861732751878143 1151846447448561405 467257771752201853 683930041385277311 432010719984459389 319104378117934975 611451291444233983 647509226592964607 251832107792119421 827811265410084479 864032478037725181";
        var a = Console.ReadLine().Split().Select(long.Parse).ToArray();

        var oddPart = a.Aggregate(0L, (x, y) => x ^ y);
        a = a.Select(x => x - (x & oddPart)).ToArray();
        var maxXor = maxSubsetXOR(a);
        Console.WriteLine(oddPart + maxXor * 2);
    }

    public static string ToBinary(this long x) => Convert.ToString(x, 2).PadLeft(64, '0');

    public static long StupidMaxXor(long[] a)
    {
        long max = 0;
        for (int i = 0; i < (1 << a.Length); i++)
        {
            long res = 0;
            for (int j = 0; j < a.Length; j++)
            {
                if (((i >> j) & 1) == 1) res ^= a[j];
            }
            max = Max(max, res);
        }
        return max;
    }
    public static long maxSubsetXOR(long[] a)
    {
        int index = 0;
        for (int i = 63; i >= 0; i--)
        {
            long maxValue = -1;
            int maxIndex = index;
            for (int j = index; j < a.Length; j++)
            {
                if (((a[j] >> i) & 1) == 1 && a[j] > maxValue)
                {
                    maxValue = a[j];
                    maxIndex = j;
                }
            }
            if (maxValue == -1) continue;

            long temp = a[index];
            a[index] = a[maxIndex];
            a[maxIndex] = temp;
            maxIndex = index;

            for (int j = 0; j < a.Length; j++)
                if (j != maxIndex && ((a[j] >> i) & 1) == 1)
                    a[j] ^= a[maxIndex];
             
            index++;
        }
        return a.Aggregate(0L, (x, y) => x ^ y);
    }
}


Measured memory_bytes: 35408
#include<bits/stdc++.h>
using namespace std;   //author: madmin2619/mintu_agarwal
     
#define nfs() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"
#define pb push_back
#define pf push_front
#define forin(i, n) for(int i=0;i<n;i++)
#define tr(c, it) for(auto it=c.begin();it!=c.end();it++)
#define sz(c) c.size()
#define all(c) c.begin(),c.end()
#define ff first
#define ss second
#define m_p(x, y) make_pair(x, y)
     
const int M = 1e9 + 7;
const int N = 1001;

int dp[N][N];
char grid[N][N];

int ways(int x, int y){  // x is rows and y is cols
	if(dp[x][y] >= 0)
		return dp[x][y];
	if(!x && !y)
		dp[x][y]=1;
	else if(grid[x][y]=='#')
		dp[x][y]=0;
	else if(!x)
		dp[x][y]=ways(x,y-1);
	else if(!y)
		dp[x][y]=ways(x-1,y);
	else
		dp[x][y]=(ways(x-1, y) + ways(x, y-1))%M;
	return dp[x][y];
}
     
int32_t main(){
    nfs()
    int t, n, i, j, k, m;
    cin >> n >> m;
    for(i=0;i<n;i++){
    	for(j=0;j<m;j++){
    		cin >> grid[i][j];
    		dp[i][j] = -1;
    	}
    }
    cout << ways(n-1, m-1) << '\n';
    return 0;
}

Measured memory_bytes: 9216
#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 rep(i,n) for(int i=0; i<(int)(n); i++)
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 P = pair<ll, ll>;

//constexpr ll mod = 998244353;
constexpr ll mod = 1e9+7;
const double PI = acos(-1.0);
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

unordered_map<ll, ll> minvmap;
ll minv(ll a, ll m) {
  auto k = a; auto p = minvmap[a]; if (p != 0) return p;
  ll b = m, u = 1, v = 0;
  while (b) { ll t = a/b; swap(a -= t*b, b); swap(u -= t*v, v); }
  p = (u%m+m)%m; minvmap[k] = p; return p;
}
struct mint {
    ll x;
    mint():x(0){}
    mint(ll x):x((x%mod+mod)%mod){}
    mint& fix() { x = (x%mod+mod)%mod; return *this;}
    mint operator-() const { return mint(0) - *this;}
    mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
    mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
    mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
    mint& operator/=(const mint& a){ (x*=minv(a.x, mod))%=mod; return *this; }
    mint operator+(const mint& a)const{ return mint(*this) += a;}
    mint operator-(const mint& a)const{ return mint(*this) -= a;}
    mint operator*(const mint& a)const{ return mint(*this) *= a;}
    mint operator/(const mint& a)const{ return mint(*this) /= a;}
    bool operator<(const mint& a)const{ return x < a.x;}
    bool operator==(const mint& a)const{ return x == a.x;}
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}

vector<bool> isbroken(100005);
vector<mint> ans(100005);

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

  int n, m; cin >> n >> m;

  rep(i, m) {
    int a; cin >> a;
    isbroken[a] = true;
  }

  ans[0] = 1;
  for(int i=0; i<n; i++) {
    if (!isbroken[i+1]) {
      ans[i+1] += ans[i];
    }
    if (!isbroken[i+2]) {
      ans[i+2] += ans[i];
    }
  }
  cout << ans[n] << endl;
}

Measured memory_bytes: 1024
A=[]
while True:
	#midterm exam score(50) : m
	#final  exam score(50)  : f
	#retest score(100)      : r
	m,f,r = [int(i) for i in input().split()]
	if m == f == r == -1:
		break
	elif m==-1 or f==-1:
		A.append('F')	
	elif m+f >= 80:
		A.append('A')
	elif 65<=m+f<80:
		A.append('B')
	elif (50<=m+f<65) or ((30<=m+f<50) and (50<=r)):
		A.append('C')
	elif (30<=m+f<50):
		A.append('D')
	else:
		A.append('F')

for i in A:
	print(i)

Measured memory_bytes: 7748
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main() {
    int P;
    int Q;
    int R;
    cin >> P >> Q>>R;
    vector<int> v;
    v.push_back(P);
    v.push_back(Q);
    v.push_back(R);
    int sum=0;
    sort(v.begin(), v.end());

    sum=v[0]+v[1];

    cout << sum<< endl;
    return 0;
}


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

using namespace std;

template <class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')
    cerr<<*sdbg++;
  cerr<<"="<<h<<","; 
  _dbg(sdbg+1, a...);
}

template<class T> ostream & operator<<(ostream & os, vector<T> V){
  os<<"[";
  for(auto vv: V) os << vv <<",";
  return os << "]";
}
template<class L, class R> ostream & operator <<(ostream & os, pair<L,R> P){
  return os <<"("<<P.first <<","<<P.second <<")";
}

#ifdef DEBUG
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

const int N = 105;

int n;
char word[N];

int main() {
    scanf("%s", &word[1]);
    int n = strlen(word + 1);
    bool good = true;
    for (int i = 1; i <= n; i++) {
        good &= word[i] == word[n - i + 1];
    }
    
    int last = (n - 1) / 2;
    for (int i = 1; i <= last; i++) {
        good &= word[i] == word[last - i + 1];
    }
    
    int left = (n + 3) / 2;
    for (int i = left; i <= n; i++) {
        good &= word[i] == word[n - (i - left)];
    }
    
    printf(good ? "Yes\n" : "No\n");
    return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

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


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  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 >
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); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

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

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int X, Y;
  cin >> X >> Y;
  for(int p = 0; p <= X; p++) {
    int x = p * 2;
    int y = (X - p) * 4;
    if(x + y == Y) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
}




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

string s;
long long dem;
long long ans;
int main(){
	cin>>s;
	int lens=s.length();
	s=" "+s;
	for(int i=1;i<=lens-1;i++)
	{
		if(s[i]=='A')
		{
			dem++;	
		}
		else if(s[i]=='B'&&s[i+1]=='C')
		{
			ans+=dem;
			i++;
		}
		else
		{
			dem=0;
		}
	}
	cout<<ans;
	
	
}

Measured memory_bytes: 772
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE 100005

char S[SIZE];

int main(){

	scanf("%s",S);

	int len;
	for(len = 0; S[len] != '\0'; len++);

	if(S[0] == S[len-1]){

		if(len%2 == 1){

			printf("Second\n");

		}else{

			printf("First\n");
		}

	}else{

		if(len%2 == 1){

			printf("First\n");

		}else{

			printf("Second\n");
		}
	}

	return 0;
}


Measured memory_bytes: 384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int x;
  cin >> x;
  for(int i=1; i<200; i++){
    for(int j=-i; j<i; j++){
      int y = pow(i, 5)-pow(j, 5);
      if(y==x)
      {cout << i << " " << j << endl;
       return 0;
      }
    }
  }
}

Measured memory_bytes: 4052
N, M = $stdin.gets.split.map {|i| i.to_i }
H = $stdin.gets.split.map {|i| i.to_i }
T = (1..N).map { Array.new }
0.upto(M - 1) do |m|
  am, bm = $stdin.gets.split.map {|i| i.to_i - 1 }
  T[am].push(bm)
  T[bm].push(am)
end
count = 0
0.upto(N - 1) do |i|
  h = H[i]
  t = T[i]
  good = true
  t.each do |oi|
    oh = H[oi]
    if h <= oh
      good = false
      break
    end
  end
  count += 1 if good
end
puts count


Measured memory_bytes: 34032
#include<iostream>

using namespace std;

void Show(int a[],int n)
{
    for(int i=0;i<n;i++)
    {
        if(i)
        {
            cout<<" ";
        }
        cout<<a[i];
    }
    cout<<endl;
}

void Insertion_sort(int a[],int n)
{
    Show(a,n);
    for(int i=1;i<n;i++)
    {
        int temp=a[i];
        int j=i-1;
        while(j>=0&&a[j]>temp)
        {
            a[j+1]=a[j];
            j--;
        }
        a[j+1]=temp;
        Show(a,n);
    }
}

int main()
{
    int a[101];
    int n;

    cin>>n;

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

    Insertion_sort(a,n);

    return 0;
}



Measured memory_bytes: 3084
import numpy as np

N = int(input())
X = np.array([int(n) for n in input().split()])
iX = np.argsort(X)
sX = X[iX]

A = [0] * N

for i in range(N):
    if i < N // 2:
        ans = sX[N//2]
    else:
        ans = sX[(N-2)//2]
    A[iX[i]] = ans

for a in A:
    print(a)


Measured memory_bytes: 34180
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int N;
  cin >> N;
  vector<P> A(N);
  rep(i, N) {
    int x;
    cin >> x;
    A[i].first = x;
    A[i].second = i+1;
  }
  sort(A.begin(), A.end());
  rep(i, N) cout << A[i].second << ' ';
  return 0;
}


Measured memory_bytes: 3988
#include<iostream>
using namespace std;
int main()
{
	int a[3],i,j,tmp;
	for(i=0;i<3;i++)
		cin>>a[i];
	for(i=1;i<3;i++){
		tmp=a[i];
		for(j=i;j>0;j--){
			if(tmp<a[j-1])	
				a[j]=a[j-1];
			else
				break;			
		}
		a[j]=tmp;
	}
	cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
	
	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
int h,w,k,ans = 0;
int main() {
    cin >> h >> w >> k;
    string line[7];
    for(int i = 0;i<h;i++){
        cin >> line[i];
    }
    for(int q = 0;q<(1<<h);q++){
        for(int r = 0;r<(1<<w);r++){
            int black = 0;
            for(int i = 0;i<h;i++){
                for(int j = 0;j<w;j++){
                    if((q>>i&1)&&(r>>j&1)){
                        if(line[i][j]=='#')black++;
                    }
                }
            }
            if(k==black)ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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



namespace Test1 {

    class ClassMain {

        public static void Main(String[] args) {
            string line;
            while ((line = Console.ReadLine()) != null) {
                int n = int.Parse(line);
                if (n == 0) { break; }
                int hiruZenbu = 0 , hiruOK = 0;
                int yuuZenbu = 0, yuuOK = 0;
                int yoruZenbu = 0, yoruOK = 0;
                for (int i = 0; i < n; i++) {
                    line = Console.ReadLine();
                    int zikoku = int.Parse(line.Split(':')[0]);
                    if (11 <= zikoku && zikoku <= 14) {
                        hiruZenbu++;
                        if (isOK(line)) { hiruOK++; }
                    }
                    if (18 <= zikoku && zikoku <= 20) {
                        yuuZenbu++;
                        if (isOK(line)) { yuuOK++; }
                    }
                    if (21 <= zikoku || zikoku <= 1) {
                        yoruZenbu++;
                        if (isOK(line)) { yoruOK++; }
                    }
                }
                if (hiruZenbu > 0) {
                    Console.WriteLine("lunch " + (hiruOK * 100) / hiruZenbu);
                }
                else { Console.WriteLine("lunch no guest"); }
                if (yuuZenbu > 0) {
                    Console.WriteLine("dinner " + (yuuOK * 100) / yuuZenbu);
                }
                else { Console.WriteLine("dinner no guest"); }
                if (yoruZenbu > 0) {
                    Console.WriteLine("midnight " + (yoruOK * 100) / yoruZenbu);
                }
                else { Console.WriteLine("midnight no guest"); }
            }
        }

        public static bool isOK(String str) {
            String[] strs = str.Split(' ');
            int tyuumonMin = int.Parse(strs[0].Split(':')[1]); 
            int teikyouMin = int.Parse(strs[1]);
            if (tyuumonMin > teikyouMin) { teikyouMin += 60; }
            return (teikyouMin - tyuumonMin <= 8);
        }

    }

}

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

int main(){
  int N,a,b;
  cin>>N;
  vector<int> d(N);
  for(int i=0;i<N;i++){
    cin>>d[i];
  }
  sort(d.begin(),d.end());
  a=d[N/2-1];
  b=d[N/2];
  cout<<b-a<<endl;
}

Measured memory_bytes: 768
#include <iostream>
#include<string>
using namespace std;


int main() {
	
	int A, B, C, X;
	cin >> A >> B >> C >> X;
	int Y = 0;

	for (int i = A; 0 <= i;i--) {
		for (int k = B; 0 <= k; k--) {
			for (int s = C; 0 <= s; s--) {
				if (((i * 500) + (k * 100) + (s * 50)) == X) {
					Y++;
				}
			}
		}
	}


	cout << Y << endl;


	return 0;
}


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

struct Point{
    double x;
    double y;
};

typedef struct Point Point;

void koch(int,Point,Point);

int main(){
    Point a,b;
    int n;

    scanf("%d",&n);

    a.x=0;
    a.y=0;
    b.x=100;
    b.y=0;

    printf("%0.8f %0.8f\n",a.x,a.y);
    
    koch(n,a,b);
    
    printf("%0.8f %0.8f\n",b.x,b.y);

    return 0;
}

void koch(int n,Point a,Point b){
    Point s,t,u;
    double th=M_PI*60/180;

    if(n==0) return;

    s.x=(2*a.x+b.x)/3;
    s.y=(2*a.y+b.y)/3;
    t.x=(a.x+2*b.x)/3;
    t.y=(a.y+2*b.y)/3;
    u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
    u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;

    koch(n-1,a,s);
    printf("%0.8f %0.8f\n",s.x,s.y);
    koch(n-1,s,u);
    printf("%0.8f %0.8f\n",u.x,u.y);
    koch(n-1,u,t);
    printf("%0.8f %0.8f\n",t.x,t.y);
    koch(n-1,t,b);

}


Measured memory_bytes: 2112