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

int main() {
  int N;
  cin >> N;
  vector<string> V(N);
  for (int i = 0; i < N; i++)
    cin >> V.at(i);
  
  map<string,int> M;
  for (int j = 0; j < N; j++)
    M[V.at(j)]++;
  
  int a = 0;
  for (auto p : M) {
    if (p.second > a)
      a = p.second;
  }
  
  for (auto k = M.begin(); k != M.end(); k++) {
    if (k->second == a)
      cout << k->first << endl;
  }
  
  
}


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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  REP(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

int gcd(int x, int y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

signed main() {
  int n = read();
  vi t(n);
  REP(i, n) t[i] = read();
  int ans = t[0];
  FOR(i, 1, n) { ans = ans / gcd(ans, t[i]) * t[i]; }
  std::cout << ans << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
typedef vector<int,vector<int>> vec;
typedef pair<int,int> P;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define all(vec) vec.begin(),vec.end()
#define mod 1000000007
const int INF = 1e9;

int main(){
  int N,K,idx,a;cin>>N>>K;
  vector<int> vec(N);
  REP(i,0,N){
    cin>>a;
    if(a==1){idx=i;}
    vec[i]=a;
  }
  ll ans;
  if(idx<K-1){
    ans=1+max(0LL,(ll)ceil(1.*(N-K)/(K-1)));
  }
  else{
    ans=max((ll)ceil(1.*idx/(K-1)),(ll)ceil(1.*idx/(K-1)+1.*(N-1-idx)/(K-1)));
  }



  // if(idx<K-1){
  //   ans=1+max(0LL,(ll)ceil(1.*(N-K)/(K-1)));
  // }
  // else{
  //   ans=ceil(1.*idx/(K-1))+max(0LL,(ll)ceil(1.*(N-1-idx)/(K-1)));
  // }
  print(ans)

}


Measured memory_bytes: 640
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    A = [int(a) for a in input().split()]
    l = A.index(1)
    count = 1
    
    r = K - 1
    while r < l:
        r += (K - 1)
        count += 1
    
    if r < N - 1:
        ll = N - K
        count += 1
        while ll > r:
            ll -= (K - 1)
            count += 1
    print(count)
    
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 14132
import java.util.*;

public class Main {

    static int MOD = 1000000007;
    public static void main(String[] args) {

        int ans=1;
        Scanner sc = new Scanner(System.in);
        // int a=sc.nextInt(),b=sc.nextInt();
        int n=Integer.parseInt(sc.next());
        //  String s=sc.next();
        int[] p = new int[n];
        int[] min = new int[n];
        for(int i=0;i<n;i++){
            p[i]=sc.nextInt();
        }
        min[0]=p[0];
        for(int i=1;i<n;i++){
            min[i]=Math.min(min[i-1],p[i]);
        }
        for(int i=1;i<n;i++){
            if(p[i]<min[i-1])ans++;
        }

        System.out.println(ans);

    }

}


Measured memory_bytes: 84412
#include<stdio.h>
int main(void)
{
	int n,min=1000000,i,a[200005],count=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
	{
		if(a[i]<min)
		{
			min = a[i];
			count++;
		}
	}
	printf("%d",count);
	return 0;
}

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

int main(){
	long long N,M,sum=0;
	cin >> N >> M;
	if(2*N<=M){
     sum=N+(M-2*N)/4;
  }else sum=M/2;
	cout << sum<< endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace _0125
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x.Min() < 0) break;
                DateTime dt1 = new DateTime(x[0],x[1],x[2]);
                DateTime dt2 = new DateTime(x[3],x[4],x[5]);
                Console.WriteLine((dt2 - dt1).Days);
            }
        }
    }
}


Measured memory_bytes: 9508
#include <stdio.h>
int main(void)
{
    int a, b;
    int kingaku=0, suuryou=0, n=0;
    while (scanf("%d,%d", &a, &b) != EOF) {
        kingaku += a * b;
        suuryou += b;
        n++;
    }
    printf("%d\n%d\n", kingaku, (int)((double)suuryou/n + 0.5));
    return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
  int a,b,c,d;
  scanf("%d %d %d",&a,&b,&c);
  	if(a-b<=c) {
	  d=c-(a-b);
	  printf("%d\n",d);
  }
  	else{
  		printf("0\n");
	  }
	  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean chk = true;
        HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
        for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            if(map.containsKey(a)){
                chk = false;
                break;
            }else{
                map.put(a,1);
            }
        }
        if(chk){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

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

int main(int argc, char const *argv[])
{
    int n, a;
    std::vector<int> input_a;
    int max, min;
    long long sum = 0;

    std::cin >> n;

    for (int i = 0; i < n; i++)
    {
        std::cin >> a;
        sum += a;
        input_a.emplace_back(a);
    }

    max = *std::max_element(input_a.begin(), input_a.end());
    min = *std::min_element(input_a.begin(), input_a.end());

    std::cout << min << " " << max << " " << sum << std::endl;

    return 0;
}



Measured memory_bytes: 3264
//
// Created by yamunaku on 2020/05/03.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    map<int, int> mp;
    ll ans = 0;
    rep(i, n){
        ans += mp[i - a[i]];
        mp[i + a[i]]++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 20972
#include <iostream>
#include <sstream>
#include <bitset>
using namespace std;

std::string sss(int n)
{
  unsigned x = n;
  std::stringstream ss;
  ss << static_cast<std::bitset<32>>(x);
  std::string x_bin = ss.str();
  return x_bin;
}

int main(){
  int N;
  cin >> N;
  int a[N];
  int data[32];
  for (int i = 0; i < 32;i++)
    data[i] = 0;
  for (int i = 0; i < N; i++)
  {
    cin >> a[i];
    string s = sss(a[i]);
    for (int j = 0; j < 32; j++)
    {
      if (s[j] == '1')
        data[j]++;
    }
  }
  bool ans=true;
  for (int i = 0; i < 32;i++){
    if(data[i]%2==1)
      ans = false;
  }

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

Measured memory_bytes: 640
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long ll;
ll N, P;
int main() {
  scanf("%ld %ld", &N, &P);
  ll ans = P;
  for(ll i = sqrt(P); N > 1 && i > 0; --i) {
    ll t = pow(i, N);
    if(t > P) continue;
    if(P%t == 0) {
      ans = i;
      break;
    }
  }
  printf("%ld\n", ans);
}

Measured memory_bytes: 384
#include<cstdio>
#include<iostream>
#include<cmath>

using namespace std;
#define PI 3.1415926535897932

int main(){
	double x=0.0, y=0.0;
	int	dir=90, step, ang;
	char dmy;

	while(1){
	cin >> step >> dmy >> ang;
	if((step==0) && (ang==0)){
		cout<< (int)x << endl << (int)y << endl;
		return 0;
	}
		x+=(cos((long double)dir/180*PI)*step);
		y+=(sin((long double)dir/180*PI)*step);

		dir=(dir-ang)%360;
	}
}

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

int gcd(int a, int b){
	if(b==0)
		return a;

	return gcd(b,a%b);
}

int main(){
	while(true){
		int a,b;
		cin >> a>> b;
		
		if(cin.eof())
			break;

		int g=gcd(a,b);
		cout << g <<' '<<a/g*b <<endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
import Control.Monad
import Data.List
import qualified Data.IntMap as M

-- 素数生成(無限リスト)
pr=2:q
q=3:5:7:3#q
m#(a:b:x)=[n|n<-[a^2,a^2+2..b^2-2],gcd n m<2]++(m*b)#(b:x)

-- 素因数分解 -> 結果をData.IntMapに(素因数,その数)として蓄積
fac :: [Int]->M.IntMap Int->Int->M.IntMap Int
fac _ m 1 = m
fac pa@(p:pr) m n
    |n`mod`p==0=fac pa (M.insertWith(+)p 1 m) (n`div`p)
    |True      =fac pr m n

main=do
    n<-readLn::IO Int
    print.foldl (\a n->(a*(n+1))`mod`1000000007) 1.M.elems $ foldl (fac pr) M.empty [2..n]


Measured memory_bytes: 1148
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;

const int INF = 200000000;
const int MOD = 1e9 + 7;

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

    char b;
    cin >> b;
    if (b == 'A') {
        b = 'T';
    } else if (b == 'C') {
        b = 'G';
    } else if (b == 'G') {
        b = 'C';
    } else if (b == 'T') {
        b = 'A';
    }
    cout << b << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using System.Text;
 
class DandA {
    static void Main(string[] args) {
        int n = ReadLineInt();
        int[][] xyArr = ReadMLineIntArray(n);
        double rtn = 0;
        for (int i = 0;i < n;i++) {
            for (int j = i + 1;j < n;j++) {
                rtn += Math.Sqrt(Math.Pow(xyArr[i][0] - xyArr[j][0], 2) + Math.Pow(xyArr[i][1] - xyArr[j][1], 2));
                //Console.WriteLine("wk:" + root[j,i] + " rtn:" + rtn);
            }
        }
        Console.WriteLine((rtn * 2) / n);
    }
 
    static string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ";
    static string[] strAry = new string[] {"L", "R", "U", "D"};
    static int[] intArray = new int[10];
    static List<int> intList = new List<int>();
  
    static private string ReadLineStr() {return Console.ReadLine();}
    static private int ReadLineInt() {return int.Parse(Console.ReadLine());}
    static private long ReadLineLong() {return long.Parse(Console.ReadLine());}
    static private double ReadLineDouble() {return double.Parse(Console.ReadLine());}
    static private string[] ReadLineStrArray() {return Console.ReadLine().Trim().Split();}
    static private int[] ReadLineIntArray() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToArray();}
    static private long[] ReadLineLongArray() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToArray();}
    static private double[] ReadLineDoubleArray() {return Console.ReadLine().Trim().Split().Select(a => double.Parse(a)).ToArray();}
    static private decimal[] ReadLineDecimalArray() {return Console.ReadLine().Trim().Split().Select(a => decimal.Parse(a)).ToArray();}
    static private List<int> ReadLineIntList() {return Console.ReadLine().Trim().Split().Select(a => int.Parse(a)).ToList();}
    static private List<long> ReadLineLongList() {return Console.ReadLine().Trim().Split().Select(a => long.Parse(a)).ToList();}
    static private string[][] ReadMLineStrArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split()).ToArray();}
    static private int[][] ReadMLineIntArray(int arg) { return new int[arg].Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();}
 
    static private bool IsPrime(int num) {
        if (num < 2) return false;
        if (num == 2) return true;
        else if (num % 2 == 0) return false;
        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2) {
            if (num % i == 0) return false;
        }
        return true;
    }
  
    static private string IntToNString(int x, int n) {
        var nstring = "";
        var numbers = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" };
        int r = 1;
        int q = x;
        while (q > 0) {
            r = q % n;
            nstring += numbers[r];
            q = q / n;
        }
        return string.Join("",nstring.Reverse());
     }
}

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

int main(){
	
	int i,n;
	double m,a,x[1000],sum1,sum2;
	
	while(1){
		sum1=0;
		sum2=0;
		a=0;
	scanf("%d",&n);
		if(n==0)break;
		
	for(i=0;i<n;i++){
		scanf("%lf",&x[i]);
		sum1+=x[i];
	}
	m=sum1/n;
	for(i=0;i<n;i++){
			x[i]=(x[i]-m)*(x[i]-m);
			sum2+=x[i];
		}
	a=sqrt(sum2/n);
		printf("%.8f\n",a);
	}
	return 0;
}

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

using namespace std;

int main(){
  int n;

  while(cin>>n,n){
    int temp1,temp2;
    vector<int> score;
    int mini=1000000;

    for(int i=0;i<n;++i){
      cin>>temp1;
      score.push_back(temp1);
    }

    sort(score.begin(),score.end());
      
    for(int i=0;i<n-1;++i){
      mini=min(mini,score[i+1]-score[i]);
	}

    cout<<mini<<endl;
  }
}
      

Measured memory_bytes: 3072
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <limits>
#include <iterator>
#include <cmath>
using namespace std;

int main()
{
	long double t, x;
	cin >> t >> x;
	cout <<fixed<< setprecision(10) << t/x << endl;

	return 0;
}

Measured memory_bytes: 256
S = input()
ok = True
for i in range(len(S)):
    if (i + 1) % 2:
        if S[i] not in ['R', 'U', 'D']:
            ok = False
    else:
        if S[i] not in ['L', 'U', 'D']:
            ok = False

if ok:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<map>
#include<cmath>

using namespace std;

typedef long long ll;
#define INF 1000000007

int main(){
    int a[5], k;
    for(int i = 0; i < 5; i++)
    {
        cin >> a[i];
    }
    cin >> k;
    
    bool ok = true;
    for(int i = 0; i < 4; i++)
    {
        for(int j = i + 1; j < 5; j++)
        {
            if(a[j] - a[i] > k) ok = false;
        }
        
    }
    

    if(ok == true) cout << "Yay!" << "\n";
    else cout << ":(" << "\n";
    return 0;
}


Measured memory_bytes: 256
object Main extends App {
	
	override def main(args:Array[String]) = {
		val sc = new java.util.Scanner(System.in)
		
		val n = sc.nextInt
		val m = sc.nextInt
		
		var matrix = Array.ofDim[Int](n,m)
		var vector = new Array[Int](m)
		
		for(i <- (0 until n) ; j <- (0 until m)){
			matrix(i)(j) = sc.nextInt
		}
		
		for(j <- (0 until m)){
			vector(j) = sc.nextInt
		}
		
		val result = product(matrix, vector)
		for(i <- (0 until n)){
			println(result(i))
		}
	}
	
	def product(matrix: Array[Array[Int]] , vector: Array[Int]): Array[Int] ={
		val n = matrix.length
		val m = matrix(0).length
		
		var res = new Array[Int](n)
		
		for(i <- (0 until n)){
			var sum = 0
			for(j <- (0 until m)){
				sum = sum + matrix(i)(j) * vector(j)
			}
			res(i) = sum
		}
		res
	} 
}

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

using namespace std;

void scan() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
#define ll long long
#define fir first
#define sec second
int vis[10000];

int solve(int T) {
    int n;
    cin >> n;
    if (!vis[n]) cout << "No";
    else cout << "Yes";
    return 0;
}





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

    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            vis[i * j] ++;
        }
    }
    int T = 1;
//    cin >> T;
    for (int i = 1; i <= T; i++) solve(i);
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define ll long long

#define IMIN INT_MIN;
#define IMAX INT_MAX;

int maxelem(vector<int> src) {
	int dst = IMIN;
	rep(i, src.size()) {
		dst = (dst > src[i]) ? dst : src[i];
	}
	return dst;
}

int secondelem(vector<int> src) {
	int dst = IMIN;
	int dst2 = IMIN;
	rep(i, src.size()) {
		if (dst < src[i]) {
			dst2 = dst;
			dst = src[i];
		}
		else if (dst2 < src[i]) {
			dst2 = src[i];
		}
	}
	return dst2;
}

vector<int> count(vector<int> a) {
	int ma = maxelem(a);
	vector<int> count(ma+1, 0);
	rep(i, a.size()) {
		count[a[i]]++;
	}
	return count;
}

int find(vector<int> a, int b) {
	rep(i, a.size()) {
		if (a[i] == b) return i;
	}
	return -1;
}

int main(){
	int A, B, C, D;
	string x;
	int op[2] = { 1, -1 };
	char opc[2] = { '+', '-' };
	bool flag = false;
	cin >> x;
	A = x[0] - '0';
	B = x[1] - '0';
	C = x[2] - '0';
	D = x[3] - '0';
	rep(i, 2) {
		rep(j, 2) {
			rep(k, 2) {
				if (op[i] * B + op[j] * C + op[k] * D == 7 - A) {
					cout << A << opc[i] << B << opc[j] << C << opc[k] << D << "=7";
					flag = true;
					break;
				}
			}
			if (flag) break;
		}
		if (flag) break;
	}



	return 0;
}


Measured memory_bytes: 256
s = input()

u = int(s[:2])
d = int(s[2:])

if (1 <= u and u <= 12) and (1 <= d and d <= 12):
    print("AMBIGUOUS")
elif (1 <= u and u <= 12):
    print("MMYY")
elif (1 <= d and d <= 12):
    print("YYMM")
else:
    print("NA")


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

int main()
{
  int n,m,c,ans;
  cin>>n>>m>>c;
  ans=0;
  vector<int> b(m);
  vector<vector<int>> a(n,vector<int>(m));
  for(int i=0;i<m;i++)
  {
    cin>>b.at(i);
  }
  for(int i=0;i<n;i++)
  {
    for(int j=0;j<m;j++)
    {
      cin>>a.at(i).at(j);
    }
  }
  for(int i=0;i<n;i++)
  {
    int p=0;
    for(int j=0;j<m;j++)
    {
      p+=a.at(i).at(j)*b.at(j);
    }
    if(p+c>0)
      ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=(n)-1;i>=0;i--)
#define VSORT(v) sort(v.begin(), v.end())
#define SORT(v, n) sort(v, v+n)
#define VREV(v) reverse(v.begin(),v.end())
#define REV(v,n) reverse(v,v+n)
#define vi vector<int>
#define pf push_front
#define pb push_back

template<class T, size_t N> size_t countof(const T (&array)[N]) { return N; }
template <class T> void chmin(T&a,const T&b) { a = min(a,b); }
template <class T> void chmax(T&a,const T&b) { a = max(a,b); }
 
void print(){cout<<"\n";}
template <class Head, class... Tail>
void print(Head&& h,Tail&&... t){ 
	if(sizeof...(t)==0)
		cout<<h;
	else
		cout<<h<<' ';
	print(move(t)...);
}

void mprint(auto *matrix,auto N){
	REP(i,N) cout<<matrix<<(i!=N-1?' ':'\n');
	return;
}

const double EPS =1e-9;
const int INF =2e+9;
const ll INFL =9e+18;
const ll MOD =1000000007;
#define PI 3.14159265258979

#define P pair<int,int>
#define Pll pair<ll,ll>
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

inline int in(){int x; cin>>x; return x;}

struct UnionFind{
	vector<int> par; //データiが属する親の番号
	vector<int> sizes; //根ノードiの木に含まれるデータの数

	// 最初は全てのデータiがグループiに存在するものとして初期化
	UnionFind(int n):par(n),sizes(n, 1){
		REP(i,n) par[i] = i;
	}

	// 根を張り替えながら再帰的に根ノードを探す
	int find(int x){
		if(x==par[x]) return x;
		return par[x]=find(par[x]);
	}

	// 2つのデータx, yが属する木をマージする
	void unite(int x, int y) {
		// データの根ノードを得る
		x = find(x);
		y = find(y);

		// 既に同じ木に属しているならマージしない
		if (x == y) return;

		// xの木がyの木より大きくなるようにする
		if (sizes[x] < sizes[y]) swap(x, y);

		// xがyの親になるように連結する
		par[y] = x;
		sizes[x] += sizes[y];
		sizes[y] = 0;  // sizes[y]は無意味な値となるため
	}

	// 2つのデータx, yが属する木が同じならtrueを返す
	bool same(int x, int y) {
		return find(x) == find(y);
	}

	// データxが含まれる木の大きさを返す
	int size(int x) {
		return sizes[find(x)];
	}
};
int gcd(int n,int m){
	if(m>n) return gcd(m,n);
	if(m==0) return n;
	else return gcd(m,n%m); 
}

int main(void){
	int N,d[100000];
	cin>>N;
	REP(i,N) cin>>d[i];

	SORT(d,N);
	print(d[N/2]-d[N/2-1]);
	return 0;
}


Measured memory_bytes: 640
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

# import numpy as np
# from scipy.misc import perm
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 # 10^9 + 7

########

def main():
    A, B, Q = l_inpl()
    s = [-INF] + line_inpl(A) + [INF]
    t = [-INF] + line_inpl(B) + [INF]
    x = line_inpl(Q)

    for qi in range(Q):
        b, d = bisect_right(s, x[qi]), bisect_right(t, x[qi])
        res = INF
        for S in (s[b-1], s[b]):
            for T in (t[d-1], t[d]):
                d1, d2 = abs(S-x[qi]) + abs(T-S), abs(T-x[qi]) + abs(S-T)
                res = min(res, d1, d2)
        print(res)

if __name__ == "__main__":
    main()

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

int main() {
  int n; string s; cin >> n >> s;
  rep(i, s.size()) {
    if (s[i] + n > 'Z')
      s[i] = 'A' + (s[i] - 'Z' - 1);
    s[i] += n;
    cout << s[i];
  }
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

    string s;
    cin >> s;
    s = string(".") + s + string(".");

    using P = tuple<char, char>;
    vector<P> query;
    rep(i, q)
    {
        char t, d;
        cin >> t >> d;
        query.push_back(P(t, d));
    }

    int L = 0, R = n + 1;
    rrep(i, q)
    {
        if (L + 1 >= R) {
            cout << 0 << endl;
            return 0;
        }

        char t, d;
        tie(t, d) = query[i];
        if (d == 'L') {
            if (s[L + 1] == t) {
                L++;
            }
            if (s[R] == t) {
                R++;
            }
        } else {
            if (s[L] == t) {
                L--;
            }
            if (s[R - 1] == t) {
                R--;
            }
        }
    }
    cout << R - 1 - L << endl;

    return 0;
}

Measured memory_bytes: 1240
#include <bits/stdc++.h>
#define ll long long int 
#define endl '\n'
#define INF 1000000000
#define MOD 1000000007
#define MAX 100000000 
#define mp make_pair
#define pb push_back
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll h,w;
    cin>>h>>w;
    string s[h];
    for(int i=0;i<h;i++)
    {
    	cin>>s[i];
    	//cout<<s[i]<<endl;
    }
    ll dp[h][w];
    for(int i=0;i<h;i++)
    {
    	for(int j=0;j<w;j++)
    	{
    		if(s[i][j]=='#')
    		{
    			dp[i][j]=0;
    			continue;
    		}
    		if(i==0&&j==0)
    		{
    			dp[i][j]=1;
    			continue;
    		}
    		if(i==0)
    		{
    			dp[i][j]=dp[i][j-1];
    		}
    		else
    		if(j==0)
    		{
    			dp[i][j]=dp[i-1][j];
    		}
    		else
    		{
    			dp[i][j]=(dp[i-1][j]+dp[i][j-1])%MOD;
    		}
    	}
    }
    cout<<dp[h-1][w-1];
}

Measured memory_bytes: 12420
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    string s;
    cin >> n >> s;
    VI a(n+2);
    s += s;
    REP(x,2) REP(y,2){
        a[0] = x;
        a[1] = y;
        FOR(i,1,n){
            if ((s[i] == 'o') ^ (a[i] == 0)) a[i+1] = a[i-1];
            else a[i+1] = a[i-1] ^ 1;
        }
        if (a[0] == a[n] && a[1] == a[n+1]){
            REP(i,n) cout << (a[i] ? 'S' : 'W');
            cout << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 1052
x = int(input())

if 400 <= x <= 599:
  print(8)
if 600 <= x <= 799:
  print(7)
if 800 <= x <= 999:
  print(6)
if 1000 <= x <= 1199:
  print(5)
if 1200 <= x <= 1399:
  print(4)
if 1400 <= x <= 1599:
  print(3)
if 1600 <= x <= 1799:
  print(2)
if 1800 <= x <= 1999:
  print(1)

Measured memory_bytes: 9184
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> V(N);
    rep(i,0,N)cin >> V[i];
    sort(V.begin(), V.end());

    int table[3000] = {};
    rep(i,0,N)rep(j,i+1,N)table[V[i] + V[j]]++;

    ll cnt = 0;
    
    rep(i,2,N){
        rep(j,0,i){
            ll num = V[i] - V[j];
            auto itr = upper_bound(V.begin(), V.begin() + j, num);
            //cout << *itr << endl;

            int dif = distance(V.begin(), itr);
            dif = j - dif;
            //dif = max(0, dif - 1);
            //if(V[i] > V[j] + V[j])dif = max(0, dif - 1);
            //cout << V[i] << " " << V[j] << " " << dif << " " << *itr << endl;
            cnt += dif;
        }
        //cout << endl;
    }
    cout << cnt << endl;
    /*
    rep(i,0,N){
        ll sub = 0;
        rep(j,V[i]+1,3000)sub += table[j];
        //cout << i << " " << sub << endl;

    }
    cout << cnt << endl;

    ll cnt2 = 0;
    rep(i,0,N)rep(j,i+1,N)rep(k,j+1,N)if(V[k] < V[i] + V[j])cnt2++;
    cout << cnt2 << endl;
    */
}

Measured memory_bytes: 256
#include <stdio.h>
#define MAX 100005
#define NIL -1

struct Node {int p,l,r;};

struct Node  T[MAX];
int n,D[MAX];

void print(int u){
  int i,c;

  printf("node %d: ",u);
  printf("parent = %d,",T[u].p);
  printf(" depth = %d, ",D[u]);


  if(T[u].p == NIL) printf("root, ");
  else if (T[u].l == NIL) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i) printf(", ");
    printf("%d",c);
  }
  printf("]\n");

}

int rec(int u,int p){
  D[u] = p;
  if(T[u].r != NIL) rec(T[u].r,p);
  if(T[u].l != NIL) rec(T[u].l,p+1);
}

int main(){

  int n,i,j,num,node,nodenum,c,left,right;
  
  scanf("%d",&n);
  for(i=0;i<n;i++) T[i].p = T[i].l = T[i].r = NIL;

  for(i = 0;i<n;i++){
    scanf("%d %d",&node,&nodenum);
    for(j=0;j<nodenum;j++){
      if(nodenum == 0) break;
      scanf("%d",&c);
      if(j == 0) T[node].l = c;
      else T[left].r = c;
      left = c;
      T[c].p = node;
    }
  }
  for(i=0;i<n;i++) if(T[i].p == NIL) right = i;

  rec(right,0);
 
  for(i=0;i<n;i++) print(i);
    return 0;
}
    


Measured memory_bytes: 6484
import numpy as np

N, M = map(int, input().split())
X = list(map(int, input().split()))
X = np.array(X)

X_sorted = np.sort(X)[::-1]
X_diff = X_sorted[:-1] - X_sorted[1:]
X_diff_sorted = np.sort(X_diff)[::-1]

print(X_sorted[0] - X_sorted[-1] - X_diff_sorted[:N-1].sum())

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

int main(void) {
    int n, s, i;
    double sum, sum2, dev;

    while (1) {
        scanf("%d", &n);
        if (n==0) break;
        sum=0;
        sum2=0;
        for (i=0;i<n;i++) {
            scanf("%d", &s);
            sum+=s;
            sum2+=s*s;
        }
        dev = sqrt(sum2/(double)n - sum*sum/(double)n/(double)n);
        printf("%.4lf\n", dev);
    }

    return 0;
}



Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
template <typename Functor>
struct fix_type
{
    Functor functor;
    template <typename... Args>
    decltype(auto) operator()(Args&&... args) const& { return functor(functor, std::forward<Args>(args)...); }
};
template <typename Functor>
fix_type<typename std::decay<Functor>::type> fix(Functor&& functor) { return {std::forward<Functor>(functor)}; }
int main()
{
    while (true) {
        int M, N;
        cin >> M >> N;
        if (M == 0 and N == 0) { break; }
        vector<string> obj(N);
        for (int i = 0; i < N; i++) { cin >> obj[i]; }
        map<vector<int>, int> memo;
        auto f = fix([&](auto&& self, const vector<int>& S) -> int {
            if (S.size() == 1) { return 0; }
            if (memo.find(S) != memo.end()) { return memo[S]; }
            int ans = 1 << 30;
            for (int i = 0; i < M; i++) {
                vector<int> l;
                vector<int> r;
                for (const int j : S) { (obj[j][i] == '0' ? l : r).push_back(j); }
                if (l.empty() or r.empty()) { continue; }
                ans = min(ans, max(self(self, l), self(self, r)) + 1);
            }
            return memo[S] = ans;
        });
        vector<int> S(N);
        iota(S.begin(), S.end(), 0);
        cout << f(S) << endl;
    }
    return 0;
}



Measured memory_bytes: 5096
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
atoe = [a, b, c, d, e]
flag = True
for i in atoe:
    if not flag: break
    for j in atoe:
        if abs(i-j) > k:
            flag = False
            print(':(')
            break
if flag:
    print('Yay!')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e5+10;
pair<string,int>s[SIZE];
int id;
int cnt[SIZE][27],nxt[SIZE][27],dp[SIZE][27][27];
int f(int lv,int x,int y){
    if(x+1==y)return s[x].S;
    if(SZ(s[x].F)!=lv&&s[x].F[lv]==s[y-1].F[lv]){
        return f(lv+1,x,y);
    }
    int st=x;
    int me=id++;
    if(SZ(s[x].F)==lv){
        //printf("[%d]:%d\n",me,s[x].S);
        nxt[me][0]=s[x].S;
        st++;
    }
    cnt[me][0]=st-x;
    for(int i=st,j;i<y;i=j){
        for(j=i+1;j<y&&s[j].F[lv]==s[i].F[lv];j++);
        cnt[me][s[i].F[lv]]=j-i;
        nxt[me][s[i].F[lv]]=f(lv+1,i,j);
    }
    return me;
}
int tmp[27][27];
void go(int x){
    REP(i,27){
        if(cnt[x][i]==0)continue;
        REP(j,27){
            tmp[i][j]+=cnt[x][j];
        }
        if(cnt[x][i]==1){
            memcpy(dp[nxt[x][i]],tmp,sizeof(tmp));
        }
        else go(nxt[x][i]);
        REP(j,27){
            tmp[i][j]-=cnt[x][j];
        }
    }

}
int main(){
    id=1;
    DRI(N);
    REP(i,N){
        cin>>s[i].F;
        s[i].S=i+1;
    }
    sort(s,s+N);
    REP(i,N)REP(j,SZ(s[i].F))s[i].F[j]-='a'-1;
    f(0,0,N);
    go(1);
    DRI(Q);
    while(Q--){
        DRI(k);
        char input[30];
        RS(input);
        REP(i,26)input[i]-='a'-1;
        int an=1;
        REPP(i,1,27){
            an+=dp[k][i][0];
            for(int j=0;input[j]!=i;j++)an+=dp[k][i][input[j]];
        }
        printf("%d\n",an);
    }
    return 0;
}


Measured memory_bytes: 297088
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main()
    {
        var NX = ReadLine().Split().Select(int.Parse).ToArray();
        var N = NX[0];
        var X = NX[1];
        var m = new int[N];
        for (int i = 0; i < N; i++)
        {
            m[i] = int.Parse(ReadLine());
        }

        X -= m.Sum();
        var a = X / m.Min();
        WriteLine(N + a);
    }
}

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

import sys
import os
import math

N, M = map(int, input().split())

A = [0] * N
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1

    A[a] += 1
    A[b] += 1

for i in range(N):
    print(A[i])


Measured memory_bytes: 3060
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt();
    String s=sc.next(),res="",f="";
    int k=sc.nextInt();
    for(int i=0;i<n;i++)if(i+1==k)f=s.substring(i, i+1);
    for(int i=0;i<n;i++) {
    	if(s.substring(i, i+1).equals(f)) {
    		res+=s.substring(i, i+1);
    	}else {
    		res+="*";
    	}
    }
    System.out.println(res);
  }
}


Measured memory_bytes: 21716
#include <stdio.h>
long long n;
int a, x, y;
int main() {
	scanf("%lld", &n);
	for (long long i = 2; i < 1000000; i++) {
		while (!(n % i)) {
			a++;
			n /= i;
		}
		x = 1;
		while (a >= x) {
			a -= x;
			x++;
		}
		y += x - 1;
		a = 0;
	}
	if (n != 1)y++;
	printf("%d\n", y);
}

Measured memory_bytes: 1720
#include<bits/stdc++.h>
#define rep(i, n) for (int i=0;i<(n);i++)
using namespace std;
#define vecout(V) for(int i=0;i<V.size();i++) {cout<<V[i]<<endl;}
typedef long long ll;

struct unionfind{
    vector<int> d;
    unionfind(int n=0) : d(n, -1){}
    int find(int x) {//根を返す関数
        if(d[x]<0) return x;
        return d[x]=find(d[x]);//d[x]にfind[d[x]]の値を代入してそれを返している．これにより根に全ての子を繋げられる．
    }
    bool unite(int x, int y){
        x=find(x);y=find(y);
        if(x == y) return false;
        if(d[x]>d[y]) swap(x, y);//-なので逆にしている
        d[x]+=d[y];//連結成分サイズを保持している
        d[y]=x;//yの根をxにしている
        return true;
    }
    bool same(int x, int y){return find(x)==find(y);}//同じかどうかを判定
    int size(int x){
        return -d[find(x)];
    }//連結成分の数を返す
};

int main(void){
    int n, m;
    cin>>n>>m;
    vector<pair<pair<int, int>, int> > v(m);
    rep(i, m){
        int x, y, z;
        cin>>x>>y>>z;
        --x;--y;
        v[i]=make_pair(make_pair(x, y), z);
    }
    unionfind uf(n);
    rep(i, m){
        uf.unite(v[i].first.first, v[i].first.second);
    }
    int ans=1;
    vector<int> root;
    rep(i, n){
        root.push_back(uf.find(i));
    }
    sort(root.begin(), root.end());
    rep(i, n-1){
        if (root[i]!=root[i+1]) ans++;
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 2428
#include<iostream>
using namespace std;
long long ans;
void dfs(long long a,long long b)
{
	if(a%b==0)
	{
		ans+=b*(a/b*2-1);
		printf("%lld",ans);
	}
	else
	{
		ans+=b*(a/b*2);
		dfs(b,a%b);
	}
}
int main()
{
	long long n,x;
	scanf("%lld%lld",&n,&x);
	if(x*2>n)x=n-x;
	if(n==x*2)
	  printf("%lld",x*3);
	else
	{
		ans=n;
		dfs(n-x,x);
	}
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
char a[1000+10];
int main()
{
	scanf("%s",a);
	int len=strlen(a);
	int i=0;
	int t=len-1;
	int flag=0;
	for(;i<=len/2;i++,t--)
	{
		if(a[i]!=a[t])
		{
			flag=1;
			break;
		}
	}
	if(flag)
		printf("No");
	else 
		printf("Yes");
	printf("\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
bool can(vector<int> xs,int X){
	vector<bool> dp(40001);
	dp[20000] = 1;
	for(int x:xs){
		vector<bool> ndp(40001);
		rep(i,40001) if(dp[i]) ndp[i-x] = ndp[i+x] = 1;
		dp = ndp;
	}
	return dp[20000+X];
}
int main(){
	string s;
	int x,y;
	cin>>s>>x>>y;
	int N = s.size();
	int now = 0;
	bool fst = 1;
	bool isx = 1;
	vector<int> xs,ys;
	rep(i,N+1){
		if(i!=N && s[i]=='F'){
			now++;
		}else{
			if(fst){
				x -= now;
				fst = 0;
			}else{
				if(isx) xs.pb(now);
				else ys.pb(now);
			}
			now = 0;
			isx = !isx;
		}
	}
	if(can(xs,x) && can(ys,y)) puts("Yes");
	else puts("No");
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=b-1; (ll)(a)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};


int main(){
    ll n, k;    cin >> n >> k;
    vector<ll> dp(k+1, 0), a(n);
    rep(i, n)   cin >> a[i];
    
    rep(i, k+1){
        rep(j, n){
            if(a[j]<=i && dp[i-a[j]]==0) dp[i] = 1;
        }
    }
    if(dp[k]) cout << "First" << endl;
    else cout << "Second" << endl;
}


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

using namespace std;

using ll = long long int;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	for (ll a = 1; a <= 3500; a++) {
		for (ll b = 1; b <= 3500; b++) {
			ll x = n * a * b;
			ll y = 4 * a * b - n * b - n * a;
			if (y > 0 && x % y == 0) {
				ll c = x / y;
				cout << a << " " << b << " " << c << endl;
				return 0;
			}
		}
	}
	return 0;
}


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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
    int N,M,X,Y;
    cin >> N >> M >> X >> Y;
    int max_x = -1000;
    int min_y = 1000;
    for (int i = 0; i < N; i++) {
        int tmp;
        cin >> tmp;
        max_x = max(max_x,tmp);
    }
    for (int i = 0; i < M; i++) {
        int tmp;
        cin >> tmp;
        min_y = min(min_y,tmp);
    }

    for (int z = -100; z < 101; z++) {
        if (X < z && z <= Y && max_x < z && min_y >= z) {
            cout << "No War" << endl;
            return 0;
        }
    }
    cout << "War" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

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;
}

string s, t;

void solve() {
    int max_s = 3010;
    ll dp[max_s][max_s];
    dp[0][0] = 0;
    rep(i_s, s.length()) {
        rep(i_t, t.length()) {
            if (s[i_s] == t[i_t]) {
                chmax(dp[i_s + 1][i_t + 1], dp[i_s][i_t] + 1);
            } else {
                chmax(dp[i_s + 1][i_t + 1], max(dp[i_s][i_t + 1], dp[i_s + 1][i_t]));
            }
        }
    }
    string ans;
    int i_s = s.length() - 1;
    int i_t = t.length() - 1;

    while (i_s >= 0 && i_t >= 0) {
        if (dp[i_s + 1][i_t + 1] > max(dp[i_s][i_t + 1], dp[i_s + 1][i_t])) {
            ans = s[i_s] + ans;
            i_s--, i_t--;
        } else {
            if (dp[i_s + 1][i_t + 1] == dp[i_s][i_t + 1]) i_s--;
            else i_t--;
        }
    }
    cout << ans << endl;
}

int main() {
    cin >> s >> t;
    solve();
    return 0;
}

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

using namespace std;

using u32 = uint32_t;
using u64 = uint64_t;
using i64 = int64_t;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = (b-1); i >= a; i--)
#define RF0(i,b) RFO(i,0,b)

bool kaibun(string s) {
  F0R(i, s.length() / 2) {
    if (s[i] != s[s.length() - 1 - i]) {
      return false;
    }
  }
  return true;
}

bool veryKaibun(string s) {
  int n = s.length();
  int s3 = (n + 3) / 2 - 1;
  return kaibun(s) && kaibun(s.substr(0, (n - 1) / 2))
    && kaibun(s.substr(s3, n - s3));
}

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

  string S;
  cin >> S;

  cout << (veryKaibun(S) ? "Yes" : "No");
}


Measured memory_bytes: 256