akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ll long long
long long INF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
    int n;
    ll ar[5]={};
    ll ans=0;
    cin >> n;
    vector<string> vi(n);
    REP(i,n) cin >> vi[i];

    REP(i,n){
        if(vi[i][0] == 'M') ++ar[0];
        else if(vi[i][0] == 'A') ++ar[1];
        else if(vi[i][0] == 'R') ++ar[2];
        else if(vi[i][0] == 'C') ++ar[3];
        else if(vi[i][0] == 'H') ++ar[4];
    }

    REP(i,5){
        FOR(j,i+1,5){
            FOR(k,j+1,5){
                ans += ar[i]*ar[j]*ar[k];
            }
        }
    }

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


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

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


Measured memory_bytes: 3084
n=int(input())
a=list(map(int,input().split()))

import collections
"""
l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
c = collections.Counter(l)
print(c) # {'a': 4, 'c': 2, 'b': 1}
print(c['a']) # 4
print(len(c)) # 3
print(list(c.keys())) # ['a', 'b', 'c']
print(list(c.values())) # [4, 1, 2]
print(list(c.items())) # [('a', 4), ('b', 1), ('c', 2)]
"""

c = collections.Counter(a)
if len(c)==len(a):
    print('YES')

else:print('NO')

Measured memory_bytes: 33076
def get_num(n, x):
    ans = 0
    for n3 in xrange(min(n, x - 3), (x + 2) / 3, -1):
        for n2 in xrange(min(n3 - 1, x - n3 - 1), (x - n3) / 2, -1):
            for n1 in xrange(min(n2 - 1, x - n3 - n2), 0, -1):
                if n3 == x - n1 - n2:
                    ans += 1
                    break
    return ans


data = []
while True:
    [n, x] = [int(m) for m in raw_input().split()]
    if [n, x] == [0, 0]:
        break
    if x < 3:
        print(0)
    else:
        print(get_num(n, x))

Measured memory_bytes: 6372
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;
const int INF = 1 << 25;
const LL MOD = 1000000007LL;
using namespace std;
typedef pair<int, int> P;
int dp[101][101][301]; //dp[i][j][k]=i番目までのものからj個選んで重さがk以下となるときの価値の最大値
int w[100], v[100];
int main() {
	int N, W;
	cin >> N >> W;
	rep(i, N) {
		cin >> w[i] >> v[i];
	}
	rep(i, N) {
		for (int j = 0; j <= i; j++) {
			for (int k = 0; k <= 300; k++) {
				dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
				if (k + (w[i] - w[0]) <= 300) dp[i + 1][j + 1][k + (w[i] - w[0])] = max(dp[i + 1][j + 1][k + (w[i] - w[0])], dp[i][j][k] + v[i]);
			}
		}
	}
	int ans = 0;
	for (int i = 0; i <= N; i++) {
		if (W < w[0] * i) break;
		ans = max(ans, dp[N][i][min(300, W - w[0] * i)]);
	}
	cout << ans << endl;
}

Measured memory_bytes: 10368
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long int
#define PB push_back
#define MP make_pair

inline bool cmp(pair<ll, ll> p1, pair<ll, ll> p2) {
	return p1.first < p2.first;
}

int main() {
	ll n, m, ans = 0, cans = 0;
	vector< pair<ll, ll> > v;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		ll a, b;
		cin >> a >> b;
		v.PB(MP(a, b));
	}
	sort(v.begin(), v.end(), cmp);
	int i = 0;
	while (cans < m) {
		ll temp = 0;
		temp = v[i].second;
		if (cans + temp > m) {
			temp = m - cans;
			cans = m;
		}
		else
			cans += temp;
		ans += v[i].first*temp;
		i++;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

#define int long long
#define pii pair<int, int>
#define pb push_back

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y); swap(x, z);
    cout << x << " " << y  << " " << z << endl;

    return 0;
}



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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

ll dp[201][100001];

int main() {
  int n, x;
  cin >> n >> x;
  vector<int> s(n);
  REP(i, n) cin >> s[i];
  sort(ALL(s));
  for (int i = 0; i <= x; ++i) dp[0][i] = i;
  REP(i, n) for (int j = 0; j <= x; ++j) {
    dp[i + 1][j] += dp[i][j % s[i]];
    dp[i + 1][j] %= MOD;
    dp[i + 1][j] += (i * dp[i][j]) % MOD;
    dp[i + 1][j] %= MOD;
  }
  cout << dp[n][x] << endl;
  return 0;
}

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

#ifdef LOCAL
#include <local.h>
#endif

#define EPS 1e-6
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define llinf 0x3f3f3f3f3f3f3f3f

#define fi first
#define se second
#define pb push_back
#define ende '\n'

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define mset(x, y) memset(&x, (y), sizeof(x))

using namespace std; 

using ll = long long;
using ii = pair<int,int>;

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

  ll n, W; cin >> n >> W;
  ll V = 0;

  vector<ll> w(n), v(n);
  for (int i = 0; i < n; ++i) {
    cin >> w[i] >> v[i];
    V += v[i];
  }

  vector<ll> dp(V + 1, llinf);
  dp[0] = 0;
  for (int i = n - 1; i >= 0; --i)
    for (int j = V; j >= v[i]; --j)
      dp[j] = min(dp[j], dp[j-v[i]] + w[i]);

  for (int j = V; j >= 0; --j)
    if (dp[j] <= W)
      return cout << j << ende, 0;

  return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		String str = scan.next();
		char charStr[] = str.toCharArray();
		for(int i=charStr.length-1; i>=0; i--){
			System.out.print(charStr[i]);
		}
		System.out.println();
	}
} 

Measured memory_bytes: 17124
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
string s;
bool c(string t)
{
	return (((int)s.find(t))!=-1);
}
int main()
{
	cin>>s;
	if (c("000")||c("111")||c("222")||c("333")||c("444")||c("555")||c("666")||c("777")||c("888")||c("999")) cout<<"Yes"; else cout<<"No";
	return 0;
}

Measured memory_bytes: 384
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int n = read.to!int;
	int q = read.to!int;
	
	Node[] nodes;
	foreach(i; 0 .. n) nodes ~= new Node(i);
	
	foreach(i; 0 .. n - 1){
		int a = read.to!int - 1;
		int b = read.to!int - 1;
		nodes[a].nodes ~= nodes[b];
		nodes[b].nodes ~= nodes[a];
	}
	
	nodes[0].treefy(null);
	
	foreach(t; 0 .. q){
		int p = read.to!int - 1;
		long x = read.to!long;
		nodes[p].value += x;
	}
	
	nodes[0].calc;
	
	nodes.map!(x => x.value.to!string).join(" ").writeln;
}

class Node{
	int id;
	long value;
	Node[] nodes;
	Node[] kids;
	Node parent;
	bool isTreefied;
	this(int id){
		this.id = id;
	}
	void treefy(Node par){
		this.isTreefied = 1;
		if(par) this.parent = par;
		foreach(nd; this.nodes){
			if(nd.isTreefied) continue;
			else{
				this.kids ~= nd;
				nd.treefy(this);
			}
		}
	}
	void calc(){
		foreach(kid; this.kids){
			kid.value += this.value;
			kid.calc;
		}
	}
}


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

using namespace std;

int main() {

    string s;
    cin >> s;

    if (s.size() == 0) {
        cout << 0 << '\n';
        return 0;
    }

    auto L = 0;
    auto R = 1;

    int ans = 0;
    while(R <= s.size()) {
    
        if (s[L] == s[R]) {
            if(s[R] == '1')
                s[R] = '0';
            else
                s[R] = '1';
            L++;
            R++;
            ans += 1;
        } else {
            L++;
            R++;
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 512
num = gets.to_i;

for i in 1..num do
	
	if i % 3 == 0 then
		
		print " " + i.to_s;
		
	else
		
		str = i.to_s;
		#pos = str.index("3");
		#str.include?("l")
		if str.include?("3") then
			
			print " " + i.to_s;
			
		end
		
	end
	
end


print "\r\n"

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

int main() {
    int k;
    cin >> k;
    int p = k * k;
    vector<long long> a(p);
    int tmpGcd = 0;
    int answer = 0;
    
    for (int i = 0; i < k; i++){
        for (int j = 0; j < k; j++){
            a.at(tmpGcd) = gcd(i + 1, j + 1);
            tmpGcd ++;
        }
    }
    
    for (int i = 0; i < p; i++){
        for (int j = 0; j < k; j ++){
            //cout << gcd(a.at(i), j + 1) << endl;
            answer += gcd(a.at(i), j + 1);
        }
    }
    cout << answer << endl;

    
}

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

int main()
{
    int n;
    std::cin >> n;
    std::vector<uint64_t> a(n);
    for (auto& itr: a)
    {
        std::cin >> itr;
        if (itr == 0)
        {
            std::cout << 0 << std::endl;
            return 0;
        }
    }
    constexpr uint64_t ANS_MAX = 1000000000000000000;
    uint64_t ans = 1;
    for (auto itr: a)
    {
        if (ans > ANS_MAX / itr)
        {
            std::cout << -1 << std::endl;
            return 0;
        }
        ans *= itr;
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 4048
s = list(input())
lose = 0
win = 0
g = 0
for i in s:
    if g == 0: #pを出せない時
        # print ('A')
        g += 1
        if i == 'g': #あいこ
            pass
        else:
            lose += 1
    elif g > 0: #pを出せる時
        # print ('B')
        g -= 1
        if i == 'g': #勝ち
            win += 1
        else: #pを出してあいこ
            pass

print (win - lose)



Measured memory_bytes: 3956
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int N;cin>>N;
  std::vector<int> e[N];
  typedef pair<int,int> P;
  std::vector<P> edge(N-1);
  for(int i=0;i<N-1;i++){
    int a,b;cin>>a>>b;a--;b--;
    e[a].push_back(b);
    e[b].push_back(a);
    edge[i]=P(a,b);
  }
  std::vector<int> c(N);
  for(int i=0;i<N;i++)cin>>c[i];
  sort(c.begin(),c.end());
  queue<int> que;
  std::vector<int> used(N);
  for(int i=0;i<N;i++)used[i]=e[i].size();
  for(int i=0;i<N;i++)if(used[i]==1)que.push(i);
  int ans=0;
  std::vector<int> fans(N);
  int now=0;
  while(que.size()){
    int p=que.front();que.pop();
    fans[p]=c[now++];
    for(int q:e[p]){
      used[q]--;
      if(used[q]==1)que.push(q);
    }
  }
  for(int i=0;i<N-1;i++){
    ans+=min(fans[edge[i].first],fans[edge[i].second]);
  }
  cout<<ans<<endl;
  for(int i=0;i<N;i++){
    if(i)cout<<" ";cout<<fans[i];
  }
  cout<<endl;
}


Measured memory_bytes: 1408
#include<stdio.h>
#define N 100
#define INF 2000000000
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2

int A[N][N],n;

int prim(void){
  int u,i,v,mincost,total;
  int d[N],pi[N],color[N];

  for(i=0;i<n;i++){
    d[i]=INF;
    pi[i]=NIL;
    color[i]=WHITE;
  }
  d[0]=0;

  while(1){
    mincost=INF;
    u=-1;
    for(i=0;i<n;i++){
      if(mincost>d[i]&&color[i]!=BLACK){
	u=i;
	mincost=d[i];
      }
    }
    if(u==NIL) break;

    color[u]=BLACK;

    for(v=0;v<n;v++){
      if(color[v]!=BLACK && A[u][v]!=NIL){
	if(d[v]>A[u][v]){
	  d[v]=A[u][v];
	  pi[v]=u;
	  color[v]=GRAY;
	}
      }
    }
  }
  total=0;
  for(i=0;i<n;i++){
    if(pi[i]!=NIL) total+=A[i][pi[i]];

  
  }
  return total;
}
int main(){
  int i,j;

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

  
  printf("%d\n",prim());

  return 0;
}



Measured memory_bytes: 2048
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 100;
const int inf = 0x3f3f3f3f;

const int SZ = 1 << 20;  //快速io
struct fastio {
    char inbuf[SZ];
    char outbuf[SZ];

    fastio() {
        setvbuf(stdin, inbuf, _IOFBF, SZ);
        setvbuf(stdout, outbuf, _IOFBF, SZ);
    }
} io;

void read(int &x) {
    x = 0;
    char ch, c = getchar();
    while (c < '0' || c > '9') ch = c, c = getchar();
    while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    if (ch == '-') x = -x;
}

int vis[30];

int n;
void dfs(int k, int a, int b) {
    if (k == 1) {
        printf("%d %d ", a, b);
        return;
    }
    for (int i = 0; i < n; i++) {
        if (((a >> i) & 1) ^ ((b >> i) & 1)) {
            vis[i] = 1;
            int mid = a;
            for (int j = 0; j < n; j++) {
                if (!vis[j]) {
                    mid = mid ^ (1 << j);
                    break;
                }
            }
            dfs(k - 1, a, mid);
            dfs(k - 1, mid ^ (1 << i), b);
            vis[i] = 0;
            break;
        }
    }

}

int main() {
    //freopen("in.txt", "r", stdin);
    int a, b;
    cin >> n >> a >> b;
    if (__builtin_popcount(a ^ b) % 2 == 0) {
        printf("NO\n");
    } else {
        printf("YES\n");
        dfs(n, a, b);
    }

    return 0;
}




Measured memory_bytes: 1792
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
import std.container;

alias sread = () => readln.chomp();
alias route = Tuple!(long, "From", long, "To");
long bignum = 1_000_000_007;

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    long n, x, d, count = 1;
    scan(n, x);
    auto l = aryread();
    foreach (e; l)
    {
        if(d + e > x)
            break;

        d += e;
        count++;
    }
    writeln(count);
}

Measured memory_bytes: 256
(* 基本 *)
(* ocamlc str.cma main.ml でコンパイルできる *)
let () =
  let (h, w, k) = Scanf.sscanf (input_line stdin) "%d %d %d" (fun a b c -> (a, b, c)) in
  let a = Array.make_matrix h w ' ' in
  let b = Array.make_matrix h w 0 in
  let fst = ref (-1) in
  let last = ref (-1) in
  for i = 0 to h - 1 do
    for j = 0 to w - 1 do
      a.(i).(j) <- Scanf.scanf " %c" (fun x -> x);
      if a.(i).(j) = '#' then ((if !fst = (-1) then fst := i); last := i)
    done
  done;
  let tmp = ref 0 in
  for i = !fst to !last do
    let flag = ref true in
    for j = 0 to w - 1 do
      if a.(i).(j) = '#' then ((tmp := !tmp + 1);
                               flag := false);
      if !flag then b.(i).(j) <- !tmp + 1 else b.(i).(j) <- !tmp
    done;
    if !flag then
      for j = 0 to w - 1 do
        b.(i).(j) <- b.(i - 1).(j) 
      done
  done;
  
  if !fst <> 0 then
    for i = !fst - 1 downto 0 do
      for j = 0 to w - 1 do
        b.(i).(j) <- b.(i + 1).(j) 
      done
    done;
  
  if !last <> h then
    for i = !last + 1 to h - 1 do
      for j = 0 to w - 1 do
        b.(i).(j) <- b.(i - 1).(j) 
      done
    done;
  
  for i = 0 to h - 1 do
    for j = 0 to w - 2 do
      print_int b.(i).(j);
      print_char ' '
    done;
    print_int b.(i).(w - 1);
    print_newline ()
  done;


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define rep(i, n) for (ll i=0; i<n; ++i)
#define rep1(i, n) for (ll i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

vector<ll> a {1};
vector<ll> p {1};

ll f(ll n, ll x) {
    if (n==0) {
        if (x<=0) return 0;
        else return 1;
    }
    else if (x <= 1 + a[n-1]) {
        return f(n-1, x-1);
    }
    else {
        return p[n-1] + 1 + f(n-1, x-2-a[n-1]);
    }
}

int main() {
    ll n, x; cin >> n >> x;
    rep(i, n) {
        a.push_back(a[i] * 2 + 3);
        p.push_back(p[i] * 2 + 1);
    }
    ll ret; ret = f(n, x);
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
process.stdin.resume();
process.stdin.setEncoding('utf8');

class Dice {
   constructor(top, front, right, left, back, bottom) {
       this.top = top;
       this.front = front;
       this.right = right;
       this.left = left;
       this.back = back;
       this.bottom = bottom;
   }
   rollVertical() {
       return new Dice(this.front, this.bottom, this.right, this.left, this.top, this.back);
   }
   rollHorizontal() {
       return new Dice(this.top, this.right, this.back, this.front, this.left, this.bottom);
   }
   existVertial(number) {
       return [this.top, this.front, this.bottom, this.back].includes(number);
   }
   existHorizontal(number) {
       return [this.front, this.left, this.back, this.right].includes(number);
   }
   fit(top, front) {
       let dice = this;
       if (!dice.existVertial(top)) {
           dice = dice.rollHorizontal();
       }

       let isNotTop = true;
       
       while (isNotTop) {
           dice = dice.rollVertical();
           if (dice.top === top) {
               isNotTop = false;
           }
       }
       
       let isNotFront = true;
       while (isNotFront) {
           dice = dice.rollHorizontal();
           if (dice.front === front) {
               isNotFront = false;
           }
       }
       return dice;
   }
}


process.stdin.on('data', function (chunk) {
   const n = chunk.toString() // 文字列化する
       .split("\n") // \nで分割
       .filter(x => x !== "");

   const [diceNumber, qNumber, ...questions] = n;
   const [top, front, right, left, back, bottom] = diceNumber.split(" ");

   questions.forEach(q => {
       const dice = new Dice(top, front, right, left, back, bottom);
       const qq = q.split(" ");
       console.log((dice.fit(qq[0], qq[1])).right);
   })

});


Measured memory_bytes: 16028
class Dice
  attr_reader :labels

  def initialize(args)
    @labels = args
  end

  def top
    @labels[0]
  end

  def move(a,b,c,d)
    arr = [@labels[a], @labels[b], @labels[c], @labels[d]]
    t = arr.shift
    arr << t
    @labels[a], @labels[b], @labels[c], @labels[d] = arr
  end

  def move_n
    move(0,1,5,4)
  end

  def move_e
    move(0,3,5,2)
  end

  def move_s
    move(4,5,1,0)
  end

  def move_w
    move(2,5,3,0)
  end

  def move_to_input(ch)
    case ch
    when 'E'
      move_e
    when 'N'
      move_n
    when 'S'
      move_s
    when 'W'
      move_w
    end
  end
end

n = gets.to_i
dices = []
n.times do
  input = gets.split.map(&:to_i)
  dices << Dice.new(input)
end

f = 'Yes'

dices.combination(2) do |dice1, dice2|
  100.times do
    dice2.move_to_input('ENSW'.chars.sample)
    if dice1.labels == dice2.labels
      f = 'No'
      break
    end
  end
end

puts f

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

int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  for (int i=0; i<N; i++) {
    cin >> S.at(i);
  }
  sort(S.begin(),S.end());
  int count=1;
  for (int i=0; i<N; i++) {
    
    if(i!=0) {
      if (S.at(i)!=S.at(i-1)) count++;
    }
    
  }
  cout << count << endl;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int T;
ll A,B,C,D;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>T;
	while(T--) {
		cin>>A>>B>>C>>D;
		
		if(D<B || A<B) {
			cout<<"No"<<endl;
			continue;
		}
		if(C>=B-1) {
			cout<<"Yes"<<endl;
			continue;
		}
		
		D=__gcd(D,B);
		ll L=(((C+1)-A)%B+B)%B;
		ll R=(((B-1)-A)%B+B)%B;
		if(R>=L) {
			if(L/D == R/D && L%D) {
				cout<<"Yes"<<endl;
			}
			else {
				cout<<"No"<<endl;
			}
		}
		else {
			cout<<"No"<<endl;
		}
		
		
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
import collections
n=int(input())
v=list(map(int,input().split()))
v1=[]
v2=[]
c=0
for i in range(len(v)):
    if c==0:
        v1.append(v[i])
        c=1
    else:
        v2.append(v[i])
        c=0
m1=collections.Counter(v1)
w1=m1.most_common()
m2=collections.Counter(v2)
w2=m2.most_common()
if w1[0][0]==w2[0][0]:
    if w1[0][1]>w2[0][1]:
        print(n-w1[0][1]-w2[1][1])
    elif w1[0][1]<w2[0][1]:
        print(n-w1[1][1]-w2[0][1])
    elif len(w1)>1:
        if w1[1][1]>=w2[1][1]:
            print(n-w1[1][1]-w2[0][1])
        else:
            print(n-w1[0][1]-w2[1][1])
    else:
        print(n//2)
else:
    print(n-w1[0][1]-w2[0][1])

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.rbegin(), a.rend());
    long long ans = 0, j = 0;
    for (int i = 1; i < n; i++)
    {
        if (i % 2 == 1)
            ans += a[j];
        else
            ans += a[++j];
    }
    cout << ans << endl;
}


Measured memory_bytes: 4036
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
using namespace std; using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
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;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n,k;
    cin >> n >> k;
    ll ans = 0;
    for(ll i = k;k <= n+1;i++){
        if(i*i-i*n-1 > 0) break;
        ans = (ans+(i*n%mod-i*(i-1)%mod+1)%mod)%mod;
    }
    cout << ans+1 << endl;
}

Measured memory_bytes: 3688
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int d, g, cnt[11], c[11], p[11], ans=999999999;

void dfs (int scr, int dep)
{
    if (scr<=0) { ans=min(ans, dep); return; }
    if (dep>ans) return;
    for (int i=1; i<=d; i++)
    {
        if (cnt[i]>0)
        {
            if (scr-100*i*(p[i]-1)>0)
            {
                cnt[i]=0;
                dfs(scr-c[i]-100*i*p[i], dep+p[i]);
            }
            else
            {
                if (scr%(100*i)==0) dfs(0, dep+scr/(100*i));
                else dfs(0, dep+scr/(100*i)+1);
            }
            cnt[i]=p[i];
        }
    }
}

int main()
{
    cin>>d>>g;
    for (int i=1; i<=d; i++) cin>>cnt[i]>>c[i];
    for (int i=1; i<=d; i++) p[i]=cnt[i];
    dfs(g, 0);
    cout<<ans<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pob pop_back
#define vi vector<ll>
#define mp make_pair
#define sz size()
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define rep(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define maxx 5*100005
#define se second
#define fi first
#define be begin()
#define en end()
#define sortv(v) sort(v.begin(),v.end());
#define w() ll _;cin>>_;while(_--)
#define edge pair<ll,ll>
#define pq priority_queue<ll>
#define mod 1000000007
#define Endl "\n"
#define cy cout<<"YES"<<endl;
#define cn cout<<"NO"<<endl;
using namespace std;

int main()
{
	fast;
		
	int x;
	cin>>x;
 
	int ans=1;
	ll a=x;
	while(a%360>0){
		a+=x;
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}

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

int N, a, b;
ll D;
ll ans;
P p[100000];
P xya[100000];
P yxa[100000];
set<P> S;
set<P> xy, yx;

void dfs(P v) {
	S.insert(v);
	ll x = v.first, y = v.second;
	ll d[2] = { D, -D };
	vector<P> check;
	for(int i = 0; i < 2; i++) {
		P s(x + d[i], y - D), t(x + d[i], y + D);
		for(auto it = xy.lower_bound(s); it != xy.end() && *it <= t; ++it) {
			check.push_back(*it);
		}
		ans += upper_bound(xya, xya + N, t) - lower_bound(xya, xya + N, s);
	}
	for(int i = 0; i < 2; i++) {
		P s(y + d[i], x - D), t(y + d[i], x + D);
		for(auto it = yx.lower_bound(s); it != yx.end() && *it <= t; ++it) {
			check.push_back(P(it->second, it->first));
		}
		ans += upper_bound(yxa, yxa + N, t) - lower_bound(yxa, yxa + N, s);
		if(binary_search(yxa, yxa + N, s)) ans--;
		if(binary_search(yxa, yxa + N, t)) ans--;
	}

	for(auto c : check) {
		xy.erase(c);
		yx.erase(P(c.second, c.first));
	}
	for(auto c : check) {
		if(!S.count(c)) {
			dfs(c);
		}
	}
}

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

	cin >> N >> a >> b;
	a--, b--;
	for(int i = 0; i < N; i++) {
		ll x, y;
		cin >> x >> y;
		ll xx = x + y, yy = x - y;
		p[i] = P(xx, yy);
		xya[i] = p[i];
		yxa[i] = P(yy, xx);
		xy.insert(p[i]);
		yx.insert(P(yy, xx));
	}
	sort(xya, xya + N);
	sort(yxa, yxa + N);

	D = max(abs(p[a].first - p[b].first), abs(p[a].second - p[b].second));
	dfs(p[a]);

	cout << ans / 2 << endl;
}

Measured memory_bytes: 27136
#include<bits/stdc++.h> 
//#define <- プログラムの文字列を置換する
//typedef <- 新しい型に名前を付けるためのキーワード

using namespace std;

#define MAX_N 1

typedef long long ll;

const double PI = 3.141592653589793;
const long long MOD = 1e9 + 7;
const long long INF = 1e15;
const int INF_INT = 1e9;

int main(){
    int N;
    cin >> N;
    int count4 = 0;
    int counteven = 0;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        if(a % 4 == 0) count4++;
        else if(a % 2 == 0){
            counteven++;
        } 
    }
    int zan = N - count4 - counteven;
    if(counteven == 0 && 2 * count4 + 1 >= N) cout << "Yes" << endl; 
    else if(zan <= count4) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;


int main(int argc, char const *argv[]) {
    int n;cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;++i)cin>>a[i];
    int num = 0;
    int res = 0;
    for(int i=1;i<n;++i){
        if(a[i-1]==a[i]){
            num++;
        }
        else{
            res += (num+1)/2;
            num = 0;
        }
    }
    res += (num+1)/2;
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){

    string a,b,c;;
    cin>>a>>b>>c;
    
    if(a[a.size()-1]==b[0]&&b[b.size()-1]==c[0]){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    
    return 0;
    
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())

ans = 'NO'
if a < b and c%a == 0:
  ans = 'YES'
else:
  for i in range(1, 1000):
    if (b*i + c)%a == 0:
      ans = 'YES'
      break
  
print(ans)

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

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

  string s;
  cin >> s;

  for (int i = 0; i < s.size(); i++)
  {
    if (s.at(i) == '?')
    {
      s.at(i) = 'D';
    }
  }
  cout << s << endl;
  
  return 0;
}

Measured memory_bytes: 3716
import sys

s=input()

n=[0]*6
q=[0]*6
j=[1,10,9,12,3,4,1]
lens=len(s)
for i in range(lens):
    i6=i%6
    if s[lens-1-i]=="?":
        q[i6]+=1
    else:
        n[i6]+=int(s[lens-1-i])

mod=10**9+7
    
nsum=0
for i in range(6):
    nsum+=(n[i]*j[i])%13
nsum=(5-nsum)%13

if q==[0]*6:
    if nsum==0:
        print(1)
    else:
        print(0)
    sys.exit()
        
cc2=[[-1]*13 for i in range(6)]

for i6 in range(6):
    for i in range(10):
        iii=(i*10**i6)%13
        cc2[i6][i]=iii

#dp=[[0]*13 for i in range(80)]
dpm=[0]*13
dpn=[0]*13
icnt=-1
for i6 in range(6):
    for i in range(q[i6]):
        dpn=[0]*13
        icnt+=1
        if icnt==0:
            for j in range(10):
                jj=(j*10**i6)%13
#                dp[icnt][jj]=1            
#                dpn[jj]=1
                dpm[jj]=1
            continue
        for mi in range(13):
            for j in range(10):
#                ccir=(mi-(j*(10**i6))%13)%13
                ccir=(mi-cc2[i6][j])%13
#                dp[icnt][mi]=(dp[icnt][mi]+dp[icnt-1][ccir])%mod
                dpn[mi]=(dpn[mi]+dpm[ccir])%mod
        dpm=dpn.copy()  
#    print(icnt,dp[icnt])

#print(dp[icnt][nsum]%mod)
print(dpm[nsum]%mod)
            


Measured memory_bytes: 74032
#include<stdio.h>
int main(void)
{
    int n;
    int a[100];
    double sum=0.0;

    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        sum+=1.0/(double)a[i];
    }
    printf("%lf\n",1.0/sum);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y){ return y ? gcd(y, x%y): x;}
int main(){
  ll A, B;
  cin >> A >> B;
  ll g = gcd(A,B);
  ll s = g;
  ll ans = 1;
  for(int i=2; i<=sqrt(s); i++){
    if(g%i==0){
      ans+=1;
      while(g%i==0){
        g/=i;
      }
    }
  }
  if(g>1){
    ans++;
  }
  cout << ans;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 998244353 
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        int h1,m1,h2,m2,k;
        cin>>h1>>m1>>h2>>m2>>k;
        int ans=0;
        int y=0;
        if(h1==h2)
            y=m2-m1;
        else{
            y=(60-m1)+m2+(h2-(h1+1))*60;
        }
        ans=max(ans,y-k);
        cout<<ans<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int D, N;

int main(void) {
    // insert code here...
    cin >> D >> N;
    switch(D){
        case 0:
            if(N!=100){
                cout << N << endl;
            }else{
                cout << 101 << endl;
            }
            break;
        case 1:
            if(N!=100){
                cout << N*100 << endl;
            }else{
                cout << 10100 << endl;
            }
            
            break;
        case 2:
            if(N!=100){
                cout << N*10000 << endl;
            }else{
                cout << 1010000 << endl;
            }
            
            break;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define N 1000000007
#define ll long long
#define ull unsigned long long
#define mem(a) memset(a,0,sizeof(a))
int s[200010];
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    int k, n;
    cin >> k >> n;
    for(int i = 0; i < n; i++) cin >> s[i];
    sort(s,s+n);
    int minn = 10000000;
    for(int i = 0; i < n; i++){
        int sum1 = 0;
        int sum2 = 0;
        if(i==0){
            sum1 = s[n-1]-s[0];
            sum2 += s[0]-0;
            sum2 += k-s[n-1];
            sum2 += s[n-1]-s[1];
        }else if(i==n-1){
            sum1 = s[n-1]-s[0];
            sum2 += k-s[n-1];
            sum2 += s[0]-0;
            sum2 += s[n-2]-s[0];
        }else{
            sum1 += s[i]-0;
            sum1 += k-s[i+1];
            sum2 += k-s[i];
            sum2 += s[i-1]-0;
        }
        minn = min(minn,sum1);
        minn = min(minn,sum2);
    }
    cout << minn << endl;
    return 0;
}







Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
int main(){
	int d=0;
	string ans;
	cin >> d;
	if(d == 25){ ans = "Christmas";
	}else if(d == 24){ ans = "Christmas Eve";
	}else if(d == 23){ ans = "Christmas Eve Eve";
	}else { ans = "Christmas Eve Eve Eve";} 

	cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  string S;
  cin>>S;
  int ans=0, i, tmp=S[0];
  for (i=0;i<S.length();i++){
    if (S[i]!=tmp){
      ans+=1;
      tmp=S[i];
    }
  }
  cout<<ans;
}


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

ll gcd(ll x, ll y){return y == 0 ? x : gcd(y,x%y);}

vector<ll> a;
int n;

ll seg_gcd(int l, int r){
    ll g;
    if (l > 0) g = a[0];
    else g = a[r];
    rep(i,l) {
        g = gcd(g, a[i]);
    }
    for (int i = r; i < n; i++) {
        g = gcd(g, a[i]);
    }
    return g;
}

ll solve(int l, int r) {
    ll res = 0;
    for (int x = l; x < r; x++) {
        res = max(res,seg_gcd(x, x+1));
    }
    return res;
}


int main(void){
    cin >> n;
    a.resize(n);
    rep(i,n) cin >> a[i];
    int l = 0, r = n;
    while (l+1 < r) {
        if (r-l < 10) {
            cout << solve(l, r) << endl;
            return 0;
        }
        int mid = (l+r)/2;
        ll res1 = seg_gcd(l, mid);
        ll res2 = seg_gcd(mid, r);
        if (res1 > res2) {
            r = mid;
        } else {
            l = mid;
        }
    }
    cout << seg_gcd(l, r) << endl;
    return 0;
}


Measured memory_bytes: 1024
/*
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;

int main(){

double x,h,W=0,X=0,S=0;
while(1){
scanf("%lf %lf",&x,&h);
if(x==0&&h==0)break;
X=0.5*x;
W=sqrt(X*X+h*h);
S=x*x+2*W*x;
cout<<S<<endl;

}
return 0;
}

*/

#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;

int main(){

double x,h,W,S=0,R=0,PI;
PI=3.141592;
while(1){
scanf("%lf %lf",&x,&h);
if(x==0&&h==0)break;
R=atan2( h, 0.5*x );
W=0.5*x/cos(R);
//W=sqrt(x*x+h*h);
S=x*x+2*W*x;
printf("%lf\n",S);
//cout<<S<<endl;
//cout<<W<<endl;

}
return 0;
}

Measured memory_bytes: 1292
#include <stdio.h>

int calc(int n, int y){
  int i, j, k;

  if(y < 1000*n || y > 10000*n){
    printf("-1 -1 -1");
    return;
  }else {
    for(i = (y/1000)% 5; i <= n; i += 5){ //1000円札
      for(j = 0; j <= n ; j++){ //5000円札
        k = n - i - j;
        if(y == 1000*i + 5000*j + 10000*k && k >= 0){
          printf("%d %d %d", k, j, i);
          return;
        }
      }
    }
  }


  printf("-1 -1 -1");
  return 0;
}

int main(){
  int n,y;

  scanf("%d %d", &n, &y);

  calc(n, y);
  return 0;
}

Measured memory_bytes: 128
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int N = 510;

int n;

int oc[N][N];
int dd[N][N];

int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};

bool nm(int x, int y) {
	return x >= 0 && y >= 0 && x < n && y < n;
}

void dfs(int x, int y) {
	for (int d = 0; d < 4; ++d) {
		int nx = x + dx[d];
		int ny = y + dy[d];
		if (nm(nx, ny) && dd[nx][ny] > dd[x][y] + oc[x][y]) {
			dd[nx][ny] = dd[x][y] + oc[x][y];
			dfs(nx, ny);
		}
	}
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(20);
	cin >> n;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			oc[i][j] = 1;
			dd[i][j] = min({i, j, n - 1 - i, n - 1 - j});
		}
	}
	int ans = 0;
	for (int it = 0; it < n * n; ++it) {
		int pp;
		cin >> pp;
		--pp;
		int x = pp / n;
		int y = pp % n;
		ans += dd[x][y];
		oc[x][y] = 0;
		dfs(x, y);
	}
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 20796
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};


//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


int main(){
    string s; cin >> s;
    int n = s.size(),cnt0 = 0,cnt1 = 0;

    rep(i,n){
        if(s[i] == '0') cnt0++;
        if(s[i] == '1') cnt1++;
    }
    int ans = 2 * min(cnt0,cnt1);
    
    cout << ans << endl;
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) {
        cout << "Yes" << '\n';
    } else {
        cout << "No" << '\n';
    }
}

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


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

bool val[10000001];
int n;
vector <int> lis;

bool dp[101][101];
bool valid[101][101];

string bruteforce()
{
	memset(dp, 0, sizeof(dp));
	memset(valid, 0, sizeof(valid));
	for(int i = 0; i < lis.size(); i++)
	{
		int row = i+1;
		int len = lis[i];
		for(int j = len; j >= 1; j--)
		{
			valid[row][j] = true;
			if(valid[row][j+1] && dp[row][j+1] == false)
				dp[row][j] = true;
			if(valid[row-1][j] && dp[row-1][j] == false)
				dp[row][j] = true;
		}
	}
	return (dp[lis.size()][1] ? "First" : "Second");
}

int MAIN()
{
	while(cin >> n)
	{
		lis.clear();
		for(int i = 1; i <= n; i++)
		{
			int x;
			cin >> x;
			lis.push_back(x);
		}
		sort(lis.begin(), lis.end());
		int top = lis[0];
		int maxV = 200000;
		if(top > maxV)
		{
			if(top % 2 == 0)
				top = maxV;
			else
				top = maxV - 1;
		}
		for(int i = top; i >= 1; i--)
		{
			val[i] = (top-i) % 2 == 0 ? 0 : 1;
		}
		for(int i = 1; i < lis.size(); i++)
		{
			int v = lis[i] + i;

			if(v > maxV)
			{
				if(v % 2 == 0)
					v = maxV;
				else
					v = maxV - 1;
			}
			if(v <= top) continue;
			if(v == top + 1)
			{
				top ++;
				val[top] = val[top - 1] ^ 1;
			}
			else
			{
				//cout << "v = " << v << endl;
				for(int i = v; i > top; i--)
					val[i] = ((v - i) % 2 == 0 ? 0 : 1);
				if(val[top] == 0 && val[top+1] == 0)
					val[top+1] = 1;
				top = v;
			}
		}
		/*for(int i = 1; i <= 4; i++)
			cout << val[i];
		cout << endl;*/
		string myAns = (val[n] == 0 ? "Second" : "First");
		cout << myAns << endl;
		//string bfAns = bruteforce();
		//if(n <= )
		//cout << bfAns << endl;
		/*
		if(myAns != bfAns)
		{
			for(int i = 0; i < lis.size(); i++)
				cout << lis[i] << " ";
			cout << endl;
			cout << "!" << endl;
		}*/
	}
	return 0;
}

int main()
{
	int start = clock();
	#ifdef LOCAL_TEST
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	ios :: sync_with_stdio(false);
	cout << fixed << setprecision(16);
	int ret = MAIN();
	#ifdef LOCAL_TEST
		cout << "[Finished in " << clock() - start << " ms]" << endl;
	#endif
	return ret;
}


Measured memory_bytes: 1016
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a)      (a).begin(),(a).end()
#define debug_array(a,n) for (ll bccc=(0); bccc<(n); bccc++) cout<<a[bccc]<<" "<<"\n"
#define debug_vector(a) for(ll bccc=(0); bccc<(a.size());bccc++) cout<<a[bccc]<<" "<<"\n"
#define F           first
#define S           second
#define debug_set(s) for(auto p:s) cout<<p<<" "
#define debug_map(m) for(auto p:m) cout<<p.F<<" "<<p.S<<"\n"
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
typedef long long ll;
using namespace __gnu_pbds;
typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
/* ll t = 0;
ordered_multiset me;
...
me.insert({x, t++});
me.erase(me.lower_bound({x, 0}));
cout << me.order_of_key({x, 0}) << "\n";

///////////   t is insertion time
*/
// #pragma GCC optimize("Ofast")  // works very well
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
typedef long double lld;
lld pi=3.14159265358;
ll powr(ll a,ll b)
{
    ll c=1;
    ll kjk;
    for(kjk=0;kjk<b;kjk++)
        c*=a;
    return c;
}
ll hell=1000000007;
//ll hell=998244353   ;
ll power(ll x, ll y, ll p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
// to generate random number , use rng() ... eg cout<<rng();
ll h[300005];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    ll m1,d1,m2,d2;
    cin>>m1>>d1>>m2>>d2;
    if(d2==1LL)
    {
        cout<<1;
    }
    else
        cout<<0;
}


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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  string s;
  int w;
  cin >> s >> w;

  string ans = "";
  for (int i = 0; i < s.length(); i += w) {
    ans += s[i];
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    typedef long long ll;
    using namespace std;
    int a[100000];
    int main() {
        ios::sync_with_stdio(0);
        cin.tie(0);
        ll k,last=0;
        cin>>k;
        queue<ll> q;
        for(ll i=1;i<10;i++)
        q.push(i);
        for(ll i=0;i<k;i++)
        {
            last=q.front();
            q.pop();
            if(last%10!=0)
            q.push(last*10+(last%10)-1);
            q.push(last*10+(last%10));
            if(last%10!=9)
            q.push(last*10+(last%10)+1);
        }
        cout<<last;
        return 0;
    }

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

using namespace std;
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define ll long long
#define ld long double

int main()
{
	IOS;
	int n;
	cin >>n;
	vector<int> arr(n);
	int sum=0;
	for(int i=0;i<n;i++)
	{
		cin >>arr[i];
		sum=sum^arr[i];
	}
	if(sum==0)
		cout <<"Yes";
	else cout <<"No";
	cout <<"\n";
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <vector>
using namespace std;
#pragma warning(disable:4996)
int main()
{
	int n, k;
	scanf("%d %d", &n, &k);
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
	}
	int ans = 0;
	if (n - k == 0) {
		ans = 1;
		printf("%d", ans);
		return 0;
	}
	ans = 1;
	n -= k;
	while (n > 0)
	{
		ans++;
		n -= (k - 1);
	}
	printf("%d", ans);
	return 0;
}

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

# 書類に書かれている整数のうち、偶数であるものは全て、 3 または 5 で割り切れる。
# 上の規約に従うとき、書類にN個の整数A1,A2,…,ANが書かれた入国者を承認するならば APPROVED を、しないならば DENIED を出力してください。

for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 != 0 and A[i] % 5 != 0:
            print('DENIED')
            exit()

else:
    print('APPROVED')

Measured memory_bytes: 9160
#include <stdio.h>

int main(){
    int A, B, i, x[3], max;

    scanf("%d %d", &A, &B);

    x[0] = A + B;
    x[1] = A - B;
    x[2] = A*B;
    max = x[0];
    for(i = 0; i < 3; i++){
        if(max <= x[i]){
            max = x[i];
        }
    }

    printf("%d\n", max);

    return 0;

}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		if (s.charAt(2) == s.charAt(3) && s.charAt(4) == s.charAt(5)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21972
#include <stdio.h>

int main()
{
   long int a,b,c,x,y=0,flag=0,i,j,count,sum,max;
   y=0;
   scanf("%ld%ld",&a,&b);
    for(i=a;i<=b;i++)
    {
        x=i;
       y=0;
            
           while(x>0)
           {
               y*=10;
               y+=x%10;
               x/=10;
               
           }
        if(i==y)
        {
            count++;
        }
       
        
    }
    printf("%lld\n",count);
     return 0;
}


Measured memory_bytes: 128
"use strict"
let input = require("fs").readFileSync("/dev/stdin","utf-8");
input = input.split("\n");

let peopleLine = input[1]

let changeNum = 0; // 向きを変える人数
// 左端の人がリーダーの場合の向きを変える人数を数える
for(let i = 1; i < peopleLine.length; i++){
    changeNum += peopleLine[i] == "E" ? 1 : 0;
}
let minChangeNum = changeNum;

// 1つずつずらしてみて、向きを変える人数をそれぞれ計算する
for(let i = 1; i < peopleLine.length; i++){
    changeNum += peopleLine[i - 1] == "W" ? 1 : 0;
    changeNum -= peopleLine[i] == "E" ? 1 : 0;
    minChangeNum = Math.min(minChangeNum, changeNum);
}
console.log(minChangeNum);

Measured memory_bytes: 7488
import java.util.Scanner;

public class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        String s = sc.next();
        int ans = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '+') {
                ans++;
            } else {
                ans--;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23252