akhauriyash/Code-Regression huggingface dataset:
package main

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

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func reverse(ints []int) []int {
	for i, j := 0, len(ints)-1; i < j; i, j = i+1, j-1 {
		ints[i], ints[j] = ints[j], ints[i]
	}
	return ints
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N := sc.nextInt()
	A := sc.nextIntSlice(N)
	Left := []int{}
	Right := []int{}
	pos := ""
	if N%2 == 0 {
		pos = "right"
	} else {
		pos = "left"
	}
	for i := 0; i < N; i++ {
		if pos == "right" {
			Right = append(Right, A[i])
			pos = "left"
		} else {
			Left = append(Left, A[i])
			pos = "right"
		}
	}
	reverse(Left)
	for i := 0; i < len(Left); i++ {
		fmt.Fprint(wtr, Left[i], " ")
	}
	for i := 0; i < len(Right); i++ {
		fmt.Fprint(wtr, Right[i])
		if i != len(Right)-1 {
			fmt.Fprint(wtr, " ")
		}
	}
	fmt.Fprintln(wtr)
	wtr.Flush()
}


Measured memory_bytes: 11264
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>
#include <cstdint>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						(int)2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef unsigned long long		SQWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	// 入力
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	
	int ans = 0;
	if (a != c) ans = 1;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9+7
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
 
 
int main(){
    int n;
    cin>>n;
    bool ok=true;
    rep(i,n){
        int a;
        cin>>a;
        if(a%2==1) continue;
        if(a%3!=0 && a%5!=0) ok=false;
    }

    if(ok) cout<<"APPROVED"<<endl;
    else cout<<"DENIED"<<endl;
}

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

int main()
{
	int n;
	int i;
	int temp;

	cin >> n;

	int* p = new int[n];

	for (i = 0; i < n; i++) {
		cin >> p[i];
	}

	for (i = 0; i <= n / 2 - 1; i++) {
		temp = p[i];
		p[i] = p[n - 1 - i];
		p[n - 1 - i] = temp;
	}

	for (i = 0; i < n; i++) {
		if (i < n - 1) {
			cout << p[i] << " ";
		} else {
			cout << p[i] << endl;
		}
	}

	delete [] p;

	return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int num=0;
    
    for (int i=0; i<N; i++) {
        int a, b;
        cin >> a >> b;
        
        if (a==b) num+=1;
        else num=0;
        
        if (num==3) {
            cout << "Yes" << endl;
            break;
        }
        if (i==N-1) cout << "No" << endl;
    }
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 62;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main()
{
  string s; cin >> s;
  int n = s.size();
  int ans = 0;
  rep(i, n/2) if(s[i] != s[n-1-i]) ++ans;
  cout << ans << endl;
}

Measured memory_bytes: 3592
/*
    Author: Nguyen Tan Bao
    Status:
    Idea:
*/

#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 110;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    char s;
    cin >> s;
    if (s >= 'A' && s <= 'Z') cout << "A";
    else cout << "a";
    return 0;
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc=new Scanner(System.in);
		
		int n=sc.nextInt();		//IDカード
		int m=sc.nextInt();		//ゲート
		
		int l=0;
		int r=n;
		
		for(int i=0;i<m;i++) {
			int l2=sc.nextInt();
			int r2=sc.nextInt();
			
			l=Math.max(l,l2);
			r=Math.min(r,r2);
		}
		int ans=r-l+1;
		if(ans>0) System.out.println(ans);
		else System.out.println(0);
	}
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    ll H,W,M; cin >> H >> W >> M;
    vector<pair<ll,ll>> P(M);
    vector<ll> H_cnt(H,0), W_cnt(W,0);
    REP(i,M){
        ll h,w; cin >> h >> w;
        h--;
        w--;
        P[i] = {h,w};
        H_cnt[h]++;
        W_cnt[w]++;
    }

    //M点について調べ、最大値とその組数を求める


    vector<ll> A(M);
    
    REP(i,M){
        A[i] = H_cnt[P[i].first] + W_cnt[P[i].second];
    }
    sort(ALL(A));
    ll a_max = A[M-1];
    ll as = A.end() - lower_bound(ALL(A), a_max);

    //cout << a_sum << " " << a_cnt << endl;

    //H*W点についても
    sort(ALL(H_cnt));
    sort(ALL(W_cnt));
    ll h_max = H_cnt[H-1];
    ll w_max = W_cnt[W-1];
    ll hs = H_cnt.end() - lower_bound(ALL(H_cnt), h_max);
    ll ws = W_cnt.end() - lower_bound(ALL(W_cnt), w_max);


    //cout << h_max+w_max << " " << hs << " " << ws << endl;
    if(h_max+w_max > a_max) cout << h_max + w_max << endl;
    else if(hs*ws - as == 0) cout << h_max + w_max - 1 << endl;
    else cout << h_max + w_max << endl;

    return 0;
}

Measured memory_bytes: 14848
#include <iostream>
#include <vector>
#include <string>
using namespace std;
using ll = long long;

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

    ll n, k;
    cin >> n >> k;
    
    vector<ll> a(n);
    for(int i = 0; i < n; ++i) cin >> a[i];

    const int mxd = 50;
    vector<vector<ll>> dp(100, vector<ll>(2, -1));

    dp[0][0] = 0;
    for(int d = 0; d < mxd; ++d){
        ll mask = 1ll << (mxd-d-1);

        int num = 0;
        for(int i = 0; i < n; ++i) if(a[i] & mask) ++num;
        
        ll xxor0 = mask*num;
        ll xxor1 = mask*(n-num);

        if(dp[d][1] != -1){
            dp[d+1][1] = max(dp[d+1][1], dp[d][1] + max(xxor0, xxor1));
        }

        if(dp[d][0] != -1){
            if(k & mask){
                dp[d+1][1] = max(dp[d+1][1], dp[d][0] + xxor0);
            }
        }
        if(dp[d][0] != -1){
            if(k & mask) dp[d+1][0] = max(dp[d+1][0], dp[d][0] + xxor1);
            else dp[d+1][0] = max(dp[d+1][0], dp[d][0] + xxor0);
        }
    }

    cout << max(dp[mxd][0], dp[mxd][1]) << endl;

    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> p(n+10);
  rep(i,n) cin >> p[i];
  rep(i,n-1){
    bool fla = true;
    rep(k,n-1){
      if(p[k] >= p[k+1]){
        fla = false;
        break;
      }
    }
    if(fla){
      puts("YES");
      return 0;
    }
    for(int j = i+1;j < n;++j){
      swap(p[i],p[j]);
      bool flag = true;
      rep(k,n-1){
        if(p[k] >= p[k+1]){
          flag = false;
          break;
        }
      }
      if(flag){
        puts("YES");
        return 0;
      }
      else swap(p[i],p[j]);
    }
  }
  puts("NO");
  return 0;
}


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

sum_list = [None] * (N+1)

sum_list[0] = 0
for i in range(N):
    sum_list[i+1] = sum_list[i] + A[i]

output = 0
sum_list_sorted = sorted(sum_list)
i = 0
while i < N:
    k = 1
    for j in range(i+1, N+1):
        if sum_list_sorted[i] == sum_list_sorted[j]:
            k += 1
        else:
            break
    output += k * (k-1) // 2
    i += k
    
print(output)

Measured memory_bytes: 27260
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll mod=1e9+7;
const int inf=1<<30;

ll dp[100010][110][2];

int main(){
  string s; cin >> s;
  int n=s.size();
  int D; cin >> D;
  dp[0][0][0]=1;
  rep(i,n){
    rep(j,D){
      int ni=i+1;
      rep(d,10){
        int nj=(j+d%D)%D;
        if(d>s[i]-'0'){
          dp[ni][nj][1]+=dp[i][j][1];
        }
        else if(d<s[i]-'0'){
          dp[ni][nj][1]+=dp[i][j][0];
          dp[ni][nj][1]+=dp[i][j][1];
        }
        else{
          dp[ni][nj][1]+=dp[i][j][1];
          dp[ni][nj][0]+=dp[i][j][0];
        }
        dp[ni][nj][1]%=mod;
        dp[ni][nj][0]%=mod;
      }
    }
  }
  ll ans=(dp[n][0][0]+dp[n][0][1])%mod;
  ans--;
  if(ans<0) ans+=mod;
  cout << ans << endl;
}

Measured memory_bytes: 18688
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    for(int i = 0 ; i < n ; ++i){
      String s = sc.next();
      if(s.equals("AC")) ac++;
      if(s.equals("WA")) wa++;
      if(s.equals("TLE")) tle++;
      if(s.equals("RE")) re++;
    }

    System.out.println("AC x " + ac);
    System.out.println("WA x " + wa);
    System.out.println("TLE x " + tle);
    System.out.println("RE x " + re);
    
  }
}

Measured memory_bytes: 59064
//arc065_d.cpp
//Sun Jul  7 17:44:45 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

//Union-Find木
int par[200000]; //親
int treerank[200000]; //木の深さ

//n要素で初期化
void init(int n){
	for (int i=0;i<n;i++){
		par[i] = i;
		treerank[i] = 0;
	}
}

//木の根（親）を見つける
int find (int x){
	if (par[x] == x){
		return x;
	} else {
		return par[x] = find(par[x]);
	}
}

//xとyの属する集合の併合
void unite(int x, int y){
	x = find(x);
	y = find(y);
	if (x == y) {
		return;
	} 

	if (treerank[x] < treerank[y]){
		par[x] = y;
	} else {
		par[y] = x;
		if (treerank[x] == treerank[y]){
			treerank[x]++;
		}
	}
}

//xとyが同じグループに属するか判定
bool same(int x, int y){
	return find(x) == find(y);
}

int main(){
	int n,k,l;
	cin >> n >> k >> l;

	init(n);
	for (int i=0;i<k;i++){
		int p,q;
		cin >> p >> q;
		p--;q--;
		unite(p,q);
	}

	int road[n];
	for (int i=0;i<n;i++){
		road[i] = find(i);
	}

	init(n);
	for (int i=0;i<l;i++){
		int r,s;
		cin >> r >> s;
		r--;s--;
		unite(r,s);
	}

	int train[n];
	for (int i=0;i<n;i++){
		train[i] = find(i);
	}

	int ans[n];
	fill(ans,ans+n,1);

	vector<P> pair;
	for (int i=0;i<n;i++){
		pair.push_back(make_pair(road[i],train[i]));
	}

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

	map<P, int> mp;
	for (int i=0;i<pair.size();i++){
		auto itr = mp.find(pair[i]);
		if (itr != mp.end()){
			mp[pair[i]]++;
		}else{
			mp[pair[i]]=1;
		}
	}

	for (int i=0;i<n;i++){
		P temp = make_pair(road[i],train[i]);
		cout << mp[temp] << " ";
	}
	printf("\n");
}

Measured memory_bytes: 17392
#include<stdio.h>

int main(void){
  long int y;
  int d;
  while(scanf("%d",&d)!=EOF){
    y=0;
    for(int i=d;i<=600-d;i+=d){
      y +=  (i*i)*d;
    }
    printf("%ld\n",y);
  }
  return 0;
}



Measured memory_bytes: 2036
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    rep(i,7){int a,b;cin>>a>>b;cout<<abs(a-b)<<endl;}
}

Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {

	static int n;
	static int[][] arr;
	static int[][] memo;
	static boolean f = false;
	static boolean t = false;
	static int OO = (int) 1e9 + 7;

	static int dp(int i , int k) {
		if (i == n )
			return 0;

		if(memo[k][i]!=-1)
			return memo[k][i];
		
		int ans = -OO;
		for(int j = 0 ;  j < 3 ; j++ ){
			if(j == k)
				continue;
			ans = Math.max(ans , arr[i][j] + dp(i+1, j));
		}
	
		return memo[k][i] = ans;
	}

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);

		StringTokenizer st = new StringTokenizer(br.readLine());
		n = Integer.parseInt(st.nextToken());

		arr = new int[n + 1][3];
		for (int i = 0; i < n; i++) {
			st = new StringTokenizer(br.readLine());
			arr[i][0] = Integer.parseInt(st.nextToken());
			arr[i][1] = Integer.parseInt(st.nextToken());
			arr[i][2] = Integer.parseInt(st.nextToken());
		}
		memo = new int[4][(int) 1e5 + 1];

		for (int i = 0; i < 4; i++)
			Arrays.fill(memo[i], -1);
		
		pw.print(dp(0 , 3));
		pw.close();
	}
}


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

int main()
{ 
	int i1, i2;
	while (cin >> i1 >> i2) {
		i1 += i2;
		i2 = 0;
		while (i1) {
			i2++;
			i1 /= 10;
		}
		cout << i2 << endl;
	}
    return 0;
}



Measured memory_bytes: 3032
#include<bits/stdc++.h>
 
using namespace std;
 
 
#define mod(cans) cans%10**9+7
#define debug(x) cout << "Debug" << x << "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define cin_pl(n,x) rep(i,n){cin>>x[i];}
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define prians(Answer) cout<<Answer<<"\n"
#define TF(X) X==1?cout<<"Yes\n":cout<<"No\n"
#define elcon else{continue;}
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vector<int> > matrix;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef greater<int> gi;
typedef vector<unsigned> vu;


ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
bool is_prime(const unsigned n){
    switch(n){
        case 0:
        case 1: return false;
        case 2: return true;
    }
 
 
    for(unsigned i=2;i<n;++i){
        if(n%i == 0) return false;
    }
 
    return true;
}

int main()
{
    int n,r;cin>>r>>n;
    r>=10?cout<<n:cout<<n+100*(10-r);
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int N,K;
    cin >> N >> K;
    string str;
    cin >> str;

    for(int i = 0; i < (int)str.size(); ++i){
        if(K - 1 == i) {
            cout << (char)tolower(str[i]);
        } else {
            cout << str[i];
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');

var line;
while (line = lines.shift()) {
	var num = +line;

	if (num == 2) {
		console.log(1);
		continue;
	} else if (num == 3) {
		console.log(2);
		continue;
	} else if (num < 2) {
		console.log(0);
		continue;
	}

	var cnt = 2;
	for (var i = 5; i <= num; i++) {
		if (isPrime(i)) {
			cnt++;
		}
	}

	console.log(cnt);
}

function isPrime(num) {
	if (num == 2 || num == 3) return true;
	if (num < 2 || num % 2 == 0 || num % 3 == 0) return false;
	var limit = Math.round(Math.sqrt(num));

	var i = 1;
	while(i * 6 - 1 <= limit) {
		if (num % (i * 6 - 1) == 0 || num % (i * 6 + 1) == 0) return false;
		i++;
	}
	return true;
}

Measured memory_bytes: 8692
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
const double EPS = 1e-10;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    string s, t; cin >> s >> t;

    vector<string> candidates;
    rep(i, s.size()-t.size()+1) {
        bool match = true;
        rep(j, t.size()) {
            if (s[i+j] == t[j] || s[i+j] == '?') continue;
            match = false;
        }

        if (match) {
            string u(s);
            rep(j, t.size()) u[i+j] = t[j];
            rep(j, u.size()) if (u[j] == '?') u[j] = 'a';
            candidates.push_back(u);
        }
    }
    if (candidates.empty()) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    sort(ALL(candidates));
    cout << candidates[0] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 200005
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d ", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007
#define mod 998244353
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

vector<pii>edge[MAX];
ll dp[MAX];

void dfs(int u, int p = -1)
{
    for(auto v : edge[u])
    {
        if(v.first==p)
            continue;
        dp[v.first] = (dp[u] + v.second);
        dfs(v.first, u);
    }
}

void solve()
{
    int n;
    cin>>n;
    for(int i = 0; i < n-1; i++)
    {
        int u, v, w;
        cin>>u>>v>>w;
        edge[u].push_back({v, w});
        edge[v].push_back({u, w});
    }
    dfs(1);
    for(int i = 1; i <= n; i++)
        cout<<dp[i]%2<<endl;
}

int main()
{
    FASTIO;
    solve();

    return 0;
}


Measured memory_bytes: 15056
# C - Peaks
n,m = map((int),(input().split()))

h = list(map(int,(input().split())))

result = [0] * n
for i in range(0, m):
    a, b = map((int),(input().split()))

    if h[a - 1] > h[b - 1]:
        result[b - 1] = 1
    elif h[a -1] < h[b - 1]:
        result[a - 1] = 1
    else:
        result[a - 1] = 1
        result[b - 1] = 1

sum = 0
for j in result:
    if j == 0:
        sum += 1

print(sum)

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

using namespace std;
#define N 100100
#define SIGMA 26

int main()
{
    ios::sync_with_stdio();
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    cout << (n * (n - 1)/ 2) + (m * (m - 1)/ 2);

    return 0;
}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int a,b,c; cin >> a >> b >> c;
    cout << (a+b>=c?"Yes":"No") << endl;
}


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


int main() {
  ll n,k;
  cin >> n>>k;
  ll t=(n-1)*(n-2)/2;
  //cout<<t<<endl;

  if(k>t) {
    cout<<-1;
    return 0;
  }
  ll c=n-1+t-k;
  cout<<c<<endl;
  rep(i,n-1){
    cout<<"1 "<<(i+2)<<endl;
  }
  ll now=t-k;
    for(ll i=2;i<=n;i++){
      for(ll j=i+1;j<=n;j++){
        if (now<=0)break;
        cout<<i<<" "<<j<<endl;
        //cout<<now<<endl;
        now--;

      }
    }
return 0;

}


Measured memory_bytes: 3648
import math

A,B=map(int, input().split(" "))

#print(A,B)

start = math.floor(A*100/8)
end = (B+1)*10

ans = -1

for i in range(start,end+1):
  ta = math.floor(i * 0.08)
  tb = math.floor(i * 0.1)
  #print(ta,tb)
  if ta == A and tb == B:
    ans = i
    break

print(ans)


Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;
    string s;
    cin>>n>>k>>s;
    s[k-1] += 'a' - 'A';
    cout<<s<<endl;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static int exception(int h,int w){
		int result = 0;
		if(0 < h && h <= 300 && 0 < w && w <= 300){ //??????????????????
			result = 2;
		}
		else if(h == 0 && w == 0){
			result = 1;
		}
		else{
			System.out.println("1~300????????§.???????????????.");
			result = 0;
		}
		return result;
	}
	public static void main(String[] args) {
		/**
		 * ?????°?????£?¨?
		 */
		int a = 0;
		int t = 0, inc = 0;
		int h = 0,w = 0; //height:h width:w
		int count = 0;
		int x = 0;
		/**
		 * ???????????£?¨?
		 */
		ArrayList<String> st = new ArrayList<String>();
		ArrayList<Integer> parse = new ArrayList<Integer>();
		/**
		 * ????¨???????????????\???
		 */
		Scanner scan = new Scanner(System.in);
		while(a == 0){
		for (t = 0; t < 2; t++){ //??´??°2???????????????
		st.add(scan.next());
		}
		//System.out.println(""); //????????????????????\???????????????
		h = Integer.parseInt(st.get(inc));
		w = Integer.parseInt(st.get(inc+1));
		parse.add(h);
		parse.add(w);

		if(exception(h,w) == 1){ //h=w=0?????¨??????????????????????????????
			break;
		     }
		inc = inc + 2; //???????????§?????°
		}
		/**
		 * ??????
		 */
		for(int n= 1; n < ((parse.size())/2) ; ++n){ //???????????°??????
		 for(int i = 0; i < parse.get(2*(n-1)); ++i){
			for(int j = 0; j < parse.get(2*n-1); ++j){
				System.out.print("#");
			}
			System.out.println("");
		 }
		 System.out.println("");
		}
	}
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	long long  ans = 0;
	vector<long long >A(N);


	for (int n = 0; n < N; ++n) {
		cin >> A[n];
		ans += A[n];
	}
	int Q;
	cin >> Q;
	vector<long long  >B(Q);
	vector<long long  >C(Q);
	for (int n = 0; n < Q; ++n) {
		cin >> B[n]>>C[n];
	}
	vector<long long>X(100001);
	for (int n = 0; n < N; ++n) {
		X[A[n]]++;
	}
	for (int n = 0; n < Q; ++n) {
		ans = ans + C[n] * X[B[n]] - B[n] * X[B[n]];
		X[C[n]] += X[B[n]];
		X[B[n]] = 0;
		cout << ans <<endl;
	}

	return 0;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)

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

	int a[100000];
	int yakuSize = 0;

	for (long long int i = 1; i * i <= n; ++i) {
		if (n % i == 0) {
			a[yakuSize++] = n / i;
		}
	}

	int ans = a[yakuSize - 1];
	int keta = 1;
	while (ans / 10 != 0) {
		ans /= 10;
		++keta;
	}
	cout << keta << endl;
}

Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) (x).begin(), (x).end()
typedef long long int ll;
using namespace std;
int main()
{
  int n;
  cin >> n;
  vector<int> h;
  int tmp;
  int tmpr;
  REP(i, n)
  {
    cin >> tmp;
    if (tmp == tmpr)
    {
      continue;
    }
    else
    {
      h.push_back(tmp);
      tmpr = tmp;
    }
  }
  n = h.size();
  REP(i, n - 2)
  {
    if (h[i] > h[i + 1] + 1 || (h[i + 1] < h[i] && h[i + 2] < h[i + 1]))
    {
      cout << "No" << endl;
      return 0;
    }
  }
  if (h[n - 2] > h[n - 1] + 1)
  {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int a,b,c,d,e,k;
  cin >> a >> b >> c >> d >> e >> k;

  if(e-a<=k) cout << "Yay!" << endl;
  else cout << ":(" << endl;
  
  return 0;
}

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

int main() {
  int x,t;
  cin>>x>>t; 
  cout<<max(0,x-t)<<endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<iomanip>
#include<functional>
using namespace std;
typedef long long llong;
int main() {
	string s;
	getline(cin, s);
	for (int i = 0; i < s.size(); i++) {
		if (islower(s[i]))s[i]=toupper(s[i]);
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3008
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <bits/stdc++.h>  
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);
#define vl vector<ll>
#define mod 1000000007


int main()
{
    string s;;cin>>s;
    ll n=s.size();
    ll sum=0;
    for(ll i=0;i<n;i++)
    {
        sum=sum+s[i]-'0';
    }
    if(sum%3==0)
    cout<<"Yes"<<"\n";
    else
    cout<<"No"<<"\n";
}

Measured memory_bytes: 3720
/*
 Author : Alokit Kumar
 */
 #include<bits/stdc++.h>
 using namespace std;
 #define int long long
 int32_t main()
 {
   int t,n,i,j,k,l,l1;
   cin>>n;
    j=(n+999)/1000;
    cout<<j*1000-n;
 }

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

int main(){
  string S; cin>>S;
  int N=S.size();
  int A,Z;
  
  for (int i=0;i<N;++i){
    if (S[i]=='A'){
      A=i;
      break;
    }
  }
  for (int j=N;0<j;--j){
    if (S[j]=='Z'){
      Z=j;
      break;
    }
  }
  
  cout<<Z-A+1<<endl;
}
  

Measured memory_bytes: 640
import sys
from collections import deque
import copy
import heapq

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] =  [int(input_raw[0]), int(input_raw[1])]
    graph = {}
    for i in range(M):
        input_raw = read_func().strip().split()
        [a, b, c] =  [int(input_raw[0]), int(input_raw[1]), -long(input_raw[2])]
        if a not in graph:
            graph[a] = [(b, c)]
        else:
            graph[a].append((b, c))

    dummy_inf = long(sys.maxint) * long(sys.maxint)
    dist_list =[dummy_inf for i in range(N + 1)]
    dist_list[1] = 0L

    for i in range(0, 2 * N):
        for j in range(1, N + 1):
            if j not in graph:
                continue
            for edge in graph[j]:
                if dist_list[j] < dummy_inf:
                    new_cost = dist_list[j] + edge[1]
                    if new_cost < dist_list[edge[0]]:
                        dist_list[edge[0]] = new_cost
                        if (i >= N - 1 and edge[0] == N):
                            print "inf"
                            return
    print -dist_list[N]


if __name__ == '__main__':
    main()


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


int main(){
    int n,c,k;
    cin >> n >> c >> k;
    vector<int> t;
    for(int i = 0; i < n; i++){
        int temp;
        cin >> temp;
        t.push_back(temp);
    }
    sort(t.begin(),t.end());
    vector<bool> tflag(n);
    for(int i = 0; i < n; i++){
        tflag[i] = false;
    }

    int ans = 1;

    for(int i = 0; i < n; i++){
        if(tflag[i] == true) continue;
        else{
            for(int j = i + 1; j < n; j++){
                if(t[j] - t[i] > k or j - i + 1 > c){
                    ans++;
                    break;
                } 
                else tflag[j] = true;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 892
#include <iostream>
#include <numeric>

using namespace std;

int main() {
    int n;
    int dp[4001];
    while (true) {
        cin >> n;
        if (cin.eof()) {
            return 0;
        }
        for (int i=0; i<=1000; i++) {
            dp[i] = 1;
        }
        for (int i=1001; i<=n; i++) {
            dp[i] = 0;
        }
        for (int i=0; i<3; i++) {
            for (int j=n; j>=0; j--) {
                int *begin = dp+max(0, j-1000);
                int *end = dp+j+1;
                dp[j] = accumulate(begin, end, 0);
            }
        }
        cout << dp[n] << endl;
    }
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    bool allNegative = true;
    rep(i, 0, n){
        cin >> a[i];
        if(a[i] >= 0) allNegative = false;
    }
    int sum = -INF;
    vector<int> ans;
    if(allNegative){
        int MAX = -INF, idx = -1;
        rep(i, 0, n){
            if(MAX < a[i]){
                MAX = a[i]; idx = i;
            }
        }
        sum = MAX;
        int pre = 0;
        rep(i, 0, idx){
            ans.push_back(0);
            pre++;
        }
        for(int i = n - 1; i > idx; i--){
            ans.push_back(n - 1 - pre);
            pre++;
        }
    }else{
        rep(r, 0, 2){
            vector<int> cand;
            int now = 0;
            rep(i, 0, n){
                if(i % 2 != r) continue;
                if(a[i] >= 0){
                    now += a[i];
                    cand.push_back(i);
                }
            }
            if(sum < now){
                sum = now;
                ans.clear();
            }else{
                continue;
            }
            int pre = 0;
            rep(i, 0, cand[0]){
                ans.push_back(0);
                pre++;
            }
            for(int i = 0; i < cand.size() - 1; i++){
                int idx = (cand[i] + cand[i + 1]) / 2 - pre;
                int diff = cand[i + 1] - cand[i];
                for(int j = 0; j < diff / 2; j++){
                    ans.push_back(idx);
                    idx--;
                    pre += 2;
                }
            }
            for(int i = pre; i < n - 1; i++){
                ans.push_back(n - 1 - pre);
                pre++;
            }
        }
    }
    cout << sum << endl;
    cout << ans.size() << endl;
    rep(i, 0, ans.size()){
        cout << ans[i] + 1 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define fastio() ios_base::sync_with_stdio(false);
#define rmod(x, y) ((((x)%(y))+(y))%(y))
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
template<typename T, typename R = null_type, typename C = less<T>>
tree<T, R, C, rb_tree_tag, tree_order_statistics_node_update> ordered_set(){
	return tree<T, R, C, rb_tree_tag, tree_order_statistics_node_update>();
}

const int maxn = 1e5+5;
int n, mod, x, y, in[maxn], out[maxn];
vector<int> vs[maxn], sons[maxn], pre[maxn], suf[maxn];

inline int mul(ll a, ll b){return (a*b)%mod;}
inline int add(ll a, ll b){return (a+b)%mod;}

int getin(int v, int idx){
	int ret = 1;
	if (idx > 0) ret = mul(ret, pre[v][idx-1]);
	if (idx < int(sons[v].size())-1) ret = mul(ret, suf[v][idx+1]);
	return ret;
}

void dfsin(int v, int p = -1){
	for(int &e: vs[v]) if (e == p) {swap(e, vs[v].back()); break;}
	int ways = 1, aux;
	for(int &e: vs[v]) if (e != p){
		dfsin(e, v);
		aux = add(in[e], 1);
		ways = mul(ways, aux);
		sons[v].push_back(aux);
	}
	in[v] = ways;
}

void dfsout(int v, int p = -1){
	if (sons[v].size() == 0) return;
	for(int i = 0; i<vs[v].size(); i++)
		if (vs[v][i] != p) out[vs[v][i]] = add(1, mul(getin(v, i), out[v]));
		
	for(int &e: vs[v]) if (e != p) dfsout(e, v);
}
	
int main(){
	scanf("%d %d", &n, &mod);
	for(int i = 0; i<n-1; i++){
		scanf("%d %d", &x, &y);
		vs[--x].push_back(--y);
		vs[y].push_back(x);
	}
	if (n == 1) {puts("1"); return 0;}
	dfsin(0);
	for(int i = 0; i<n; i++){
		x = sons[i].size();
		if (x == 0) continue;
		pre[i].resize(x);
		suf[i].resize(x);
		pre[i][0] = sons[i][0];
		suf[i].back() = sons[i].back();
		for(int l = 1; l<x; l++) pre[i][l] = mul(pre[i][l-1], sons[i][l]);
		for(int l = x-2; l>=0; l--) suf[i][l] = mul(suf[i][l+1], sons[i][l]);
	}
	out[0] = 1;
	dfsout(0);
	for(int i = 0; i<n; i++) printf("%d\n", mul(in[i], out[i]));
	return 0;
}


Measured memory_bytes: 29440
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

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;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

int n, K;
int a[110];
bool dp[100010];

int main() {
    cin >> n >> K;
    rep(i, n) cin >> a[i];
    memset(dp, false, sizeof(dp)); 
    rep(k, K+1) {
        rep(i, n) {
            if (k >= a[i]) {
                dp[k] |= !dp[k - a[i]];
            }
        }
    }
    cout << (dp[K] ? "First" : "Second") << endl;
    return 0;
}


// int n, K;
// int a[110];
// bool memo[100010];
//
// bool rec(int k) {
//     if (memo[k])
//         return memo[k];
//     bool wins = false;
//     rep(i, n) {
//         if (a[i] && k >= a[i]) {
//             wins |= !rec(k - a[i]);
//         }
//     }
//     memo[k] = wins;
//     return wins;
// }
//
// int main() {
//     cin >> n >> K;
//     rep(i, n) cin >> a[i];
//     cout << (rec(K) ? "First" : "Second") << endl;
//     return 0;
// }
//
//


Measured memory_bytes: 384
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  a, b = map(int, readline().split())
  if a*b%2==1:
    print('Yes')
  else:
    print('No')
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 5248
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

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 RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 3333;
LL mp[MAX][MAX];
LL dp[MAX][MAX][4];
int R, C, K;

void solve() {
    cin >> R >> C >> K;
    LL sum = 0;
    REP(i, K) {
        int r, c, v;
        cin >> r >> c >> v;
        mp[r - 1][c - 1] = v;
        sum += v;
    }
    DEBUG(sum)

    REP(i, MAX) REP(j, MAX) REP(k, 4) dp[i][j][k] = -LLINF;
    dp[0][0][0] = 0;

    REP(_, 10) REP(i, R) REP(j, C) REP(k, 4) {
        if (dp[i][j][k] == -LLINF) continue;

        if (i < R) chmax(dp[i + 1][j][0], dp[i][j][k]);
        if (j < C) chmax(dp[i][j + 1][k], dp[i][j][k]);

        if (mp[i][j] > 0 && k < 3) {
            if (i < R) chmax(dp[i + 1][j][0], dp[i][j][k] + mp[i][j]);
            if (j < C) chmax(dp[i][j + 1][k + 1], dp[i][j][k] + mp[i][j]);
        }
    }

    LL ans = 0;
    REP(i, 4) {
        chmax(ans, dp[R][C - 1][i]);
        chmax(ans, dp[R - 1][C][i]);
    }

    cout << ans << endl;
}

int main(void) {
#ifndef ONLINE_JUDGE
    const auto in_stream = freopen("../in.txt", "r", stdin);
    if (in_stream == nullptr) {
        cerr << "ERROR!" << endl;
        return 1;
    }
#endif

    solve();

#ifndef ONLINE_JUDGE
    fclose(in_stream);
#endif
}


Measured memory_bytes: 428684
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define ull unsigned long long
#define INF 987654321

int main() {
    ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, cnt = 0;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        if (a % 2 == 1 && i % 2 == 1) {
            cnt++;
        }
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3484
/* 実行時間1s制限の場合
  10^6 1,000,000   : 余裕をもって間に合う
  10^7 10,000,000  : おそらく間に合う
  10^8 100,000,000 : 非常にシンプルな処理でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}          // Least Commont Multiple オーバーフローしないように先に割る

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

int main()
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    std::ifstream in("c.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;

    vector<int> h(n);
    rep(i, n)
    {
        cin >> h[i];
    }

    int ans = 0;
    int tmp = 0;
    for (int i = n-1; i > 0; i--)
    {
        if (h[i] <= h[i-1])
        {
            if (i == 1) {
                tmp++;
                ans = max(ans, tmp);
            }
            else {
                tmp++;
            }
        }
        else
        {
            ans = max(ans, tmp);
            tmp = 0;
        }
    }

    cout << ans;

    return 0;
}

/*
  - 1e9 : 10^9
  - vector
    vector<int> A(N);
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - string
    - loop
      for (char& c : s) {}
 */



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

typedef long long ll;

int main(void) {
	int N, T;
	int t0, t1;

	cin >> N >> T;
	cin >> t0;

	ll X = 0;
	for (int i = 1; i < N; ++i) {
		cin >> t1;
		X += (t1 - t0 < T) ? (t1 - t0) : T;
		t0 = t1;
	}
	X += T;

	cout << X << '\n';
	return 0;
}


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

#define int long long
#define DEBUG(x) cerr <<#x<<":"<<x<<endl;
#define DEBUG2(x, y) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<endl;
#define DEBUG3(x, y, z) cerr <<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl;
#define DEBUGVC(x) cerr <<#x<<": "; for(auto a:x) cerr << a <<" "; cerr << endl;
#define DEBUGMP(x) cerr <<#x<<":"<<endl; for(auto a:x) cerr << a.first <<" "<< a.second << endl;
#define MAX_N (100005)
#define INF (1LL << 60)
const int MOD = (int)1e9 + 7;


signed main(){
    int N, L;
    cin >> N >> L;

    int mn=10000000, sum=0;
    bool flag=false;
    for(int i=0; i<N; i++) {
        //DEBUG(L+i);
        if(mn > abs(L+i)){
            mn = abs(L+i);
            if(L+i < 0) flag=false;
            else flag=true;
        }
        sum += L+i;
    }

    //DEBUG(sum);
    cout << (flag?sum-mn:sum+mn) << endl;

}

Measured memory_bytes: 256