akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CRectangleCutting solver = new CRectangleCutting();
        solver.solve(1, in, out);
        out.close();
    }

    static class CRectangleCutting {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long w = in.nextLong(), h = in.nextLong();
            long x = in.nextLong(), y = in.nextLong();

            double answer = ((double) (w * h)) / 2;
            boolean ways = 2 * x == w && 2 * y == h;

            out.format("%f %d%n", answer, ways ? 1 : 0);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }
}



Measured memory_bytes: 21588
a,b = map(int,input().split())
alibli =[]
bli = []
for i in range(10):
    bli.append(10*b + i)
for i in range(10):
    if bli[i]//12.5 == a:
        alibli.append(bli[i])
if alibli != []:
    print(min(alibli))
else:
    print("-1")


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			int L = sc.nextInt();
			int[] pos = new int[N];
			int[] dir = new int[N];
			boolean[] exit = new boolean[N];
			for (int i = 0; i < N; ++i) {
				dir[i] = sc.next().charAt(0) == 'R' ? 1 : -1;
				pos[i] = sc.nextInt() * 2;
			}
			int c = 0;
			int exitL = -1;
			int exitR = -1;
			int time = 0;
			for (; c < N; ++time) {
				exitL = -1;
				exitR = -1;
				for (int j = 0; j < N; ++j) {
					if (exit[j]) continue;
					pos[j] += dir[j];
					if (pos[j] == 0) {
						exitL = j;
						++c;
					}
					if (pos[j] == L * 2) {
						exitR = j;
						++c;
					}
				}
				for (int j = 0; j < N; ++j) {
					if (!exit[j] && pos[j] % 2 == 0) {
						for (int k = 0; k < j; ++k) {
							if (pos[k] == pos[j]) {
								dir[k] *= -1;
								dir[j] *= -1;
							}
						}
					}
				}
			}
			System.out.println(time / 2 + " " + ((exitL != -1 ? exitL : exitR) + 1));
		}
	}
}

Measured memory_bytes: 24724
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

const string YES = "Yes";
const string NO = "No";

void solve(long long a, long long b, long long c, long long d){
    if (abs(a-c) <= d){
        cout << YES << endl;
    } else if (abs(a-b) <= d && abs(b-c) <= d) {
        cout << YES << endl;
    } else{
        cout << NO << endl;
    }
}

int main(){

    long long a;
    scanf("%lld",&a);
    long long b;
    scanf("%lld",&b);
    long long c;
    scanf("%lld",&c);
    long long d;
    scanf("%lld",&d);
    solve(a, b, c, d);
    return 0;
}



Measured memory_bytes: 256
// Best practice
 
#include<bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii         pair<int,int>
#define psi         pair<string,int>
#define vi             vector<int>
#define vpii          vector<pii>
#define vvi         vector<vi>
#define sz(x)        (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define prec(n)     fixed<<setprecision(n)
#define ini(a, i)     memset(a, i, sizeof(a))
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
using namespace std;
 
#define debug(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<i<<" "; cout<< "]" << endl
#define debugp(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<"("<<i.x<<","<<i.y<<")"<<" "; cout<< "]" << endl
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << "[" << *it << ": " << a << "]\t";
    err(++it, args...);
}
 
// const int dx[4] = { -1, 1, 0, 0};
// const int dy[4] = {0, 0, -1, 1};
// int dX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
// int dY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
 
 
// Code from Here -------------------------------------------------------------------------------

signed main() {
    tezz
 
    int n, p;
    cin >> n;
    map<int,int> mp;
    for(int i=0; i<n; i++){
        cin >> p;
        vi arr;
        for(int j=2; j*j<=p; j++){
            if(p%j==0){
                while(p%j==0)p/=j;
                mp[j]++;
            }
        }
        if(p>1)mp[p]++;
    }
    int c=1;
    for(auto it: mp){
        if(it.y == n){
            cout << "not coprime" << endl;
            return 0;
        }
    }
    for(auto it: mp){
        if(it.y > 1){
            cout << "setwise coprime" << endl;
            return 0;
        }
    }
    cout << "pairwise coprime" << endl;
 
    return 0;
}  

Measured memory_bytes: 8556
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

string s, t;

int solve() {
    int l = s.size();
    int res = 0;
    for (int i = 0; i < l; i++) {
        if (s[i] != t[i])
            res++;
    }
    return res;
}

void input() {
    cin >> s >> t;
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 3728
#include<stdio.h>
//A is array and N is count
int selection_sort(int array[],int size){
  int count=0,min,min_index,tmp,i,j;
  for(i=0;i<size;i++){
    min_index=i;
    for(j=i;j<size;j++){
      if(array[j]<array[min_index]){
        min=array[j];
        min_index=j;
      }
    }
    if(i!=min_index) count++;
    tmp=array[i];
    array[i]=min;
    array[min_index]=tmp;
  }
  return count;
}

int main(void){
  int i,size,array[100000],count;
  scanf("%d",&size);
  for(i=0;i<size;i++){
    scanf("%d",&array[i]);
  }
  count = selection_sort(array,size);
  for(i=0;i<size;i++){
    if(i>0) printf(" ");
    printf("%d",array[i]);
  }
  printf("\n");
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 1764
def digit_gen(num_str, index):
    global S, sum_list
    if index == len(S):
        sum_list.append(num_str)
        return
    digit_gen(num_str + S[index], index + 1)
    digit_gen(num_str + S[index] + "+", index + 1)


if __name__ == "__main__":
    S = [c for c in input()]  
    index = 0
    sum_list = []
    num_str = ""
    digit_gen(num_str, index)
    sum_list = sum_list[::2]
    ans = 0
    a = "ans += "
    for num_str in sum_list:
        exec(a+num_str)
    print(ans)


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

int x,y;

int main() {
  cin >> x  >> y;
  if(x==y||y==1||x%y==0)
  cout << -1 << endl;
  else
  cout << x << endl;
}

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

using namespace std;
#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 rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

int decompositPrime(int n) {
	int a = 2;
	int cnt = 0;
	int ans = 0;
	while (n >= a * a) {
		cnt = 0;
		while (n % a == 0) {
			n /= a;
			cnt++;
		}
		int sub = 1;
		while (cnt >= sub) {
			cnt -= sub;
			ans++;
			sub++;
		}
		a++;
	}
	if (n != 1) {
		ans++;
	}
	return ans;
}

signed main(void) {
	int n;
	cin >> n;
	print(decompositPrime(n));
}

Measured memory_bytes: 3692
from sys import stdin
#stdin = open("input.txt")

def bubbleSort(A, N):
    flag = True
    cnt = 0
    while flag:
        flag = False
        for j in range(N-1, 0, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                cnt += 1
                flag = True
    return cnt

if __name__ == "__main__":
    N = int(stdin.readline())
    A = [int(item) for item in stdin.readline().split()]
    cnt = bubbleSort(A, N)
    print(*A)
    print(cnt)


Measured memory_bytes: 5616
from operator import itemgetter
while 1:
	N = int(raw_input())
	if N == 0:
		break
	produce = []
	for i in range(N):
		inputs = raw_input().split(" ")
		name = inputs[0]
		p,a,b,c,d,e,f,s,m = map(int,inputs[1:])
		time = (a + b + c) + (d + e) * m
		value = f * s * m - p
		produce.append((-1.0 * value / time, name))
	produce.sort(key=itemgetter(0,1))
	for pro in produce:
		print pro[1]
	print "#" 

Measured memory_bytes: 4384
import math
from itertools import combinations
n = int(input())
p = [list(map(int, input().split())) for i in range(n)]
def enclose(points):

    a = points[0]
    b = points[1]
    c = points[2]
    d = points[3]
    e = points[4]
    f = points[5]

    aa = a * a
    bb = b * b
    cc = c * c
    dd = d * d
    ee = e * e
    ff = f * f

    py = ((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee- ff)) / (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f))

    px = (2 * (b - f) * py - aa - bb + ee + ff) / (2 * (e - a)) \
        if (c == a) else (2 * (b - d) * py - aa - bb + cc + dd) / (2 * (c - a))

    r = math.hypot(px - a, py - b)

    return (px, py, r)


ans = 1000000

if n >= 3:
    for i, j, k in combinations(range(n), 3):
        points = []
        points.extend(p[i])
        points.extend(p[j])
        points.extend(p[k])
        try:
            px, py, r = enclose(points)
        except:
            continue
        flag = 1
        for l in range(n):
            if (px-p[l][0])**2 + (py-p[l][1])**2 > r**2 + 0.0000001:
                flag = 0
                break
        if flag == 1:
            ans = min(ans, r)

for i, j in combinations(range(n), 2):
    px = (p[i][0]+p[j][0]) / 2
    py = (p[i][1]+p[j][1]) / 2
    r = ((p[i][0] - px)**2 + (p[i][1] - py) ** 2) ** (1/2)
    flag = 1
    for l in range(n):
        if (px-p[l][0])**2 + (py-p[l][1])**2 > r**2 + 0.0000001:
            flag = 0
            break
    if flag == 1:
        ans = min(ans, r)

print(ans)


Measured memory_bytes: 49900
#include "bits/stdc++.h"
#include <random>
using namespace std; typedef unsigned long long _ulong; typedef long long int lint; typedef pair<lint, lint> plint; typedef pair<double long, double long> pld;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define endk '\n'
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
const lint mod = 1e9 + 7, _INF = 1e18;
lint dx[8] = { 0, -1, 1, 0, 1, -1, 1, -1 }, dy[8] = { 1, 0, 0, -1, -1, -1, 1, 1 };
typedef pair<double, lint> Pa;

string s;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> s;
	lint cnt = 0, maxv = 0;
	REP(i, 3) {
		if (s[i] == 'R') {
			cnt++;
		}
		else {
			chmax(maxv, cnt);
			cnt = 0;
		}
	}
	chmax(maxv, cnt);
	cout << maxv << endk;
}	

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

int a[100] = {0};
ll dp[100][30] = {0};

signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int(n);
    scn(n, a);

    dp[0][a[0]] = 1;
    rep1(i, n - 1)rep(j, 21){
      dp[i][j + a[i]] += dp[i - 1][j];
      if(j - a[i] >= 0)dp[i][j - a[i]] += dp[i - 1][j];
    }
    pri(dp[n - 2][a[n - 1]]);

/*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 3236
#include <stdio.h>

#define N 100000

int n, q;
int s[N], t[N];
int binary(int);

main() {
  int i, judge, count = 0;

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

  for(i = 0; i < q; i++) {
    judge = binary(t[i]);
    if(judge == 1) {
      count++;
    }
    else {
      continue;
    }
  }

  printf("%d\n", count);
  return 0;
}

int binary(int key) {
  int mid, left = 0, right = n;
  while(left < right) {
    mid = (left + right) / 2;
    if(key == s[mid]) {
      return 1;
    }
    if(key > s[mid]) {
      left = mid + 1;
    }
    else if(key < s[mid]) {
      right = mid;
    }
  }
  return 0;
}

Measured memory_bytes: 1188
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <ctype.h>
#include <stdlib.h>


using namespace std;


int main(){
    int N;
    cin >> N;
    vector<int> p(N);
    vector<int> p2(N);

    for (int i = 0; i < N; i++)
    {
        /* code */
        cin >> p[i];
        p2[i] = p[i];
    } 

    int cnt = 0;
    sort(p.begin(),p.end());
    for (int i = 0; i < N - 1 ; i++)
    {
        /* code */
        if(p[i] != p2[i]){
            cnt++;
        }
    }

    
    if(cnt >= 3){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
    


}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;


int main() {

    string S;
    cin >> S;


    if (S[0] == S[1] and S[1] == S[2]) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}

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

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back
#define MOD 1000000007
const int N=100005;


int32_t main()
{
	int n;
	cin>>n;
	vector<int> a(n),suffix(n+1);
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int i=n-1;i>=0;i--)
	{
		suffix[i]=(suffix[i+1]+a[i])%MOD;
	}
	int ans=0,res=0;;
	for(int i=0;i<n;i++)
	{
		ans=(a[i]*suffix[i+1])%MOD;
		res=(res+ans)%MOD;
	}
	cout<<res;
	
	
	
}


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

int main(){
    int n;
    cin>>n;
    int a[n], b[n], c[n];
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i]>>c[i];
    int dpa[n], dpb[n], dpc[n];
    dpa[0] = a[0];
    dpb[0] = b[0];
    dpc[0] = c[0];
    for(int i=1;i<n;i++){
        dpa[i] = max(dpb[i-1],dpc[i-1]) + a[i];
        dpb[i] = max(dpa[i-1],dpc[i-1]) + b[i];
        dpc[i] = max(dpb[i-1],dpa[i-1]) + c[i];
    }
    cout<<max(max(dpa[n-1],dpb[n-1]),dpc[n-1]);
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define _rep(i,m,n) for(long long int i = m; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;
const ll mod = 1000000007;

int main() {
    string s; cin >> s;
    int ans = 0;
    rep(i,4){
        if(s[i] == '+')ans++;
        else ans--;
    }
    print(ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
typedef pair<int,P>PP;
#define fi first
#define se second

int n,a[10001];
double tim[11111],dp[11111];
double b,r,v,e,f;

signed main(){
	while(cin>>n,n){
		r(i,11111)dp[i]=1e15;
		tim[0]=0;
		r(i,n)cin>>a[i];
		cin>>b>>r>>v>>e>>f;
		r(i,11100){
			if(i>=r) tim[i+1]= 1.0/(v-e*(double)(i-r)) + tim[i];
			else tim[i+1]= 1.0/(v-f*(double)(r-i)) + tim[i];
		}
		r(i,n)dp[i+1]=tim[a[i]];
		r(i,n){
			r(j,n){
				dp[j+1]=min(dp[j+1],dp[i+1]+tim[a[j]-a[i]]+b);
			}
		}
		printf("%.11f\n",dp[n]);
	}
}


Measured memory_bytes: 3332
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.B
{
    internal static class CR
    {
        public static string GetText() { return Console.ReadLine(); }
        public static List<string> GetTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long GetLong() { return long.Parse(Console.ReadLine()); }
        public static List<long> GetLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }
    }

    public class Program
    {
        public static string S { get; private set; }
        public static int N { get; private set; }

        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            S = CR.GetText();
            N = S.Length;

            if (!IsKaibun(S))
            {
                return "No";
            }

            var s1 = S.Substring(0, (N - 1) / 2);
            if (!IsKaibun(s1))
            {
                return "No";
            }
            var s2 = S.Substring((N + 3) / 2 - 1);
            if (!IsKaibun(s2))
            {
                return "No";
            }

            return "Yes";
        }

        private static bool IsKaibun(string s)
        {
            var harfIndex = s.Length / 2;
            for (int i = 0; i < harfIndex; i++)
            {
                if (s[i] != s[s.Length - 1 - i])
                {
                    return false;
                }
            }

            return true;
        }
    }
}


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

using namespace std;
using ll = long long;

int main() {
	const ll INF = 1e18;
	ll L;
	cin >> L;
	vector<ll> A(L + 1);
	for (int i = 1; i <= L; ++i) { cin >> A[i]; }

	array<ll, 5> now;
	now.fill(INF);
	now[0] = 0;
	for (int i = 1; i <= L; ++i) {
		ll base = INF;
		for (int j = 0; j < 5; ++j) {
			base = min(base, now[j]);
			ll add = 0;
			if ((j == 0) || (j == 4)) { add = A[i]; }
			if ((j == 1) || (j == 3)) { add = (A[i] == 0 ? 2 : A[i] % 2); }
			if (j == 2) { add = 1 - (A[i] % 2); }

			now[j] = base + add;
		}
	}

	ll res = INF;
	for (int i = 0; i < 5; ++i) { res = min(res, now[i]); }
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 1792
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n, k := scanInt(), scanInt()
	a := scanInts(n)

	l, r := 0, int(1e9)
	for l+1 != r {
		c := 0
		mid := (l + r) / 2
		for i := 0; i < n; i++ {
			c += (a[i]+mid-1)/mid - 1
		}
		if c <= k {
			r = mid
		} else {
			l = mid
		}
	}
	fmt.Fprintln(wr, r)
}


Measured memory_bytes: 5836
"use strict";

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }

function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

!function () {
  function splitNum(line) {
    return (Array.isArray(line) ? line : line.split(/\s+/)).map(function (n) {
      return parseInt(n);
    });
  }

  !function (input) {
    var lines = input.split("\n");

    var _splitNum = splitNum(lines[0]),
        _splitNum2 = _slicedToArray(_splitNum, 3),
        P = _splitNum2[0],
        Q = _splitNum2[1],
        R = _splitNum2[2];

    console.log(Math.min(P + Q, Q + R, R + P));
  }(require("fs").readFileSync("/dev/stdin", "utf8"));
}();


Measured memory_bytes: 21060
import numpy as np
N = int(input())
W = list(map(int,input().split()))
sumall = sum(W)
check = list()
for i in range(N):
    sumunder = 0
    sumover = 0
    for j in range(0,i):
        sumunder += W[j]
    sumover = sumall - sumunder
    check.append(abs(sumover-sumunder))
print(min(check))
    
    

Measured memory_bytes: 12500
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
bool isPrime[1000001];
ll power(ll a,ll b)
{
    ll result = 1;
    while(b>0)
    {
        if(b%2)
        {
            result = (a*result)%mod;
        }
        a = (a*a)%mod;
        b = b/2;
    }
    return result;
}
int gcd(int a,int b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b,a%b);
}
void sieve()
{
    memset(isPrime,1,sizeof(isPrime));
    isPrime[0] = isPrime[1] = 0;
    for(int i=2;i*i<=1000000;i++)
    {
        if(isPrime[i])
        {
            for(int j=i*i;j<=1000000;j+=i)
            {
                isPrime[j] = 0;
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    int t,n;
    t = 1;
    for(int i=0;i<t;i++)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        if (b<=c) 
        {
            cout<<a*(b-1)/b;
        } 
        else 
        {
            cout<<a*c/b;
        }
    }
    return 0;
}

Measured memory_bytes: 3612
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (let* ((a (read))
         (b (read))
         (c (read))
         (d (read))
         (e (read))
         (k (read)))
    (if (<= (- e a) k)
        (write-line "Yay!")
        (write-line ":("))))

#-swank(main)


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

typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int n,m;
int l[200000],r[200000];
signed main() {
    cin >> n>> m;

    int mi=n,mx=0;
    for (int i=0;i<m;i++) {
        cin >> l[i] >> r[i];
        mi = min(mi,r[i]);
        mx = max(mx,l[i]);
    }
    int ans = max(mi - mx +1,0);
    cout << ans << endl;


}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long ll;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

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

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define RREP(i,n) RFOR(i,n,0)

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << "[L " << __LINE__ << "] " << #x << " = " << (x) << "\n";

const int INF = 1e9;
const double EPS = 1e-10;

int h,w;
int c[26];

int main() {
	cin>>h>>w;

	REP(i,h){
		string s;
		cin>>s;
		REP(j,w){
			c[s[j]-'a']++;
		}
	}
	int n4=(h/2)*(w/2);//4
//	int n2=(h%2)*(w/2)+(h/2)*(w%2)-(h%2)*(w%2);//2
	int n1=(h%2)*(w%2);//1
	int c1=0,c4=0;
	REP(i,26)if(c[i]>0){
		if(c[i]%2==1)c1++;
		c4+=c[i]/4;
	}
	if(n1==!!c1 && c1<2 && c4>=n4)
		cout << "Yes"<<endl;
	else cout << "No" <<endl;

}


Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var A, B, C, X, Y int
	fmt.Scan(&A, &B, &C, &X, &Y)

	ans := math.MaxInt64
	for i := 0; i <= max(X, Y); i++ {
		cst := i * 2 * C
		cst += max(0, A*(X-i))
		cst += max(0, B*(Y-i))
		ans = min(ans, cst)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <fstream>
#include <random>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;



int main() {

    //freopen("../input.txt", "r", stdin);

    ios::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    int a, b;
    cin >> a >> b;

    for (int price = 1; price <= 2000; ++price) {
        int price1 = price * 2 / 25;
        int price2 = price / 10;

        if (price1 == a && price2 == b) {
            cout << price;
            return 0;
        }
    }

    cout << -1;
    return 0;

    return 0;
}

Measured memory_bytes: 256
S = input()

s = list(S)
num = []
for k in s:
    num.append(int(k))

num1 = 10*num[0] + num[1]

num2 = 10*num[2] + num[3]

ans1 = False
ans2 = False
if num1 < 13 and num1 >0:
    ans1 = True

if num2 < 13 and num2 >0:
    ans2 = True

if ans1 and ans2:
    print("AMBIGUOUS")
elif ans1 and not ans2:
    print("MMYY")
elif not ans1 and ans2:
    print("YYMM")
else:
    print("NA")

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

int main() {
	int d;
	cin >> d;
	const int n = 26;
	vector<int> c(n);
	vector<vector<int>> s(d, vector<int>(n));
	rep(i, n) cin >> c[i];
	rep(i, d) rep(j, n) cin >> s[i][j];
	vector<int> t(d);
	
	random_device rnd;
    mt19937 mt(rnd());
	rep (i, d) t[i] = mt()%n + 1;
	int ans = -1001001001;
	int cnt = 0;
	while(1) {
		// 局所探索法
		cnt++;
		if(cnt > 200000) break;
		vector<int> old = t;
		int CH = mt()%5 + 1; // CH箇所変える
		rep(i, CH) {
			int nd = mt()%d;
			int nq = mt()%n + 1;
			t[nd] = nq;
		}
		
		// 点数の再計算
		vector<int> nlast(n);
		ll now = 0;
		rep(i, d) {
			now += s[i][t[i]-1];
			nlast[t[i]-1] = i+1;
			rep(j, n) {
				now -= c[j] * (i+1-nlast[j]);
			}
		}
		
		// 良くなれば更新
		if(now > ans) {
			ans = now;
			// cout << cnt << " :" << ans << endl;
		} else {
			t = old;
		}
	}
	
	rep(i, d) printf("%d\n", t[i]);
	return 0;
}

Measured memory_bytes: 3768
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

int main() {
	int H, W;
	string s[102];
	cin >> H >> W;

	int alp[26];
	REP(i, 26) alp[i] = 0;

	REP(i, H) {
		cin >> s[i];
	}

	REP(i, H) {
		REP(j, W) {
			alp[s[i][j] - 'a']++;
		}
	}

	if (H % 2 == 0 && W % 2 == 0) {
		REP(i, 26) {
			if (alp[i] % 4 != 0) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	else if (H % 2 == 0 || W % 2 == 0) {
		int n2 = 0;
		REP(i, 26) {
			if (alp[i] % 4 == 2) n2++;
			else if (alp[i] % 4 != 0) {
				cout << "No" << endl;
				return 0;
			}
		}
		if (n2*2 > H*(H % 2 == 0) + W*(W % 2 == 0)) {
			cout << "No" << endl;
			return 0;
		}
	}
	else {
		int n1 = 0;
		int n2 = 0;
		REP(i, 26) {
			if (alp[i] % 4 == 1) n1++;
			else if (alp[i] % 4 == 2) n2++;
			else if (alp[i] % 4 != 0) {
				cout << "No" << endl;
				return 0;
			}
		}
		if (n1 > 1 || n2 > H + W - 2) {
			cout << " No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
// Aizu 1173: The Balance of the World
// 2017.9.14 bal4u@uu

#include <stdio.h>

char buf[110], *p;

int parse()
{
//	printf("%s\n", p);
	while (*p) {
		if (*p == '(') {
			if (*(p+1) == ')') p+=2;
			else if (*(p+1) == ']') return 0;
			else {
				p++; if (!parse()) return 0;
				if (*p++ != ')') return 0;
			}
		} else if (*p == '[') {
			if (*(p+1) == ']') p+=2;
			else if (*(p+1) == ')') return 0;
			else {
				p++; if (!parse()) return 0;
				if (*p++ != ']') return 0;
			}
		} else return 1;
	}
	return 1;
}

int main()
{
	int f, ca, cb;
	char t[120], *q;

	while (1) {
		fgets(t, 110, stdin); if (t[0] == '.' && (!t[1] || t[1] == '\n')) break;
		f = 1, ca = cb = 0, p = buf, q = t; while (*q) {
			if      (*q == '(')   ca++, *p++ = *q++;
			else if (*q == ')') { ca--, *p++ = *q++; if (ca < 0) { f = 0; break; } }
			else if (*q == '[')   cb++, *p++ = *q++;
			else if (*q == ']') { cb--, *p++ = *q++; if (cb < 0) { f = 0; break; } }
			else q++;
		}
		*p = 0, p = buf;
		if (ca || cb) f = 0; 
		if (f) f = parse();
		puts(f ? "yes" : "no");
	}
	return 0;
}

Measured memory_bytes: 1660
import java.util.Arrays;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int L = sc.nextInt();
		String S[] = new String[N];
		for (int i=0; i<N; i++) {
			S[i] = sc.next();
		}
		Arrays.sort(S);
		String s = new String();
		for (int i=0; i<N; i++) {
			s += S[i];
		}
		System.out.println(s);
	}
}


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

int main()
{
    string s;
    cin >> s;
    int cost = 700;
    for(int i=0;i<3;i++){
        if(s[i] == 'o'){
            cost = cost + 100;
        }
    }
    cout << cost << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		List<Integer> foo = new ArrayList<>();
		foo.add(a);
		foo.add(b);
		foo.add(c);
		
		 Collections.sort(foo);
		// 出力
		System.out.println(foo.get(0) + " " + foo.get(1) + " " + foo.get(2));
	}
}


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

int main() {

  long long int n;
  cin >> n;

  long long int c[4];
  cin >> c[0] >> c[1] >> c[2] >> c[3];

  long long int ans = 1000;

  for ( long long int i = 1; i <= n; i++ ) {

    long long int x[4], y[4];
    for ( long long int j = 0; j < 4; j++ ) {
      x[j] = ( c[j] - 1 ) % i;
      y[j] = ( c[j] - 1 ) / i;
    }

    ans = min( ans, abs( x[0] - x[1] ) + abs( y[0] - y[1] ) + abs( x[2] - x[3] ) + abs( y[2] - y[3] ) );

  }

  cout << ans << endl;

  return 0;

}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdlib>

using namespace std;
//DP用
template<class T> inline bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF = 1LL << 60;

int main() {
    int n,k,x,y;
    cin >> n >> k >> x >> y;
    if(n <= k) {
        cout << x*n;
        return 0;
    }else {
        cout << x*k + (n-k)*y;
        return 0;
    }
    return 0;
}

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



#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)

using namespace std;

template <class T>
using vec = std::vector<T>;
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const long long INF = 1LL<<60;

int lcm(int a,int b){
    //最小公倍数
    return a/__gcd(a,b) * b;
}


ll h,w;

int main()
{
    cin>>h>>w;
    ll ans=0;
    if(h<2 or w<2){
        ans=1;
    }
    else if(h%2==1 and w%2==1){
        ans=(h/2+1)*w-(w/2);
    }else if(h%2==1 or w%2==1){
        if(w%2==1)swap(h,w);
        ans=(h/2+1)*w-(w/2);
    }else{
        ans=(h/2)*w;
    }

    cout<<ans<<endl;

    return 0;

}




Measured memory_bytes: 384
//Name : Rupa Dey
  //Date : 28 august 2020
//joi sri gour hori gobindo...
//gobindo ja hobe vlor jonnoi hobe..
#include<bits/stdc++.h>
#define ll long long
#define d double
#define ld long double
#define vi vector<int>
#define vul vector<ull>
#define vl vector<ll>
#define pb push_back
#define si set<int>
#define sl set<ll>
#define yes cout<<"YES\n"<<endl
#define no cout<<"NO\n"<<endl
#define ys cout<<"Yes\n"<<endl
#define n cout<<"No\n"<<endl
#define test cin>>t; while(t--)
#define for(i,a,n) for(i=a;i<n;i++)
#define mp make_pair
#define ft first
#define sc second
#define gap " ";
#define MAX 9999999
#define MOD 1000000007
#define nd endl
using namespace std;
int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int a,b,c,i,j,cnt=0,x,y,z;
    cin>>a>>b>>c;

    cout<<c<<" "<<a<<" "<<b;


}
//hare krishna...
//hey gobindo kripa koro......
//only gobindo exists..^..


Measured memory_bytes: 3620
#include <iostream>
using namespace std;
int r[82];
int main()
{
  int p,q;
  while(cin >> p >> q){
    int i=0;
    p %= q;
    r[i++] = p;
    for(;;){
      cout << p*10/q;
      p = p*10%q;
      if(p == 0) {
	cout << endl;
	break;
      }else{
	int j;
	for(j=0;j<i;j++){
	  if(r[j] == p) break;
	}
	if(j == i) r[i++] = p;
	else{
	  cout << endl;
	  int k;
	  for(k=0;k<i;k++){
	    if(k>=j) cout << "^";
	    else cout << " ";
	  }
	  cout << endl;
	  break;
	}
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
int cmp3(T lhs, T rhs) { return (lhs == rhs) ? 0 : (lhs > rhs) ? 1 : -1; }

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

void solve(int N, int K, vector<int> const &As) {
  vector<bool> dp(K+10, false);
  FOR(m, 0, K) for (int i = 0; i < N && m + As[i] <= K; ++i) {
    dp[m+As[i]]  = dp[m+As[i]] || ! dp[m];
  }
  cout << (dp[K] ? "First" : "Second") << endl;
}

int main() {
  int N, K; cin >> N >> K;
  vector<int> As;
  REP(i, N) {
    int A;
    cin >> A;
    As.push_back(A);
  }
  solve(N, K, As);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (long i = long(s); i < long(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

using ll = long;
using namespace std;

int main(){
    ll n, m; cin >> n >> m;
    vector<ll> x(n), y(n), z(n); rep(i,n) cin >> x[i] >> y[i] >> z[i];

    ll ans = 0;
    loop(i,-1,2) loop(j,-1,2) loop(k,-1,2){
        if(i==0 || j==0 || k==0) continue;
        vector<ll> data(n); rep(l,n) data[l] = x[l]*i + y[l]*j + z[l]*k;
        sort(all(data));
        ll count = 0;
        rep(l,m) count += data[n-1-l];
        if(ans < count) ans = count;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3660
n = int(input())
a = list(map(int, input().split()))
q = int(input())
for i in range(q):
  b, e, t = list(map(int, input().split()))
  for k in range(e-b):
    a[b+k], a[t+k] = a[t+k], a[b+k]
print(" ".join(map(str, a)))


Measured memory_bytes: 5712
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
#define Vi vector<int>
#define FOR(i,n) for(int i=0;i<n;i++)
#define DEB cout<<"!"

int main(){
  int n,t;
  cin>>n>>t;
  Vi v(n);
  FOR(i,n)cin>>v[i];
  long ans=t;
  for(int i=1;i<n;i++){
    if(v[i-1]+t<=v[i])ans+=t;
    else ans+=(v[i]-v[i-1]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double W = sc.nextDouble();
		double H = sc.nextDouble();
		double x = sc.nextDouble();
		double y = sc.nextDouble();
		sc.close();



		double ans1 = (W*H)/2;

		if(W/2 == x && H/2 == y){
			System.out.println(ans1 + " " + 1);
		}
		else{
			System.out.println(ans1 + " " + 0);

		}
	}
}


Measured memory_bytes: 24276
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int H, W;
    cin >> H >> W;
    vector<string> A(H);
    rep(i, 0, H) cin >> A[i];
    queue<tuple<int, int, int>> Q;
    vector<vector<int>> dists(H, vector<int>(W, 1000000));
    rep(i, 0, H) rep(j, 0, W)
    {
        if (A[i][j] == '#')
        {
            Q.push(make_tuple(i, j, 0));
            dists[i][j] = 0;
        }
    }
    while (!Q.empty())
    {
        int r, c, dist;
        tie(r, c, dist) = Q.front();
        Q.pop();
        if (dists[r][c] < dist) continue;
        static const array<int, 4> dr = {1, -1, 0, 0};
        static const array<int, 4> dc = {0, 0, 1, -1};
        rep(i, 0, 4)
        {
            const int nr = r + dr[i];
            const int nc = c + dc[i];
            const int ndist = dist + 1;
            if (nr >= 0 && nr < H && nc >= 0 && nc < W)
            {
                if (chmin(dists[nr][nc], ndist))
                {
                    Q.push(make_tuple(nr, nc, ndist));
                }
            }
        }
    }
    int ans = 0;
    rep(i, 0, H) rep(j, 0, W) chmax(ans, dists[i][j]);
    cout << ans << endl;
}


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

#define int long long

#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      // cout << " " << Array[i][j];
      printf("%6f ", Array[i][j]);
    }
    cout << endl;
  }
}

int N;
double p[3333];
double dp[3333][3333]; // dp[i][j]: 表i枚、裏j枚が出る確率

signed main() {
  // 入力
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> p[i];
  }

  dp[0][0] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i + j > N) continue;
      // おもて
      dp[i+1][j] += dp[i][j] * p[i+j];
      // うら
      dp[i][j+1] += dp[i][j] * (1 - p[i+j]);
    }
  }

  double ans = 0;
  for (int i = N/2+1; i <= N; i++) {
    int j = N - i;
    ans += dp[i][j];
  }

  printf("%.10f\n", ans);

  return 0;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  if ((a % 2) == 1 && (b % 2) == 1) {
    cout << "Odd" << endl;
  }
  else {
    cout << "Even" << endl;
  }
}

Measured memory_bytes: 256
while(1):
    try:
        c1,c2,c3 = [int(i) for i in input().split()]
        tot = [i for i in range(1,11)]
        tot.remove(c1);tot.remove(c2),tot.remove(c3)
        tot = [i + c1+c2 for i in tot]
        count = [1 if i <= 20 else 0 for i in tot]
        if sum(count) > 3:
            print("YES")
        else:
            print("NO")
    except EOFError:
        break


Measured memory_bytes: 5600
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (auto &&i : a)
    {
        cin >> i;
        i /= 2;
    }
    sort(rbegin(a), rend(a));
    a.erase(unique(a.begin(), a.end()), a.end());
    int ans = 0;
    for (int i = a[0]; i <= m; i += a[0] * 2)
    {
        ans++;
        for (auto &&j : a)
        {
            if (i % j || (i / j) % 2 == 0)
            {
                ans--;
                break;
            }
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define LL long long int
#define INF 10000000
using namespace std;	
int main(void)
{
	LL i,j,k,n,m,glid[21][21],start,gorl,v[21],clr[21],a,b,c,d,mm,p,ans2,mini,x,ans1;
	cin>>n>>m;
	for(i=0;i<21;i++)for(j=0;j<21;j++) glid[i][j]=INF;
	for(i=0;i<m;i++) {
		scanf("%lld,%lld,%lld,%lld",&a,&b,&c,&d);
		glid[a][b]=c;
		glid[b][a]=d;
	}
	scanf("%lld,%lld,%lld,%lld",&start,&gorl,&mm,&p);
	for(i=0;i<21;i++) v[i]=INF,clr[i]=0;
	v[start]=0;
	while(1) {
		x=0;
		for(i=1;i<=n;i++) {
			if(v[i]<v[x]&&clr[i]==0) x=i;
		}
		if(x==0) break;
		clr[x]=1;
		for(i=1;i<=n;i++) v[i]=min(v[i],glid[x][i]+v[x]);
	}
	ans1=v[gorl];
	for(i=0;i<21;i++) {
		v[i]=INF;
		clr[i]=0;
	}
	v[gorl]=0;
	while(1) {
		x=0;
		for(i=1;i<=n;i++) {
			if(v[i]<v[x]&&clr[i]==0) x=i;
		}
		if(x==0) break;
		clr[x]=1;
		for(i=1;i<=n;i++) v[i]=min(v[i],glid[x][i]+v[x]);
	}
	ans2=v[start];
	cout<<mm-p-ans1-ans2<<endl;
}
	

Measured memory_bytes: 3136