akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

ll nCr(ll n, ll r) {
	ll ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n)cin >> a.at(i);
    sort(a.rbegin(), a.rend());
    ll mid=a.at(0);
    double mi=inf;
    REP(i, n-1){
        if(mi > (double)abs(a.at(0)/2-a.at(i))){
            mid = a.at(i);
            mi = (double)abs(a.at(0)/2-a.at(i));
        }
    }
    cout << a.at(0) << " " << mid << endl;
}

Measured memory_bytes: 1024
N, P = map(int, input().split())
A = list(map(int, input().split()))

odd = 0 # 奇数
even = 0

for a in A:
    if a % 2:
        odd += 1
    else:
        even += 1

if odd == 0:
    if P == 1:
        print(0)
    else:
        print(2 ** N)
else:
    print(2 ** (N - 1))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// 端点を間違えないように気をつけること!
#define FOR(i, m, n) for (ll i = (ll)(m); i <= (ll)(n); i++)
#define RFOR(i, m, n) for (ll i = (ll)(m); i >= (ll)(n); i--)
// 割り算をするときは自作関数syou,amariを使うこと!

int main()
{
    ll a, b, c, d, e, k;
    cin >> a >> b >> c >> d >> e >> k;
    if (e - a <= k)
    {
        cout << "Yay!" << endl;
    }
    else
    {
        cout << ":(" << endl;
    }
}

Measured memory_bytes: 256
from collections import deque
S=deque(input())
Q=int(input())
ref=0
for i in range(Q):
    T=input().split()
    if T[0] == '2':
        if (T[1]=='1' and ref%2==0):
            S.appendleft(T[2])
        elif (T[1]=='2' and ref%2==0):
            S.append(T[2])
        elif (T[1]=='1' and ref%2==1):
            S.append(T[2])
        elif (T[1]=='2' and ref%2==1):
            S.appendleft(T[2])
    else:
        ref+=1
for i in range(len(S)):
    if ref%2==0:
        char=S.popleft()
        print(char,end='')
    else:
        char=S.pop()
        print(char,end='')

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

typedef long long ll;

/* メモリ食い過ぎ注意 */
#define int ll
#define ALL(v) v.begin(), v.end()
#define _REP(i, n) for (int i = 0; i < n; i++)
#define REP(n) _REP(i, n)

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

struct edge
{
    int to, cost;
};

int n;
vector<edge> G[100001];
int d[100001];

void dijkstra(int x)
{
    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> que;
    fill(d, d + n + 1, INF);
    d[x] = 0;
    que.push({0, x});
    // cout << "b" << endl;
    while (!que.empty())
    {
        pair<int, int> p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;

        for (int i = 0; i < G[v].size(); i++)
        // for (int i = 0; i < 2; i++)
        {
            // cout << "b2" << endl;
            edge e = G[v][i];
            // cout << "b3" << endl;
            if (d[e.to] > d[v] + e.cost)
            {
                d[e.to] = d[v] + e.cost;
                que.push({d[e.to], e.to});
            }
        }
    }
}

signed main()
{

    int u[100000], v[100000], w[100000];
    cin >> n;
    for (int i = 0; i < n - 1; i++)
        cin >> u[i] >> v[i] >> w[i];

    for (int i = 0; i < n - 1; i++)
    {
        // G[u[i] - 1].push_back({v[i] - 1, w[i]});
        G[u[i]].push_back({v[i], w[i]});
        G[v[i]].push_back({u[i], w[i]});
    }
    // cout << "a" << endl;
    dijkstra(1);
    // cout << "a2" << endl;
    for (int i = 1; i <= n; i++)
    {
        if (d[i] == INF || d[i] % 2)
            cout << 0 << endl;
        else
            cout << 1 << endl;
    }
}

Measured memory_bytes: 11008
#include<bits/stdc++.h>
int n;
inline int read(){
    register int x=0,f=1;register char ch=getchar();
    while(ch<'0' or ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0' and ch<='9'){
        x=(x<<3)+(x<<1)+(ch xor 48);
        ch=getchar();
    }
    return x*f;
}
main(){
	n=read();
	for(register int i=6;i>=0;i--){
		if(pow(2,i)<=n){
			printf("%d\n",(int)pow(2,i));
			exit(0);
		}
	}
}

Measured memory_bytes: 512
//差分計算を頑張ろうとすると沼る。冷静になると、消す辺の候補を高々N本に絞れる。
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n, m;
vector<int> et[600];
double E[600];

int main() {
	int i, j, k;
	
	cin >> n >> m;
	rep(i, m) {
		int s, t;
		cin >> s >> t; s--; t--;
		et[s].push_back(t);
	}
	
	for (i = n - 2; i >= 0; i--) {
		rep(j, et[i].size()) {
			E[i] += E[et[i][j]];
		}
		E[i] /= et[i].size();
		E[i] += 1;
	}

	double ans = 11451419;
	rep(i, n) {
		double maxE = -1;
		int maxJ = -1;
		rep(j, et[i].size()) {
			if (maxE < E[et[i][j]]) {
				maxE = E[et[i][j]];
				maxJ = j;
			}
		}
		
		double F[600] = {0};
		for (j = n - 2; j >= 0; j--) {
			int cnt = 0;
			rep(k, et[j].size()) {
				if (j == i && k == maxJ) continue;
				F[j] += F[et[j][k]];
				cnt++;
			}
			if (cnt == 0) break;
			F[j] /= cnt;
			F[j] += 1;
		}
		if (j == -1) ans = min(ans, F[0]);
	}
	printf("%.14f\n", ans);
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long int 
int main()
{
    string s,t;
    cin >> s >>t;
    ll n=t.size();
    ll ans=INT_MAX;
    if(n==s.size())
    {
        ll count=0;
        for(ll i=0;i<n;i++)
        {
            if(t[i]!=s[i])
            {
                count++;
            }
        }
        cout << count;
        return 0;
    }
    for(ll i=0;i<s.size()-t.size();i++)
    {
        string p=s.substr(i,n);
        ll count=0;
        for(ll j=0;j<n;j++)
        {
            if(p[j]!=t[j])
            {
                count++;
            }
        }
        ans=min(ans,count);
    }
    cout << ans;
}

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

int main() {
	ll n, m;
	cin >> n >> m;
	ll x[m];
	ll sum = 0;
	for(int i = 0; i < m; i++) {
		cin >> x[i];
		sum += x[i];
	}
	if(sum > n) {
		cout << -1;
	} else {
		cout << n - sum;
	}
}

Measured memory_bytes: 3608
def gcd(a,b):
	i = a
	j = b
	while i!=j:
		if i > j:
			i = i-j
		else :
			j = j - i
	return i

k = int(input())

ret = 0
for i in range(1,k+1):
	for j in range(i,k+1):
		for l in range(j,k+1):
			g = gcd(i,gcd(j,l))
			if (i == j) and (j == l):
				m = 1
			elif (i == j) or (j == l) or (l == i):
				m = 3
			else :
				m = 6
			#print("i:",i," j:",j," l:",l," gcd:", g," m:",m)
			ret += g*m
print(ret)

Measured memory_bytes: 68928
#include <iostream>
using namespace std;
int main(){
  string s;
  cin >> s;
  bool c = false;
  for(int i = 0; i < s.length(); i++){
    if(!c){
      if(s[i] == 'C')
        c = true;
    }else{
      if(s[i] == 'F'){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


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

int main()
{
    char c;
    string str;

    cin >> c;
    if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
        str = "vowel";
    }
    else {
        str = "consonant";
    }
    cout << str << endl;
    return 0;
}

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

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

template<class T> inline bool chmin(T& a,T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if (a < b) {a = b; return true;} return false;}

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N; cin >> N;
  vector<int> L(N); rep(i, N) cin >> L[i];

  sort(L.begin(), L.end());
  int ans = 0;
  for (int i = 0; i < N; ++i){
    for (int j = i + 1; j < N; ++j){
      int k = lower_bound(L.begin(), L.end(), L[i] + L[j]) - L.begin();
      ans += max(k - (j + 1), 0);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long ll;
#define unsigned ll
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
  ll a,b,c,d,lc,sum=0;
  cin >> a >> b >> c >> d;
  sum += (b/c) - (a/c);
  if(a%c==0) sum++;
  sum += (b/d) - (a/d);
  if(a%d==0) sum++;
  lc = c/gcd(c,d)*d;
  sum -= (b/lc) - (a/lc);
  if(a%lc==0) sum--;
  sum = (b-a+1) - sum;
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define mp            make_pair
#define M             1000000007
#define MM            998244353
#define fr            first
#define sc            second
#define all(v)        (v).begin(),(v).end()
#define rall(v)       (v).rbegin(),(v).rend()
#define vc            vector
#define vi            vector<int>
#define pii           pair<int,int>
#define psi           pair<string,int>
#define pis           pair<int,string>
#define mii           map<int,int>

int solve(){
	int n,l; cin>>n>>l;
	vc<string> v;
	for (int i = 0; i < n; ++i)
	{
		string str; cin>>str;
		v.pb(str);
	}
	sort(all(v));
	for (int i = 0; i < n; ++i)
	{
		cout<<v[i];
	}
}
 
signed main() {
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--)
		solve();
    return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/04  Problem: ABC 098 D / Link: http://abc098.contest.atcoder.jp/tasks/abc098_d  ----- */


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

	LL N;
	cin >> N;
	vector<LL> a(N);
	for (int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	LL ans = 0LL;
	LL psum = 0;
	LL xsum = 0;
	LL L = 0;
	// [L,R]が正しい区間
	FOR(R, 0, N) {
		psum += a[R];
		xsum ^= a[R];
		DD(de(psum,xsum))
		while (L < R && psum != xsum) {
			psum -= a[L];
			xsum ^= a[L];
			L++;
		}
		ans += R - L+1;
		DD(de(R,L,ans,psum,xsum))
	}

	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
int main()
{
    long int i, n, m, arr[10005], sum=0, a;
    scanf("%ld %ld", &n, &m);
    for(i=0; i<m; i++)
    {
        scanf("%ld", &arr[i]);
        sum+=arr[i];
    }
    if(sum>n)
    {
        printf("-1");
    }
    else
    {
        a=n-sum;
        printf("%ld", a);
    }
    return 0;
}

Measured memory_bytes: 1804
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

X=int(input())
YesNo(X>=30)

Measured memory_bytes: 61716
import java.util.Scanner;
import java.util.Arrays;
import java.util.Calendar;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int M = scan.nextInt();
        int C = scan.nextInt();

        int B[] = new int[M];
        int A[] = new int[M];


        int total = 0;
        int count = 0;

        for(int i = 0 ; i < M; i++){
            B[i]= scan.nextInt();
        }

        for(int j = 0 ; j < N; j++){

        for(int i = 0 ; i < M; i++){
            A[i]= scan.nextInt();
            total += B[i] * A[i];
        }
        total += C;
        
        if(total > 0){
            count++;
        }
        total = 0;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 23764
n = gets.to_i
stair = gets.chomp.split(" ").map(&:to_i)
dp = Array.new(n,0)
dp[1] = (stair[0] - stair[1]).abs
if n == 2
  puts dp[1]
  exit
end
for i in 2..n-1
  if (dp[i-2]+((stair[i-2] - stair[i]).abs)) > (dp[i-1]+((stair[i-1] - stair[i]).abs))
      dp[i] = dp[i-1]+((stair[i-1] - stair[i]).abs)
  else
    dp[i] = dp[i-2]+((stair[i-2] - stair[i]).abs)
  end
end
puts dp[-1]


Measured memory_bytes: 9228
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#include <utility>
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1e9
typedef long long int ll;
using namespace std;

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

    int res, ans;
    bool A=false, jio=false;

    REP(i,s.size()){
        if(s[i]=='A')   A=true, res=i;
        if(s[i]=='C' and A and i-res==1)  jio=true;
    }

    if(jio){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
ll n, a[100005], cs, ans = 1;

int main()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++) {
		if(2*cs+1 <= a[i]) cs++;
		else ans = (ans * (cs+1)) % mod;
	}
	for(;cs;cs--) ans = (ans * cs) % mod;
	printf("%lld\n",ans);
}


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

public class Main {
	Scanner sc = new Scanner(System.in);
	int index = 0;

	void run() {
		String input = sc.next();
		int ans = sc.nextInt();
		boolean M = false;
		boolean L = false;

		int s = Integer.valueOf(input.charAt(0) - '0');
		int sum = s;
		// L
		for (int i = 1; i < input.length() - 1; i++) {
			char c = input.charAt(i);
			char n = input.charAt(i + 1);
			if (!Character.isDigit(c)) {
				if (c == '*') {
					sum *= Integer.valueOf(n - '0');
				} else {
					sum += Integer.valueOf(n - '0');
				}
				i++;
			}
		}
		if (sum == ans) {
			L = true;
		}
		// M
		if (expression(input) == ans) {
			M = true;
		}
		if (L && M) {
			System.out.println("U");
		} else if (L) {
			System.out.println("L");
		} else if (M) {
			System.out.println("M");
		} else {
			System.out.println("I");
		}
	}

	int expression(String sb) {
		int res = term(sb);
		for (; index < sb.length();) {
			if (sb.charAt(index) == '+') {
				index++;
				res += term(sb);
			} else if (sb.charAt(index) == '-') {
				index++;
				res -= term(sb);
			} else {
				break;
			}
		}
		return res;
	}

	int term(String sb) {
		int res = factor(sb);
		for (; index < sb.length();) {
			if (sb.charAt(index) == '*') {
				index++;
				res *= factor(sb);
			} else if (sb.charAt(index) == '/') {
				index++;
				res /= factor(sb);
			} else {
				break;
			}
		}
		return res;
	}

	int factor(String sb) {
		int res = 0;
		if (index < sb.length() && sb.charAt(index) == '(') {
			index++;
			res = expression(sb);
			index++;
		} else {
			res = number(sb);
		}
		return res;
	}

	int number(String sb) {
		int res = 0;
		while (index < sb.length() && Character.isDigit(sb.charAt(index))) {
			res *= 10;
			res += sb.charAt(index) - '0';
			index++;
		}
		return res;
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debu(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

Measured memory_bytes: 17352
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()
// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class X> void DEBUG(X d, T e){if(DEBUG_OUT == false)return;std::cout <<d<<" ";DEBUG(e);};
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
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); }

//CODE

void solve(void)
{
  int N;
  cin>>N;
  cout<<N/2 + N%2<<endl;
  
  
  
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();
  

 
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int cnt[N] = {};
bool vis[N] = {};
int build() {
    int ans = 0;
    for (int i = 1; i <= N; i++)
        if (cnt[i] && !vis[i]) {
            if (cnt[i] == 1) ans++;
            for (int j = i + i; j <= N; j += i)
                vis[j] = true;
        }
    return ans;
}
int main() {
    int n, x;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> x;
        cnt[x]++;
    }
    cout << build() << '\n';
    return 0;
}

Measured memory_bytes: 8468
#include <stdio.h>

int main(void)
{
	int n;
	int a[100];
	int b[100];
	int c[100] = {};
	int i = 0;
	int j, k;
	int max;
	
	while(scanf("%d", &a[i]) != EOF) {
		i++;
	}
	
	for(j = 0; j < 100; j++) {
		b[j] = j + 1;
	}
	for(j = 0; j < 100; j++) {
		for(k = 0; k < i; k++) {
			if(b[j] == a[k]) c[j]++;
		}
	}
	max = c[0];
	for(j = 1; j < 100; j++) {
		if(c[j] > max) max = c[j];
	}
	for(j = 0; j < 100; j++) {
		if(c[j] == max) printf("%d\n", b[j]);
	}
	return 0;
}


Measured memory_bytes: 596
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as MV
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Control.Monad

main :: IO ()
main = do
  [n, m] <- map read . words <$> getLine
  q <- replicateM m (listToPair . map (subtract 1) <$> readIntLns)
  let
    ans = V.create $ do
      v <- MV.replicate n (1, False)
      MV.write v 0 (1, True)
      forM_ q $ \(x, y) -> do
        red <- snd <$> MV.read v x
        MV.modify v (\(l, b) -> (l+1, if red then red else b)) y
        MV.modify v (\(l, b) -> if l == 1 then (0, False) else (l-1, b)) x
      return v
  print $ V.length $ V.filter snd ans

readLns :: (Read a) => IO [a]
readLns = map read . words <$> getLine
readPair :: (Read a) => IO (a, a)
readPair = listToPair <$> readLns
readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt
readIntLns :: IO [Int]
readIntLns = map readInt . BS.words <$> BS.getLine
readIntLn :: IO Int
readIntLn = readInt <$> BS.getLine
readIntPair :: IO (Int, Int)
readIntPair = listToPair <$> readIntLns

listToPair :: [a] -> (a, a)
listToPair (a:b:_) = (a, b)


Measured memory_bytes: 34172
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
long long int gcd(long long int x, long long int y){
  return y!=0 ? gcd(y, x%y) : x;
}
long long int lcm(long long int x, long long int y){
  return x*y/gcd(x, y);
}
long long int factorial(long long int x){
  return x==0 ? 1 : x*factorial(x-1);
}
int main(){
  int i, j, a, b;
  cin >> a >> b;
  if(a>0){
    cout << "Positive";
    return 0;
  }
  if(a==0){
    cout << "Zero";
    return 0;
  }
  if(b>=0){
    cout << "Zero";
    return 0;
  }
  if((b-a)%2==0){
    cout << "Negative";
    return 0;
  }
  cout << "Positive";
  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
PY = [list(map(int,input().split())) for i in range(M)]

ken_d = [[] for _ in range(N+1)]

rankdic = {} # 通し番号：県における順位

for i, p in enumerate(PY):
    # print(p)
    ken_d[p[0]].append([i, p[1]])

for k in range(N+1):
    ken_d[k].sort(key=lambda x:x[1])
    for i, v in enumerate(ken_d[k]):
        rankdic[v[0]] = i # 通し番号辞書に入れる

for i, p in enumerate(PY):
    x = rankdic[i] + 1
    print(str(p[0]).zfill(6) + str(x).zfill(6))

# 気づき：indexはクソ遅い


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

int main() {
    int H, N; cin >> H >> N;
    int a, sum_damage = 0;
    for (int i = 0; i < N; i++) {
        cin >> a;
        sum_damage += a;
    }
    if (H <= sum_damage) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int A[101];
	int N,key,i,j,k;

	scanf("%d", &N);

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

	for(k = 0;k < N;k++){
		printf("%d", A[k]);
		if(k != N - 1){
			printf(" ");
		}
	}
	printf("\n");

	for(j = 1;j < N;j++){
		key = A[j];
		i = j - 1;

		while(i >= 0 && A[i] > key){
			A[i+1] = A[i];
			A[i] = key;
			i = i - 1;
		}

		for(k = 0;k < N;k++){
			printf("%d", A[k]);
			if(k != N - 1){
				printf(" ");
			}
		}
		printf("\n");
	}

	return 0;
}

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

int rel_l_l( double x0, double y0, double x1, double y1, double x2, double y2, double x3, double y3, double *x, double *y ) {
	double a, b, c, d;
	int rel;

	if ( x0 != x1 ) {
		a = ( y0 - y1 ) / ( x0 - x1 );
		b = ( x0 * y1 - x1 * y0 ) / ( x0 - x1 );
	}
	if ( x2 != x3 ) {
		c = ( y2 - y3 ) / ( x2 - x3 );
		d = ( x2 * y3 - x3 * y2 ) / ( x2 - x3 );
	}

	rel = 0;
	if ( x0 == x1 ) {
		*x = x0;
		if ( x2 == x3 )
			if ( x0 == x2 )
				rel = 2;
			else
				rel = 1;
		else
			*y = c * *x + d;
	} else {
		if ( x2 == x3 )
			*x = x2;
		else
			if ( fabs( a - c ) < 1e-10 )
				if ( fabs( b - d ) < 1e-10 )
					rel = 2;
				else
					rel = 1;
			else
				*x = ( -b + d ) / ( a - c );
		*y = a * *x + b;
	}

	return rel;
}

int main( void ) {
	int n;

	scanf( "%d", &n );
	while ( n-- ) {
		int rel;
		double x1, y1, x2, y2, x3, y3, x4, y4, x, y;

		scanf( "%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4 );

		rel = rel_l_l( x1, y1, x2, y2, x3, y3, x4, y4, &x, &y );

		printf( "%s\n", rel == 0 ? "NO" : "YES" );
	}

	return 0;
}

Measured memory_bytes: 620
/*********************
*@Author:   CKang *
*@Language: C++11    *
*********************/
#include<bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
//#define DEBUG
#define RI register int
#define endl "\n"

using namespace std;

typedef long long ll;
//typedef __int128 lll;
//const int N=100000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-9;
const int INF = 0x3fffffff;
const ll LINF = 0x3fffffffffffffff;

inline ll read(){
    long long x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

int main()
{
#ifdef DEBUG
    freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout)
#endif
    //cout.tie(0);
    //ll t = read() ;
    //while(t--){}
    ll a=read(),b=read(),c=read();
    swap(a,b);
    swap(a,c);
    cout<<a<<' '<<b<<' '<<c;
#ifdef DEBUG
    printf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif
    //cout << "Fuck You !" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
void YN(bool f){ cout << (f ? "YES" : "NO");}
void yn(bool f){ cout << (f ? "yes" : "no");}
void YeNo(bool f) {cout << (f ? "Yes" : "No");}
signed main(){
    int n,m;
    cin >> n >> m;
    vector<pii>v(n);
    for(auto & p : v){
        cin >> p.first >> p.second;
        p.second *= -1;
    }
    vector<int>ans;
    sort(all(v));
    priority_queue<int,vector<int>>que;
    size_t idx = 0;
    int crt = v.front().first;
    for(int d = m ; d >= 1; d--){
        int yahara = m - d + 1;
        if(yahara == v[idx].first){
            for(;yahara == v[idx].first;++idx){
                v[idx].second *= -1;
                que.push(v[idx].second);
            }
        }
        if(not que.empty()){
            ans.push_back(que.top());
            que.pop();
        }
    }
    cout << accumulate(all(ans),0LL,[](int a, int b){return a += b;}) << endl;
}


Measured memory_bytes: 4084
#[allow(unused_macros)]
macro_rules! input {
    ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } };
    ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! input_inner {
    ( $ next : expr ) => { };
    ( $ next : expr , ) => { };
    ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } };
}
#[allow(unused_macros)]
macro_rules! read_value {
    ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) };
    ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) };
    ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) };
    ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(unused_macros)]
macro_rules! chmin {
    ( $ x : expr , $ y : expr ) => { if $ x > $ y { $ x = $ y ; true } else { false } };
}

fn main() {
    input! {
        n: usize, k: usize,
        h: [i64; n]
    }

    let mut dp = vec![1i64 << 60; n];
    dp[0] = 0;
    for i in 0..n {
        for j in 1..k+1 {
            if i+j < n {
                chmin!(dp[i+j], dp[i] + (h[i] - h[i+j]).abs());
            }
        }
    }
    println!("{}", dp[n-1]);
}

Measured memory_bytes: 6396
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int bb = 0;
		int cc = 0;
		if (a > b) {
			bb = a - b;
		} else if (a < b) {
			bb = b - a;
		}
		if (a > c) {
			cc = a - c;
		} else if (a < c) {
			cc = c - a;
		}

		if (bb < cc) {
			System.out.println("A");
		} else if (bb > cc) {
			System.out.println("B");
		}

	}

}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S; cin>>S;
    int size=S.size();
    int ansa=0,ansb=0;
    for(int i=0;i<size;i++){
        if(S[i]=='0'){
            ansa++;
        }
        else{
            ansb++;
        }
    }
    cout<<min(ansa,ansb)*2;
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main(){
  // 入力
  string S;
  cin >> S;

  string result = "No";
  if (S[2]==S[3] && S[4]==S[5]){
    result = "Yes";
  }
  
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

int main(){
    int n;
    std::cin >> n;

    std::vector<int> h(n);
    for(int i = 0; i < n; ++i){
        std::cin >> h.at(i);
    }

    int count = 0;
    std::vector<int>::iterator itr = std::find_if(h.begin(), h.end(), [](int i){
            return 0 < i;
        }), spot;

    while(h.end() != itr){
        spot = std::find_if(itr, h.end(), [](int i){
            return 0 == i;
        });

        while(spot != itr){
            --*itr++;
        }

        itr = std::find_if(h.begin(), h.end(), [](int i){
            return 0 < i;
        });

        ++count;
    }

    std::cout << count << std::endl;

    return 0;
}

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

int main() {
  string s;
  cin >> s;
  int count =0 ;
  for ( int i=0 ; i<3 ; i++){
    if ( s.at(i) == 'o' ){
      count++;
    }
  }
  cout << 700+count*100 << endl;
}

Measured memory_bytes: 3556
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner in = new Scanner(System.in);
		
		 int A  = in.nextInt();
		 int B  = in.nextInt();
		 char nam [] = new char[B];
		 StringBuilder val = new StringBuilder();


		  for(int i= 0; i < A ; i++){
		      String s = in.next();
		      for(int j = 0; j < 2; j ++){
		        System.out.println(s);
		      }
		 }
		
	}
}

Measured memory_bytes: 24148
moji = str(input())
length = len(moji)
mojilst = list(moji)
ans = 0
temp = []
for i in range(length):
  if str(mojilst[i]) == "A" or str(mojilst[i]) == "G" or str(mojilst[i]) == "C" or str(mojilst[i]) == "T":
    temp.append(str(mojilst[i]))
  else:
    if ans < len(temp):
      ans = len(temp)
    temp = []
if ans < len(temp):
      ans = len(temp)
print(ans)

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


int main(int argc, char const *argv[])
{
  int input, rtMax, max = 1, temp;

  scanf("%d", &input);

  rtMax = (int) sqrt(input);
  for (int i = 2; i <= rtMax;i++){
    int j = 2;
    do{
      temp = pow(i, j);
      if (temp > input) break;
      if (temp > max) max = temp;
      j++;
    } while (1);
  }
  printf("%d", max);
}


Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>

using namespace std;

#define ll long long

void solve()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    for (ll i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }

    vector<ll> sa;
    sa.push_back(A.at(N - 1));
    for (ll i = N - 2; i >= 0; i--)
    {
        auto iterL = upper_bound(sa.begin(), sa.end(), A.at(i));
        if (iterL == sa.end())
        {
            // 見つからなかったので色を追加
            sa.push_back(A.at(i));
        }
        else
        {
            // 見つかったので入れ替え
            *iterL = A.at(i);
        }
    }

    cout << sa.size() << endl;

    return;
}

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


Measured memory_bytes: 2168
from collections import Counter

def f(n,v):
	a=Counter(v[0::2]).most_common()
	b=Counter(v[1::2]).most_common()
	
	a.append([0,0])
	b.append([0,0])
	
	if a[0][0]!=b[0][0]:
		return n-(a[0][1]+b[0][1])
	else:
		return min(n-(a[1][1]+b[0][1]),n-(a[0][1]+b[1][1]))

if __name__=="__main__":
	x=int(input())
	data=[int(i) for i in input().split()]
	print(f(x,data))

Measured memory_bytes: 20692
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;

#define io ios_base::sync_with_stdio(false)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pb push_back
#define mod 998244353
#define pii pair<int, int>
#define PI 2*acos(0.0)

int main()
{
    io;
    ll n;
    cin>>n;
    int b[n+1];
    memset(b, 0, sizeof(b));
    int j = n-1;
    while(j--)
    {
        int x;
        cin>>x;
        b[x]++;
    }
    for(int i = 1; i <= n;i++)
        cout << b[i] <<"\n";
    return 0;
}

Measured memory_bytes: 4428
n = int(input())
ab, cd = [], []
for _ in range(n):
    ab.append([int(x) for x in input().split()])
for _ in range(n):
    cd.append([int(x) for x in input().split()])
cd.sort(key=lambda x: x[0])
ab.sort(key=lambda x: x[1], reverse=True)
pair_cnt = 0
for cdleftmost in cd:
    for abi in ab:
        if(abi[0] < cdleftmost[0] and abi[1] < cdleftmost[1]):
            ab.remove(abi)
            pair_cnt += 1
            break
print(pair_cnt)

Measured memory_bytes: 39024
#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"n=int(input());print(*[~-n*~-n//2]+['%d %d'%(i,j)*(j>i!=n-j+1-n%2)for i in range(1,n)for j in range(n+1)])\n"
"\"";
  system(s);
  return 0;
}            

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

#define FAST ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define REP(i,a,n) for (int i=a;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define UM unordered_map
#define PB push_back
#define V vector
#define EPS 1e-8
typedef unsigned long UL;
typedef long long LL;
typedef string STR;
/*FIN*/

const LL MAXN = (LL)1e6;

int main()
{
	FAST;
	V<bool> marked(MAXN+1,0);
	map<LL, LL> div;
	LL n, ans=0;
	cin>>n;
	LL t=n;
	if(n<2) {
		cout<<0<<endl;
		return 0;
	}
	for(LL i = 2; i*i <= n; i++) {
		if(!marked[i]) {
			if(!(t%i)) div[i]=0;
			for(; !(t%i); div[i]++, t/=i);
			for(LL j=i; j*j <= n; j+=i) marked[j]=1;
		}
	}
	for(auto i:div) {
		ans += LL(sqrt(1 + 8*i.second) - 1)>>1;
		//cout<<i.first<<" "<<i.second<<endl;
	}
	if(ans==0LL)
		cout<<1<<endl;
	else if(t!=1)
		cout<<ans+1<<endl;
	else
		cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
typedef vector< ii > vii;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef	vector<pair<int,pair<int,int > > > viii;
typedef long long int lli;

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=b-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(a) (int)(a.size())

#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define slli(n) scanf("%llid",&n)
#define lldout(n) printf("%llid\n",n)
const int N = (int)1e5 + 10;
//vvi v;
vector<vector<lli> > v;
lli cnt=0;
lli vis[N];
//int vis1[52][52],v[52][52];
int dfs(int t,int p){
	vis[t]=1;
  cnt++;
	//v[i][j]=val;
	rep(i,0,v[t].size()){
    if(v[t][i]==p){return 0;}
		if(vis[v[t][i]]==0){
			dfs(v[t][i],p);
		}
	}
	// if(v[i][j-1]==-1 and vis1[i][j-1]==0 and v[i+1][j-1]!=v[i][j] and v[i][j-2]!=v[i][j] and v[i-1][j-1]!=v[i][j])dfs(i,j-1,val);
	// if(v[i][j+1]==-1 and vis1[i][j+1]==0 and v[i][j+2]!=v[i][j] and v[i+1][j+1]!=v[i][j] and v[i-1][j+1]!=v[i][j])dfs(i,j+1,val);
	// if(v[i-1][j]==-1 and vis1[i-1][j]==0 and v[i-1][j-1]!=v[i][j] and v[i-1][j+1]!=v[i][j] and v[i-2][j]!=v[i][j])dfs(i-1,j,val);
	// if(v[i+1][j]==-1 and vis1[i+1][j]==0 and v[i+2][j]!=v[i][j] and v[i+1][j-1]!=v[i][j] and v[i+1][j+1]!=v[i][j])dfs(i+1,j,val);
	// return 0;
}
lli lcm(lli a,lli b) { return a*(b/__gcd(a,b));}
lli pow(lli x, lli y, lli p) {
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1) res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
map<lli,lli> ph;
lli vis1[200005],vis2[200005];
int main(){
  string s,t;
  cin>>s;
  cin>>t;
  int flg=0;
  int y=sz(s);
  rep(i,0,sz(s)){
    string g="";
    rep(j,y,sz(s))g+=s[j];
    rep(j,0,y){
      g+=s[j];
    }
    //cout<<y<<" "<<g<<endl;
    y--;
    if(g==t)flg=1;
  }
  if(flg)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

int main() {
	int n;
	int a[100] = { 0 }, b[99] = { 0 };

	cin >> n;
	for (int i = 0; i < n - 1; ++i)
		cin >> b[i];

	a[0] = b[0];
	for (int i = 1; i < n; ++i)
		a[i] = (b[i - 1] <= b[i]) ? b[i - 1] : b[i];
	
	a[n - 1] = b[n - 2];

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

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,{chars :$base :expr } ) =>{read_value !($iter ,String ) .chars () .map (|c |(c as u8 -$base as u8 ) as usize ) .collect ::<Vec <usize >>() } ;($iter :expr ,{char :$base :expr } ) =>{read_value !($iter ,{chars :$base } ) [0 ] } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,char ) =>{read_value !($iter ,chars ) [0 ] } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .unwrap () } ;}
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,mut $var :ident :$t :tt $($r :tt ) *) =>{let mut $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,mut $var :ident $($r :tt ) *) =>{input_inner !{$iter ,mut $var :usize $($r ) *} } ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;($iter :expr ,$var :ident $($r :tt ) *) =>{input_inner !{$iter ,$var :usize $($r ) *} } ;}
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;(iter =$iter :ident ,$($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut $iter =s .split_whitespace () ;input_inner !{$iter ,$($r ) *} } ;($($r :tt ) *) =>{let s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
fn main() {
    input! { s: chars };
    let n = s.len();
    let ans = (s[0] == s[n - 1]) ^ (s.len() % 2 == 1);
    println!("{}", if ans { "First" } else { "Second" });
}


Measured memory_bytes: 4352
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
using namespace std;
#define rep2(x,from,to) for(long long (x)=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 1000000000000000

long long n,m;
long long x[10006][3];
long long used[100006];
long long maxx;
long long ans;
long long res;
long long maxxize;
long long ff;
int main()
{
    cin>>n>>m;
    rep(i,n)
    {
        rep(j,3)cin>>x[i][j];
    }
    for(long long xx=-1;xx<2;xx+=2)
    {
        for(long long yy=-1;yy<2;yy+=2)
        {
            for(long long zz=-1;zz<2;zz+=2)
            {
                res=0;
                rep(i,n)used[i]=0;
                rep(kosu,m)
                {
                    ff=0;
                    
                    rep(i,n)
                    {
                        if(used[i])continue;
                        if(ff==0)
                        {
                            maxx=xx*x[i][0]-yy*x[i][1]-zz*x[i][2];
                            maxxize=i;
                            ff=1;
                            continue;
                        }
                        if(maxx<xx*x[i][0]-yy*x[i][1]-zz*x[i][2])
                        {
                            maxx=xx*x[i][0]-yy*x[i][1]-zz*x[i][2];;
                            maxxize=i;
                        }
                    }
                    used[maxxize]=1;
                    res+=maxx;
                }
                if(res>ans)ans=res;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

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

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<pair<char, int>> term, term2;
    rep(i, n) {
        if (term.empty() || term.back().first!=s[i]) term.emplace_back(s[i], 0);
        term.back().second++;
    }
    rep(i, sz(term)) {
        if (i%2==1 && k>0) {
            term[i].first = term[i-1].first;
            --k;
        }
        if (!term2.empty() && term2.back().first==term[i].first) term2.back().second += term[i].second;
        else term2.emplace_back(term[i].first, term[i].second);
    }
    int ans = 0;
    rep(i, sz(term2)) {
        ans += term2[i].second - 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5712
#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double db;
const int oo=2139063143;
const int N=1010000;
const int P=998244353;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }
int del(int x) { return x>=P?x-P:x; }
void add(int &x,int y) { x=del(x+y); }
int ksm (int a,int b)
{
	int ans=1;
	while (b)
	{
		if (b&1) ans=(LL)ans*a%P;
		a=(LL)a*a%P,b>>=1;
	}
	return ans;
}
int jc[N],inv[N];
void init (int n)
{
	jc[0]=1;
	for (int i=1; i<=n; i++)
		jc[i]=(LL)i*jc[i-1]%P;
	inv[n]=ksm (jc[n],P-2);
	for (int i=n-1; i>=0; i--)
		inv[i]=(LL)(i+1)*inv[i+1]%P;
}
int C(int n,int m) { return (m< 0||m> n)?0:(LL)jc[n]*inv[m]%P*inv[n-m]%P; }
int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	int n,m,ans=0; sc(n),sc(m);
	if (m< n) return pr(0),0;
	init (m);
	for (int R=0; R<=m; R++)
	{
		int B=m-R;
		if (B> R) continue;
		if (R-B>=n) add(ans,C(m,R));
		else 
		{
			if (R==B) --B;
			add(ans,del(C(R+B,R)-C(R+B,2*R-n+1)+P));
		}
	}
	pr(ans);

    return 0;
}


Measured memory_bytes: 6272
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.replace(/\n$/,"")).split("\n");
let lefts = [0,0,0,0]
let rights = [0,0,0,0]

function push(eyes,num){
    if(num >= 1.1){
        eyes[0]++
    }else if(num < 1.1 && num >= 0.6){
        eyes[1]++
    }else if(num < 0.6 && num >= 0.2){
        eyes[2]++
    }else{
        eyes[3]++
    }
}

for(var i = 0;i < Arr.length;++i){
    let nums = Arr[i].split(" ").map(Number);
    push(lefts,nums[0])
    push(rights,nums[1])
}

for(var i = 0;i < 4;++i){
    console.log(lefts[i],rights[i])
}


Measured memory_bytes: 15196
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int n;
    cin >> n;
    vector<int> a(n);
    vector<ll> sum(n+1);
    rep(i, n) cin >> a[i];
    rep(i, n) sum[i+1] = sum[i] + a[i];

    ll ans = 5e18;
    for (int i = 1; i < n ;++i) {
        chmin(ans, abs(sum[i] - (sum[n] - sum[i])));
    }
    cout << ans << endl;
}


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

int main() {
  int N,M,X;
  cin >> N >> M >>X;
  vector<bool> vec(N+1);
  vector<int> A(M);
  
  for(int i = 0;i<M;i++){
    cin >> A.at(i);
  }
  for(int i = 0;i<M;i++){
    vec.at(A.at(i)) = 1;
  }
  
  int c1 = 0;
  int c2 = 0;
  for(int i = 0;i<X;i++){
    if(vec.at(i) == 1) c1++;
  }
   for(int i = X+1;i<N+1;i++){
    if(vec.at(i) == 1) c2++;
  }
  cout << min(c1,c2) << endl;
  
}


Measured memory_bytes: 256
#include <iostream>

int main() {
    int n, d, x;
    std::cin >> n;
    std::cin >> d >> x;

    int A[110];
    for(int i=0; i<n; ++i) {
        std::cin >> A[i];
    }

    int chocolate = 0;

    for(int i=0; i<n; ++i) {
        // 一人当たり
        for(int day=1; day <= d; ++day) {
            if(A[i] == 1) {
                chocolate++;
            }
            else if(day % A[i] == 1) {
                chocolate++;
            }
        }
    }

    std::cout << chocolate+x << std::endl;
}

Measured memory_bytes: 256