akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for (ll i = 0; i < n; ++i)
#define rep2(i, n) for (ll i = 0; i < n; ++i)
#define rep3(i, a, b) for (ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for (ll i = a; i < b; i += c)
#define erep(n) for (ll i = 0; i <= n; ++i)
#define erep2(i, n) for (ll i = 0; i <= n; ++i)
#define erep3(i, a, b) for (ll i = a; i <= b; ++i)
#define erep4(i, a, b, c) for (ll i = a; i <= b; i += c)
#define rrep(i, a, b) for (ll i = a; i > b; --i)
#define rrep2(i, a, b, c) for (ll i = a; i > b; i -= c)
#define errep(i, a, b) for (ll i = a; i >= b; --i)
#define errep2(i, a, b, c) for (ll i = a; i >= b; i -= c)
#define print(a) cout << a << endl;
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
#define cin(x) cin >> x;
const ll MOD = 1000000007;
const double PI = 3.14159265358979323846264338327950;
inline int newline() { putchar('\n'); return 0; }

struct Sieve {
    const ll max;
    vector<bool> flags;
    vector<ll> primes;

    Sieve(ll max): max(max), flags(max + 1, true) {
        flags[0] = flags[1] = false;

        for (ll i = 2; i <= max; ++i) {
            if (flags[i]) {
                primes.push_back(i);
                for (ll j = i * i; j <= max; j += i) {
                    flags[j] = false;
                }
            } else {
                continue;
            }
        }
    }

    bool isPrime(ll num) {
        return flags[num];
    }

    vector<pair<ll, ll>> factor(ll x) {
        vector<pair<ll, ll>> result;

        for (ll i: primes) {
            ll j = 0;
            while (x % i == 0) {
                x /= i;
                ++j;
            }
            if (j != 0) result.emplace_back(i, j);
        }

        if (x != 1) result.emplace_back(x, 1);
        return result;
    }
};

int main() {
    ll n;
    cin(n);

    Sieve s(1000005);
    ll result = 0;

    for (auto i: s.factor(n)) {
        ll j = 1;
        while(i.second >= j) {
            i.second -= j;
            ++result;
            ++j;
        }
    }

    print(result);
    return 0;
}

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

int main () {
	int n, m, a[102]; cin >> n >> m;
	int sum = 0;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i]; sum += a[i];
	}
	int k = (sum + 4 * m - 1) / (4 * m);
	for (int i = 1; i <= n; i ++) {
		if (a[i] >= k) m --;
	}
	cout << (m <= 0 ? "Yes" : "No");
	return 0;
}


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

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

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int d1[N],d2[N];
  REP(i,N)cin>>d1[i]>>d2[i];
  int ans=1;
  int temp=0;
  REP(i,N){
    if(d1[i]==d2[i]){
      temp++;
      ans=max(ans,temp);
    }else{
      temp=0;
    }
  }
  cout<<(ans>=3?"Yes":"No")<<endl;
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string S;
    cin >> S;
    if(S == "SUN"){
        cout << 7 << endl;
    }
    if(S == "MON"){
        cout << 6 << endl;
    }
    if(S == "TUE"){
        cout << 5 << endl;
    }
    if(S == "WED"){
        cout << 4 << endl;
    }
    if(S == "THU"){
        cout << 3 << endl;
    }
    if(S == "FRI"){
        cout << 2 << endl;
    }
    if(S == "SAT"){
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[2000];
int main()
{
   string n;
   cin>>n;
   int i;
   int ma=0,k=0,maximum=0;
   for(i=0;i<n.size();i++)
   {
       if(n[i]=='R')
       {

           k++;
           maximum=max(maximum,k);
       }
       else
       {
           k=0;
       }
   }
   cout<<maximum<<endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(void) {
	int N;
	cin>>N;
	vector<ll> a(3 * N);
	REP(i, 3 * N) cin>>a[i];
	multiset<ll> mae;
	multiset<ll> ushiro;
	ll maesum = 0, ushirosum = 0;
	ll ans = - (INF * INF);
	REP(i, N) {
		mae.insert(a[i]);
		maesum += a[i];
	}
	REP(i, 2 * N) ushiro.insert(a[N + i]);
	multiset<ll>::iterator ite = ushiro.begin();
	map<ll, ll> hoge1;
	map<ll, ll> hoge2;
	REP(i, N) {
		ushirosum += *ite;
		if(hoge1.count(*ite) == 0) hoge1[*ite] = 1;
		else ++hoge1[*ite];
		++ite;
	}
	ans = max(ans, (maesum - ushirosum));
	REP(i, N) {
		if(a[N + i] > *(mae.begin())) {
			maesum -= *(mae.begin());
			mae.erase(mae.begin());
			mae.insert(a[N + i]);
			maesum += a[N + i];
		}
		if(hoge1.count(a[N + i]) != 0 && hoge1[a[N + i]] > 0) {
			ushirosum -= a[N + i];
			--hoge1[a[N + i]];
			while(true) {
				if(hoge2.count(*ite) == 0 || hoge2[*ite] <= 0) {
					ushirosum += *ite;
					if(hoge1.count(*ite) == 0) hoge1[*ite] = 1;
					else ++hoge1[*ite];
					++ite;
					break;
				} else {
					--hoge2[*ite];
					++ite;
				}
			}
		} else {
			if(hoge2.count(a[N + i]) == 0) hoge2[a[N + i]] = 1;
			else ++hoge2[a[N + i]];
		}
		ans = max(ans, (maesum - ushirosum));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 29184
/**
 * author:    Ziel
 * created:   12.04.2020 18:05:53
**/

// ~zaletaet~

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>

#define fi first
#define se second
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin, x.rend()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define bpc __builtin_popcountl
#define fre(f) if(fopen(f".in", "r")) freopen(f".in", "r", stdin),freopen(f".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

using ll = long long;
using ull = unsigned long long;
// using big = __int128_t; // -10^38...10^38
using db = double;
using ld = long double;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;

template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class T>
using p_queue = priority_queue<T, vector<T>, greater<T>>;

const ll N = 1e5 + 123, MOD = 1e9 + 7, oo = 1e9 + 9, INF = 1e18 + 9;
const db EPS = 1e-9, PI = acos(-1); // 3.14159265358979323846
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1}, dy[] = {0, 0, 1, -1, 1, -1, -1, 1};

main() {
#ifdef ZVER
	cerr << "Ready\n";
#endif
	fre("");
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	
	string s;
	cin >> s;
	
	if (s[0] == '7' || s[1] == '7' || s[2] == '7') cout << "Yes";
	else cout << "No";
	
	return 0;
}

// uniform_int_distribution<int>(l, r)(rng) -> random in range [l, r]
// assert(condition) -> if (condition == false) Runtime Error
// order_of_key(x) -> number of elements smaller than x
// *find_by_order(k) -> k-th element in 0-based indexation


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

int main()
{
	int n, b, f, r, v;
	cin.tie(0);
	cin >> n;

	int a[4][3][10] = { 0 };
	for (int i = 0; i < n; i++) {
		cin >> b >> f >> r >> v;
		a[b - 1][f - 1][r - 1] += v;
	}
	for (int i = 0; i < 4; i++) {
		for (int f = 0; f < 3; f++) {
			for (int r = 0; r < 10; r++) {
				cout << " ";
				cout << a[i][f][r];
			}
			cout << "\n";
		}
		if (i < 3) cout << "####################" << "\n";
	}
}


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

using namespace std;
using ll = long long;

template <typename K,typename V>
using umap = unordered_map<K,V>;
template <typename V>
using uset = unordered_set<V>;
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; }
#define REP(i,n) for(int i=0;i<n;i++)
#define REPD(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define ALL(v) v.begin(),v.end()

#define INF 1'000'000'000'000 //10^12
#define MOD 1'000'000'007

int main(){

    ll n,m;

    cin >> n >> m;

    ll s_count = n+m/2;

    cout << min(s_count/2 ,m/2) << endl;

    return 0;
}


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

int main(void) {
    int N;
    cin >> N;

    unsigned long long a[200010] = {0};
    unsigned long long A[200010] = {0};
    for (int i=0; i<N; i++) {
        cin >> a[i];
        A[a[i]]++;
    }
    unsigned long long sum = 0;
    for (int i=1; i<N+1; i++) {
        if (A[i] > 1) sum += (A[i]*(A[i]-1))/2;
    }

    for (int i=0; i<N; i++) {
        unsigned long long t = a[i];
        unsigned long long modify = 0;
        if (A[t] > 1) modify = (((A[t])*(A[t]-1))/2) - (((A[t]-1)*(A[t]-2))/2);
        cout << sum - modify << endl;
    }
    return 0;
}


Measured memory_bytes: 5888
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		final long K = sc.nextLong();
		char[] chars = s.toCharArray();

        for(int i = 0; i < K && i < chars.length; i++) {
            if (chars[i] != '1') {
            	System.out.println(chars[i]);
            	return;
			}
        }
        System.out.println("1");
	}
}

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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repp(i, n, m) for(int (i) = (n); (i) < (m); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 200005;

/* ...o(^-^)o... */

lint dp[MAX][3];

int main(){
    // dp[i][j] := i日目にjをするときの最大幸福 (i < n, j < 3)
    int n; cin >> n;
    rep(i, n){
        lint h[3]; rep(j, 3) cin >> h[j];
        if(i == 0){
            rep(j, 3) dp[0][j] = h[j]; continue;
        }
        rep(j, 3) rep(k, 3){
            if(j == k) continue;
            dp[i][j] = max(dp[i][j], dp[i-1][k]+h[j]);
        }
    } 
    out(max({dp[n-1][0],dp[n-1][1],dp[n-1][2]}));
}

Measured memory_bytes: 4352
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int S = sc.nextInt();
        int count = 0;
        for(int i=0;i<=K;i++){
            for(int j=0;j<=i;j++){
                for(int k=0;k<=j;k++){
                    int a = i+j+k;
                    if(a == S){
                        if(i == j && j== k){
                            count ++;
                        }else if(i != j && j != k && k != i){
                            count += 6;
                        }else{
                            count += 3;
                        }
                    }
                }
            }
        }
        System.out.println(count);
    }
}   

Measured memory_bytes: 35760
S = input()
T = input()

len_S, len_T = len(S), len(T)



def judge(start):
    # print(S[start: start+len_T])
    for j in range(len_T):
        if S[start+j] == '?':
            continue

        elif S[start+j] == T[j]:
            continue

        else:
            return False

    return True


for i in range(len_S - len_T, -1, -1):
    if judge(i):
        S = S[:i] + T + S[i+len_T:]
        S = S.replace('?', 'a')
        print(S)
        exit()

print('UNRESTORABLE')


Measured memory_bytes: 38256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
double const PI=3.141592653589793;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

int const MAX=1000000;

int N;
int cnt[MAX];

int main(){
    cin>>N;
    
    repn(i,N-1){
        for(int j=i;j<=N;j+=i){
            cnt[j]++;
        }
    }

    int ans=0;
    rep(i,N){
        ans+=cnt[i];
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 7492
#include<cstdio>
int a[55];
int main()
{
	int n,m,x;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=2*m;i++)
	{
		scanf("%d",&x);
		a[x]++;
	}
	for(int i=1;i<=n;i++)
	printf("%d\n",a[i]);
	return 0;
}

Measured memory_bytes: 128
def good(x):
	VC = list(V)

	Breduce = B * x

	for i in range(N):
		VC[i] -= Breduce

	required = 0

	for i in range(N):
		if VC[i] > 0:
			required += (VC[i] + A - 1) / A

	if required <= x:
		return True
	else:
		return False

N, A, B = map(int, raw_input().split(' '))
A = A - B

V = [0 for i in range(N)]

for i in range(N):
	V[i] = int(raw_input())

l = 1
r = 1000000000000000000
best = 1000000000000000000


while l <= r:
	mid = (l + r) / 2
	if good(mid):
		r = mid - 1
		best = mid
	else:
		l = mid + 1

print best

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n, q;
	cin>>n>>q;
	string s;
	cin>>s;
	vector<int> cnt(n - 1);
	for(int i = 0; i + 1 < n; i++){
		cnt[i] = (s[i] == 'A' && s[i + 1] == 'C');
		if(i)cnt[i] += cnt[i - 1];
	}
	int l, r;
	while(q--){
		cin>>l>>r;
		l -= 1;
		r -= 2;
		int ans = cnt[r];
		if(l)ans -= cnt[l - 1];
		cout<<ans<<'\n';
	}

	return 0;
}

Measured memory_bytes: 1488
package main

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

const (
	initialBufSize = 1024
	maxBufSize     = 1e6
)

var (
	scanner = bufio.NewScanner(os.Stdin)
	writer  = bufio.NewWriterSize(os.Stdout, 1000000)
)

type student struct {
	order, num int
}

type students []student

func (s students) Len() int {
	return len(s)
}

func (s students) Less(i, j int) bool {
	return s[i].order < s[j].order
}

func (s students) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

func main() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer writer.Flush()

	n := scanInt()
	a := make(students, n)
	for i := 0; i < n; i++ {
		a[i] = student{order: scanInt(), num: i+1}
	}

	sort.Sort(a)

	for i := 0; i < n; i++ {
		fmt.Printf("%v ", a[i].num)
	}
}

func scanInt() int {
	i, _ := strconv.Atoi(scanString())
	return i
}

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

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanString(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

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

func scanStrings(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanString()
	}
	return s
}

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}

// greatest common divisor(最大公約数)
func gcd(a, b int) int {
	for {
		mod := a % b
		if mod == 0 {
			return b
		}
		a, b = b, mod
	}
}

// latest common multiple(最小公倍数)
func lcm(a, b int) int {
	return (a / gcd(a, b)) * b
}

func fact(n int) int {
	ret := 1
	for i := 1; i <= n; i++ {
		ret *= i
	}
	return ret
}

func perm(n, r int) int {
	ret := 1
	for i := 0; i < r; i++ {
		ret *= n
		n--
	}
	return ret
}

func isPrimeNum(n int) bool {

	if n <= 1 {
		return false
	}

	l := int(math.Sqrt(float64(n)) + 1.)
	for i := 2; i < l; i++ {
		if n%i == 0 {
			return false
		}
	}

	return true
}


Measured memory_bytes: 4224
//By Vlgd
#include<bits/stdc++.h>
using namespace std;
const int N=500005;
struct point{int x,y,no;}P[N];
struct node{int loc,r,l;}T[N];
bool X(point p1,point p2){return p1.x<p2.x;}
bool Y(point p1,point p2){return p1.y<p2.y;}
int tot=0;
int sx,tx,sy,ty;
vector<int>ans;
int make(int l,int r,int dep){
	if(l>=r) return -1;
	int mid=(l+r)/2;
	int t=tot++;	
	if(dep%2==0) sort(P+l,P+r,X);
	else sort(P+l,P+r,Y); 
	T[t].loc=mid;
	T[t].l=make(l,mid,dep+1);
	T[t].r=make(mid+1,r,dep+1);
	return t;
}
int find(int v,int dep){
	int x=P[T[v].loc].x;
	int y=P[T[v].loc].y;
	if(sx<=x&&x<=tx&&sy<=y&&y<=ty) ans.push_back(P[T[v].loc].no);
	if(dep%2==0){
		if(sx<=x&&T[v].l!=-1) find(T[v].l,dep+1);
		if(x<=tx&&T[v].r!=-1) find(T[v].r,dep+1);	
	}else{
		if(sy<=y&&T[v].l!=-1) find(T[v].l,dep+1);
		if(y<=ty&&T[v].r!=-1) find(T[v].r,dep+1);
	}
}
main(){
	int n,q;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&P[i].x,&P[i].y);
		P[i].no=i;
	}
	make(0,n,0);
	scanf("%d",&q);
	for(int i=0;i<q;i++){
		scanf("%d%d%d%d",&sx,&tx,&sy,&ty);
		ans.clear();
		find(0,0);
		sort(ans.begin(),ans.end());
		for(int j=0;j<ans.size();j++) printf("%d\n",ans[j]);
		printf("\n");
	}
}



Measured memory_bytes: 14496
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = S()
    if 'A' in s and 'B' in s:
        print("Yes")
    else:
        print("No")


main()



Measured memory_bytes: 6860
#include <iostream>
#define MAX_N 100000
using namespace std;

int n;
string s;

void solve()
{
    int ans = 0;
    char prev = '*';

    for (char &c : s)
    {
        if (c != prev)
        {
            ans++;
        }
        prev = c;
    }
    cout << ans;
}

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

    solve();
}


Measured memory_bytes: 512
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
using ll = long long;
using VL=vector<ll>;

#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++)
const long long INF =  999999999;

ll a[103];
bool dp[100100];

int main(){
  ll N,K;
  cin >>N>>K;

  REP(i,N){
    cin >> a[i];
  }
    FOR(i,1,K+1){
      FOR(j,0,N){
        if(i-a[j]>=0)dp[i] |=!dp[i-a[j]];
      }
    }
    if(dp[K])cout<<"First" <<endl;
    else cout <<"Second"<<endl;
}


Measured memory_bytes: 384
if __name__ == "__main__":
    num_a = int(input())
    a = list(map(lambda x: int(x), input().split()))
    num_query = int(input())

    for _ in range(num_query):
        begin, end, t = map(lambda x: int(x), input().split())
        for i, idx in enumerate(range(begin, end)):
            a[idx], a[t + i] = a[t + i], a[idx]

    print(" ".join([str(elem) for elem in a]))



Measured memory_bytes: 5648
#include <cstdio>
#include <iostream>
#include <string>
#include <stack>
using namespace std;

stack<int> S;

int main() {
    string ch;
    int a, b;
    while (cin >> ch) {
        if (ch == "*") {
            a = S.top();
            S.pop();
            b = S.top();
            S.pop();
            S.push(a*b);
        }
        else if(ch == "+") {
            a = S.top();
            S.pop();
            b = S.top();
            S.pop();
            S.push(a+b);
        }
        else if(ch == "-") {
            a = S.top();
            S.pop();
            b = S.top();
            S.pop();
            S.push(b-a);
        }
        else {
            sscanf(ch.c_str(), "%d", &a);
            S.push(a);
        }
    }
    printf("%d\n", S.top());
    return 0;
}


Measured memory_bytes: 3324
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
		String strA = bufferedReader.readLine();
		String strB = bufferedReader.readLine();

		String[] list = strA.split("");
		String reA = list[2] + list[1] + list[0];

		if(strB.equals(reA)) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}

}


Measured memory_bytes: 21332
#include<iostream>
#include<cassert>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

typedef long long ll;
const ll mod = 1000000007;
/*
const int N = 2500;
ãããã°ç¨
ll comb[N][N];
void precalc(){
  comb[0][0] = 1;
  REP(i,1,N){
    comb[i][0] = comb[i][i] = 1;
    REP(j,1,i){
      comb[i][j] = (comb[i-1][j] + comb[i-1][j-1]) % mod;
    }
  }
}
*/

ll mypow(ll n,ll p){
  if (p == 1)return n;
  ll ret=mypow(n,p/2);
  ret=ret*ret%mod;
  if (p&1)ret=ret*n%mod;
  return ret;
}
ll getinv(ll a){
  return mypow(a,mod-2);
}


const int N = 300000;
ll fact[N];
void precalc(){
  fact[0] = 1;
  REP(i,1,N)fact[i] = (i * fact[i-1])%mod;
}

ll comb(int a,int b){
  ll ret = fact[a];
  ret = (ret * getinv(fact[b]))%mod;
  ret = (ret * getinv(fact[a-b]))%mod;
  return ret;
}

//nãä¸ã«ç§»åããåæ°
//xãä¸ã«ç§»åããåæ°
ll solve(int n,int x){
  if (x == 0)return 1;
  int u = n+x,d = x;
  ll all = comb(u + d,u);//ãã¹ã¦ã®ãã¿ã¼ã³ã®æ°
  ll ng  = comb(u+1 + d-1,u+1);//ãã¡ãªãã¿ã¼ã³ã®æ°ï¼åº§æ¨ãè² ã«ãªããã¿ã¼ã³)
  assert(x-1 + n >= n);
  return (all - ng+mod)%mod;
}

main(){
  precalc();
  int n,m,k;
  while(cin>>n>>m>>k && n){
    ll ans = 0;
    /*
      kéãã®å¯ãéããå·¦å³ã«ç§»åããåæ°ãåºå®ãã¦å¨éãè©¦ãã
      åå¯ãéã®ãã¿ã¼ã³ã¯n+2*iååããã¨ã«ãªãã
      ããã§åº§æ¨ããã¤ãã¹ã«ãªããªãããã®æ¹æ³ã¯ãæ°å­¦ã¬ã¼ã«ï¼å·»ã«ä¹ã£ã¦ããæ¹æ³ãä½¿ãã¨ããã
     */
    rep(i,k+1){
      ll lr = solve(n,i)  ;//å·¦å³ã®ç§»å
      ll ud = solve(m,k-i);//ä¸ä¸ã®ç§»å
      ll tmp = (lr*ud)%mod;
      ll cm  = comb(n+2*i + m+2*(k-i),n+2*i);
      cm = (cm*tmp)%mod;
      ans = (ans + cm)%mod;
    }
    cout << ans << endl;
  }
}

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

// @@ !! LIM()

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

  string S; cin >> S;
  ll K; cin >> K;
  for (ll i = 0; i < K; i++) {
    if (S.at(i) != '1') {
      cout << S.at(i) << endl;
      return 0;
    }
  }
  cout << 1 << endl;

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define MOD1 1000000007;
#define MOD2 1000007
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/*  */
 
ull pow(ull x,ull n) {
  ull res = 1;
  while(n > 0) {
    if(n&1) res = res * x;
    x = x * x;
    n >>= 1;
  }
  return res;
}
int dic_op(char str[14])
{
  int j;
  long long f = 1;
  long long g = 0;
  for(j = 0;;j++) {
    if(str[j] == 'A')
      g += f * 1;
    else if(str[j] == 'C')
      g += f * 2;
    else if(str[j] == 'G')
      g += f * 3;
    else if(str[j] == 'T')
      g += f * 4;
    else break;
    f *= 5;
  }
  return g; 
}
 
int main()
{
  int i,j,k,l;
  int n;
  long ans = 0;
  static char dic[90000000];
  char opstr[7];
  char str[13];
  cin >> n;
  for (i = 0; i < n; i++) {
    scanf("%s %s",opstr,str);
    if(opstr[0] == 'i') {
      dic[dic_op(str)] = 1;
    }
    else if(opstr[0] == 'f') {
      if(dic[dic_op(str)] == 1)
        puts("yes");
      else
        puts("no");
      j++;
    }
  }
  return 0;
}

Measured memory_bytes: 10632
h,w,kk = map(int,input().split())
dp = [[[] for j in range(w)] for i in range(h+1)]
# dp[i][j]
# 高さiにおいて点jに行き得る通り数
for i in range(h+1):
        for j in range(w):
                dp[i][j] = 0
dp[0][0]=1
mod = 1000000007

for i in range(1,h+1):
        for j in range(1<<(w-1)):
                yoko = [False for loo in range(w)]
                for k in range((w-1)):
                        yoko[k] = True if ((j>>k)&1) else False
                
                ok = True
                for l in range(w-2):
                        if(yoko[l]==True and yoko[l+1]==True):
                                ok = False
                if(not ok):
                        continue
                
                for l in range(w):
                        if(l==0):
                                if(yoko[l]):
                                        dp[i][l] += dp[i-1][l+1]
                                else:
                                        dp[i][l] += dp[i-1][l]
                                dp[i][l]%=mod
                                continue
                        if(l==w-1):
                                if(yoko[l-1]):
                                        dp[i][l] += dp[i-1][l-1]
                                else:
                                        dp[i][l] += dp[i-1][l]
                                dp[i][l]%=mod                                
                                continue

                        if(yoko[l-1] or yoko[l]):
                                if(yoko[l-1]):
                                        dp[i][l]+= dp[i-1][l-1]
                                else:
                                        dp[i][l]+= dp[i-1][l+1]
                        else:
                                dp[i][l] += dp[i-1][l]
                        dp[i][l]%=mod
                        
print(dp[h][kk-1])

Measured memory_bytes: 3192
#include <cstdio>
#include <algorithm>
#include <map>
#include <iterator>
#define LL long long
#define For(x) for (int i=1;i<=n;++i)
#define rep(i,x) for (int i=1;i<=x;++i)
#define repp(i,x,y) for (int i=x;i<=y;++i) 
#define F(x) for (int i=head[x];i;i=b[i].next)
#define mk(x,y) make_pair(x,y)
#define ft first
#define sd second
#define _ b[i].v;
#define mod  998244353
const int maxn=2e2+10;
using namespace std;

int n,x[maxn],y[maxn];
LL tmp1,tmp2,tmp,ans;
map <pair<LL,LL>,int> a;

LL qsm(LL a,LL b)
{
	LL tmp=1;
	while (b)
	{
		if (b&1) tmp=tmp*a%mod;
		a=a*a%mod;
		b>>=1;
	}
	return tmp;
}

int main()
{
	scanf("%d",&n);
	ans=(qsm(2,n)-n-1+mod)%mod;
	For (n) scanf("%d%d",&x[i],&y[i]);
	For (n)
	{
		a.clear();
		repp(j,i+1,n)
		{
			tmp1=y[i]-y[j];
			tmp2=x[i]-x[j];
			tmp=__gcd(tmp1,tmp2);
			tmp1/=tmp;
			tmp2/=tmp;
			++a[mk(tmp1,tmp2)];
		}
		for (map <pair<LL,LL>,int>::iterator k=a.begin();k!=a.end();++k)
		  ans=(ans-qsm(2,k->sd)+1+mod)%mod;
	}
	return 0*printf("%lld",ans);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    if(a<b){
        cout<<"a < b"<<endl;
    }
    if(a > b){
        cout<<"a > b"<<endl;
    }
    if(a==b){
        cout<<"a == b"<<endl;
    }
}


Measured memory_bytes: 3116
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let m = 1000_000_000 + 7;
    let n: usize = read();
    let a: Vec<i64> = (0..n).map(|_| read()).collect();

    let mut sum_a: i64 = a.iter().sum();

    let mut sum_ans = 0;
    sum_a = sum_a % m;
    for i in 0..n-1 {
        sum_a -= a[i];
        sum_ans += ((a[i]%m) * (sum_a%m))%m;
        sum_ans = sum_ans % m;
    }

    if sum_ans >= 0{
        println!("{}", sum_ans);
    }else{
        println!("{}", sum_ans+m);
    }
}


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

int main(){
    int n,k,ans=0,t;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(a[i]==1) t=i+1;
    }
    ans=(n-1+k-2)/(k-1);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i = 0;i < n;i++)
    {
        cin >> a[i];
    }
    int count = 0;
    int i = 0;
    while(a[i] != 2)
    {
        int temp = a[i];
        if(temp < 0)
        {
            cout << "-1";
            return 0;
        }
        a[i] = -1;
        i = temp - 1;
        count++;
    }
    cout << count + 1;

    return 0;
}

Measured memory_bytes: 640
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N,M = [int(x) for x in input().split()]
Llist =[]
Rlist =[]
for i in range (M):
    L,R = [int(x) for x in input().split()]
    Llist.append(L)
    Rlist.append(R)
 
lmax = max(Llist)
Rmax = min(Rlist)

if lmax > Rmax:
    print(0)
else:
    print(Rmax-lmax+1)



Measured memory_bytes: 10996
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 200010
using namespace std;
int n,l,r,mid;
int a[MAXN];
inline bool check_large(int x,int y)
{
    if(a[x]>mid&&a[y]>mid) return true;
    return false;
}
inline bool check_small(int x,int y)
{
    if(a[x]<=mid&&a[y]<=mid) return true;
    return false;
}
inline bool solve()
{
    for(int i=0;i<n-1;i++) 
    {
        if(check_large(n+i,n+i+1)||check_large(n-i,n-i-1)) return true;
        if(check_small(n+i,n+i+1)||check_small(n-i,n-i-1)) return false;
    }
    if(a[1]<=mid) return false;
    else return true;
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n*2-1;i++) scanf("%d",&a[i]);
    l=1,r=2*n-1;
    while(l<r)
    {
        mid=(l+r)>>1;
        if(solve()==true) l=mid+1;
        else r=mid; 
    }
    printf("%d\n",l);
    return 0;
}

Measured memory_bytes: 1024
a, b, c, d = map( int, input().split() )
#print( a, b, c, d )
 
for i in range( 200 ):
    c = c - b
    if c <= 0:
        print( "Yes" )
        exit()
 
    a = a - d
    if a <= 0:
        print( "No" )
        exit()

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

int main() {
  
  int N, K, x, sum;
  cin >> N >> K;
  sum = 0;
  
  for (int i = 0; i < N; i++) {
      cin >> x;
      if (K - x > x) {
          sum += x * 2;
      }
      else if (K - x <= x) {
          sum += (K - x) * 2;
      }
  }
  
  cout << sum << endl;
  
}


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

int N, K;

bool judge(vector<int> &A, int t)
{

    int cnt = 0;
    for (int i = 0; i < N; i++)
    {
        cnt += A.at(i) / t;
        if (A.at(i) % t == 0)
        {
            cnt--;
        }
    }

    if (cnt <= K)
    {
        return true;
    }
    else
    {
        return false;
    }
}

int binary_search(vector<int> &A, int ng, int ok)
{
    int mid;

    while (abs(ok - ng) != 1)
    {
        mid = (ok + ng) / 2;
        if (judge(A, mid))
        {
            ok = mid;
        }
        else
        {
            ng = mid;
        }
    }

    return ok;
}

int main()
{

    cin >> N >> K;
    vector<int> A(N);

    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }

    int ans;
    ans = binary_search(A, 0, 1000000000);
    cout << ans << endl;
}


Measured memory_bytes: 4052
def main():
    N, A, B = map(int, input().split())
    X = list(map(int, input().split()))

    cost = 0
    for i in range(N-1):
        distance = abs(X[i] - X[i+1])
        if distance * A < B:
            cost += distance * A
        else:
            cost += B
    print(cost)

if __name__ == "__main__":
    main()


Measured memory_bytes: 20140
#include <iostream>
using namespace std;
int main(void){
    long n;
    cin >> n;
    long ans = n;
    for(long i = 1;i * i <= n;i++){
          if(n % i == 0){
                ans = min(ans, i - 1 + n / i - 1);
          }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3608
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
int dp[6][1010];//動的計画法
int prime[1000001];
char str[1010][1010];
vector<pair<int,int> > pc[100001];
int ABS(int a){return max(a,-a);}
void solve(int,int);
int main(){
  double n,sn;
  while(1){
    cin >> n;
    if(n==-1.0) break;
    sn = n * 16;
    if(sn!=(int)sn || sn>=4096) cout << "NA";
    else solve((int)sn,0);
    cout << endl;
  }
}
void solve(int sn,int p){
  if(p == 12) return;
  solve(sn/2,p+1);
  if(p == 3) cout << ".";
  cout << sn % 2;
}


Measured memory_bytes: 5488
N=int(input())
x=[]
y=[]
h=[]

for _ in range(N):
    xx,yy,hh=map(int,input().split())
    x.append(xx)
    y.append(yy)
    h.append(hh)

for n in range(N):
    if h[n]!=0:
        sample_id=n
        break

for Cx in range(101):
    for Cy in range(101):
        ass_h=abs(x[sample_id]-Cx)+abs(y[sample_id]-Cy)+h[sample_id]
        judge=True
        for k in range(N):
            ass=abs(x[k]-Cx)+abs(y[k]-Cy)
            if max(ass_h-ass,0)!=h[k]:
                judge=False
                break
        if judge:
            print(Cx,Cy,ass_h)
            break
    if judge:
        break

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stdio.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
#include <fstream>
#include <list>
#include <iomanip>
#include <cctype>

using namespace std;

#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979

void printVec(std::vector<int>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}
void printVec1(std::vector<string>& vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}

template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
	vector.erase(vector.begin() + index);
}

int vector_finder(std::vector<string> vec, string number) {
	auto itr = std::find(vec.begin(), vec.end(), number);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

#include <sstream> 
std::vector<std::string> StringSplit(const std::string& str, char sep)
{
	std::vector<std::string> v;
	std::stringstream ss(str);
	std::string buffer;
	while (std::getline(ss, buffer, sep)) {
		v.push_back(buffer);
	}
	return v;
}

Int gcd(Int a, Int b) {
	return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
	return a * b / gcd(a, b);
}

bool comp(const string a, const string b) {
	return a.length() < b.length();
}

bool integer(double num) {
	return floor(num) == num;
}
#

int main() {
	int n; cin >> n;
	vector<string> w(n), c(n);
	for(int i = 0; i < n; i++) {
		cin >> w[i];
	}
	c = w;
	string store,temp,temp2;
	sort(w.begin(), w.end());
	w.erase(unique(w.begin(), w.end()), w.end());
	if (w.size() == c.size()) {
		for (int i = 1; i < n; i++) {
			temp = c[i-1];
			temp2 = c[i];
			if (temp[temp.size()-1] != temp2[0]) {
				//cout << temp[temp.size()-1] << endl;
				//cout << temp2[0] << endl;
				cout << "No";
				return 0;
			}
		}
		cout << "Yes";
	}
	else cout << "No";
	cout << store;

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#define in(n, m) for (int i=n; i<m;i++)
#define inj(n, m)for (int j=n; j<m;j++)
#define ink(n, m)for (ll k=n; k<m;k++)
using namespace std;
using ll=long long;
using P =pair<ll, ll>;
const ll INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll x;

int main() {
	cin >> x;
	ll happy500 = x / 500;
	ll happy5 = x % 500 / 5;
	cout << happy500 * 1000 + happy5 * 5 << endl;
	return 0;
}

Measured memory_bytes: 256
/// b.cpp
# include <stdio.h>
# include <bits/stdc++.h>
using namespace std;
const pair < int , int > DD[] = {{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};
# define fi cin
# define fo cout
# define x first
# define y second
# define ll long long
# define IOS ios_base :: sync_with_stdio(0);cin.tie(0)
# define p(v) cerr << #v << " = " << v << '\n'
# define p2(v) cerr << #v << " = " << (complex < decltype(v.x) > (v.x,v.y)) << '\n'
# define vi vector < int >
# define vl vector < ll >
# define pll pair < ll , ll >
# define pii pair < int , int >
# define mp make_pair
# define db long double
# define fail puts("-1")
# define yes puts("YES")
# define no puts("NO")
# define PP puts("Possible")
# define II puts("Impossible")
# define vii vector < pii >
# define vll vector < pll >
# define pb push_back
# define pdd pair < db , db >
# define all(s) s.begin(),s.end()
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void)
{
    #ifdef CF
    freopen("input","r",stdin);
    #endif // CF
    srand(time(0));
    fo << fixed << setprecision(7);
    cerr << fixed << setprecision(7);
    vii e;
    int n,m;
    int k;
    fi>>n>>m>>k;
    for (int i = 1;i <= n;i += 2)
    {
        for (int j = 1;j <= m;++j)
            e.pb(mp(i,j));
        if (i + 1 <= n)
            for (int j = m;j;--j)
                e.pb(mp(i + 1,j));
    }
    static int s[1 << 10][1 << 10];
    for (int i = 1;i <= k;++i)
    {
        int v;
        fi>>v;
        while (v --)
        {
            auto index = e.back();
            e.pop_back();
            s[index.x][index.y] =  i;
        }
    }
    for (int i = 1;i <= n;++i)
        for (int j = 1;j <= m;++j)
            fo << s[i][j] << " \n"[j == m];
    cerr << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
    return 0;
}


Measured memory_bytes: 896
#include <stdio.h>

int GCD(int x, int y)
{
  int temp = x % y;
  if (temp) {
    return GCD(y, temp);
  }
  else {
    return y;
  }
}

int main()
{
  int x, y;
  scanf("%d %d", &x, &y);

  printf("%d\n", GCD(x, y));

  return 0;
}



Measured memory_bytes: 2744
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define repc(i, s, t) for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

// Returns n divisors ORDER BY ASC.
vector<i64> getDivisors(i64 n)  // {{{
{
    vector<i64> ret;
    i64 i = 1;
    for (i = 1; i * i < n; ++i) {
        if (n % i == 0) {
            ret.emplace_back(i);
            ret.emplace_back(n / i);
        }
    }
    if (i * i == n) ret.emplace_back(i);
    sort(begin(ret), end(ret));
    return ret;
}  // }}}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    var(int, N);
    map<int, int> cnt;
    rep(i, 0, N) {
        var(int, a);
        cnt[a] += 1;
    }

    int ans = 0;
    set<int> buf;

    for (const auto [value, c] : cnt) {
        if (c > 1) {
            buf.insert(value);
            continue;
        }

        bool ok = true;
        for (const int d : getDivisors(value)) ok &= buf.count(d) == 0;
        if (ok) ++ans;

        buf.insert(value);
    }

    print(ans);

    return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    int count = 0;
    for(int i = a; i < b+1; i++){
        string s = to_string(i);
        if(s[0] == s[4] && s[1] == s[3]){
            count++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int bomb[8][8];

void disp_bomb (void )
{
	rep (i, 8 ){
		rep (j, 8 ){
			cout << bomb[i][j];
		} // end rep
		cout << endl;
	} // end rep
}

void explosion (int row, int col )
{
	bomb[row][col] = 0;
	for (int i = row; i <= row + 3 && i < 8; i++ ){
		if (bomb[i][col] ) explosion (i, col );
	} // end for
	for (int i = row; i >= row - 3 && i >= 0; i-- ){
		if (bomb[i][col] ) explosion (i, col );
	} // end for
	for (int j = col; j <= col + 3 && j < 8; j++ ){
		if (bomb[row][j] ) explosion (row, j );
	} // end for
	for (int j = col; j >= col - 3 && j >= 0; j-- ){
		if (bomb[row][j] ) explosion (row, j );
	} // end for
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.Bombs_Chain", "r", stdin );
	int n;
	scanf ("%d", &n );
	int cnt = 0;
	while (n-- ){
		memset (bomb, 0, sizeof (bomb ) );
		rep (i, 8 ){
			rep (j, 8 ){
				scanf ("%1d", &bomb[i][j] );
			} // end rep
		} // end rep
		int x, y;
		scanf ("%d %d", &x, &y );
		x--, y--;
//		disp_bomb ();
//		cout << endl;
		explosion (y, x );
		printf ("Data %d:\n", ++cnt );
		disp_bomb ();
//		cout << endl;
	} // end while
		
	return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i,a,b) for(int i=a;i<=b;i++)
const int N=1e2+5;
LL n,g,p[N],c[N],a[N],ans;
int main()
{
	cin>>n>>g;
	rep(i,1,n)
	{
		cin>>p[i]>>c[i];
		a[i]=i;
	}
	LL ans=1e18;
	do
	{
		LL sum=0,tot=0;
		rep(i,1,n)
		{
			int j=a[i];
			if(sum+p[j]*j*100+c[j]<=g)
			{
				sum+=p[j]*j*100+c[j];
				tot+=p[j];
			}
			else
			{
				LL ad=(g-sum)/(j*100);
				if((g-sum)%(j*100))ad++;
			    tot+=min(ad,p[j]);
				ans=min(ans,tot);
				break;
			}
		}
		ans=min(ans,tot);

	}while(next_permutation(a+1,a+1+n));
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#define rep(i, a, n) for(int i = int(a);i < int(n);++i)
#define repe(i, a, n) for(int i = int(a);i <= int(n);++i)
#define repr(i, a, n) for(int i = int(a);i > int(n);--i)
#define reper(i, a, n) for(int i = int(a);i >= int(n);--i)
#define size(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define pb push_back
#define EPS (1e-20)
#define INF 2147483647
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using namespace std;


int main() {
	string S;
	cin >> S;

	int ans = 700;
	rep(i, 0, size(S))
		if(S[i] == 'o') ans += 100;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 300000
using namespace std;
int n,seq[MAXN+5],lsh[MAXN+5],lcnt;
int a[MAXN+5],b[MAXN+5],la,lb;
int main()
{
//	freopen("sort.in","r",stdin);
//	freopen("sort.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&seq[i]);
		lsh[++lcnt]=seq[i];
	}
	sort(lsh+1,lsh+1+lcnt);
	lcnt=unique(lsh+1,lsh+1+lcnt)-lsh-1;
	for(int i=1;i<=n;i++)
		seq[i]=lower_bound(lsh+1,lsh+1+lcnt,seq[i])-lsh;
	int ans=0;
	for(int i=1;i<=n;i+=2)
		if(seq[i]%2==0)
			ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2176
def f(hp,atk):
	i = 1
	while True:
		if hp - i*atk <= 0:
			return i
		i += 1

a,b,c,d = input().split()

# print('Aくんは{}ターンで勝つ'.format(f(int(c),int(b))))
# print('Bくんは{}ターンで勝つ'.format(f(int(a),int(d))))

if f(int(c),int(b)) <= f(int(a),int(d)):
	print('Yes')
else:
	print('No')
	

Measured memory_bytes: 9184
n, w = map(int, input().split())
s = [list(map(int, input().split())) for i in range(n)]
ws = [x[0] for x in s]
v = [x[1] for x in s]

dp = [[0]*(w+1) for _ in range(n+1)]

for sum_w in range(w+1):
    for i in range(1, n+1):
        if ws[i-1] <= sum_w:
            dp[i][sum_w] = max(dp[i-1][sum_w], dp[i-1][sum_w-ws[i-1]]+v[i-1])
        else:
            dp[i][sum_w] = dp[i-1][sum_w]

print(dp[-1][-1])


Measured memory_bytes: 120684