akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
int main(void){
   int n, a, b, c, S, key;
   scanf("%d", &n);
   key = 1;
   if ( n == 2 ) {
      scanf("%d %d", &a, &b);
      if ( a > b ) S = b;
      else S = a;
      while ( key <= S ) {
         if ( a % key == 0 && b % key == 0) printf("%d\n", key);
         key++;
      }
   } else if ( n == 3 ) {
      scanf("%d %d %d", &a, &b, &c);
      if ( a >= c && b >= c ) S = c;
      else if ( a >= b && c >= b ) S = b;
      else S = a;
      while ( key <= S ) {
         if ( a % key == 0 && b % key == 0) printf("%d\n", key);
         key++;
      }
   }
   return 0;
}

Measured memory_bytes: 1816
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();
        boolean aa = a>8;
        boolean bb = b>8;
        boolean xx = !(aa || bb);
        if (xx) {
            System.out.println("Yay!");
        } else {
            System.out.println(":(");
        }

    }
}


Measured memory_bytes: 21972
<?php
list($N, $M) = array_map(function ($n) {
    return (int)$n;
}, explode(' ', fgets(STDIN)));

$map = [];
$from_map = [];
$has_been_went = [1];

for ($i = 0; $i < $N; $i++) {
    $map[$i + 1] = [];
    $from_map[$i + 1] = null;
}

for ($i = 0; $i < $M; $i++) {
    list($A, $B) = array_map(function ($n) {
        return (int)$n;
    }, explode(' ', fgets(STDIN)));
    $map[$A][$B] = $B;
    $map[$B][$A] = $A;
}

$next_from = [];
foreach ($map[1] as $second_room) {
    $from_map[$second_room] = 1;
    $has_been_went[$second_room] = $second_room;
    $next_from[] = $second_room;
    unset($map[1][$second_room]);
    unset($map[$second_room][1]);
}

while (count($has_been_went) !== $N) {
    $next_next_from = [];
    foreach ($next_from as $from) {
        $should_go_next = $map[$from];
        foreach ($should_go_next as $next) {
            if (!isset($has_been_went[$next])) {
                $from_map[$next] = $from;
                $has_been_went[$next] = $next;
                $next_next_from[] = $next;
            }
            unset($map[$from][$next]);
            unset($map[$next][$from]);
        }
    }
    $next_from = $next_next_from;
}

echo "Yes\n";
foreach ($from_map as $from) {
    if ($from) {
        echo $from . "\n";
    }
}


Measured memory_bytes: 75820
//  MONSTER >_<
#include <bits/stdc++.h>
#define SPEED ios::sync_with_stdio(false); cin.tie(0)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define dbg(x) cout<<#x<<": "<<x<<endl
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define mo 1000000007
#define inf 1e18
#define eps 0.0000000001
#define stp setprecision(20)
#define all(v) v.begin(),v.end()
#define endl '\n'
using namespace std;
//mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());

#define N  int(2e5)+10

int main()
{    SPEED;

       int m,d;
       cin>>m>>d;int cnt=0;
       loop(i,1,d+1){ 
       	 if(i%10>=2&&(i/10)%10>=2&&(i/10)*(i%10)<=m)cnt++;
	   }cout<<cnt;
}



Measured memory_bytes: 256
#include <stdio.h>

int is_month(int m) {
    return (m >= 1) && (m <= 12);
}

int main () {
    int S;
    scanf("%d", &S);

    int bottom_2 = S % 100;
    int top_2 = S / 100;

    char *ans;
    if (is_month(top_2) && is_month(bottom_2)) {
        ans = "AMBIGUOUS";
    } else if (is_month(top_2) && !is_month(bottom_2)) {
        ans = "MMYY";
    } else if (!is_month(top_2) && is_month(bottom_2)) {
        ans = "YYMM";
    } else {
        ans = "NA";
    }

    printf("%s\n", ans);
    return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python3
import sys
import math
def main():
    input = sys.stdin.readline
    n, d = map(int, input().split())
    ans = 0
    for i in range(n):
        x, y = map(int, input().split())
        dis = math.sqrt(x ** 2 + y ** 2)
        if dis <= d:
            ans += 1
    print(ans)
if __name__ == '__main__':
    main()


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

int main(){
	double v;
	while(cin >> v){
		double 	t=v/9.8;
		int n=1;
		while(5*n-5 <= 4.9*t*t) ++n;
		printf("%d\n", n);
	}
	return 0;
}

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

int main(){
    int n, ans;
    cin >> n;
    ans =  2147483647;
    vector<int> x(n);
    rep(i, n) cin >> x[i];
    rep(p, 101){
        int sum = 0;
        rep(i, n){
            sum += pow(p - x[i], 2);
        }
        ans = min(ans , sum);
    }
    cout << ans <<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

ll N;
map<ll, ll> AB;

signed main()
{
    cin >> N;
    REP(i, N) {
        ll a, b;
        cin >> a >> b;
        AB[b] += a;
    }
    // 現在時間
    ll cur = 0;
    for(auto& ab : AB) {
        ll a = ab.second;
        ll b = ab.first;
        cur += a;
        //DBG("a: %lld b:%lld cur: %lld\n", a, b, cur);
        if(cur > b) {
            printf("No\n");
            return 0;
        }
    }

    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std ;
#define ll long long 
#define pb push_back
#define in(x) int x; cin>>x;
#define ln(x) long long x; cin>>x;
#define memf(a) memset(a,false,sizeof(a))
#define F first
#define S second
#define endl "\n"
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
int main()
{
	fast
	string s;
	cin>>s;
	ll ans=0;
	for(int i=0;i<s.length();i++)
	{
		ans+=(s[i]-48);
	}
	if(ans%9==0)
		cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define fore(i, n) for(auto &i : n)
#define rep(i, n) for (int i = 0; i < n; ++i)
#define repr(i, n) for (int i = n; i >= 0; --i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

//#pragma GCC optimize ("-O3")

const static int mod = 1000000000 + 7;
const static int inf = INT_MAX / 2;
const static llong INF = LLONG_MAX / 2;
const static double eps = 1e-6;
const static int dx[] = {1, 0, -1, 0};
const static int dy[] = {0, 1, 0, -1};

template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

struct BipartiteMatching {
    int n, m;
    const int inf = INT_MAX / 2;
    vector<int> match, dist;
    vector<vector<int>> E;

    void init(int _n,int _m){
        n =_n, m =_m;
        E.resize(n + m + 2);
        match.resize(n + m + 2);
        dist.resize(n + m + 2);
    }

    bool bfs() {
        queue<int> que;
        for (int i = 1; i < n + 1; ++i) {
            if (! match[i]) dist[i] = 0, que.push(i);
            else dist[i] = inf;
        }

        for (int i = 1; i < n + 1; ++i) {
            if (!match[i]) dist[i] = 0, que.push(i);
            else dist[i] = inf;
        }

        dist[0] = inf;
        while (! que.empty()) {
            int u = que.front(); que.pop();
            if (u) fore(v, E[u]) if (dist[match[v]] == inf) {
                dist[match[v]] = dist[u] + 1;
                que.push(match[v]);
            }
        }

        return (dist[0] != inf);
    }

    bool dfs(int u) {
        if (u) {
            fore(v, E[u]) if (dist[match[v]] == dist[u] + 1) if (dfs(match[v])) {
                match[v] = u; match[u] = v;
                return true;
            }
            dist[u] = inf;
            return false;
        }
        return true;
    }

    void add(int a, int b) {
        b += n; 
        E[a + 1].push_back(b + 1); 
        E[b + 1].push_back(a + 1);
    }

    int whois(int x) {
        return match[x + 1] - 1;
    }

    int solve() {
        for (int i = 0; i < n + m + 1; ++i) match[i] = 0;
        int res = 0;
        while (bfs()) {
            for (int i = 1; i < n + 1; ++i) {
                if (!match[i] && dfs(i)) res++;
            }
        }
        
        return res;
    }
};

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

    int N, A[101], B[101], C[101], D[101];
    cin >> N;
    rep(i, N) cin >> A[i] >> B[i];
    rep(i, N) cin >> C[i] >> D[i];

    BipartiteMatching bm;
    bm.init(N, N);
    rep(i, N) rep(j, N) {
        if (A[i] < C[j] and B[i] < D[j]) bm.add(i, j);
    } 
    cout << bm.solve() << endl;

    return 0;
}

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

int main() {
	int N, a1[110], a2[110], cnt, max, i;

	scanf("%d", &N);
	for (i = 0; i < N; i++) scanf("%d", &a1[i]);
	for (i = 0; i < N; i++) scanf("%d", &a2[i]);
	
	cnt = a1[0];
	for (i = 0; i < N; i++) cnt += a2[i];
	max = cnt;
	for (i = 1; i < N; i++) {
		cnt = cnt - a2[i - 1] + a1[i];
		if (max < cnt) max = cnt;
	}

	printf("%d", max);
	return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cstring>

#define INF     0x3f3f3f3f
#define LL  long long
using namespace std;
int N;
string S;
LL ans = 0;

int main()
{
    
    scanf("%d", &N);
    cin>>S;

    LL c1, c2, c3;
    c1 = c2 = c3  = 0;
    LL rgb = 0;
    for(int i=0; i<N; i++) {
        if(S[i] == 'R') {
            ++c1;
        }
        if(S[i] == 'G') {
            ++c2;
        }
        if(S[i] == 'B') {
             ++c3;

        }
        /*
        if(i+2<N) {
            if(S[i] == S[i+1] && S[i+1] == S[i+2]) {
                ++rgb;
            }
        }
        */
    }

/*
    for(int i=0; i<N; i++) {
        for(int j=i+1; j<N; j++) {
            int t = j-i;
            if(S[i]!=S[j] && S[j] != S[j+t]) {
                ++rgb ;
            } 
        }
    }
    */

    for(int i=0; i<N; i++) {
        for(int d=1; i+2*d<N; d++) {
            if(S[i] != S[i+d] && S[i+2*d] != S[i]&&S[i+d]!=S[i+2*d]) {
                ++rgb;
            }
         }
    }

//    printf("%d %d\n", c1*c2*c3, rgb);
    ans =c1*c2*c3 -rgb;

/*
    int cnt = 0;
    int t1, t2, t3;
    t1 = t2 = t3;
    ofstream out;
    out.open("1.txt", ios::trunc);
    for(int i=1; i<=N; i++) {
        for(int j=i+1; j<=N; j++) {
            for(int k=j+1; k<=N; k++) {
//                if(k+i==j+j) continue;
                if(k+i==j+j && S[i-1]!=S[j-1] && S[i-1]!=S[k-1] && S[j-1]!=S[k-1]) {
//                    out << i << ","  << j << "," <<k << ":";
//                    out <<S[i-1]<< S[j-1]<< S[k-1]<<endl;
                    ++cnt;
                    //printf("%d %d %d\n", i, j, k);                  
                }
            }
        }
    }
    */
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int n, x, y, W;
ll dp[101][100001];
vector <pair <int, int> > a;

ll solve(int ind, int W){
    if(ind == n) return 0;
    ll &ret = dp[ind][W];
    if(ret != -1) return ret;
    ret = 0;
    ret = solve(ind + 1, W);
    if(W >= a[ind].first) ret = max(ret, solve(ind + 1, W - a[ind].first) + a[ind].second);
    return ret;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(dp, -1, sizeof dp);
    cin >> n >> W;
    for(int i = 0 ; i < n && cin >> x >> y ; i++)
        a.push_back(make_pair(x, y));
    cout << solve(0, W) << endl;
}


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

typedef pair<ll,ll> Point;
typedef vector<Point> VP;
#define X first
#define Y second

bool compy(const Point &a, const Point &b) {
    return a.Y < b.Y;
}

Point p[50],pp[50];

int main(void){
    int N,K;
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>K;
    rep(i,N){
        ll x,y;
        cin>>x>>y;
        p[i] = Point(x,y);
    }
    sort(p,p+N);
    ll res = LLONG_MAX;
    rep(r,N)rep(l,r){
        ll w = p[r].X-p[l].X;
        if(r-l+1<K)continue;
        int idx=0;
        for(int i=l;i<=r;i++){
            pp[idx++]=p[i];
        }
        int n = idx;
        sort(pp,pp+n,compy);
        rep(i,n-K+1){
            ll h = pp[i+K-1].Y-pp[i].Y;
            res = min(res,w*h);
        }
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace ITP1_10_A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            double x1 = double.Parse(input[0]);
            double y1 = double.Parse(input[1]);
            double x2 = double.Parse(input[2]);
            double y2 = double.Parse(input[3]);
            double dx = x2 - x1;
            double dy = y2 - y1;
            Console.WriteLine(Math.Sqrt(dx * dx + dy * dy));
        }
    }
}

Measured memory_bytes: 9276
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a, b, k;
	vector<int> v;
	cin >> a >> b >> k;
	for (int i = a; i < a + k; i++) {
		if (i > b)break;
		v.push_back(i);
	}
	for (int i = b - k+1; i <= b; i++) {
		if (i > v.back()) {
			v.push_back(i);
		}
	}
	for (auto i : v) {
		cout << i << endl;
	}
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
A.sort()
M = A[-1]+1
DP = [0]*M
for i in A:
  DP[i] += 1
  for j in range(i*2,M,i):
    DP[j] = 2
print(DP.count(1))

Measured memory_bytes: 32284
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    unordered_map<char, char> chara1, chara2;
    for (int i = 0; i < s.length(); i++) {
        if (chara1.count(s[i]) == 0) {
            chara1[s[i]] = t[i];
        } else {
            if (chara1[s[i]] != t[i]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    for (int i = 0; i < t.length(); i++) {
        if (chara2.count(t[i]) == 0) {
            chara2[t[i]] = s[i];
        } else {
            if (chara2[t[i]] != s[i]) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 776
#include<iostream>
#include<vector>
#include<bitset>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<list>
#include<queue>
#include<map>
#include<numeric>
#include<set>
#include<iterator>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)
int INF=1e9;
const long long mod=1e9+7;
#define ll long long 
int main(){
    int n;
    cin>>n;
    vector<int>d(n);
    rep(i,n){
        cin>>d[i];
    }
    sort(d.begin(),d.end());
    if(d[n/2]==d[(n/2)-1]){
        cout<<0<<endl;
    }
    else{
        cout<<d[n/2]-d[(n/2)-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 640
// B.

#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; ++i) {
		cin >> d[i];
	}
	set<int> s(d.begin(), d.end());
	cout << s.size() << endl;
	return 0;
}


Measured memory_bytes: 256
using System;

public class Test{
  public static void Main(){
    
    //文字列の読み込み
    string[] str1 = System.Console.ReadLine().Split(' ');
    long n = Convert.ToInt64(str1[0]);
    long m = Convert.ToInt64(str1[1]);

    //nから2個またはmから2個取るパターンが該当
    long pattern = n * (n-1) / 2 + m * (m-1) / 2;

   	System.Console.WriteLine(pattern);
  }
}


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

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

    vector<tuple<string, int, int>> v;
    for (int i = 0; i < n; i++) {
        string s;
        int p;
        cin >> s >> p;

        p = 100 - p;
        v.push_back(make_tuple(s, p, i + 1));
    }
    sort(v.begin(), v.end());

    for (tuple<string, int, int> t : v) {
        int i;
        tie(ignore, ignore, i) = t;
        cout << i << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

vector<int> Zalgo(string s){
    vector<int> A(s.size(),0);
    A[0]=s.size();
    int i = 1, j = 0;
    while (i < s.size()) {
        while (i+j < s.size() && s[j] == s[i+j]) ++j;
        A[i] = j;
    if (j == 0) { ++i; continue;}
    int k = 1;
    while (i+k < s.size() && k+A[k] < j) A[i+k] = A[k], ++k;
    i += k; j -= k;
    }
    return A;
}
int main(){
    int N;cin>>N;
    string s;cin>>s;
    vector<int> Z;
    int ans=0;
    REP(i,N){
        Z=Zalgo(s.substr(i,N-i));   
        rep(j,1,N-i) ans=max(ans,min(j,Z[j]));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
n = int(input())
s = [0]*n
for i in range(n):
    s[i] = int(input())

max = sum(s)

if max % 10 == 0:
    s.sort()
    min = 0
    for i in s:
        if i % 10 != 0:
            min = i
            break
    if min == 0:
        print(0)
    else:
        print(max-min)
else:
    print(max)


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

class Prog
{
  public static void Main()
  {
    var n = Int32.Parse(Console.ReadLine());
    var ipts = new List<List<char>>();
    for(var i = 0; i < n; i++)
    {
      ipts.Add(Console.ReadLine().ToList());
    }
    var charDic = new Dictionary<char,int>();
    foreach(var c in  Enumerable.Range(97,26).Select(i=>(char)i))
    {
      charDic.Add(c,ipts.Select(ipt => ipt.Where(cc =>cc==c).Count()).Min());
    }
    var ans ="";
   foreach(var k in charDic.Keys)
   {
     if(charDic[k]>0)
       ans += new String(k,charDic[k]);
   }
   Console.WriteLine(ans);
  }
}


Measured memory_bytes: 11488
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int v[]=new int[n];
    for(int i=0;i<n;i++){
      v[i]=sc.nextInt();
    }
    sc.close();
    Arrays.sort(v);
    double sum=v[0]*(1/(Math.pow(2,n-1)));
    for(int i=1;i<n;i++){
      sum+=v[i]*(1/(Math.pow(2,n-i)));
    }
    System.out.println(sum);
  }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define INF 2e9
#define LINF 1e18
#define mod 1e9+7
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> P;

int main() {
    ll a, b, k; cin >> a >> b >> k;
    if (k<=a) {
        cout << a-k << " " << b << endl;
    } else if (a<=k && k<=a+b) {
        cout << 0 << " " << b-(k-a) << endl;
    } else {
        cout << 0 << " " << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <climits>
#include <math.h>

#define sint(x) scanf("%d", &x)
#define sints(x,y) scanf("%d%d", &x, &y)

using namespace std;

int main()
{
    int a,b;
    int v,w;
    sints(a,v);
    sints(b,w);

    int t;
    sint(t);

    if(a  < b){
        long long int x = (long long int) b + (long long int) w*t;

        long long int y =  (long long int) a + (long long int) v*t;

        cout << (y >= x ? "YES" : "NO" ) << endl;
    }


    else if(a  > b){
        long long int x = (long long int) b - (long long int) w*t;

        long long int y =  (long long int) a - (long long int) v*t;

        cout << (y <= x ? "YES" : "NO" ) << endl;
    }

    return 0;
}


Measured memory_bytes: 3764
#include <iostream>
#include <cstring>
#include <queue>
using namespace std;
const int maxn = 1e5 + 10;
const int maxm = 1e5 + 10;
struct edge{
	int to;
	int next;
}Edge[2 * maxm];
int head[maxn], pos, n, color[maxn];
void init(){
	for(int i = 0; i < maxn; i++) head[i] = -1;
	for(int i = 0; i < maxn; i++) color[i] = -1; // -1 is uncolored 1 is whrite, 0 is black
	pos = 0;
}
void addEdge(int u, int v){
	Edge[pos].to = v;
	Edge[pos].next = head[u];
	head[u] = pos;
	pos++;
}
void BFS(){
	queue <int> q;
	color[1] = 0;
	color[n] = 1;
	q.push(1);
	q.push(n);
	while(!q.empty()){
		int h = q.front();
		q.pop();
		for(int i = head[h]; i != -1; i = Edge[i].next){
			if(color[Edge[i].to] == -1){
				color[Edge[i].to] = color[h];
				q.push(Edge[i].to);
			}
		}
	}
}
// void BFS(){
// 	queue <int> qw;
// 	queue <int> qb;
// 	qw.push(n);
// 	color[n] = 1;
// 	qb.push(1);
// 	color[1] = 0;
// 	while(!qw.empty() || !qb.empty()){
// 		if(!qb.empty()){
// 			int h = qb.front();
// 			//cout << "B" << h << endl;
// 			qb.pop();
// 			for(int i = head[h]; i != -1; i = Edge[i].next){
// 				if(color[Edge[i].to] == -1){
// 					//cout << Edge[i].to << " ";
// 					color[Edge[i].to] = 0;
// 					qb.push(Edge[i].to);
// 				}
// 			}
// 			//cout << endl;
// 		}
// 		if(!qw.empty()){
// 			int h = qw.front();
// 			//cout << "W" << h << endl;
// 			qw.pop();
// 			for(int i = head[h]; i != -1; i = Edge[i].next){
// 				if(color[Edge[i].to] == -1){
// 					//cout << Edge[i].to << " ";
// 					color[Edge[i].to] = 1;
// 					qw.push(Edge[i].to);
// 				}
// 			}
// 			//cout << endl;
// 		}
// 	}

// }
int main(){
	//freopen("input.txt", "r", stdin);
	while(scanf("%d", &n) != EOF){
		init();
		for(int i = 1; i <= n - 1; i++){
			int u, v;
			scanf("%d%d", &u, &v);
			addEdge(u, v);
			addEdge(v, u);
		}
		//cout << n << endl;
		BFS();
		int white = 0, black = 0;
		for(int i = 1; i <= n; i++){
			//cout << i << ":"<< color[i] << endl;
			if(color[i] == 1) white++;
			else black++;
		}
		//cout << white <<" "<< black << endl;
		if(white < black) printf("Fennec\n");
		else printf("Snuke\n");
	}
	return 0;
}





Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;


namespace AtCoder
{
    class AtCoderrr
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            int max = 0;
            int tmp = 0;
            for (int i = 0; i < n; i++)
            {
                int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
                int a = s[0];
                int b = s[1];
                if (a > tmp)
                {
                    tmp = a;
                    max = a + b;
                }
            }
            WriteLine(max);

        }
    }
}


Measured memory_bytes: 15400
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,A,B;
  cin >> K >> A >> B;
  
  int x = 0;
  
  for(int i = A; i <= B; i++){
    if(i % K == 0){
      x++;
    }
  }
  
  if(x == 0){
    cout << "NG" << endl;
  }
  
  else{
      cout << "OK" << endl;
  }
  
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char>cvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
int main()	{
  int n;string s;
  cin>>n>>s;
  rep(i,s.size()){
    int a=s[i]-'A';
    a=(s[i]-'A'+n)%26;
    s[i]=a+'A';
  }
  cout<<s<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N,M;
  int sum=0;
  int ans=0;
  cin>>N>>M;

  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
    sum=sum+vec.at(i);
  }

  for(int i=0;i<N;i++){
    if(vec.at(i)>=(double)sum/(4*M)){
      ans=ans+1;
    }
  }
  if(ans>=M){
   cout<<"Yes"<<endl;  
  }else{
   cout<<"No"<<endl;
  }

  
}








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

using namespace std;

typedef long long ll;
typedef vector<ll> vll;

#define rep(i,m,n) for(ll i=m;i<n;i++)

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

 ll n;
  cin >> n;
  vll l(n);
  rep(i,0,n) cin >> l[i];

 ll res=0; 
  
  sort(l.begin(),l.end());
  
  rep(i,0,n){
   rep(j,i+1,n){
    rep(k,j+1,n) if(l[k]<l[i]+l[j]) res++;
   }
  }
  
   cout << res << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 62;

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }

int main() {
  string s; cin>>s;
  long long k; cin>>k;
  int n = s.size();

  if (s == string(n, s[0]) or n == 1) {
    print((n * k) / 2);
    return 0;
  }

  int head = 0, tail = 0, mid = 0;
  for (int i = 0; s[i] == s[0]; ++i) ++head;
  for (int i = n-1; s[i] == s[n-1]; --i) ++tail;
  REP(i, head+1, n-tail) {
    if (s[i] == s[i-1]){
      ++mid;
      ++i;
    }
  }
  long long ans = mid*k + head/2 + tail/2;
  if (s[0] == s[n-1]) {
    ans += ((head+tail)/2) * (k-1);
  } else {
    ans += (head/2 + tail/2) * (k-1);
  }
  print(ans);

  return 0;
}

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

typedef long long int ll;

ll MOD = 1000000007;
ll INF = 100000000000;

int main(){
 int N;
 cin >> N;
 vector<string> S(N);
 for(int i = 0;i < N;i++){
   cin >> S[i];
   sort(S[i].begin(),S[i].end());
 }
 sort(S.begin(),S.end());
 ll ans = 0;
 ll memo = 1;
 for(int i = 0;i < N-1;i++){
   if(S[i+1] == S[i]){
     memo++;
   }else{
     ans += memo * (memo-1) / 2;
     memo = 1;
   }
   if(i == N-2){
      ans += memo * (memo-1) / 2;
     memo = 1;
   }
 }
 cout << ans << endl;
}


Measured memory_bytes: 7296
#include <iostream>
#include <algorithm>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>
//#include <cmath>
#include <cstdlib>

using namespace std;

int main(){

    int n;
    cin >> n;

    vector<long long int> a(n+1);
    for(int i=0;i<n;i++) cin >> a[i];
    a[n] = 0;
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());

    long long int b=0;
    for(int i=0;i<n;i++){
        if(a[i] == a[i+1]){
            if(b == 0){
                b = a[i];
                i++;
            }else{
                cout << b * a[i];
                return 0;
            }
        }
    }
    cout << "0";
    

    return 0;
}

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

#define MAX 100000
#define SENTINEL 2000000000

struct Card { int number; char mark;};

int partition(Card C[], int p, int r) {
    int x = C[r].number;
    int i = p - 1;
    Card tmp;
    for (int j = p; j < r; j++) {
        if (C[j].number <= x) {
            i++;
            tmp = C[i];
            C[i] = C[j];
            C[j] = tmp;
        }
    }
    tmp = C[i+1];
    C[i+1] = C[r];
    C[r] = tmp;
    return i + 1;
}

void q_sort(Card C[], int p, int r) {
    if (p < r) {
        int q = partition(C, p, r);
        q_sort(C, p, q-1);
        q_sort(C, q+1, r);
    }
}

Card L[MAX/2+2], R[MAX/2+2];
void merge(Card C[], int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++) {
        L[i] = C[left+i];
    }
    for (int i = 0; i < n2; i++) {
        R[i] = C[mid+i];
    }
    L[n1].number = R[n2].number = SENTINEL;
    int li = 0, ri = 0;
    for (int i = left; i < right; i++) {
        if (L[li].number <= R[ri].number) {
            C[i] = L[li++];
        } else {
            C[i] = R[ri++];
        }
    }
}

void merge_sort(Card C[], int left, int right) {
    if (left+1 < right) {
        int mid = (left + right) / 2;
        merge_sort(C, left, mid);
        merge_sort(C, mid, right);
        merge(C, left, mid, right);
    }
}

int main() {
    int n;
    cin >> n;
    Card C1[MAX], C2[MAX];
    int number;
    char mark;
    for (int i = 0; i < n; i++) {
        cin >> mark >> number;
        C1[i].mark = mark; C1[i].number = number;
        C2[i] = C1[i];
    }
    q_sort(C1, 0, n-1);
    merge_sort(C2, 0, n);
    bool is_stable = true;
    for (int i = 0; i < n; i++) {
        if (C1[i].number != C2[i].number || C1[i].mark != C2[i].mark) is_stable = false;
    }
    if (is_stable) {
        cout << "Stable";
    } else {
        cout << "Not stable";
    }
    cout << endl;
    for (int i = 0; i < n; i++) {
        cout << C1[i].mark << " " << C1[i].number << endl;
    }
    return 0;
}



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

int main()
{
    int x, y;
    cin >> x >> y;
    int z;
    while (true)
    {
        z = x % y;
        if (z == 0)
        {
            cout << y << endl;
            return 0;
        }
        x = y;
        y = z;
    }
}



Measured memory_bytes: 3120
import java.io.PrintWriter;
import java.util.*;
import java.util.Scanner;

// Solution
public class Main {
  private static Scanner in;
  private static PrintWriter out;
  private static final String INPUT = ""; // input file name

  /**
   * Interactive get next command
   */
  static int get(int pos) {
    out.println(pos + 1);
    out.flush();
    return ni();
  }

  static void solve() {
    int x = ni();
    int n = ni();

    int[] arr = new int[n];
    Set<Integer> s = new HashSet<>();
    for (int i = 0; i <n ;i++) {
    	arr[i] = ni();
      s.add(arr[i]);
    }
    
    Arrays.sort(arr);
    
    int t = x;
    int a = x; int b = x;
    
    while (true) {
      if (s.contains(a)) {
      	a--;
      } else {
      	out.println(a);
        break;
      }
      
      if (s.contains(b)) {
      	b++;
      } else {
      	out.println(b);
        break;
      }
    }
  }

  public static void main(String[] args) throws Exception {
    long S = System.currentTimeMillis();
    in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
    out = new PrintWriter(System.out);

    solve();
    out.flush();
    long G = System.currentTimeMillis();
    tr(G - S + "ms");
  }

  private static int ni() {
    return Integer.parseInt(in.next());
  }

  private static long nl() {
    return Long.parseLong(in.next());
  }

  // Math Utils
  private static int pi(int num, int pow) {
    int result = 1;

    while (pow > 0) {
      if (pow % 2 == 1) {
        result *= num;
      }

      num *= num;
      pow /= 2;
    }

    return result;
  }

  private static int pim(int num, int pow, int mod) {
    int result = 1;

    while (pow > 0) {
      if (pow % 2 == 1) {
        // keep collecting `odd` num in result
        result = (result * num) % mod;
      }

      num = (num * num) % mod;
      pow /= 2;
    }

    return result;
  }

  private static long pl(long num, long pow) {
    long result = 1;

    while (pow > 0) {
      if (pow % 2 == 1) {
        result *= num;
      }

      num *= num;
      pow /= 2;
    }

    return result;
  }

  private static long plm(long num, long pow, long mod) {
    long result = 1;

    while (pow > 0) {
      if (pow % 2 == 1) {
        // keep collecting `odd` num in result
        result = (result * num) % mod;
      }

      num = (num * num) % mod;
      pow /= 2;
    }

    return result;
  }

  static void tr(Object... o) {
    if (!INPUT.isEmpty())
      out.println(Arrays.deepToString(o));
  }
}


Measured memory_bytes: 38732
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
#include <functional>
#include <bitset>
using namespace std;
//typedef __int64 LL;
//typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef pair<int,int> P;
//typedef pair<LL,LL> PL;

const int MOD=1000000007;
int INF=100100100;

int a[20][20];
int main(){
	int n;cin>>n;
	for(int i=0;i<n;i++)
	{
		int m;
		cin>>m;
		for(int j=0;j<m;j++)
		{
			int x,y;
			cin>>x>>y;x--;
			a[i][x]=y+1;
			//1は不親切
			//2は正直
		}
	}
	int ans=0;
	
	for(int i=0;i<(1<<n);i++)
	{
		
		int keta=0;
		bool flag=true; 		
		bitset<17> bi(i);
		for(int j=0;j<n;j++)
		{
			if(bi.test(j))
			{
				keta++;
			for(int k=0;k<n;k++)
				{
					if((a[j][k]==1 && bi.test(k)) ||
					(a[j][k]==2 && !(bi.test(k))))
					{
						flag=false;
					}
				}
			}
		}
		if(flag)ans=max(ans,keta);
	}
	cout<<ans<<endl;
	return 0;
}

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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    int t = 1, count = 0;
    bool f = false;
    REP(i, n) {
        if (a[i] == t) {
            t++; f = true;
            continue;
        }
        count++;
    }
    if (f) cout << count << endl;
    else cout << -1 << endl;
}


Measured memory_bytes: 1024
using System;
class Program
{
    public static void Main()
    {
        for(int i = 1; i <= 9; i++)
        {
            for(int j = 1; j <= 9;j++)
            {
                Console.WriteLine("{0}x{1}={2}",i,j,i*j);
            }
        }
    }
}


Measured memory_bytes: 15772
/* 
    @author : srinathbalaji_99
*/


#include<bits/stdc++.h>

#define PB push_back
#define MP make_pair
#define endl '\n'
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define rep(i, a, b, inc) for(long long i = a; i < b; i += inc)
#define REP(i, n) rep(i, 0, n, 1)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define PLL pair<long long, long long>
#define VL vector<long long>
#define VS vector<string>
#define VLL vector<PLL>
#define VVL vector<VL>
#define MPLL map<long long, long long>
#define UMPLL unordered_map<long long, long long>
#define SETL set<long long>
#define MSETL multiset<long long>
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) (a * b)/GCD(a, b)
#define ff first
#define ss second
#define pall(a) REP(i, sizeof(a)/sizeof(a[0]))cout << a[i] << " ";cout << endl;
#define pvall(v) REP(i, v.size())cout << v[i] << " ";cout << endl;
#define gall(a, n) REP(i, n)cin >> a[i];
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

typedef unsigned long long ULL;
typedef long long LL;
typedef long double LD;


using namespace std;

void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

int main()
{
    fast();


    LL t,n,i,j,k,x,y,c,m;
    cin >> n;
    --n;
    cout << (n * (n + 1)) / 2;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define df 0
int dc=100000;
#define MAX 100010
typedef long int li;
li gcd(li a,li b){
  if(b==0)return a;
  return gcd(b,a%b);
}
#define lcm(a,b) ((a)/gcd(a,b)*(b))

int main(){
  if(df)printf("*** debug mode ***\n");
  li n,m=1,i;
  scanf("%ld",&n);

  for(i=0;i<n;i++){
    li a;
    scanf("%ld",&a);
    m=lcm(m,a);
  }
  printf("%ld",m);
  return 0;
}


/// confirm df==0 ///


Measured memory_bytes: 128
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
	char str[10];
	int n,vis=0;
	cin>>str;
	n=strlen(str);
	for(int i=0;i<n;i++){
		if(str[i]=='A' && str[i+1]=='C'){
		   vis=1;
		   break;
		}
	}
	if(vis)
       cout<<"Yes"<<endl;
    else
       cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//https://drken1215.hatenablog.com/entry/2019/03/23/175300
fn main() {
    let _n: usize = read();
    let s: Vec<char> = read::<String>().chars().collect();

    let mut count = s.iter().filter(|x| **x == 'E').count();
    let mut ans = count;

    for ch in s.iter(){
        if *ch == 'E'{
            count -= 1;
            ans = std::cmp::min(count,ans);
        }else{
            count += 1;
        }
    }
    println!("{}",ans);
}


Measured memory_bytes: 3812
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;

int main() {
	string s;
	cin >> s;
	int result = 700;
	rep(i, 3) {
		if (s.at(i) == 'o') {
			result += 100;
		}
	}
	cout << result << endl;
}


Measured memory_bytes: 3600
#include<stdio.h>
int R=1,C=1,H[2000010],N[2000010];
//????????¢??°????????????MAX???
int hyouka(int a,int b){
  if(C<b)return 1;
  if(C<a||b==0)return 0;
  return N[H[a]]<N[H[b]]?1:0;
}
//?????\??¢??°
void hin(int a){
  int i=C++;
  for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//??????????????¢??°
int hout(){
  int rt=H[1],i,j=2,k=H[--C];
  for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
  H[j/2]=k;
  return rt;
}
int ta[100010],nt[400010],to[400010],co[400010];
//????????°??????
void mkls(int v,int e,int *a,int *b,int *c){
  int i;
  for(i=0;i<v;i++)ta[i+1]=-1;
  for(i=0;i<e;i++){
    nt[i  ]=ta[to[i+e]=a[i]];
    nt[i+e]=ta[to[i  ]=b[i]];
    co[ta[b[i]]=i+e]=co[ta[a[i]]=i]=c[i];
  }
}
void prls(int v){
  int i,j;
  for(i=0;i<v;i++){
    printf("%d:",i+1);
    for(j=ta[i+1];j+1;j=nt[j])printf("%d,%d ",to[j],co[j]);
    printf("\n");
  }
  printf("\n");
}
int MAX(int a,int b){return a<b?b:a;}
int MIN(int a,int b){return a<b?a:b;}
int main(){
  int n,m,k,a[200010],b[200010],c[200010],d[100010],e[100010],f[100010];
  int q[100010],t,r,i,j;
  scanf("%d %d %d",&n,&m,&k);
  for(i=0;i<m;i++)scanf("%d %d",&a[i],&b[i]);
  for(i=0;i<m;i++)c[i]=1e9;
  for(i=0;i<k;i++){
    scanf("%d",&j);
    c[j-1]=i+1;
  }
  mkls(n,m,a,b,c);
  //prls(n);
  q[t=0]=1;
  for(i=0;i<n;i++)d[i+1]=1e9;
  for(i=0;i<n;i++)e[i+1]=0;
  d[1]=0;
  e[1]=1e9;
  for(r=1;r-t;t++){//printf("%d\n",q[t]);
    hin(e[q[t]]);
    for(i=ta[q[t]];i+1;i=nt[i]){
      if(d[to[i]]<d[q[t]]+1)continue;
      if(d[to[i]]>d[q[t]]+1)q[r++]=to[i];
      d[to[i]]=d[q[t]]+1;
      e[to[i]]=MAX(e[to[i]],MIN(e[q[t]],co[i]));
    }
  }
  for(i=0;i<n;i++)f[i]=N[hout()];
  //for(i=0;i<n;i++)printf("%d ",f[i]);printf("\n");
  for(i=j=0;i<k;i++){
    while(f[j]<=i+1)j++;
    printf("%d\n",j);
  }
  return 0;
}

Measured memory_bytes: 12832
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
   std::ops::*,
};

fn main() {
   input! {
      s: Bytes,
   }
   let n = s.len();
   let b1 = s[0] != s[n - 1];
   let b2 = n % 2 == 0;
   if b1 ^ b2 {
      println!("First");
   } else {
      println!("Second");
   }
}


Measured memory_bytes: 2352
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <set>
#include <map>

#define INF 100000000
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
using P = pair<int, int>;

const int MAX = 1000000;
const int MOD = 1000000007;


long long fac[MAX], finv[MAX], inv[MAX];

/*
//テーブルの前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        //そのまま計算すると負の値になるのでMODを足す
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//二分累乗法
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
*/


//UnionFind木
struct UnionFind{
   vector<long long int> par; //par[i] : iの親の番号
   vector<long long int> rnk; //root[i] : iの木のサイズ

   //コンストラクタ
   UnionFind(long long int n): par(n), rnk(n){
       //木の初期化
       for(long long int i = 0; i < n; i++){
           par[i] = i;
           rnk[i] = 1;
       }
   }

   //データxが属する木の根を再帰で取得
   long long int root(long long int x){
       if(par[x] == x){
           return x;
       }else{
           return par[x] = root(par[x]);
       }
   }

   //xとyが同じ木に属しているかを判定
   bool same(long long int x, long long int y){
       return root(x) == root(y);
   }

   //xとyの木を併合
   void unite(long long int x, long long int y){
       long long int rx = root(x); //xの根
       long long int ry = root(y); //yの根
       if(rx == ry) return; //根が同じならそのまま

       //併合するときにサイズを足し合わせる
       if(rnk[rx] < rnk[ry]){
           par[rx] = ry;
           rnk[ry] += rnk[rx];
       }else{
           par[ry] = rx;
           rnk[rx] += rnk[ry];
       }
   }

   //属している木のサイズを取得
   long long int size(long long int x){
       return rnk[root(x)];
   }
};

/*
typedef struct edge{
   int to;
   int cost;
} edge;

vector<edge> graph[2010];
long long int d[2010];

void dijkstra(int s){
   priority_queue<P, vector<P>, greater<P> > que;
   for(int i = 0; i < 2010; i++){
       d[i] = INF;
   }
   d[s] = 0;
   que.push(P(s, 0));

   while (!que.empty()) {
       P p = que.top();
       que.pop();
       int v = p.first;
       if (d[v] < p.second) continue;

       for (int i=0; i<graph[v].size(); ++i) {
           edge e = graph[v][i];
           if (d[e.to] > d[v] + e.cost) {
               d[e.to] = d[v] + e.cost;
               que.push(P(e.to, d[e.to]));
           }
       }
   }
}
*/

long long int solve(long long int a){
    if(a%4 == 0){
        return a;
    }else if(a%4 == 1){
        return 1;
    }else if(a%4 == 2){
        return a+1;
    }else{
        return 0;
    }
}

int main(){
    long long int A, B;
    cin >> A >> B;

    cout << (solve(B) ^ solve(A-1)) << endl;
}


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

int N, K;
long long a[1000], sum[1001];
unordered_multiset<long long> sums;

int find_next_max_bit(int now_max_bit){
    int bit_cnt[40] = {};
    for(auto itr = sums.begin(); itr != sums.end(); itr++){
        for(int bit = 0; bit < now_max_bit; bit++){
            if((*itr) & (1LL << bit)){
                bit_cnt[bit]++;
            }
        }
    }
    for(int i = now_max_bit - 1; i >= 0; i--){
        if(bit_cnt[i] >= K){
            return i;
        }
    }
    return -1;
}

int main(){
    cin >> N >> K;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
    }

    // sum(a[i: j])
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j <= N; j++){
            sums.insert(sum[j] - sum[i]);
        }
    }

    long long ret = 0;
    int now_bit = find_next_max_bit(40);
    while(now_bit != -1){
        ret += (1LL << now_bit);
        unordered_multiset<long long> tmp;
        for(auto itr = sums.begin(); itr != sums.end(); itr++){
            if((*itr) & (1LL << now_bit)){
                tmp.insert(*itr);
            }
        }
        sums = tmp;
        now_bit = find_next_max_bit(now_bit);
    }
    cout << ret << endl;

}

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

int main()
{
  int x[3][3];
  rep(i,3)
  {
    rep(j,3) cin >> x[i][j];
  }
  
  int a[3],b[3];
  for(int i = 0; i <= x[0][0]; i++)
  {
    b[0] = x[0][0] - a[i];
    b[1] = x[0][1] - a[i];
    b[2] = x[0][2] - a[i];
    
    if( x[1][0] - b[0] != x[1][1] - b[1] || x[1][0] - b[0] != x[1][2] - b[2] )
    {
      continue;
    }
    if( x[2][0] - b[0] != x[2][1] - b[1] || x[2][0] - b[0] != x[2][2] - b[2] )
    {
      continue;
    }
    
    cout << "Yes" << endl;
    return 0;
  }
  
  cout << "No" << endl;
    
}

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

int N;

vector<pair<int, int>> red(101);
vector<pair<int, int>> blue(101);

int main(void){
    
    cin >> N;
    for(int i = 0; i < N; ++i) cin >> red[i].first >> red[i].second;
    for(int i = 0; i < N; ++i) cin >> blue[i].first >> blue[i].second;
    
    sort(blue.begin(), blue.begin() + N);
    
    bitset<101> bit;
    for(int i = 0; i < N; ++i){
        int sub = -1, y = -1;
        for(int j = 0; j < N; ++j){
            if(!bit[j] && blue[i].first > red[j].first && blue[i].second > red[j].second){
                if(red[j].second > y) sub = j, y = red[j].second;
            }
        }
        if(y != -1) bit.set(sub);
    }
    cout << bit.count() << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define ins insert
#define vi vector<int>
const int mxN=1e6;

int main()
{
    int n;
    cin >> n;
    int ans[4]={};
    while(n--)
    {
        string s;
        cin >> s;
        if(s=="AC")
            ans[0]++;
        if(s=="WA")
            ans[1]++;
        if(s=="TLE")
            ans[2]++;
        if(s=="RE")
            ans[3]++;
    }
    cout << "AC x " << ans[0] << "\n";
    cout << "WA x " << ans[1] << "\n";
    cout << "TLE x " << ans[2] << "\n";
    cout << "RE x " << ans[3] << "\n";
}

Measured memory_bytes: 3608
#include<stdio.h>
int main(void){
  long n,k,i,ho=0;
  scanf("%ld %ld",&n,&k);
  long a,b;
  long x[100000]={0};
  for(i=0;i<n;i++){
    scanf("%ld %ld",&a,&b);
    x[a-1]+=b;
  }
  for(i=0;i<100000;i++){
    ho+=x[i];
    if(ho>=k){
      break;
    }
  }
  printf("%ld",i+1);
  return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
typedef long long int lint;
using namespace std;

int main() {
    lint n, limit;
    cin >> n >> limit;
    vector<lint> w(n), v(n);
    for (int i = 0; i < n; i++) {
        cin >> w[i] >> v[i];
    }
    // dp[i]][j]:品物を[0,i)まで使うときの重さjでの価値最大
    vector<vector<lint>> dp(n + 1, vector<lint>(limit + 1, 0));
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j <= limit; j++) {
            if (j - w[i - 1] < 0) {
                dp[i][j] = dp[i - 1][j];
            } else {
                dp[i][j] =
                    max(dp[i - 1][j], dp[i - 1][j - w[i - 1]] + v[i - 1]);
            }
        }
    }
    cout << *(max_element(all(dp[n]))) << endl;
}

Measured memory_bytes: 80256