akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<deque>
#include<queue>
using namespace std;

using ll = long long;
const int INF = 1001001001;
const ll LLINF = 1001001001001001001;
const int MOD = 1000000007;

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

int main()
{
  int x, y;
  cin >> x >> y;
  if (y % 2) {
    cout << "No" << endl;
    return 0;
  }
  int a = x * 2 - (y / 2);
  int b = x - a;
  if ((a >= 0 && b >= 0) || (a == 0 && b >= 0) || (a >= 0 && b == 0)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3632
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            double ans;
            if (n % 2 == 0)
                ans = 1 / 2.0;
            else
                ans = (double) (n / 2 + 1) / n;
            out.println(ans);
        }

    }

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

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

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

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

Measured memory_bytes: 21460
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        long base = 0;
        for(int i = 0; i<n; i++) {
            a[i] = sc.nextInt();
            if(i%2==0) base += a[i];
            else base -= a[i];
        }

        for(int i = 0; i<n; i++) {
            if(i!=0) base = 2*a[i-1] - base;
            System.out.println(base);
        }
    }
}

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

int main() {
	int N;
  	cin >> N;
  	int S , H , J , I ;
  	S = N / 1000 ;
  	H = N % 1000 / 100 ;
    J = N % 1000 % 100 / 10 ;
    I = N % 1000 % 100 % 10 ;
    if(S == H){
    	if(H == J){
        	cout << "Yes" << endl;
        }
        else{
        	cout << "No" << endl;
        }
    }else if(H == J){
    	if(J == I){
        	cout << "Yes" << endl;
        }else{
        	cout << "No" << endl;
        }
    }else{
    	cout << "No" << endl;
    }
}


Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n,m;
  while(cin >> n >> m, n){
    vector<int> a(n);
    REP(i,n) cin >> a[i];

    int ans = -1;
    REP(i,n) REP(j,n){
      if(i != j && a[i]+a[j] <= m) ans = max(ans,a[i]+a[j]);
    }
    if(ans != -1) cout << ans << endl;
    else cout << "NONE" << endl;
  }

  return 0;
}


Measured memory_bytes: 3160
import sys
input = sys.stdin.readline


class SegTree:
    def __init__(self, v, op, e) -> None:
        self._n = len(v)
        self.log = (self._n - 1).bit_length()
        self.size = 1 << self.log
        self.d = [e() for _ in range(2 * self.size)]
        self.op = op
        self.e = e
        for i in range(self._n):
            self.d[self.size + i] = v[i]
        for i in reversed(range(1, self.size)):
            self.__update__(i)

    @classmethod
    def init_e(cls, n: int, op, e) -> 'SegTree':
        return cls([e for _ in range(n)], op, e)

    def set(self, p: int, x) -> None:
        p += self.size
        self.d[p] = x
        for i in range(1, self.log + 1):
            self.__update__(p >> i)

    def get(self, p: int):
        return self.d[p + self.size]

    def prod(self, l: int, r: int):
        sml = self.e()
        smr = self.e()
        l += self.size
        r += self.size

        while l < r:
            if l & 1:
                sml = self.op(sml, self.d[l])
                l += 1
            if r & 1:
                r -= 1
                smr = self.op(self.d[r], smr)
            l >>= 1
            r >>= 1
        return self.op(sml, smr)

    def all_prod(self):
        return self.d[1]

    def max_right(self, l: int, f):
        if l == self._n:
            return self._n
        l += self.size
        sm = self.e()
        while True:
            while l % 2 == 0:
                l >>= 1
            if not f(self.op(sm, self.d[l])):
                while l < self.size:
                    l *= 2
                    if f(self.op(sm, self.d[l])):
                        sm = self.op(sm, self.d[l])
                        l += 1
                return l - self.size
            sm = self.op(sm, self.d[l])
            l += 1
            if (l & -l) == l:
                return self._n

    def min_left(self, r: int, f):
        if r == 0:
            return 0
        r += self.size
        sm = self.e()
        while True:
            r -= 1
            while r > 1 and r % 2:
                r >>= 1
            if not f(self.op(self.d[r], sm)):
                while r < self.size:
                    r = 2 * r + 1
                    if f(self.op(self.d[r], sm)):
                        sm = self.op(self.d[r], sm)
                        r -= 1
                return r + 1 - self.size
            sm = self.op(self.d[r], sm)
            if (r & -r) == r:
                return 0

    def __update__(self, k: int) -> None:
        self.d[k] = self.op(self.d[2 * k], self.d[2 * k + 1])


n, q = map(int, input().split())
a = list(map(int, input().split()))
seg = SegTree(a, max, lambda: -1)

for _ in range(q):
    t, x, y = map(int, input().split())
    if t == 1:
        seg.set(x - 1, y)
    elif t == 2:
        print(seg.prod(x - 1, y))
    else:
        print(seg.max_right(x - 1, lambda v: v < y) + 1)


Measured memory_bytes: 123368
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace D
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var n = long.Parse(Console.ReadLine());
            var answer = 0L;
            var prime = new Prime(n);
            foreach (var p in prime.Factors.Keys)
            {
                var e = 1;
                while (true)
                {
                    var tmp = (long)Math.Pow(p, e++);
                    if (n % tmp == 0)
                    {
                        n /= tmp;
                        answer++;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            Console.WriteLine(answer);
        }
    }

    public class Prime
    {
        public Dictionary<long, long> Factors => new Dictionary<long, long>(_factors);
        private Dictionary<long, long> _factors;
        public Prime(long n)
        {
            _factors = new Dictionary<long, long>();

            var tmp = n;
            var max = (long)Math.Sqrt(n);
            var p = 2;
            while (p <= max)
            {
                if (tmp % p == 0)
                {
                    _factors[p] = 0;
                    while (tmp % p == 0)
                    {
                        tmp /= p;
                        _factors[p]++;
                    }
                }
                p++;
            }
            if (tmp > 1) _factors[tmp] = 1;
        }

        public bool IsPrime(long n) => _factors.ContainsKey(n);
    }
}


Measured memory_bytes: 28220
//run: g++ -std=c++14 -o run_sol.exe solution.cpp -DLOCAL_JUDGE
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define INFLL 1e17
#define PI 2*acos(0.0)
#define show(x) cout<< #x <<" is "<< x <<"\n"
using namespace std;

#define FS first
#define SC second
#define PB(t) push_back(t)
#define LEN(t) ((int)t.size())
#define ALL(t) t.begin(),t.end()
#define MP(x, y) make_pair((x), (y))
#define Fill(a,c) memset(&a, c, sizeof(a))
#define POPCOUNT __builtin_popcount

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<PII> VPII;

int main() {
    #ifdef LOCAL_JUDGE
        freopen("../input.txt", "rt", stdin);
        freopen("../output.txt", "wt", stdout);
    #endif

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

    for (int n, k; cin >> n >> k;) {
        VI movs(n);
        int win, mn = k;
        for(auto& val : movs) {
            cin >> val;
            mn = min(mn, val);
        }

        VI dp(k + 1, 1);
        for (int i = mn; i <=k; i++) {
            win = 0;
            for (auto mov : movs) {
                if (i - mov >= 0) {
                    win |= dp[i - mov];
                }
            }
            if (win) {
                dp[i] = 0;
            }
        }
        
        // for (int i = 0; i <=k; i++) {
        //     cout << dp[i] << " ";
        // }
        // cout << "\n";

        if (!dp[k]) {
            cout << "First\n";
        } else {
            cout << "Second\n";
        }
    }

return 0;
}

Measured memory_bytes: 640
// ITP1_4_B
"use strict";
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});
/* 入力は 
2
*/
reader.on('close', () => {
    var s, l;
    var r = Number(lines[0]);
    [s, l] = aux(r);
    console.log(s.toString()+' '+l.toString());
});

function aux(r)
{
    var s = Math.PI*r*r;
    var l = Math.PI*2*r;

    return([s.toFixed(6), l.toFixed(6)]);
}


Measured memory_bytes: 16228
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
#define inf 1000000000
#define mod 1000000007
#define eps 1e-10
#define rep(i, l, r) for(int i=l; i<r; ++i)
const double pi=acos(-1.0);

using namespace std;
int t;
int n;
int main(){
	scanf("%d", &n);
	int cur=7%n;
	bool f=false; 
	rep(i, 1, 1000001){
		if(!cur){
			printf("%d", i);
			f=true;
			break;
		}
		cur=(10ll*cur+7)%n;
	}
	if(!f) printf("-1");
	return 0;
}

Measured memory_bytes: 1736
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val b = sc.next()

    val ret = when(b){
        "A" -> "T"
        "T" -> "A"
        "C" -> "G"
        "G" -> "C"
        else ->""
    }

    println(ret)
}

Measured memory_bytes: 29356
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>
#include<map>
#include<set>
#include<stack>
#include<queue>

#define reps(i,j,k) for(int i=(j);i<(k);i++)
#define rep(i,j) reps(i,0,j)
#define fs first
#define sc second
#define pb push_back
#define mk make_pair

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

template<class S,class T>
ostream &operator<<(ostream &out, const pair<S,T> p){
	return out << "(" << p.fs << ", " << p.sc << ")";
}

template<class T>
ostream &operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()) out << v[i] << ", ";
	return out << "}" << endl;
}

int main(){
	int n;
	cin >> n;
	vi a(n);
	ll ans = 1;
	ll cnt = 1;
	rep(i, n){
		int t;
		cin >> t;
		a[i] = 2 - (t&1);
		cnt *= a[i];
		ans *= 3;
	}
	cout << ans - cnt << endl;


	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

//Dragon Fantasy
public class Main{

	int n, hx, hy, dx, dy;
	int[][] p;
	double[] r;
	double[][] d;
	double EPS = 1e-8;
	
	boolean dfs(int k, int S, double t){
		if(S==(1<<n)-1)return true;
		for(int i=0;i<n;i++){
			if(((S>>i)&1)>0)continue;
			if(r[i]<t+d[k][i]+EPS)return false;
		}
		for(int i=0;i<n;i++){
			if(((S>>i)&1)>0)continue;
			if(r[i]>t+d[k][i]){
				if(dfs(i, S+(1<<i), t+d[k][i]))return true;
			}
		}
		return false;
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			n = sc.nextInt(); hx = sc.nextInt(); hy = sc.nextInt(); dx = sc.nextInt(); dy = sc.nextInt();
			if((n|hx|hy|dx|dy)==0)break;
			p = new int[n][2];
			for(int i=0;i<n;i++)for(int j=0;j<2;j++)p[i][j]=sc.nextInt();
			r = new double[n];
			for(int i=0;i<n;i++)r[i]=Math.hypot(p[i][0]-dx, p[i][1]-dy);
			d = new double[n+1][n+1];
			for(int i=0;i<n;i++){
				d[n][i] = d[i][n] = Math.hypot(hx-p[i][0], hy-p[i][1]);
				for(int j=i+1;j<n;j++)d[i][j] = d[j][i] = Math.hypot(p[i][0]-p[j][0], p[i][1]-p[j][1]);
			}
			System.out.println(dfs(n, 0, 0)?"YES":"NO");
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 0
import sys
sys.setrecursionlimit(10 ** 6)


def main():
    N, K = map(int, input().split())
    A = tuple(sorted(map(int, input().split())))
    c = [0] * (K + 1)
    def dp(k, A, c, turn):
        if c[k] != 0:
            return c[k] * turn
        for i in A:
            if i > k:
                break
            if dp(k - i, A, c, -turn) == turn:
                c[k] = 1
                return turn
        c[k] = -1
        return -turn
    
    print('First' if dp(K, A, c, 1) == 1 else 'Second')


main()


Measured memory_bytes: 114036
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

ll nCrcheep(ll n,ll r){
  if(r == 0) return 1;
  else if(r == 1) return n;
  else return nCrcheep(n-1,r-1)*n/r;
}

vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}




int main(){
  ll d; cin >> d; ll happy = 0;
  vl whatday(26);
  
  vector<bool> israted(26,false);
  
  vl human(26);
  rep(i,26) cin >> human[i];
  
  vvl userhappy(d,vl(26));  
  rep(i,d){
    rep(j,26){
      cin >> userhappy[i][j];
    }
  }
  
 
  rep(i,d){
    ll now = 0; ll nowhappy = 0;
    rep(j,26){
      if(israted[j]){
        if(userhappy[i][j] + 
           (human[j]*(i-whatday[j]))*(human[j]*(i-whatday[j])) > nowhappy){
          now = j;
          nowhappy = userhappy[i][now] + human[j]*(i-whatday[j]);
        }
      }
      else if(userhappy[i][j] > nowhappy){
        now = j;
        nowhappy = userhappy[i][now];
      }
    }
    
    cout << now+1 << endl;
    israted[now] = true;
    whatday[now] = i;
  }
  
  
}

Measured memory_bytes: 3668
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 200000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	ll cost;
	edge(int _t, ll _cost) : t(_t)
		, cost(_cost) {
	}
};
bool isPrime(int n) {

	if (n == 1) return false;
	for (ll i = 2; i * i <= n; i++)
	{
		if (n % i == 0) return false;
	}
	return true;
}
void Solve() {
	int n, h, w;
	cin >> n >> h >> w;
	int res = 0;
	for (size_t i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		res += (h <= a && w <= b);
	}
	cout << res << endl;
}
int main() {
	Solve();
	return 0;
}



Measured memory_bytes: 256
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    s=readline().strip()

    left_left=0
    need_left=0
    for i in range(n):
        if s[i]=="(":
            left_left+=1
        else:
            if left_left>0:
                left_left-=1
            else:
                need_left+=1

    right_right=0
    need_right=0
    for i in range(n-1,-1,-1):
        if s[i]==")":
            right_right+=1
        else:
            if right_right>0:
                right_right-=1
            else:
                need_right+=1

    print("("*need_left+s+")"*need_right)

if __name__=="__main__":
    main()

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


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

  ll id = -1;//tに適合するsの部分文字列のうちで一番後ろのものの先頭要素番号
  for(ll i=0;i<=(ll)s.size()-(ll)t.size();++i){
    //sのi番目からの部分文字列がtに適合するかを調べる
    for(ll j=0;j<(ll)t.size();++j){
      if( s.at(i+j) == '?' || s.at(i+j) == t.at(j) ){
        //適合したらその要素番号を控える
        if( j == (ll)t.size() - 1 ) id = i;
      }else{
        //合わなければ先頭要素をずらす
        break;
      }
    }
  }
  //適合する部分文字列がないとき : UNRESTORAβLE
  if( id == -1 ){
    cout << "UNRESTORABLE" << endl;
    return 0;
  }
  
  //あるなら、元の'?'以外の文字と適合部分以外は全て'a'にして出力
  for(ll i=0;i<(ll)s.size();++i){
    if( i == id ){
      cout << t;
      i += t.size()-1;
      continue;
    }
    if( s.at(i) == '?' ) cout << 'a';
    else cout << s.at(i);
  }
  cout << endl;
  return 0;
}

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

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, W;
int A[10000];
int dp0[10001][201];
int dp1[10001][201];

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> W;
  rep(i, N) cin >> A[i];
  sort(A, A+N);

  dp0[0][0] = 1;
  rep(i, N) {
    rep(w, W+1) {
      rep(k, N+1) dp1[w][k] = 0;
    }
    // k>0
    for (int k=1; k<=i; k++) {
      for (int w=W; w>=A[i]; w--) {
        dp1[w][k] += dp0[w-A[i]][k];
        if (dp1[w][k] >= MOD) dp1[w][k] -= MOD;
      }
      rep(w, W+1) {
        dp1[w][k] += dp0[w][k];
        if (dp1[w][k] >= MOD) dp1[w][k] -= MOD;
      }
    }
    // k=0
    rep(w, W+1) {
      dp1[w][i+1] += dp0[w][0];
      if (dp1[w][i+1] >= MOD) dp1[w][i+1] -= MOD;
    }
    for (int w=W; w>=A[i]; w--) {
      dp1[w][0] += dp0[w-A[i]][0];
      if (dp1[w][0] >= MOD) dp1[w][0] -= MOD;
    }
    rep(w, W+1) swap(dp0[w], dp1[w]);
  }
  int s = 0;
  rep(k, N+1) {
    rep(w, W+1) {
      if (dp0[w][k] == 0 || (k>0&&w+A[k-1]<=W)) continue;
      s += dp0[w][k];
      if (s >= MOD) s -= MOD;
    }
  }
  cout << s << "\n";
  return 0;
}

Measured memory_bytes: 18772
use proconio::input;
use proconio::marker::*;

fn main() {
  input! {
    n: usize,
    chars: Chars
  }
  
  let mut min = usize::max_value();
  let mut memo = vec![(0,0);n];
  
  let mut w = 0;
  for i in 0..n-1 {
    if chars[i] == 'W' {
      w += 1;
    }
    memo[i+1].0 = w;
  }
  
  let mut e = 0;
  for i in (0..n-1).rev() {
    if chars[i+1] == 'E' {
      e += 1;
    }
    memo[i].1 = e;
  }
  
  let mut min = usize::max_value();
  for (w, e) in memo {
    min = std::cmp::min(min, w + e);
  }
  println!("{}", min);
}

Measured memory_bytes: 8056
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;

class Main{
    public static void main(String[] args) throws IOException{
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        final PrintStream out = new PrintStream(System.out);
        br.readLine();
        String[] in = br.readLine().split(" ");
        final boolean[] sum = new boolean[2001];
        sum[0] = true;
        for(final String e:in){
            final int a = Integer.parseInt(e);
            for(int i = 2000-a; i>=0; i--){
                if(sum[i]) sum[i+a] = true;
            }
        }
        br.readLine();
        in = br.readLine().split(" ");
        for(final String e:in){
            out.println(sum[Integer.parseInt(e)] ? "yes" : "no");
        }
        out.flush();
    }
}

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

bool possible(int n) {
    for (int i = 1; i <= 9; i++) {
        for (int j = 1; j <= 9; j++) {
            if (n == i * j) {
                return true;
            }
        }
    }

    return false;
}

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

    cout << (possible(n) ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <queue>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

const int MAXH = 805;
const int MAXW = 805;
int dist[MAXH][MAXW];

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

int h, w, k;

queue<PII> q;

vector<string> board; string row;

inline int ceildiv(int x) {
    return x / k + (x % k != 0);
}

int main() {
    GI(h);
    GI(w);
    GI(k);

    int si = -1;
    int sj = -1;

    FORN(i, h) {
        cin >> row;
        board.PB(row);

        FORN(j, w) {
            if (board[i][j] == 'S') {
                si = i;
                sj = j;
            }
        }
    }

    memset(dist, -1, sizeof dist);
    
    q.push(MP(si, sj)); dist[si][sj] = 0;

    while (q.size()) {
        auto p = q.front(); q.pop();

        int i = p.FF;
        int j = p.SS;

        if (dist[i][j] == k) continue;

        FORN(d, MAXD) {
            int ni = i + dx[d];
            int nj = j + dy[d];

            if (ni >= 0 && ni < h && nj >= 0 && nj < w && board[ni][nj] != '#' && dist[ni][nj] == -1) {
                dist[ni][nj] = dist[i][j] + 1;
                q.push(MP(ni, nj));
            }
        }
    }

    /*
    FORN(i, h) {
        FORN(j, w) {
            cout << dist[i][j] << " ";
        }
        cout << endl;
    }
    */

    int res = INF;

    FORN(i, h) {
        FORN(j, w) {
            if (dist[i][j] >= 0) {
                if (i == 0 || i == h-1 || j == 0 || j == w-1) {
                    res = 1;
                }
                else {
                    res = min(res, 1 + min(ceildiv(i), min(ceildiv(h-1-i), min(ceildiv(j), ceildiv(w-1-j)))));
                }
            }
        }
    }

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

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


using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define all(n) n.begin(),n.end()
#define eb emplace_back
#define endl "\n"

const ll maxn=19;

const ll maxx=1e13;
const ll mod=1000000007;
const ll mod1=998244353;
 ll cost[maxn];
 bool dd[maxn];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("test.txt","r",stdin);
    //   freopen("GREEDY.INP", "r", stdin);
    //  freopen("GREEDY.OUT", "w", stdout);
   ll n , k;
   cin>>n>>k ;
   for (int i=1;i<=k;i++)
   {
       ll d;
       cin>>d;
        while (d--)
        {
            ll x;
            cin>>x;
            dd[x]=1;
        }
   }
   ll ans=n;
   for (int i=1;i<=n;i++)
   {
       if (dd[i])
       {
           ans--;
       }
   }
   cout <<ans;
}


Measured memory_bytes: 3656
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>

using namespace std;

int main(){
	char a[111], b;
	int n, m, i, j, flag;
	while(~scanf("%s", a)){
		int str = strlen(a);
		flag = 0;
		for(i = 0; i < str; i++){
			b = a[i], m = 0;
			for(j = 0; j < str; j++)
				if(a[j] == b)  m++;
			if(m % 2 == 1) flag = 1;
		}
		if(flag)  cout << "No" << endl;
		else cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
/*
  NAME : RISHABH SINGH
  INSTITUTION : DELHI TECHNOLOGICAL UNIVERSITY
*/
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
#define pii pair<int, int>
#define bi __builtin_inf()
#define ll long long
#define mp make_pair
#define ss second
#define pb push_back
#define ff first
#define speed_cubing ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define um unordered_map
#define us unordered_set
#define bp __builtin_popcount
#define ld long double
#define rep(n) for (int i = 0; i < n; i++)
#define pll pair<ll, ll>
#define mx = 1e18;
#define lb(v, val) (lower_bound(v.begin(), v.end(), val) - v.begin())
#define ub(v, val) (upper_bound(v.begin(), v.end(), val) - v.begin())
#define PI 3.1415926535
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> pbds;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
#define sz(v) (int)v.size()
#define endl '\n'
const int mod = 1e9+7;
ll mul_inv(ll a,ll b = mod) {ll t1=a,t2=b,t3,v1=1,v2=0,v3;while(t2!=1){ll x=t1/t2;t3=t1-x*t2;v3=v1-x*v2;t1=t2,t2=t3;v1=v2,v2=v3;}return(v2+b)%b;}
const int N = 5e5+5;
 
int32_t main(){
   
   speed_cubing
   
   
   ld d,t,s;
   cin>>d>>t>>s;

   if(d/s<=t)
     cout<<"Yes";
   else 
     cout<<"No";  


   return 0;
}

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

int main(){
  int n,t,A;
  cin >> n >> t >> A;
  double kion=10e5,baf;
  int ans;
  for(int i=0;i<n;i++){
    cin >> baf;
    if(kion>abs(A-t+baf*0.006)){
      kion=abs(A-t+baf*0.006);
      ans=i+1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3800
from collections import deque


def solve():
    N = int(input())
    XY= [[]]
    for _ in range(N):
        A = int(input())
        xylist = []
        for __ in range(A):
            x, y = map(int, input().split())
            xylist.append([x,y])
        XY.append(xylist)
        ans = 0
    for bit in range(2 ** N):
        honestset = set()
        unhonestset = set()
        for i in range(N):
            if ((bit >> i) & 1) == 1:
                honestset.add(i+1)
            else:
                unhonestset.add(i+1)

        before = 100
        before_un = 100
        while (before != len(honestset) or before_un != len(unhonestset)):
            before = len(honestset)
            before_un = len(unhonestset)
            tmp = list(honestset)
            for x in tmp:
                for xin, yin in XY[x]:
                    if yin == 1:
                        honestset.add(xin)
                    else:
                        unhonestset.add(xin)
        if len(honestset & unhonestset) == 0:
            ans = len(honestset) if ans < len(honestset) else ans

    print(ans)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 46572
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<stack>
#include<cmath>
#include<math.h>
#include <iomanip>
using namespace std;
int arr[200000];
int arr1[200000], arr2[200000];
int ind=0;
int n;
int culc(int cur){
	int fr=0;
	int ls=ind;
	int mid;
	while(ls>=fr){
		mid=(fr+ls)/2;
		if (arr1[mid]>cur)ls=mid-1; else if(arr1[mid]<cur)fr=mid+1; else return mid;
	}
	return -1;
}

int main(){
	
	long long arr3[31];
	arr3[0]=1;
	for(int i=1;i<31;i++)arr3[i]=arr3[i-1]*2;
	
	cin>>n;
	int ans=0;
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	sort(arr,arr+n);
	
	for(int i=0;i<n;i++)arr2[i]=0;
	arr1[0]=arr[0];
	arr2[0]=1;
	
	for(int i=1;i<n;i++){
		if(arr[i]!=arr[i-1])arr1[++ind]=arr[i];
		arr2[ind]++;
	}
	for(int i=ind;i>=0;i--){
		long long cur;
		for(int j=30;j>=0;j--){
			if(arr1[i]>=arr3[j]){
				cur=arr3[j+1];
				//cout<<arr1[i]<<" "<<cur<<" "<<arr3[j]<<" "<<ind<<endl;
				break;
			}
		}
		if(cur==arr1[i]*2){
			ans+=arr2[i]/2;
			continue;
		}
	//cout<<arr2[i]<<" "<<culc(cur-arr1[i])<<" "<<arr2[culc(cur-arr1[i])]<<endl;
		int ot=culc(cur-arr1[i]);
		if(ot==-1)continue;
		int cut=min(arr2[i],arr2[ot]);
		ans+=cut;
		//cout<<arr1[i]<<" "<<cut<<endl;
		arr2[ot]-=cut;
	}
	cout<<ans<<endl;
		
	return 0;
}

Measured memory_bytes: 2560
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int[] hight=new int[n];
		for (int i=0;i<n;i++) hight[i]=sc.nextInt();
		int[] dp=new int[n];
		for (int i=1;i<n;i++) {
			int tmp=Integer.MAX_VALUE;
			for (int j=1;j<=k;j++) {
				if (i-j>=0) tmp=Math.min(tmp, dp[i-j]+Math.abs(hight[i]-hight[i-j]));
			}
			dp[i]=tmp;
		}
		System.out.println(dp[n-1]);
	}
}

Measured memory_bytes: 49660
#include<bits/stdc++.h>
using namespace std;
int main(){
	char c[300];
	cin>>c+1; int flag1(0),flag2(0);
	for (int i=1; i<=strlen(c+1);++i) {
		if (c[i]=='C') flag1=1;
		if (c[i]=='F'&&flag1==1) flag2=1;}
	if (flag2==1) cout<<"Yes"<<endl;else cout<<"No"<<endl;}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val ds = sc.next().toStream.distinct

  val ns = ds.count(c => c == 'N' || c == 'S')
  val ew = ds.count(c => c == 'W' || c == 'E')

  if (ns % 2 == 0 && ew % 2 == 0) {
    println("Yes")
  } else {
    println("No")
  }
}


Measured memory_bytes: 27456
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  if(s.at(2)==s.at(3)&&s.at(4)==s.at(5)){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
 
    
  

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

int main(){
    int N;
    long long int K, A[100000];
    cin >> N >> K;
    for(int i=0; i<N; i++) cin >> A[i];

    long long int dp[41][2];
    for(int d=40; d>=0; d--) for(int j=0; j<2; j++) dp[d][j] = -1e18;
    dp[40][0] = 0;

    for(int d=39; d>=0; d--){
        long long int D = 1LL<<d;

        int num1 = 0;
        for(int i=0; i<N; i++) if(A[i] & D) num1++;
        int num0 = N - num1;

        if(K & D){
            dp[d][0] = max(dp[d][0], dp[d+1][0] + D * num0);
            dp[d][1] = max(dp[d][1], dp[d+1][0] + D * num1);
        }else{
            dp[d][0] = max(dp[d][0], dp[d+1][0] + D * num1);
        }

        dp[d][1] = max(dp[d][1], dp[d+1][1] + D * max(num0, num1));
        //cout << dp[d][0] << " " << dp[d][1] << endl;
    }

    long long int ans = max(dp[0][0], dp[0][1]);

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import copy

n = int(input())
a = input().split()
b = copy.deepcopy(a)

for i in range(n):
    for j in range(n - 1 - i):
        if int(a[j][1]) > int(a[j + 1][1]):
            tmp = a[j]
            a[j] = a[j + 1]
            a[j + 1] = tmp

ra = " ".join(a)

print(ra)
print("Stable")

for i in range(n - 1):
    minj = i
    for j in range(i + 1, n):
        if int(b[j][1]) < int(b[minj][1]):
            minj = j
    if minj != i:
        tmp = b[i]
        b[i] = b[minj]
        b[minj] = tmp

rb = " ".join(b)
print(rb)

if ra == rb:
    print("Stable")
else:
    print("Not stable")

Measured memory_bytes: 8120
#include <bits/stdc++.h>
#define MOD(x) ((x % MOD_N) + MOD_N) % MOD_N
#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 RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,v) for(auto i=v.begin();i!=v.end();++i)
#define REACH(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
#define LB(c,x) distance((c).begin(),lower_bound(ALL(c),x))
#define UB(c,x) distance((c).begin(),upper_bound(ALL(c),x))
#define COUNT(c,x) (lower_bound(ALL(c),x)-upper_bound(ALL(c),x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;
#define NL cerr<<endl;
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T sum(vector<T>&v){return accumulate(ALL(v),T());}
template<typename T>T sum(vector<T>&v,int a,int b){return accumulate(v.begin()+a,v.begin()+b,T());}
template<typename T>T max(vector<T>&v){return *max_element(ALL(v));}
template<typename T>T min(vector<T>&v){return *max_element(ALL(v));}
template<typename T>T max_index(vector<T>&v){return distance((v).begin(),max_element(ALL(v)));}
template<typename T>T min_index(vector<T>&v){return distance((v).begin(),min_element(ALL(v)));}

struct edge { int to, cost; };

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}

const int MOD_N = 1e9+7;

signed main()
{
   string s; cin >> s;
   int y = stoi(s.substr(0,4));
   int m = stoi(s.substr(5,2));
   int d = stoi(s.substr(8,2));
   if (MP(2019,MP(4,30)) >= MP(y,MP(m,d))) {
      cout << "Heisei" << endl;
   } else {
      cout << "TBD" << endl;
   }

   return 0;
}


Measured memory_bytes: 256
n = int(input())
s = list(input())
tot = 0
tot += s.count('R') * s.count('G') * s.count('B')
for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if k < n and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            tot -= 1
print(tot)


Measured memory_bytes: 9188
N = int(input())
A = [int(_) for _ in input().split()]

def solve(N, A):
    from collections import Counter
    cs = Counter(A)
    if N % 2 == 1:
        if cs[0] != 1:
            return 0
        if any(cs[i] != 2 for i in range(2, N, 2)):
            return 0
    else:
        if any(cs[i] != 2 for i in range(1, N, 2)):
            return 0
    return (2 ** (N // 2)) % 1000000007

print(solve(N, A))


Measured memory_bytes: 14500
#include<bits/stdc++.h>
using namespace std;
 
int main() {
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	
	string t;
	cin >> t;
	sort(t.begin(), t.end());
	reverse(t.begin(), t.end());
	
	if (s < t) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

ll a, b;

int main(){
    scanf("%lld%lld", &a, &b);
    if(abs(a - b) % 2 == 1){
        printf("IMPOSSIBLE\n");
        return 0;
    }
    printf("%lld\n", (a + b) / 2);
    return 0;
}

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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

struct UnionFind{
    vector<int> par; // par[i]:iの親の番号
    vector<int> s; // s[i]:iの属する木のノード数
    int n_group; // 木の数
    
    UnionFind(int N) : par(N) {
        for(int i=0; i<N; i++) par[i] = i;
        s.assign(N, 1);
        n_group = N;
    }
    
    int root(int x){ // xが属する木の根
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    
    void unite(int x, int y){ // xとyの木を併合
        int rx = root(x);
        int ry = root(y);
        if(rx == ry) return;
        par[rx] = ry;
        s[ry] += s[rx];
        s[rx] = 0;
        n_group--;
    }
    
    bool same(int x, int y){ // xとyが同じ木に属するかどうか
        return root(x) == root(y);
    }

    int size(int x){ // xが属する木のノード数
        return s[root(x)];
    }
};

int main(void){
    int N,M,K; cin >> N >> M >> K;
    VI edge[N];
    UnionFind uf(N);
    REP(i,M){
        int a,b; cin >> a >> b;
        a--; b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
        uf.unite(a,b);
    }

    VI ans(N,0);
    REP(i,N) ans[i] = uf.size(i) - edge[i].size() - 1;

    REP(i,K){
        int c,d; cin >> c >> d;
        c--; d--;
        if(uf.same(c,d)){
            ans[c]--;
            ans[d]--;
        }
    }

    REP(i,N) cout << ans[i] << " ";
    cout << endl;
    return 0;
}

Measured memory_bytes: 8184
class Dice:

    __top = 0
    __front = 1
    __right = 2
    __left = 3
    __back = 4
    __bottom = 5

    def __init__(self, a, b, c, d, e, f):
        self.__dice = [a,b,c,d,e,f]

    def S(self):
        dice_before = self.__dice[:]
        self.__dice[Dice.__top]    = dice_before[Dice.__back]
        self.__dice[Dice.__front]  = dice_before[Dice.__top]
        self.__dice[Dice.__right]  = dice_before[Dice.__right]
        self.__dice[Dice.__left]   = dice_before[Dice.__left]
        self.__dice[Dice.__back]   = dice_before[Dice.__bottom]
        self.__dice[Dice.__bottom] = dice_before[Dice.__front]

    def E(self):
        dice_before = self.__dice[:]
        self.__dice[Dice.__top]    = dice_before[Dice.__left]
        self.__dice[Dice.__front]  = dice_before[Dice.__front]
        self.__dice[Dice.__right]  = dice_before[Dice.__top]
        self.__dice[Dice.__left]   = dice_before[Dice.__bottom]
        self.__dice[Dice.__back]   = dice_before[Dice.__back]
        self.__dice[Dice.__bottom] = dice_before[Dice.__right]

    def W(self):
        dice_before = self.__dice[:]
        self.__dice[Dice.__top]    = dice_before[Dice.__right]
        self.__dice[Dice.__front]  = dice_before[Dice.__front]
        self.__dice[Dice.__right]  = dice_before[Dice.__bottom]
        self.__dice[Dice.__left]   = dice_before[Dice.__top]
        self.__dice[Dice.__back]   = dice_before[Dice.__back]
        self.__dice[Dice.__bottom] = dice_before[Dice.__left]

    def N(self):
        dice_before = self.__dice[:]
        self.__dice[Dice.__top]    = dice_before[Dice.__front]
        self.__dice[Dice.__front]  = dice_before[Dice.__bottom]
        self.__dice[Dice.__right]  = dice_before[Dice.__right]
        self.__dice[Dice.__left]   = dice_before[Dice.__left]
        self.__dice[Dice.__back]   = dice_before[Dice.__top]
        self.__dice[Dice.__bottom] = dice_before[Dice.__back]

    def top(self):
        return(self.__dice[Dice.__top])

a,b,c,d,e,f = input().split()
dice = Dice(a,b,c,d,e,f)
com = input()
for i in com:
    if i == 'S':
        dice.S()

    elif i == 'E':
        dice.E()

    elif i == 'W':
        dice.W()

    elif i == 'N':
        dice.N()

print(dice.top())

Measured memory_bytes: 7724
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<stack>
using namespace std;
int main() {
	string S;	cin >> S;
	string str1, str2;
	int num = S.size();
	for (int i = 0; i < num; ++i) {
		str1 = "";
		str2 = "";
		S.pop_back();
		if (S.size() % 2 == 0) {
			for (int j = 0; j < S.size() / 2; ++j) {
				str1 += S[j];
			}
			for (int j = S.size() / 2; j < S.size(); ++j) {
				str2 += S[j];
			}
			if (str1 == str2) {
				cout << S.size() << endl;
				cin >> S;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=1e18,MOD=1e9+7;
int main(){
	ll n,ans=0;
	string s;
	cin>>n>>s;
	map<char,ll>sum;
	for(int i=0;i<n;i++){
		sum[s[i]]++;
		ll hoge=1;
		for(auto itr:sum){
			if(itr.first!=s[i]){
				hoge*=itr.second+1;
				hoge%=MOD;
			}
		}
		ans+=hoge;
		ans%=MOD;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int x,y;
string a[105];
set<int> r,c;
int main()
{
    cin>>x>>y;
    for(int i=0;i<x;i++)
            cin>>a[i];
     for(int i=0;i<x;i++){
            bool f=0;
        for(int j=0;j<y;j++)
        {
            if(a[i][j]=='#')
            {
                f=1;
                break;
            }
        }
        if(f==0)
            {
                r.insert(i);
            }
     }
      for(int i=0;i<y;i++){
            bool f=0;
        for(int j=0;j<x;j++)
        {
            if(a[j][i]=='#')
            {
                f=1;
                break;
            }
        }
        if(f==0)
            {
                c.insert(i);
            }
     }
     for(int i=0;i<x;i++){
           bool f=0;
        for(int j=0;j<y;j++)
     {
         if(r.count(i)||c.count(j))
            continue;
         else
         {
             cout<<a[i][j];
             f=1;
         }

     }
     if(f)
     cout<<endl;
     }
}

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

const int dy[] = {-1,0,1,0}, dx[] = {0,1,0,-1};
int h,w;
string g[100];

void dfs(int y, int x, vector<pii> &b){
  rep(i,b.size()){
    if(b[i] == pii(y,x))return;
  }
  b.push_back(pii(y,x));

  rep(i,4){
    int ny = y+dy[i], nx = x+dx[i];
    if(ny<0 || nx<0 || ny>=h || nx>=w)continue;
    if(g[ny][nx] == g[y][x])dfs(ny,nx,b);
  }
}

bool rec(int y, int x, int &mid, int &num){
  vector<pii> b;
  dfs(y,x,b);

  num = 4; mid = 2;
  int l = 99, r = -l;
  rep(i,4){
    int by = b[i].first+1, bx = b[i].second;
    if(by==h || (g[by][bx] != g[y][x] && g[by][bx] != '.')){
      l = min(l, bx); r = max(r, bx+1);
    }
    mid += bx; by -= 2;

    if(by>=0 && (g[by][bx] != g[y][x] && g[by][bx] != '.')){
      int tnum = 0, tmid = 0;
      if(!rec(by,bx,tmid,tnum))return false;
      num += tnum; mid += tmid;
    }
  }

  rep(i,4)g[b[i].first][b[i].second] = '.';
  return l*num < mid && mid < r*num;
}

int main(){
  while(cin >> w >> h, h){
    rep(i,h)cin >> g[i];

    rep(i,w){
      int num = 0, mid = 0;
      if(g[h-1][i]!='.'){
	cout << (rec(h-1,i,mid,num)?"":"UN") << "STABLE\n";
	break;
      }
    }
  }
}

Measured memory_bytes: 1196