akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int M = sc.nextInt();

		int X = sc.nextInt();

		int Y  = sc.nextInt();

		if(X<Y) {

			int Xmax = sc.nextInt();

			for(int i=1;i<N;i++) {

				int x = sc.nextInt();

				if(Xmax<x) Xmax = x;

			}

			int  Ymin = sc.nextInt();

			for(int i=1;i<M;i++) {

				int y = sc.nextInt();

				if(Ymin>y) Ymin = y;

			}

			if(Xmax<Ymin && Ymin>X && Xmax<Y) {

				System.out.println("No War");

			}else System.out.println("War");

		}else {

			System.out.println("War");
		}


	}

}


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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int M, D; cin >> M >> D;
  int result = 0;
  for (int i=1; i<=D; i++) {
    if (i%10>=2 && i/10>=2) {
      if ((i%10)*(i/10)<=M) result++;
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
from __future__ import print_function

from functools import reduce
from operator import mul
from collections import Counter
from collections import deque
from itertools import accumulate
from queue import Queue
from queue import PriorityQueue as pq
from heapq import heapreplace
from heapq import heapify
from heapq import heappushpop
from heapq import heappop
from heapq import heappush
import heapq
import time
import random
import bisect
import itertools
import collections
from fractions import Fraction
import fractions
import string
import math
import operator
import functools
import copy
import array
import re
import sys
sys.setrecursionlimit(500000)


input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


mod = 1000000007


def combinations_count_mod(n, r):
    r = min(r, n - r)
    numer = reduce(lambda x, y: x*y % mod, range(n, n - r, -1), 1)
    denom = pow(reduce(lambda x, y: x*y % mod, range(1, r + 1), 1), mod-2, mod)
    return numer * denom % mod


# def f(a_init, n):
#     # n_init=7
#     if n == 0:
#         return (a_init*10 + a_init)%K
#     else:
#         return (f(a_init, n-1)*10 + a_init)%K

a_init=7
def solve(K):
    if K%2==0 or K%5==0:
        return -1
    elif a_init%K==0:
        return 1
    else:
        dp=[a_init%K]+[0 for _ in range(K)]
        for i in range(1,K+100):
            dp[i]=(dp[i-1]*10+a_init)%K
            if dp[i]%K==0:
                return (i+1)
        return -1

def main():    
    K = int(input().strip())    
    print(solve(K))
    # print(f(7,K)%K)

if __name__ == '__main__':
    main()


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1010;


int n;
int id[maxn][maxn];
int k = 1;

vector<int> g[maxn*maxn];
int indeg[maxn*maxn];

int tot;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
    cin>>n;
    tot=n*(n-1)/2;
    
    for (int i=0; i<n; i++) {
	int prev = -1;
	for (int j=1; j<n; j++) {
	    int x; cin>>x;
	    --x;
	    if (!id[i][x]) {
		id[i][x]=id[x][i] = k;
		//cout<<"("<<i<<" "<<x<<"): "<<k<<endl;
		k++;
	    }
	    if (~prev) {
		g[prev].push_back(id[i][x]);
		indeg[id[i][x]]++;
	    }
	    prev = id[i][x];
	}
    }

    vector<int> Q;
    for (int i=1; i<k; i++) {
	if (indeg[i]==0) {
	    Q.push_back(i);
	}
    }

    int days=0;
    for (int i=0; i<int(Q.size()); ) {
	int len = Q.size();
	for (int j=i; j<len; j++) {
	    for (int x: g[Q[j]]) {
		if (--indeg[x] == 0) {
		    Q.push_back(x);
		}
	    }

	    i++;
	}
	days++;
    }



    if (int(Q.size()) == tot) out(days);
    out(-1);
    return 0;
}


Measured memory_bytes: 49784
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<tuple>
#include<queue>
#include<set>
#include<unordered_map>
#include<string>
#include<map>
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int> P;
typedef pair<int, P> PP;
const long long inf = 1ll << 61;
const int mod = 1000000007;
vector<int>c[300005];
signed main() {
	int n; cin >> n;
	rep(i, n) {
		int m; cin >> m;
		rep(j, m) {
			int x; cin >> x; c[i].push_back(x);
		}
	}
	priority_queue<int>Q;
	int ans = 0;
	for (int i = n - 1; i >= 0; i--) {
		rep(j, c[i].size())Q.push(c[i][j]);
		ans += Q.top();
		Q.pop();
	}
	cout << ans << endl;
}



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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
int A[100010], B[100010];
ll s;

int main() {
	cin >> N;
	ll t = (ll)N * (N + 1) / 2;

	rep(i, N) {
		cin >> A[i];
		s += A[i];
	}
	A[N] = A[0];

	rep(i, N) B[i] = A[i+1] - A[i];

	if (s % t != 0) {
		puts("NO");
		return 0;
	}

	ll dec = s / t;

	rep(i, N) {
		B[i] -= dec;
	}

	ll ope = 0;
	rep(i, N) {
		if (B[i] > 0 || B[i] % N != 0) {
			puts("NO");			
			return 0;
		}
		ope += -B[i] / N;
	}

	puts(ope == dec ? "YES" : "NO");

	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int t[n];
  for (int i = 0;i < n;i++)
    cin >> t[i];
  int m;
  cin >> m;
  int p[m][2];
  for (int i = 0;i < m;i++)
    cin >> p[i][0] >> p[i][1];
  
  for (int i = 0;i < m;i++) {
    int sum = 0;
    for (int j = 0;j < n;j++) {
      if (j + 1 == p[i][0]) {
        sum += p[i][1];
        continue;
      }
      sum += t[j];
    }
    cout << sum << endl;
  }
}

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

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

  int k, x;
  cin >> k >> x;
  k *= 500;
  if (k >= x) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }

  return 0;
}



Measured memory_bytes: 256
<?php
  $a=trim(fgets(STDIN));
$total=0;
for($i=1;$i<=$a;$i++){
  if($i%3==0 && $i%5==0){
    $d[]=$i;
  }elseif($i%3==0){
    $d[]=$i;
  }elseif($i%5==0){
    $d[]=$i;
  }else{
    $total+=$i;
  }
}
echo $total;

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

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  while (1)
  {
    c -= b;
    if (c <= 0)
    {
      cout << "Yes" << endl;
      return 0;
    }
    a -= d;
    if (a <= 0)
    {
      cout << "No" << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;
int a1,b1,a2,b2;
int main()
{
    cin>>a1>>b1>>a2>>b2;
    a1=max(a1,a2);
    b1=min(b1,b2);
    if(b1-a1>0) cout<<b1-a1;
    else cout<<0;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<iomanip>
#include<sstream>
#include<map>
#include<set>
#include<cmath>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T& val) {
	std::fill((T*)array, (T*)(array + N), val);
}
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(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()
typedef long long ll;
typedef long double ld;
const ll INF =  1LL << 60;
const int inf = 1 << 20;
int n, m, x, y, q, d,z, w = 0, sum, ans = 0;
vector<int>a;
const int MAX = 510000;
const int MOD = 1000000007;
int main(void) {
	cin >> n; int a[51][26]; string s;
	Fill(a, 0);
	rep(i, n) {
		cin >> s;
		rep(j, s.size()) {
			a[i][s[j] - 'a']++;
		}
	}s = "";
	for (char c = 'a'; c <= 'z'; c++) {
		m = c - 'a'; w = inf;
		rep(j, n) {
			w = min(w, a[j][m]);
		}
		rep(j, w) s = s + c;
	}cout << s << endl;
}

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

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

  int n;cin>>n;
  int ans=0;
  int t=0;
  int pv;cin>>pv;
  for(int i=1;i<n;i++){
    int nx;cin>>nx;
    if(pv>=nx)t++;
    else t=0;
    pv=nx;
    ans=max(ans,t);
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 3616
#include <stdio.h>

#define N 8

int A[N][N],Row[N],Col[N],Dpos[2*N-1],Dneg[2*N-1];

void printBoard(){
  int i, j;

  for( i = 0 ; i < N ; i++ ){
    for( j = 0 ; j < N ; j++ ){
      if( A[i][j] == 1 ){
	if( Row[i] != j ){
        return;
    }
      }
    }
  }
  
  for( i = 0 ; i < N ; i++ ){
    for( j = 0 ; j < N ; j++ ){
      if( Row[i] == j ){
	printf("Q");
      }
      else printf(".");
    }
    printf("\n");
  }
}

int putQueen(int i){
  int j;
  
  if( i == N ){
    printBoard();
    return 0;
  }

  for( j = 0 ; j < N ; j++ ){
    if(Col[j] == 1 || Dpos[i+j] == 1 || Dneg[i-j+N-1] == 1){
      continue;
    }
    Row[i] = j;

    Col[j] = Dpos[i+j] = Dneg[i-j+N-1] = 1;

    putQueen(i+1);
    
    Col[j] = Dpos[i+j] = Dneg[i-j+N-1] = 0;
    
  }

}
  


int main(){
  int k, i, a, b;
  
  scanf("%d",&k);

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

  putQueen(0);

  return 0;
}




Measured memory_bytes: 2136
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	sc.Split(bufio.ScanWords)
	// in := strings.Split(readLine(), " ")
	// nstr, qstr := in[0], in[1]
	// n, _ := strconv.Atoi(nstr)
	// q, _ := strconv.Atoi(qstr)
	// s := readLine()
	// n := nextInt()
	// q := nextInt()
	var n, q int
	var s string
	fmt.Scan(&n)
	fmt.Scan(&q)
	fmt.Scan(&s)
	var numAry = make([]int, n)

	ret := 0
	for i := 1; i < n; i++ {
		get := s[i-1 : i+1]
		if get == "AC" {
			ret++
		}
		numAry[i] = ret
	}

	l := make([]int, q)
	r := make([]int, q)
	for i := 0; i < q; i++ {
		// l[i] = nextInt()
		// r[i] = nextInt()
		fmt.Scan(&l[i])
		fmt.Scan(&r[i])
	}
	for i := 0; i < q; i++ {
		// in := strings.Split(readLine(), " ")
		// lstr, rstr := in[0], in[1]
		// lq, _ := strconv.Atoi(lstr)
		// rq, _ := strconv.Atoi(rstr)
		fmt.Println(numAry[r[i]-1] - numAry[l[i]-1])
	}
}


Measured memory_bytes: 7680
#define M 999999
P[M],N[M];main(i,j,k,r,n,p,m){
	for(P[0]=P[1]=1,i=2;i<M;i++)if(!P[i])for(j=i*2;j<M;j+=i)P[j]=1;
	for(i=1;i<M;i++)N[i]=N[i-1]+!P[i];
	for(;scanf("%d",&n),n;printf("%d\n",r))
		for(r=-n,i=0;i<n;i++){
			scanf("%d%d",&p,&m);
			j=p-m-1;if(j<0)j=0;
			k=p+m;if(k>=M)k=M-1;
			r+=N[k]-N[j];
		}
}

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


int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(auto& a : A){
    cin >> a;
  }
  int ans = 0;
  while(true){
    for(auto& a : A){
      if(a%2!=0){
        cout << ans << endl;
        return 0;
      }
      a /= 2;
    }
    ans++;
  }
  return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var NAB = Sarray();
            var N = NAB[0];
            A = NAB[1];
            B = NAB[2];
            H = new long[N];
            for (var i = 0; i < N; ++i)
                H[i] = Sarray()[0];
            long l = 0, r = H.Max();
            while (1 < r - l)
            {
                var mid = l + (r - l) / 2;
                if (IsOK(mid)) r = mid;
                else l = mid;
            }
            WriteLine(r);
        }
        static long A, B;
        static long[] H;
        static bool IsOK(long K)
        {
            var d = A - B;
            var sum = 0L;
            foreach (var h in H)
                sum += Max(0, (h - B * K + d - 1) / d);
            if (sum <= K) return true;
            return false;
        }
    }
}

Measured memory_bytes: 47640
//28
#include<iostream>
#include<cctype>
#include<algorithm>

using namespace std;

int main(){
  int m;
  char n[13];
  while(cin>>m>>n,m){
    long long nd=0;
    for(int i=0;n[i];i++){
      nd*=m;
      nd+=isdigit(n[i])?n[i]-'0':n[i]-'A'+10;
    }
    long long t=1LL<<62;
    int mt=m;
    for(int i=2;i<=36;i++){
      int p=0;
      while(mt%i==0){
	p++;
	mt/=i;
      }
      if(p){
	long long tn=nd;
	long long np=0;
	while(tn){
	  tn/=i;
	  np+=tn;
	}
	t=min(t,np/p);
      }
    }
    cout<<t<<endl;
  }
  return 0;
}
    

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}

long long gcd(long long a, long long b) {return b ? gcd(b, a % b) : a;}
long long lcm(long long m, long long n ){if((0 == m )||( 0 == n ))return 0;
    return ((m / gcd(m, n)) * n);
}
vector<int> primeFactors(int n) {
    vector<int> v;
    int i = 2;
    while (i * i <= n) {
        if (n % i == 0) {
            v.push_back(i);
            n /= i;
        } else {
            i++;
        }
    }
    if(n != 1)v.push_back(n);
    return v;
}

signed main(){
    int n,p; cin >> n >> p;
    auto v = primeFactors(p);
    map<int,int>mp;
    for(auto itr : v)mp[itr]++;
    int ans = 1;
    for(auto itr :mp){
        if(itr.second >= n){
            ans *= pow(itr.first,itr.second / n);
        }
    }
    cout << ans << endl;
}





Measured memory_bytes: 512
n,k=map(int,input().split())
sunuke=set()
snack=[]
for i in range(k):
  d=int(input())
  kashi=list(map(int,input().split()))
  snack.append(kashi)
for i in range(k):
  for j in snack[i]:
    sunuke.add(j)
print(n-len(sunuke))

Measured memory_bytes: 9304
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
int abs(int x){
if(x<0)
    return x*-1;
else
    return x;
}
int main(){
int n;
cin>>n;
int i,j;
pair<int,int> a[n+1];
for(i=1;i<=n;i++){
    int g;
    cin>>g;
    a[i]=mp(g,i);

}
sort(a+1,a+n+1);


int cn1=0;
int cn2=0;
for(i=n;i>=1;i--){

   int x=abs(i-a[i].second);
if(x%2){

    if(a[i].second%2)
    cn1++;
else
    cn2++;

}

}

int ans=min(cn1,cn2);
int x=abs(cn1-cn2);
ans+=x;
if(x%2)
    ans++;

cout<<ans<<endl;



return 0;
}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int c=0;
    for(int i=0;s[i]!='\0';i++){
        if(s[i]=='9')c++;
    }
    if(c>=1)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<queue>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int> >;
using pii = pair<int, int>;
using ppi = pair<pii, int>;

int f_dir[2][4] = {{-1, 0, 1, 0}, {0, 1, 0, -1}}; //↑→↓←
int e_dir[2][8] = {{-1, -1, -1, 0, 0, 1, 1, 1}, {-1, 0, 1, -1, 1, -1, 0, 1}};
bool is_in_field(int y, int x, int h, int w){
  return (y >= 0 && y < h && x >= 0 && x < w);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start-----------------------------------------------
  int n; cin >> n;
  if((n % 10) == 7 || (n%100)/10 == 7 || (n%1000) / 100 == 7) cout << "Yes" << endl;
  else cout << "No" << endl;

  // end-----------------------------------------------
  // cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


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

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


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

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

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

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

	int h,w,n;
	cin>>h>>w>>n;
	if(h<w) swap(h,w);

	int res=0;
	for(int i=0;i<w;i++)
	{
		n-=h;
		res++;
		if(n<=0)
		{
			cout<<res<<endl;
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
n = int(input())
b = [0] * (10 ** 5 + 1)
a = list(map(int, input().split()))
for i in a:
    b[i] += 1
    if i < 10 ** 5:
        b[i + 1] += 1
    if i > 0:
        b[i - 1] += 1

print(max(b))

Measured memory_bytes: 21544
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pi pair<int,int>
#define ll long long
#define rep(i,a,b) for(int i=int(a); i<=int(b);i++)
#define repv(vec,v) for(v=(vec).begin(); v!=(vec).end();v++)
#define sz(vec) (int)(vec).size()
#define PB push_back
#define F first()
#define S second()

bool pal(string s){
	int le = (int)s.size();
	int l = le/2;
	for(int i=0; i<l; i++)
		if(s[i] != s[le-i-1])
			return false;
	return true;
}


int main(){
	string s;
	cin >> s;
	int le = (int)s.size();
	string s1 = s.substr(0, (le-1)/2);
	string s2 = s.substr((le+3)/2-1);
	if(pal(s) && pal(s1) && pal(s2))
		cout << "Yes";
	else
		cout << "No";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
	int a,b,c,d;
	scanf("%d",&a);
	b=a/3600;
	a-=b*3600;
	c=a/60;
	a-=c*60;
	d=a;
	printf("%d:%d:%d\n",b,c,d);
	return 0;
}

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

const int mod = 1e9+7;

int main(){
  int h, w; cin >> h >> w;
  bool a[h][w];
  for(int i=0; i<h; i++) {
    string s; cin >> s;
    for(int j=0; j<w; j++) {
      if (s[j] == '.') a[i][j] = true;
      else a[i][j] = false;
    }
  }
  int b[h][w], c[h][w];
  fill(c[0], c[h], 0); fill(b[0], b[h], 0);
  for(int i=0; i<h; i++) {
    int wd = 0;
    for(int j=0; j<w; j++) {
      if (a[i][j]) wd++;
      if (!a[i][j] && wd) {
        for(int k=0; k<wd; k++) {
          b[i][j-k-1] = wd;
        }
        wd = 0;
      }
      else if (j == w-1) {
        for(int k=0; k<wd; k++) {
          b[i][j-k] = wd;
        }
        wd = 0;
      }
    }
  }
  
  for(int i=0; i<w; i++) {
    int wd = 0;
    for(int j=0; j<h; j++) {
      if (a[j][i]) wd++;
      if (!a[j][i] && wd) {
        for(int k=0; k<wd; k++) {
          c[j-k-1][i] = wd;
        }
        wd = 0;
      }
      else if (j == h-1) {
        for(int k=0; k<wd; k++) {
          c[j-k][i] = wd;
        }
        wd = 0;
      }
    }
  }
  /*
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      cout << b[i][j] << " ";
    } cout << endl;
  }
  
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      cout << c[i][j] << " ";
    } cout << endl;
  }*/
  
  int an = 0;
  for(int i=0; i<h; i++) {
    for(int j=0; j<w; j++) {
      an = max(an, b[i][j] + c[i][j] - 1);
    }
  }
  cout << an << endl;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define frw(i, a, b) for(int i = a; i < b; i++)
#define fi first
#define se second
#define pb push_back
#define in insert
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) int(a.size())
#define pii pair<int, int>
#define piii pair<int, pii>
#define pll pair<ll, ll>
#define plll pair<ll, pll>
#define vpii vector<pii>
#define vpiii vector<piii>
#define vpll vector<pll>
#define vplll vector<plll>
#define mod 1000000007

ll maax=1000001;
ll p[10000001];

 ll dp[200000];

int inv(ll x,ll y)
{
	//ll y=mod-2;
	unsigned int res=1;
	while(y>0)
	{
		if(y&1)
			res=(res*x)%mod;
		y=y>>1;
		x=(x*x)%mod;
	}
	return res;
}
void seive()
{
	p[0]=1;
	p[1]=1;
	for(int i=2;i<maax;i++)
	{
		if(p[i]==0)
		{
			for(int j=2*i;j<maax;j+=i)
			{
				if(p[j]==0)
					p[j]=i;
	
			}
			p[i]=i;
		}
	}
}
ll md(ll a){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}
int main()
{
	ll n,k;
	cin>>n>>k;
	ll a[n+1];
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	ll s,d;
	s=0;
	d=0;
	ll f[n+1],fi[n+1];
	f[0]=1;
	fi[0]=inv(f[0],mod-2);
	for(int i=1;i<=n;i++)
	{
		f[i]=(f[i-1]*i)%mod;
		fi[i]=inv(f[i],mod-2);
	}
	
	for(int i=0;i<n;i++)
	{
		if(i+1>=k)
		{
			ll t=i;
			//cout<<a[i]<<" "<<f[t]<<" "<<fi[t-k+1]<<" "<<fi[k-1]<<endl;
			s=md(s+md(a[i]*md(f[t]*md(fi[t-k+1]*fi[k-1]))));
			//cout<<s<<endl;
			//unsigned int z=(inv(f[t-k+1])*inv(f[k-1]))%mod;
			//cout<<z<<endl;

		}
		 	//cout<<endl;
		 if(i<=n-k)
		 {
		 	ll u=n-i-1;
		 	//cout<<a[0]<<" "<<fi[u-k+1]<<" "<<fi[k-1]<<endl;
		 	s=md(s-md(a[i]*md(f[u]*md(fi[u-k+1]*fi[k-1]))));
		 	// cout<<s<<endl;
		 	// cout<<md(fi[u-k+1]*fi[k-1])<<endl;
		 }

	}
	cout<<s-d;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define MOD 1000000007
#define Long long long 
using namespace std;
#define maxn 100002
int a[maxn];
bool dau[maxn];
Long C1[maxn],C2[maxn];
Long power(Long b, Long p, Long mod){
	if(p==1) return b;
	Long temp = power(b,p/2,mod);
	if(p%2==0) return (temp*temp)%mod;
	return ((temp*temp)%mod*b)%mod;
}
Long divide(Long a, Long b,Long mod){
// 	if(a*(power(b,mod-2,mod)) <0 ) cout <<"!!!" << a;
	return (a*(power(b,mod-2,mod)))%mod;
}
void CalCkn(Long n, Long* C, Long mod){
	C[0] = 1;
	For(i,1,n){
		C[i] = divide(((n-i+1)*C[i-1])%mod,i,mod);
	}	
}
main(){
	Long n;
	cin >> n;
	Long pos1=0;
	Long pos2  = 0;
	Long num = 0;
	For(i,1,n+1)	 {
		scanf("%d",a+i);
		if(dau[a[i]]){
			num = a[i];
		}	else	{
			dau[a[i]] = true;
		}
	}
	For(i,1,n+1){
		if(a[i]==num){
			if(pos1==0)		{
				pos1=i;
			}	else	{
				pos2 = i;
			}
		}
	}
	Long apc = pos1-1 + (n+1-pos2);
	CalCkn(n+1,C1,MOD);
	CalCkn(apc,C2,MOD);
//	For(i,0,n+1){
//		cout << C1[i]<< " ";
//	}
	Long ans= 0;
	For(i,1,n+1){
		ans = C1[i];
		if(i-1<=apc) ans -= C2[i-1];
		ans+= MOD;
		ans %= MOD;
		printf("%lld\n",ans);
	}
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/stack:200000000")
using namespace std;
#define MAXN 250000

void setIO() 
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr); 
    cout.tie(nullptr);
}

int n,m,h[MAXN],ans;
bool good[MAXN];
int main()
{
    setIO();
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
        cin >> h[i];
    for(int i = 1,a,b; i <= m; i++)
    {
        cin >> a >> b;
        if(h[a] > h[b])
            good[b] = true;
        else if(h[a] < h[b])
            good[a] = true;
        else
            good[a] = good[b] = true;
    }
    for(int i = 1; i <= n; i++)
        ans += !good[i];
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4164
var
  a,b,c,d:longint;
  a1,b1,c1,d1:char;
begin
  readln(a1,b1,c1,d1);
  a:=ord(a1)-ord('0');
  b:=ord(b1)-ord('0');
  c:=ord(c1)-ord('0');
  d:=ord(d1)-ord('0');
  if a+b+c+d=7 then writeln(a,'+',b,'+',c,'+',d,'=7')
  else if a+b+c-d=7 then writeln(a,'+',b,'+',c,'-',d,'=7')
    else if a+b-c+d=7 then writeln(a,'+',b,'-',c,'+',d,'=7')
      else if a-b+c+d=7 then writeln(a,'-',b,'+',c,'+',d,'=7')
        else if a-b-c+d=7 then writeln(a,'-',b,'-',c,'+',d,'=7')
          else if a-b+c-d=7 then writeln(a,'-',b,'+',c,'-',d,'=7')
            else if a+b-c-d=7 then writeln(a,'+',b,'-',c,'-',d,'=7')
              else writeln(a,'-',b,'-',c,'-',d,'=7');
end.

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

using namespace std;

typedef long long ll;
const int MAX_V = 10001;

struct edge{
  int to,cap,cost,rev;
};

int V;
vector<edge> G[MAX_V];
ll dist[MAX_V];
ll h[MAX_V]; // |eV

// ¼OÌ¸_ÆÓ
int prevv[MAX_V];
int preve[MAX_V];

const ll INF = 1000000000000000LL;

// firstÍÅZ£AsecondÍ¸_ÌÔ
typedef pair<ll,int> P;

// from©çtoÖÞ©¤eÊcap,RXgcostÌÓðOtÉÇÁ·éB
void add_edge(int from,int to,int cap,int cost){
	edge e;
	e.to = to,e.cap = cap,e.cost = cost,e.rev = G[to].size();
	G[from].push_back(e);
	e.to = from,e.cap = 0,e.cost = -cost,e.rev = G[from].size()-1;
	G[to].push_back(e);
}

// s©çtÖÌ¬ÊfÌÅ¬ïp¬ðßé
// Èª¹È¢êÍ-1ðÔ·
ll min_cost_flow(int s,int t,int f){
	ll res = 0;
	fill(h,h+V,0);
	// ¬ÊªÀEÉB·éÜÅ¬·
	while(f > 0){
		// _CNXg@ÅAÅZ£ðõ
		priority_queue<P,vector<P>,greater<P> > que;
		fill(dist,dist+V,INF);
		dist[s] = 0;
		que.push(P(0,s));
		while(!que.empty()){
			P p = que.top();
			que.pop();
			int v = p.second;
			if(dist[v] < p.first)
				continue;
			for(int i = 0; i < (int)G[v].size(); i++){
				edge &e = G[v][i];
				if(e.cap > 0 && dist[e.to] > dist[v] + e.cost + h[v] - h[e.to]){
					dist[e.to] = dist[v] + e.cost + h[v] - h[e.to];
					prevv[e.to] = v;
					preve[e.to] = i;
					que.push(P(dist[e.to],e.to));
				}
			}
		}

		if(dist[t] == INF)
			return -1;
		for(int i = 0; i < V; i++)
			h[i] += dist[i];

		int d = f;
		for(int v = t; v != s; v = prevv[v]){
			d = min(d,G[prevv[v]][preve[v]].cap);
		}
		f -= d;
		res += 1LL*d*h[t];
		for(int v = t; v != s; v = prevv[v]){
			edge &e = G[prevv[v]][preve[v]];
			e.cap -= d;
			G[v][e.rev].cap += d;
		}
	}
	return res;
}

int main(){

	int n;
	const int s=0;
	int t=0;
	int a[1001];
	int b[1001];
	map<int,int> costIdxs;
	int idx=0;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
		// Ü¾¶ÝµÄ¢È¯êÎAÇÁ
		if(costIdxs.find(a[i])==costIdxs.end())costIdxs[a[i]]=idx++;
		if(costIdxs.find(b[i])==costIdxs.end())costIdxs[b[i]]=idx++;
	}
	// m[hÍAn+RXgÌíÞ+èÄ³µm[h+X^[g+S[
	V=3+n+costIdxs.size();
	// m[h-1ªS[
	t=V-1;
	int base=(--costIdxs.end())->first;
	// s©çem[hÖÚ±
	for(int i=0;i<n;i++)add_edge(0,i+1,1,0);
	// em[h©çeRXgÖÚ±
	for(int i=1;i<=n;i++){
		// Ç¿çðg¤©ÅñÊèÌèÄª¶Ý
		add_edge(i,costIdxs[a[i-1]]+n+1,1,-b[i-1]+base);
		add_edge(i,costIdxs[b[i-1]]+n+1,1,-a[i-1]+base);
		// èÄ³µ
		add_edge(i,V-2,1,base);
	}
	// eRXg©çS[ÖÚ±
	for(map<int,int>::iterator it=costIdxs.begin();it!=costIdxs.end();it++)
		add_edge(it->second+n+1,V-1,1,0);
	// èÄ³µ©çS[Ö
	add_edge(V-2,t,1000000,0);
	ll res=-(min_cost_flow(s,t,n)-base*n);
	cout<<res<<endl;

	return 0;
}

Measured memory_bytes: 1452
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];

        for(int i=0;i<n;i++){
            a[i] = sc.nextInt();
        }
        for(int i=n-1;i>=0;i--){
            if(i==0) System.out.printf("%d\n",a[i]);
            else System.out.printf("%d ",a[i]);
        }
        sc.close();
    }
}


Measured memory_bytes: 26552
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() int {
	n, err := strconv.Atoi(nextString())
	if err != nil {
		fmt.Printf("strconv.Atoi failed: %v\n", err)
	}
	return n
}

func stringifyArray(arr []int) string {
	return strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]")
}

func rotate(a []int, b, m, e int) {
	l := make([]int, m-b)
	for i := 0; i < m-b; i++ {
		l[i] = a[b+i]
	}
	r := make([]int, e-m)
	for i := 0; i < e-m; i++ {
		r[i] = a[m+i]
	}
	// fmt.Println(l, r)
	for i := b; i < e; i++ {
		j := i - b
		// fmt.Println(j < len(r), i, j, j-len(r))
		if j < len(r) {
			a[i] = r[j]
		} else {
			a[i] = l[j-len(r)]
		}
	}
}

func main() {
	scanner.Split(bufio.ScanWords)

	n := nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = nextInt()
	}

	nQueries := nextInt()
	for i := 0; i < nQueries; i++ {
		b := nextInt()
		m := nextInt()
		e := nextInt()
		// fmt.Println(b, m, e, ":", stringifyArray(a))
		rotate(a, b, m, e)
	}
	fmt.Println(stringifyArray(a))
}



Measured memory_bytes: 3476
#include<bits/stdc++.h>
using namespace std;
#define INF 10000000001
#define DIM 200001
#define mod 1000000007
#define PI 3.1415926535897932384626433
#define se second
#define fi first
#define pb push_back
#define T true
#define F false
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define endl "\n"
typedef char ch;
typedef bool boll;
typedef string st;
typedef long long ll;
typedef long double ld;
typedef set <string>sst;
typedef set <long long>sl;
typedef queue <long long>que;
typedef vector <long long>vec;
typedef unsigned long long ull;
typedef map <long long,long long>mll;
typedef pair <long long,long long>pll;
typedef vector <pair<long long,long long> >vpl;
typedef pair <long long, unsigned long long > pul;
ll n,z,s,x,c,a[200001];
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    ll cur=1;
    for(int i=1;i<=n;i++){
       if(a[i]==cur){
         cur++;
         s++;
       }
    }
    if(s==0)cout<<-1<<endl;
    else cout<<n-s<<endl;
}


Measured memory_bytes: 1792
use std::cmp::min;
use std::fs;
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: expr) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    let (a, b, q) = parse!(it, 3);
    let mut s = (0..a).map(|_| parse!(it)).collect::<Vec<_>>();
    s.insert(0, std::isize::MIN / 10);
    s.push(std::isize::MAX / 10);
    let mut t = (0..b).map(|_| parse!(it)).collect::<Vec<_>>();
    t.insert(0, std::isize::MIN / 10);
    t.push(std::isize::MAX / 10);
    let diff = |x: isize, y: isize| if x >= y { x - y } else { y - x };
    for _ in 0..q {
        let x = parse!(it);
        let si = s.binary_search(&x).unwrap_or_else(|x| x);
        let ti = t.binary_search(&x).unwrap_or_else(|x| x);
        let mut ret = std::isize::MAX / 10;
        for &(si, ti) in &[(si, ti), (si, ti - 1), (si - 1, ti), (si - 1, ti - 1)] {
            ret = min(ret, diff(x, s[si]) + diff(s[si], t[ti]));
            ret = min(ret, diff(x, t[ti]) + diff(s[si], t[ti]));
        }
        println!("{}", ret);
    }
}

fn test() {
    let mut f = fs::File::open("foo.txt").unwrap();
    let mut s = String::new();
    f.read_to_string(&mut s).unwrap();
    solve(&s);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_main() {
        test();
    }
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 13304
#include <stdio.h>
int a[4][13];
int main(void){
    int i,j,k,n;
    char ch;
    scanf("%d",&n);
    for(k=0;k<4;k++){
        for(j=0;j<13;j++){
            a[k][j]=j+1;
        }
    }
    for(i=0;i<n;i++){
        scanf("%c", &ch);
        scanf("%c %d",&ch,&j);
        if(ch=='S') a[0][j-1]=0;
        if(ch=='H') a[1][j-1]=0;
        if(ch=='C') a[2][j-1]=0;
        if(ch=='D') a[3][j-1]=0;
    }
    for(k=0;k<4;k++){
        for(j=0;j<13;j++){
            if(a[k][j]!=0){
            if(k==0) printf("S %d\n",a[k][j]);
            if(k==1) printf("H %d\n",a[k][j]);
            if(k==2) printf("C %d\n",a[k][j]);
            if(k==3) printf("D %d\n",a[k][j]);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2700
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;

vi d;
int bellmanford(v(ed) &ES,int V,int E,int s) {
  // ES[i] = P(c,P(f,t)) means that from `f` to `t` 's cost is `c`
  // returns meaning
  // 0 -> no negative cycle, 
  // -1 -> has negative cycle
  d = vi(V,INF);
  d[s] = 0;
  int cnt = 0;
  while(true) {
    bool update = false;
    rep(i,E) {
      ed e = ES[i];
      if(d[e.second.first] != INF && d[e.second.second] > d[e.second.first] + e.first) {
        d[e.second.second] = d[e.second.first] + e.first;
        update = true;
      }
    }
    if(!update) break;
    cnt++;
    if(cnt >= V) {
      return -1;
    }
  }
  return 0;
}

class Reachable {
  public:
  int N;
  vvi G;
  vi reachable;
  Reachable(int _N,vvi _G)
  : N(_N),G(_G) {}
  void findReachable(int s) {
    reachable = vi(N,0);
    dfs(s);
  }
  void dfs(int s) {
    if(reachable[s]) return;
    reachable[s]++;
    rep(i,sz(G[s])) {
      dfs(G[s][i]);
    }
  }
};
  
int main() {
  int N,M,p;
  cin >> N >> M >> p;
  v(ed) abc(M);
  vvi G(N),rG(N);
  rep(i,M) {
    int a,b,c;
    cin >> a >> b >> c;
    a--;
    b--;
    abc[i] = make_pair(p-c,P(a,b));
    G[a].push_back(b);
    rG[b].push_back(a);
  }
  Reachable s(N,G),g(N,rG);
  s.findReachable(0);
  g.findReachable(N-1);
  
  v(ed) e;
  rep(i,M) {
    if(s.reachable[abc[i].second.first] &&
       s.reachable[abc[i].second.second] &&
       g.reachable[abc[i].second.first] && 
       g.reachable[abc[i].second.second]) {
         e.push_back(abc[i]);
       }
  }
  int ng = bellmanford(e,N,sz(e),0);
  if(ng) {
    cout << -1 << endl;
    return 0;
  }
  cout << max(-d[N-1],0) << endl;
  return 0;
}

Measured memory_bytes: 1024
N,M,X,Y=map(int,input().split())
x=max([int(i) for i in input().split()])
y=min([int(i) for i in input().split()])
flg=False
for i in range(X+1,Y+1):
  if x<i<=y:
    flg=True
print("No War" if flg else "War")   

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

int main(void){
    int a, b, c;
    
    cin>>a>>b>>c;
    
    int d=a%b;
    
    int sum=d;
    
    bool bb=false;
    if(d==c){
        bb=true;
    }else{
        for(int i=0; i<b; i++){
            sum+=d;
            if(sum>=b){
                sum=sum%b;
            }
            
            if(sum==c){
                bb=true;
                break;
            }
        }
    }
    
    if(bb){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
}


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

inline int read()
{
	int x=0;char ch=getchar();
	while(ch<'0' || '9'<ch)ch=getchar();
	while('0'<=ch && ch<='9')x=x*10+(ch^48),ch=getchar();
	return x;
}

const int N=1e5+9;
bool flag=0;
int n,to[N<<1],nxt[N<<1],beg[N],tot;

inline void add(int u,int v)
{
	to[++tot]=v;
	nxt[tot]=beg[u];
	beg[u]=tot;
}

inline int dfs(int u,int fa)
{
	int ret=1;
	for(int i=beg[u];i && !flag;i=nxt[i])
		if(to[i]!=fa)
			ret-=dfs(to[i],u);
	if(flag)return 0;
	if(ret<0)
		flag=1;
	return ret;
}

int main()
{
	if(fopen("vj.in","r"))
	{
		freopen("vj.in","r",stdin);
		freopen("vj.out","w",stdout);
	}
	
	n=read();
	for(int i=1,u,v;i<n;i++)
	{
		u=read();v=read();
		add(u,v);add(v,u);
	}

	if(dfs(1,0) || flag)
		puts("First");
	else
		puts("Second");

	return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pb emplace_back 8 7
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define E endl
#define M 1000000007
#define fast ios:: sync_with_stdio(false),cin.tie(0);

int main()
{
    ll n;
    cin>>n;
    ld ans;
    if(n%2==0)
    {
    	ld k=n/2;
    	
    	 ans=k/n;
    }
    else
    {
    	ld k=(n/2)+1;
         ans=k/n;
    }
    cout<<fixed<<setprecision(10)<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i,a, b) for (ll i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template <class T>inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}


int main()
{
    int k,a,b;
    cin >> k >> a >> b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}


Measured memory_bytes: 3632
#include <cstdio>

using namespace std;

int main()
{
    int t;
    int se;

    for (int i = 0; i < 4; i++){
        scanf("%d %d", &t, &se);
        if (t == 1){
            printf("%d\n", se * 6000);
        }
        else if (t == 2){
            printf("%d\n", se * 4000);
        }
        else if (t == 3){
            printf("%d\n", se * 3000);
        }
        else if (t == 4){
            printf("%d\n", se * 2000);
        }
    }

    return (0);
}

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

int main(){
    ll n; cin >> n;
    ll time = 0;
    vector<pair<ll,ll>> a(n);
    rep(i,n) cin >> a[i].second >> a[i].first;

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

    for(long long i = 0; i < n; i++){
        time += a[i].second;
        if(time > a[i].first){
            put("No");
            return 0;
        }
    }
    put("Yes");
}

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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var N = cin.ReadInt;
            Destination[] Destinations = new Destination[N + 1];
            Destinations[0] = new Destination(0, 0, 0);
            for(int i = 1; i <= N; i++)
            {
                Destinations[i] = new Destination(cin.ReadInt, cin.ReadInt, cin.ReadInt);
            }
            var flag = true;
            for(int i = 0; i < N; i++)
            {
                var dist = Destinations[i].Distance(Destinations[i + 1]);
                var time = Destinations[i].Time(Destinations[i + 1]);
                if(dist > time || dist % 2 != time % 2){
                    flag = false;
                }
            }
            Console.WriteLine(flag ? "Yes" : "No");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }

    public class Destination
    {
        public int _t;
        public int _x;
        public int _y;
        public Destination(int t, int x, int y)
        {
            this._t = t;
            this._x = x;
            this._y = y;
        }
        public int Distance(Destination other)
        {
            return Math.Abs(this._x - other._x) + Math.Abs(this._y - other._y);
        }
        public int Time(Destination other)
        {
            return Math.Abs(this._t - other._t);
        }
    }
}


Measured memory_bytes: 20804
/* C++14 (Clang 3.8.0) for AtCoder */

#include <iostream>
#include <vector>
#include <string>
// #include <cmath>
// #include <math.h>
// #include <algorithm>

namespace AtCoder {
	using Str = std::vector<std::string>;
	using Num = std::vector<int>;

	class Ans {
	public:
		void showResult(void);
		void increment(void);
		void increment(double);
		void decrement(void);
		void decrement(double);
		double getResult(void);
	private:
		double result;
	};
	void Ans::showResult(void) {
		printf("%f\n", this->result);
	}
	void AtCoder::Ans::increment(void) {
		this->result++;
	}
	void AtCoder::Ans::increment(double value) {
		this->result += value;
	}
	void AtCoder::Ans::decrement(void) {
		this->result--;
	}
	void AtCoder::Ans::decrement(double value) {
		this->result -= value;
	}
	double AtCoder::Ans::getResult(void) {
		return this->result;
	}

	void input(Str* str) {
		str->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				str->push_back(row);
				row = "";
			} else {
				row += buf[i];
			}
		}
		str->push_back(row);
	}
	void input(Num* num) {
		num->clear();
		std::string buf = "", row = "";
		std::getline(std::cin, buf);
		for (unsigned int i = 0; i < buf.size(); i++) {
			if (' ' == buf[i]) {
				num->push_back(std::atoi(row.c_str()));
				row = "";
			} else {
				row += buf[i];
			}
		}
		num->push_back(std::atoi(row.c_str()));
	}
	void exp(std::string* str,  Str* newStr) {
		std::string pre = *str;
		newStr->clear();
		for (unsigned int i = 0; i < pre.length(); i++) {
			newStr->push_back(pre.substr(i, 1));
		}
	}
}

int main(void) {

	AtCoder::Num s;
	AtCoder::input(&s);
	const int n = s[0];

	AtCoder::input(&s);

	if (1 == n) {
		printf("%d\n", s[0]);
		return 0;
	}

	AtCoder::Ans* ans = new AtCoder::Ans();

	for (int i = 0; i < n; i++) {
		ans->increment(float(1.0f / s[i]));
	}
	{
		double buf = ans->getResult();
		ans->decrement(buf);
		ans->increment(float(1.0f / buf));
	}

	ans->showResult();

	delete(ans);

	return 0;
}


Measured memory_bytes: 888
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
using namespace std;

const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};
namespace std{
    bool operator < (const P& a, const P& b){
        return (a.X!=b.X) ? a.X<b.X : a.Y<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(abs(c)-abs(b) > EPS) return -2; //a-b-c
    return 0; //a-c-b
}

bool intersectSS(const L& a, const L& b){
    return ( ccw(a[0],a[1],b[0]) *ccw(a[0],a[1],b[1]) <= 0 ) &&
        ( ccw(b[0],b[1],a[0]) *ccw(b[0],b[1],a[1]) <= 0 );
}
P crosspointLL(const L &l, const L &m) {
  double A = cross(l[1]-l[0], m[1]-m[0]);
  double B = cross(l[1]-l[0], l[1]-m[0]);
  return m[0] + B/A *(m[1]-m[0]);
}
bool isParallel(const P &a, const P &b){
    return abs(cross(a,b)) < EPS;
}
bool isParallel(const L &a, const L &b){
    return isParallel(a[1]-a[0], b[1]-b[0]);
}
double getarea(const VP &poly){
    double ret = 0;
    for (int i=0; i<(int)poly.size(); i++){ 
        ret += cross(poly[i], poly[(i+1)%poly.size()]);
    }
    return ret*0.5;
}

int main(){
	while(1){
		int x1,y1,x2,y2;
		cin >> x1 >> y1 >> x2 >> y2;
		if(x1==0 && y1==0 && x2==0 && y2==0) break;
		vector<L> line(3);
		for(int i=0; i<3; i++){
			if(i != 0) cin >> x1 >> y1 >> x2 >> y2;
			line[i] = L(P(x1,y1), P(x2,y2));
		}
		VP v;
		for(int i=0; i<3; i++){
			if(!isParallel(line[i], line[(i+1)%3]) && intersectSS(line[i], line[(i+1)%3])){
				v.push_back(crosspointLL(line[i], line[(i+1)%3]));
			}
		}
		sort(v.begin(), v.end());
		v.erase(unique(v.begin(), v.end()), v.end());
		if((int)v.size() != 3){
			cout << "kyo" << endl;
		}else{
			if(ccw(v[0], v[1], v[2]) == -1) swap(v[1], v[2]);
			double s = getarea(v);
			if(s >= 1900000){
				cout << "dai-kichi" << endl;
			}else if(s >= 1000000){
				cout << "chu-kichi" << endl;
			}else if(s >= 100000){
				cout << "kichi" << endl;
			}else{
				cout << "syo-kichi" << endl;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3176