akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <deque>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#include <complex>
#include <cstring>
#include <cfloat>
#include <iomanip>
#include <stack>
#include <bitset>


using namespace std;
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, a, b) for(int i = (a); i > (b); i--)
#define forIt(it, a) for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define forRev(it, a) for(__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define ft(a) __typeof((a).begin())
#define ll long long
#define ld long double
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define Rep(i,n) for(int i = 0; i < (n); ++i)
#define bitcount(n) __builtin_popcountll(n)
#define pii pair<int, int>


typedef complex<ld> cplex;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<iii> viii;

const int N = 200000 + 7;
const int M = 103;
const int inf = 1e9 + 7;
const long long linf = 1ll * inf * (inf - 1);
const double pi = acos(-1);
const double eps = 1e-6;
const bool multipleTest = false;



vi pSquare(vi& list) {
    vi ans(list.size());
    
    for(int i = 0; i < list.size(); ++i) {
        ans[i] = list[list[i]];
    }
    
    return ans;
}

vi mul(vi&a, vi& b) {
    vi ans(a.size());
    
    for(int i = 0; i < ans.size(); ++i) {
        ans[i] = b[a[i]];
    }
    
    return ans;
}

int n;
ll x[N];

int m;
ll k;


int a[N];
ll d[N];

vi id;

void solve(){
    cin >> n;
    for(int i = 0; i < n; ++i) scanf("%lld", x + i);
    cin >> m >> k;
    for(int i = 0; i < m; ++i) {
        scanf("%d", a + i); --a[i];
    }
    
    
    
    vi b, I;
    for(int i = 0; i + 1 < n; ++i) {
        b.push_back(i);
        I.push_back(i);
        d[i] = x[i + 1] - x[i];
    }
    
    
    
    for(int i = 0; i < m; ++i) {
        swap(b[a[i] - 1], b[a[i]]);
    }
    
    ll xx = k;
    while (xx) {
        if (xx & 1) I = mul(I, b);
        b = pSquare(b);
        xx >>= 1;
    }
    
    
    
    cout << x[0] << "\n";
    for(int i = 1; i < n; ++i) {
        x[i] = x[i - 1] + d[I[i - 1]];
        printf("%lld\n", x[i]);
    }
    
    
    
}

void createTest() {
    freopen("in.txt", "w", stdout);
    int n = 10;
    cout << n << "\n";
    set<int> st;
    for(int i = 1; i < 2 * n; ++i) st.insert(i);
    
    for(int i = 1; i < 2 * n; ++i) {
        int u = rand() % 200000;
        ft(st) it = st.lower_bound(u);
        if (it == st.end()) --it;
        printf("%d ", *it);
        st.erase(it);
    }
}

int main() {
#ifdef _LOCAL_
    freopen("in.txt", "r", stdin);
    clock_t t1 = clock();
#endif
//    createTest();
//    return 0;
//    freopen("out.txt", "w", stdout);
    
    
    int Test = 1;
    if (multipleTest) {
        cin >> Test;
    }
    
    for(int i = 0; i < Test; ++i) {
//        printf("Case #%d: ", i + 1);
        solve();
    }
    
#ifdef _LOCAL_
    cout<<"\n" << 1.0 * (clock() - t1) / CLOCKS_PER_SEC<<endl;
#endif
    
}


Measured memory_bytes: 4444
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    int w, a, b;
    cin >> w >> a >> b;
    if (a>b) swap(a, b);
    int ans = max(0, b-a-w);
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3576
//by azidoazideazide(c2n14)
#include<iostream>
using namespace std;
typedef long long ll;
ll gcd(int a, int b){
    if(b==0) return a;
    else return gcd(b,a%b);
}
int main(){
	ios::sync_with_stdio(0);
	ll x,y;
        cin>>x>>y;
        cout<<gcd(x,y)<<endl;
return 0;
}


Measured memory_bytes: 3188
#include <iostream>
 
using namespace std;
 
int main(void) {
  int h;
  int n;
  
  cin >> h;
  cin >> n;
  
  int a_sum = 0;
    
  for (int i = 0; i < n; i++) {
     int tmp;
     cin >> tmp;
     a_sum += tmp;
  }
 
  if (a_sum >= h) {
      cout << "Yes" << endl; 
  } else {
      cout << "No" << endl; 
  }
 
  return 0;
}

Measured memory_bytes: 256
// F - Enclosed Points
#include <bits/stdc++.h>

using namespace std;

#define	MOD	998244353

long long mpow(long long x, long long n)
{
	long long r = 1;
	for ( ; n > 0; x = x * x % MOD, n >>= 1) if (n & 1) r = r * x % MOD;
	return r;
}

void fen_update(vector<int> &tree, int i, int val)
{
	for ( ; i > 0 && i < tree.size(); i += i & -i) tree[i] += val;
}

int fen_get(vector<int> &tree, int i)
{
	int sum = 0;
	for ( ; i > 0; i &= i - 1) sum += tree[i];
	return sum;
}

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
	long long n;
	cin >> n;
	vector<int> b;
	vector<pair<int, int> > a(n);
	for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second, b.push_back(a[i].second);
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	map<int, int> m;
	for (int i = 0; i < b.size(); i++) m[b[i]] = i;

	long long ans = n * mpow(2, n - 1) % MOD;

	vector<int> l(n + 1), r(n + 1);
	for (int i = 0; i < n; i++)  fen_update(r, i + 1, 1);

	for (int i = 0; i < n; i++) {
		int y = m[a[i].second];
		fen_update(r, y + 1, -1);
		long long l1 = fen_get(l, y), l2 = i - l1;
		long long r1 = fen_get(r, y), r2 = n - 1 - i - r1;
		long long t1 = (mpow(2, l1) - 1 + MOD) % MOD * (mpow(2, r2) - 1 + MOD) % MOD * mpow(2, l2 + r1) % MOD;
		long long t2 = (mpow(2, l2) - 1 + MOD) % MOD * (mpow(2, r1) - 1 + MOD) % MOD * mpow(2, l1 + r2) % MOD;
		long long d = (mpow(2, l1) - 1 + MOD) % MOD * (mpow(2, r2) - 1 + MOD) % MOD * (mpow(2, l2) - 1 + MOD) % MOD * (mpow(2, r1) - 1 + MOD) % MOD;
		ans = (ans + t1 + t2 -d + MOD) % MOD;
		fen_update(l, y + 1, 1);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 13556
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

using namespace std;
using ll = long long;
typedef pair<int, int> P;

int main(){
    int n, d, x; cin >> n >> d >> x;
    int a[n];
    int cnt = 0;
    rep(i, n) cin >> a[i];
    rep(i, n){
        cnt+=(d-1)/a[i]+1;
    }
    out(cnt+x);
}

Measured memory_bytes: 3640
/* Generated by powerful Codeforces Tool
 * You can download the binary file in here https://github.com/xalanq/cf-tool (Windows, macOS, Linux)
 * Author: alireza_kaviani
 * Time: 2020-06-13 18:04:37
**/
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n , Q , A , B , C , V[MAXN] , W[MAXN];
vector<pll> dp[MAXN];

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

    cin >> n;
    dp[0].push_back({0 , 0});
    A = (1ll << 12) ; B = (1ll << 13); C = (1ll << 18);
    for(int i = 1 ; i <= n ; i++)   cin >> V[i] >> W[i];
    for(int i = 1 ; i < A ; i++){
        dp[i] = dp[i / 2];
        for(pll j : dp[i / 2])  dp[i].push_back({j.X + W[i] , j.Y + V[i]});
        sort(all(dp[i]));
        for(int j = 1 ; j < SZ(dp[i]) ; j++)    dp[i][j].Y = max(dp[i][j].Y , dp[i][j - 1].Y);
    }
    for(int i = A ; i < C ; i++){
        if(i < B){
            dp[i] = {{0 , 0} , {W[i] , V[i]}}; 
            continue;
        }
        dp[i] = dp[i / 2];
        for(pll j : dp[i / 2])  dp[i].push_back({j.X + W[i] , j.Y + V[i]});
        //for(pll j : dp[i])  cout << i << sep << j.X << sep << j.Y << endl;
    }

    cin >> Q;
    while(Q--){
        ll v , l;
        cin >> v >> l;
        if(v < A){
            ll ind = upper_bound(all(dp[v]) , pll(l , INF)) - dp[v].begin() - 1;
            cout << dp[v][ind].Y << endl;
            continue;
        }
        ll x = v , ans = 0;
        while(x >= A) x /= 2;
        for(pll j : dp[v]){
            ll ind = upper_bound(all(dp[x]) , pll(l - j.X , INF)) - dp[x].begin() - 1;
            if(ind < 0) continue;
            ans = max(ans , dp[x][ind].Y + j.Y);
        }
        cout << ans << endl;
    }

    return 0;
}
/*

*/


Measured memory_bytes: 384708
using System;

class Test {
    static void Main() {
        string[] str = Console.ReadLine().Split();
        int[] x = new int[3];
        for (int i = 0; i < 3; i++) {
            x[i] = int.Parse(str[i]);
        }
        Array.Sort(x);
        int k = int.Parse(Console.ReadLine());
        for (int i = 0; i < k; i++) {
            x[2] *= 2;
        }
        Console.WriteLine(x[0] + x[1] + x[2]);
    }
}

Measured memory_bytes: 11092
package main

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

func main() {
	r := bufio.NewReader(os.Stdin)
	var n, a, b int
	fmt.Fscan(r, &n)
	fmt.Fscan(r, &a)
	fmt.Fscan(r, &b)
	xs := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(r, &xs[i])
	}

	ans := 0
	for i := 0; i < n-1; i++ {
		ans += min((xs[i+1]-xs[i])*a, b)
	}

	fmt.Println(ans)
}

// Union-Find
type unionFind struct {
	d []int
}

func newUnionFind(n int) *unionFind {
	uf := new(unionFind)
	uf.d = make([]int, n)
	for i := 0; i < n; i++ {
		uf.d[i] = -1
	}
	return uf
}

func (uf *unionFind) find(x int) int {
	if uf.d[x] < 0 {
		return x
	}
	uf.d[x] = uf.find(uf.d[x])
	return uf.d[x]
}

func (uf *unionFind) unite(x, y int) bool {
	rootX := uf.find(x)
	rootY := uf.find(y)
	if rootX == rootY {
		return false
	}

	if uf.d[rootX] < uf.d[rootY] {
		uf.d[rootX] += uf.d[rootY]
		uf.d[rootY] = rootX
	} else {
		uf.d[rootY] += uf.d[rootX]
		uf.d[rootX] = rootY
	}

	return true
}

func (uf *unionFind) same(x, y int) bool {
	return uf.find(x) == uf.find(y)
}

func (uf *unionFind) size(x int) int {
	return -uf.d[uf.find(x)]
}

// mod combination
func modpow(a, n, mod int) int {
	res := 1
	for n > 0 {
		if n%2 != 0 {
			res = res * a % mod
		}
		a = a * a % mod
		n = n / 2
	}
	return res
}

func modcomb(n, a, mod int) int {
	x := 1
	y := 1
	for i := 0; i < a; i++ {
		x = x * (n - i)
		x %= mod
		y = y * (i + 1)
		y %= mod
	}
	return x * modpow(y, mod-2, mod) % mod
}

func modfactorial(n, mod int) int {
	result := 1
	for i := 1; i <= n; i++ {
		result = (result * i) % mod
	}
	return result
}

// Utility

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

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

func primeFactor(x int) map[int]int {
	res := make(map[int]int)
	for i := 2; i*i <= x; i++ {
		for x%i == 0 {
			res[i]++
			x = x / i
		}
	}
	if x != 1 {
		res[x] = 1
	}
	return res
}

func divisor(x int) []int {
	res := make([]int, 0)
	for i := 1; i*i <= x; i++ {
		if x%i == 0 {
			res = append(res, i)
			if i != x/i {
				res = append(res, x/i)
			}
		}
	}
	return res
}

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

func lcm(x, y int) int {
	return x / gcd(x, y) * y
}

func reverseString(s string) string {
	r := []rune(s)
	for i, j := 0, len(r)-1; i < len(r)/2; i, j = i+1, j-1 {
		r[i], r[j] = r[j], r[i]
	}
	return string(r)
}

// Queue ...
type Queue []int

// pop ...
func (q *Queue) empty() bool {
	return len(*q) == 0
}

// push ...
func (q *Queue) push(i int) {
	*q = append(*q, i)
}

// pop ...
func (q *Queue) pop() (int, bool) {
	if q.empty() {
		return 0, false
	} else {
		res := (*q)[0]
		*q = (*q)[1:]
		return res, true
	}
}

// Stack ...
type Stack []int

// pop ...
func (s *Stack) empty() bool {
	return len(*s) == 0
}

// push ...
func (s *Stack) push(i int) {
	*s = append(*s, i)
}

// pop ...
func (s *Stack) pop() (int, bool) {
	if s.empty() {
		return 0, false
	} else {
		index := len(*s) - 1
		res := (*s)[index]
		*s = (*s)[:index]
		return res, true
	}
}


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

using ll = int64_t;
#define int ll

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

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

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

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

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

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

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

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

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

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

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

const int MA = 1e5 + 5;
int dp[3];

signed main() {
  int n = read();
  auto chose = [](int now) {
    int tmp = 0, ret = 0;
    rep(i, 3) {
      if (now == i)
        continue;
      if (tmp < dp[i])
        tmp = dp[i], ret = i;
    }
    return ret;
  };
  rep(i, 3) std::cin >> dp[i];
  srep(i, 1, n) {
    int abc[3];
    int nextdp[3];
    rep(j, 3) std::cin >> abc[j];
    rep(j, 3) {
      int index = chose(j);
      nextdp[j] = dp[index] + abc[j];
    }
    rep(j, 3) dp[j] = nextdp[j];
  }
  int ans = 0;
  rep(i, n) chmax(ans, dp[i]);
  print(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 2e5 + 10;
int a, b;
int main() {
	cin >> a >> b;
	cout << a * b << endl;
	return 0;
}

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

const int mn=3e5+6;
int v[mn],w[mn],n,q,c,l;
int f[530][100005];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) {
		scanf("%d%d",&v[i],&w[i]);
	}
	for(int i=1;i<(1<<9);++i)
		for(int j=100000;j>=0;--j) {
			f[i][j]=f[i/2][j];
			if(j>=w[i]) f[i][j]=max(f[i][j],f[i/2][j-w[i]]+v[i]);
		}
	scanf("%d",&q);
	for(int _i=1;_i<=q;++_i) {
		scanf("%d%d",&c,&l);
		int ans=0;
		if(c<(1<<9)) printf("%d\n",f[c][l]);
		else {
			int tmp=c,cnt=0;
			while(tmp>=512) tmp>>=1,cnt++;
			for(int i=0;i<1<<cnt;++i) {
				int cst=0,val=0;
				for(int j=0;j<cnt;++j) {
					if(i&(1<<j)) {cst+=w[c>>j],val+=v[c>>j];}
				}
				if(cst>l) continue;
				ans=max(ans,val+f[tmp][l-cst]);
			}
			printf("%d\n",ans);
		}
	}
}

Measured memory_bytes: 205472
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#include<string.h>
int main()
{
    ll a,b,c,d,i,test;
    cin>>a>>b>>c;
    d=a-c;
    c=c-a;
    i=b-c;
    if(i<0)i=0;
    if(d<0)cout<<0<<" "<<i<<endl;
    else cout<<d<<" "<<b<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      String s = sc.next();
      int count = 0;
      for(int i=0;i<s.length()/2;i++){
        if(s.charAt(i) != s.charAt(s.length()-1-i)){
          count++;
        }
      }     
        System.out.println(count);
    }
}


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

typedef long long ll;

#define MOD 1000000007
#define INF LLONG_MAX
#define decimDigits(n) fixed << setprecision(n)
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define irep(it, arr) for(auto it = begin(arr); it != end(arr); it++)

ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}

int main(){

    vector<string> S(3);

    cin >> S[0] >> S[1] >> S[2];


    ll turn = 0, nextTurn;
    while(!S[turn].empty()){
        nextTurn = S[turn][0] - 97;
        S[turn].erase(S[turn].begin());
        turn = nextTurn;
    }

    cout << (char)(turn + 65) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    int t = 0, i, ans;
    int f1[30][30], f2[30];
    char s[5], sl;
 
    memset(f1, 0, sizeof(f1));
    memset(f2, 0, sizeof(f2));
    while(1){
        if (t == 0) {
            printf("?aaa\n");
            f1[0][0] = 1;
            i = 0;
        } else {
            for (i=0; i<26; i++) {
                if (f1[sl - 'a'][i] == 0) {
                    printf("?%c%ca\n", sl, i + 'a');
                    f1[sl - 'a'][i] = 1;
                    break;
                }
            }
        }
 
        t++;
        fflush(stdout);
        scanf("%s", s);
        ans = 0;
        sl = s[strlen(s) - 1];
        if (s[0] != 'a') {
            ans = 1;
        } else {
            if (strlen(s) == 1) {//s=*
                if (f2[26] == 1){
                    ans = 1;
                } else {
                    f2[26] = 1;
                }
            } else {//s=**
                if ( f2[sl - 'a'] == 1) {
                    ans = 1;
                } else {
                    f2[sl - 'a'] = 1;
                }
            }
        }
 
        if (ans == 1) {
            printf("!OUT\n");
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1256
import java.io.*;
import java.util.*;
class Main{
  static Node root = null;
  static StringBuilder bl = new StringBuilder();
  public static void main(String args[])throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(br.readLine());
    String [] s = new String[2];
    for(int i = 0; i<n; i++){
      
      s = br.readLine().split("\\s+");
      
      if(s[0].charAt(0) == 'i'){
        
        Insert( Integer.parseInt(s[1]));
        
      }else if(s[0].charAt(0) == 'p'){
        
        inorder(root);
        bl.append("\n");
        preorder(root);
        bl.append("\n");
        
      }else if(s[0].charAt(0) == 'd'){
        delete(find(root, Integer.parseInt(s[1])));
        
      }else{
        
        if( find(root, Integer.parseInt(s[1])) == null){
          bl.append("no\n");
        }else{
          bl.append("yes\n");
        }
        
      }
    }
    System.out.print(bl);
  }
  
  static void Insert (int k){
    Node y = null;
    Node x = root;
    Node z = new Node();
    z.key = k;
    z.left = null;
    z.right = null;
    
    while(x != null){
      y = x;
      if(z.key < x.key){
        x = x.left;
      }else{
        x = x.right;
      }
    }
    z.parent = y;
    
    if( y == null){
      root = z;
    }else if( z.key < y.key){
      y.left = z;
    }else{
      y.right = z;
    }
  }
  
  static Node find(Node u, int k){
    while( u != null){
      if(k == u.key){
        return u;
      }
      if(k<u.key){
        u = u.left;
      }else{
        u = u.right;
      }
    }
    return null;
  }
  
  static void delete(Node u){
    Node y;
    Node x;
    if(u.left == null || u.right == null){
      y = u;
    }else{
      y = getSuccessor(u);
    }
    
    if(y.left != null){
      x = y.left;
    }else{
      x = y.right;
    }
    
    if( x != null){
      x.parent = y.parent;
    }
    
    if(y.parent == null){
      root = x;
    }else{
      if( y == y.parent.left){
        y.parent.left = x;
      }else{
        y.parent.right = x;
      }
      
      if( y !=u){
        u.key = y.key;
      }
    }
    
  }
  
  static Node getSuccessor(Node u){
    if(u.right != null){
      return getMinimum(u.right);
    }
    Node y = u.parent;
    while(y != null && u == y.right){
      u = y;
      y = y.parent;
    }
    return y;
  }
  
  static Node getMinimum(Node u){
    while(u.left !=null){
      u = u.left;
    }
    return u;
  }
  
  static void preorder(Node u){
    if( u == null) return;
    bl.append(" ").append(u.key);
    preorder(u.left);
    preorder(u.right);
  }
  
  static void inorder(Node u){
    if(u == null) return;
    inorder(u.left);
    bl.append(" ").append(u.key);
    inorder(u.right);
  }
  
}

class Node{
  int key;
  Node parent = null;
  Node right;
  Node left;
  Node(){};
}


Measured memory_bytes: 204096
#include <stdio.h>
#include <algorithm>
using namespace std;
struct data{
    int x,i;
    bool operator<(const data&r)const{
        if(x==r.x)return i<r.i;
        return x>r.x;
    }
}a[100010];
long long ans[100010];
int main(){
    int i,j,k,n;
    scanf("%d",&n);
    for(i=1;i<=n;++i)scanf("%d",&a[i].x),a[i].i=i;
    sort(a+1,a+n+1);
    for(i=j=1,k=a[1].i;i<=n;){
        for(;a[i].x==a[j+1].x;)k=min(k,a[++j].i);
        ans[k]+=(long long)(a[i].x-a[j+1].x)*j;
        i=j+1;
    }
    for(i=1;i<=n;++i)printf("%lld\n",ans[i]);
    return 0;
}


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

int main() {
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    for (int i = 0; i < 10; ++i) {
        for (int j = 0; j < 10; ++j) {
            for (int k = 0; k < 10; ++k) {
                int now = 0;
                for (int l = 0; l < N; ++l) {
                    int d = S[l] - '0';
                    if (now == 0 && d == i) now = 1;
                    else if (now == 1 && d == j) now = 2;
                    else if (now == 2 && d == k) now = 3;
                }
                if (now == 3) ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input_line = sys.stdin.readline().split(' ')
n = int(input_line[0])
k = int(input_line[1])

input_line = sys.stdin.readline().split(' ')
l_list = list(map(int, input_line))

l_list.sort(reverse=True)

l = 0
for i in range(0, k):
	l += l_list[i]

print(l)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

int main(void){
    int N;
    cin >> N;
    int count = 0;
    while(N != 0){
        if(2 == N%10){
            count++;
        }
        N /= 10;
    }
    cout << count << endl;

    return 0;
}



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

typedef long long ll;

int main() {

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);


    int n = 0, m = 0, x = 0;
    cin >> n >> m >> x;
    vector< pair<int, vector<int> > > v(n, make_pair(0, vector<int> (m, 0)));

    for(int i = 0; i < n; i++) {
        int temp = 0;
        cin >> temp;
        vector<int> tmp;
        for(int j = 0; j < m; j++) {
            int tm;
            cin >> tm;
            tmp.push_back(tm);
        }

        v[i] = make_pair(temp, tmp);
    }

    vector<int> algo;
    long long int ans = 1e18;
    for(int i = 0; i < (1 << n); i++) {
        long long cnt = 0;
        algo.assign(m , 0);
        for(int j = 0; j < n; j++) {
            if((i >> j & 1)) continue;
            cnt += v[j].first;
            for(int k = 0; k < m; k++) {
                algo[k] += v[j].second[k];
            }   
        }
        
        int check = 1;
        // for(int j = 0; j < m; j++) {
        //     cout << algo[j] << " ";

        // }
        // cout << endl;
        for(int j = 0; j < m; j++) {
            if(algo[j] < x) check = 0;
        }
        if(check) {
            ans = min(ans, cnt);
        }
    }

    if(ans == 1e18) cout << -1 << endl;
    else cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 3572
x = int(input())
num = 0
j = 1
while(j):
    ans = 1
    for i in range(2,1000):
        if (x+num)%i == 0 and x+num > i :
            ans = 0
            break
        elif x + num <= i:
            break
        else:
            pass
    if ans == 1:
        j = 0
    num +=1

print(x+num-1)

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <map>
using namespace std;

int n, m;
int a[10005];
int main()
{
	scanf("%d", &n);
	memset(a, 0, sizeof(a));
	int sum = 0;
	for(int i = 0; i < 2*n; i++)
	{
		scanf("%d", &a[i]);
	}
	sort(a, a+2*n);
	for(int i = 0; i < 2*n; i++)
	{
		if(i % 2 == 0) sum += a[i];
	}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma gcc optimize("ofast")
using namespace std;

#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define mod 1000000007
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0);
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;

ll modexp(ll a,ll b,ll m)
{
	ll r=1;
	a=a%m;
	while(b>0)
	{
	if(b&1)
		r=(r*a)%m;
	b=b/2;
	a=(a*a)%m;
	}
	return r%m;
}


int main() {
   string s,t; cin>>s>>t;
   cout<<t<<s<<endl;
   return 0;
}
/*

*/


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
#define INF (1<<29)

int main(){
	int n,s,mi,ma,t;
	while(cin>>n&&n){
		mi=INF;ma=-1;
		s=0;
		for(int i=0;i<n;i++){
			cin>>t;
			s+=t;
			mi=min(mi,t);
			ma=max(ma,t);
		}
		cout<<(s-ma-mi)/(n-2)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
k = %[Man Oku Cho Kei Gai Jo Jou Ko Kan Sei Sai Gok Ggs Asg Nyt Fks Mts].split.to_a
k.unshift("")
while gets
  m, n = $_.split.map(&:to_i)
  break if m == 0 && n == 0
  v = m ** n
  x = []
  a = v.to_s.size / 4
  (a+1).times{ |i| x[i] = v / 10**(4*i) % 10000 }
  (a+1).times{ |i| print x[a-i], k[a-i] if x[a-i] > 0 }
  puts
end

Measured memory_bytes: 8804
#include <iostream>
#include <algorithm>
#include <math.h>

using namespace std;

int main(){
	/*input*/
	long long l;
    cin >> l;
    long long r;
    cin >> r;

    /*calc*/
    long long ans = 2018;
//    int tmp_min = 0;
    if(r-l >= 2019){
    	ans = 0;
    	cout << ans;
    	return 0;
    }
    if(r-l==1 && r*l < 2019){
    	ans = r*l;
    	cout << ans;
    	return 0;
    }
	for(long long i = l; i <r; i++){
		for(long long j = l+1; j <= r; j++){
			if(ans > (i*j) % 2019){
				ans = (i*j) % 2019;
			}
		}
	}
    /*output*/
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.HashMap;

public class Main
{
	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			public void run() {
                solve();
            }
        }, "1", 1 << 26).start();
	}
	static void solve () {
		FastReader fr =new FastReader();	PrintWriter op =new PrintWriter(System.out);
 
 		int n =fr.nextInt() ,i ,j ;	long ct[][] =new long[n+1][3] ,bct[][] =new long[n+2][3] ,dm ,ans =0 ;	
 		char s[] =fr.next().toCharArray() ;
 		HashMap<Character , Integer> hm =new HashMap<>() ;	hm.put('R',0) ;	hm.put('G',1) ;	hm.put('B',2) ;
 		for (i =1 ; i<=n ; ++i)	{	++ct[i][hm.get(s[i-1])] ;	++bct[i][hm.get(s[i-1])] ;	}
 		for (i =1 ; i<=n ; ++i) {
 			ct[i][0] += ct[i-1][0] ;	ct[i][1] += ct[i-1][1] ;	ct[i][2] += ct[i-1][2] ;
 		}
 		for (i =n ; i>0 ; --i) {
 			bct[i][0] += bct[i+1][0] ;	bct[i][1] += bct[i+1][1] ;	bct[i][2] += bct[i+1][2] ;
 		}
 		for (i =1 ; i<n ; ++i) {
 			if (s[i-1]=='R') {
 				dm =ct[i-1][1] * bct[i+1][2] ;	dm += (ct[i-1][2] * bct[i+1][1]) ;//System.out.println(dm) ;
 				for (j =1 ; i+j<=n ; ++j) {
 					if (i-j==0)	break;
 					if (s[i+j-1]=='G' && s[i-j-1]=='B')	--dm ;
 					if (s[i+j-1]=='B' && s[i-j-1]=='G')	--dm ;
 				}
 			}
 			else if (s[i-1]=='G') {
 				dm =ct[i-1][0] * bct[i+1][2] ;	dm += (ct[i-1][2] * bct[i+1][0]) ;
 				for (j =1 ; i+j<=n ; ++j) {
 					if (i-j==0)	break;
 					if (s[i+j-1]=='R' && s[i-j-1]=='B')	--dm ;
 					if (s[i+j-1]=='B' && s[i-j-1]=='R')	--dm ;
 				}
 			}
 			else {
 				dm =ct[i-1][1] * bct[i+1][0] ;	dm += (ct[i-1][0] * bct[i+1][1]) ;
 				for (j =1 ; i+j<=n ; ++j) {
 					if (i-j==0)	break;
 					if (s[i+j-1]=='G' && s[i-j-1]=='R')	--dm ;
 					if (s[i+j-1]=='R' && s[i-j-1]=='G')	--dm ;
 				}
 			}
 			ans += dm ;
 		}
		op.println(ans) ;	op.flush();	op.close();
	}
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br =new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st==null || (!st.hasMoreElements())) 
			{
				try
				{
					st =new StringTokenizer(br.readLine());
				}
				catch(IOException e)
				{
					e.printStackTrace();
				}
				
			}
			return st.nextToken();
		}

		String nextLine() {
			String str ="";

			try
			{
				str =br.readLine();
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}

			return str;
		}

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

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

Measured memory_bytes: 36344
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    ll N,M; cin >> N >> M;
    vector<ll> a(N); for(auto& in:a) cin >> in;

    sort(a.begin(),a.end());
    ll _lcm = 1;
    for(auto x:a){
        _lcm = lcm(_lcm,x);
        if(_lcm > 2*M) return 0;
    }
    for(auto x:a){
        ll n = _lcm/x;
        if(n%2 == 0) return 0;
    }
    res = (2*M/_lcm + 1)/2;
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vpii = vector<pair<int,int>>;
using vpll = vector<pair<ll,ll>>;
using vi = vector<int>;
#define rep(i,n) for(int i=0;i<(int) n;i++)
#define rep1(i,m,n) for(int i=(int) m;i<(int) n;i++)
#define fix(n) cout << fixed << setprecision((int)n)

void absll(ll &x) {
    if(x>=0) return ;
    else x=-x; return;
}

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

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

const ll INF = 1LL << 60;

int N;

//DPテーブル
vector<ll> dp(100010);

int main() {
    double r;
    cin >> r;
    fix(10);
    cout << 2*M_PI*r << endl;

}

Measured memory_bytes: 3900
#include <bits/stdc++.h>
#define pb push_back
#define pll pair <ll, ll>
#define mp make_pair
#define pyshnapyshnakaa ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define x first
#define y second
#pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
#define plll pair <ll, pair <ll, ll>>
#define pllll pair <pair <ll, ll>, pair <ll, ll> >
#define psl pair <string, ll>
#define all(a) a.begin(), a.end()
#define vvl vector <vector <ll> >
 
typedef long long ll;
 
typedef long double ld;
 
using namespace std;
 
const ll maxn = 1e6 + 100;
const ll maxc = 1e9;

ll n, m, k, t;

int main() {
    pyshnapyshnakaa;
    ll q, w, e, a, b, c;
    ll n;
    cin >> n;
    ll L = 0, R = maxc, M;
    while (R - L > 1) {
        M = (L + R) / 2;
        ll x = M * M - n;
        if (x >= 0) {
            R = M;
        }
        else {
            L = M;
        }
    }
    // assert(R <= maxc);
    a = -1, b = -1;
    while (a == -1) {
        ll x = R * R - n;
        // cout << "X " << x << endl;
        if (x == 0) {
            a = b = 0;
        }
        else {
            for (q = 1; q <= x; q++) {
                if (x % q == 0 && q <= R && x / q <= R) {
                    a = q;
                    b = x / q;
                    break;
                }
            }
        }
        if (a == -1) {
            R++;
        }
    }
    cout << R << " " << R << " ";
    // assert(a != -1);
    // if (a == -1) {
    //     cout << "SOSAT" << endl;
    //     exit(0);
    // }
    cout << 0 << " " << R - a << " ";
    cout << R - b << " " << 0;
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  string ans="";
  cin>>S;
  for(int X=0;X<S.size();X++){
    if(S[X]=='1'||S[X]=='0'){
      ans.push_back(S[X]);
    }
    else if(S[X]=='B'&&ans.size()!=0){
      ans.erase(ans.size()-1);
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3572
#include<iostream>
#include<numeric>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;

int main(){ 
	int n,m; cin>>n>>m;
	if(n%3==0||m%3==0){
		cout<<"Possible"<<endl;
	}
	else if((n+m)%3==0){
		cout<<"Possible"<<endl;
	}
	else{
		cout<<"Impossible"<<endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, A, B;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> A >> B;

    int ans1 = min(A, B);
    int ans2 = max(0, (A + B) - N);

    cout << ans1 << " " << ans2 << endl;
}

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))


"""
面倒なので差分を考えておく，
この差分を+ or - のどちらで使うかの2択，
合計値を0に近づけたい，
各マスごとに取れる範囲をsetで持ちながら，とやりたいが取れる範囲が多そうな気もする．

絶対値が6400を超える分は持つ必要ないな，ギリ行けるかも?
やっぱり遅いか.
dpだと遷移が遅そうだからsetにしようとしたけど，これも遅い．

dpで取れる値をいっぺんにシフトできれば高速化可能，めっちゃでかい二進数を用意する？

"""
def main():
    mod=10**9+7
    H,W=MI()
    A=[]
    B=[]
    for i in range(H):
        a=LI()
        A.append(a)
    for i in range(H):
        b=LI()
        B.append(b)
        
    AB=[[0]*(W+1) for _ in range(H+1)]
    for i in range(H):
        for j in range(W):
            ab=abs(A[i][j] - B[i][j])
            AB[i][j]=ab
            
    offset = 80*(H+W) #負数があるのでbitをずらす
    
    dp=[[0]*(W+1) for _ in range(H+1)]
    
    def calc(a,d):
        # aをdだけ前後にずらす
        return (a<<d) | (a>>d) 
    
    
    dp[0][0]=1<<(offset+AB[0][0]) | 1<<(offset-AB[0][0])
    
    for i in range(H):
        for j in range(W):
            dp[i][j+1] = dp[i][j+1] | calc(dp[i][j],AB[i][j+1])
            dp[i+1][j] = dp[i+1][j] | calc(dp[i][j],AB[i+1][j])

    
    a=dp[-2][-2]
    
    # 正負で対称なので片側だけで良い
    a=a>>offset # ずらしたぶん戻す
    for i in range(offset):
        if a>>i & 1:
            print(i)
            break
        
    # for i in range(H):
    #     for j in range(W):
    #         print(bin(dp[i][j]>>offset))
    #         # print(bin(dp[i][j]))
    #         print()
    
    
        
                    
                
    

main()


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

using namespace std;

int main()
{
    int n,s;
    cin>>n;
    s=0;
    for(int i=0;i<n;i++)
    {
        int t;
        cin>>t;
        s+=t;
    }
    cout<<s-n<<endl;
    return 0;
}


Measured memory_bytes: 256
import numpy as np
import collections

n = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

c = collections.Counter(prime_factorize(n))

ans = 0
for num in c:
    cnt= 1
    total = 2
    while c[num] >= cnt:
        cnt += total
        total += 1
        ans += 1


print(ans)

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

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

  int N;
  cin >> N;
  cout << (N-1)/2 << endl;
}

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

int main(void){
    string w;
    cin >> w;
    transform(w.begin(), w.end(), w.begin(), ::tolower);
    int cnt = 0;
    while(1){
        string t;
        cin >> t;
        if(t == "END_OF_TEXT") break;
        transform(t.begin(), t.end(), t.begin(), ::tolower);
        if(t == w) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define pb push_back
#define MOD 1000000007
#define inf 1000000000
#define llinf 1000000000000000
#define MAX 1000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;

struct data{
    int a,b,c,d;
};


int main(){
    int h,w;
    cin>>h>>w;
    int table[502][502];
    vint a,b,c,d;
    int count=0;
    rep(i,h)rep(j,w){
        cin>>table[i][j];
    }
    rep(i,h){
        if(i%2==0){
            rep(j,w){
                if(i==h-1 && j==w-1)continue;
                if(j==w-1){
                    if(table[i][j]%2==1){
                        table[i+1][j]+=1;
                        count++;
                        a.pb(i);
                        b.pb(j);
                        c.pb(i+1);
                        d.pb(j);
                    }                  
                }
                else{
                    if(table[i][j]%2==1){
                        table[i][j+1]+=1;
                        count++;
                        a.pb(i);
                        b.pb(j);
                        c.pb(i);
                        d.pb(j+1);
                    }
                }
            }
        }
        else{
            repr(j,w){
                if(i==h-1 && j==0)continue;
                if(j==0){
                    if(table[i][j]%2==1){
                        table[i+1][j]+=1;
                        count++;
                        a.pb(i);
                        b.pb(j);
                        c.pb(i+1);
                        d.pb(j);
                    }                  
                }
                else{
                    if(table[i][j]%2==1){
                        table[i][j-1]+=1;
                        count++;
                        a.pb(i);
                        b.pb(j);
                        c.pb(i);
                        d.pb(j-1);
                    }
                }
            }
        }
    }
    cout<<count<<endl;
    rep(i,count)cout<<a[i]+1<<" "<<b[i]+1<<" "<<c[i]+1<<" "<<d[i]+1<<endl;
}

Measured memory_bytes: 5220
def main():
    from collections import deque
    import sys
    input = sys.stdin.readline

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

    G = [[] for _ in range(N + 1)]

    for _ in range(M):
        l, r, d = map(int, input().split())
        G[l].append((r, -d))
        G[r].append((l, d))


    MIN = -10 ** 18

    lst = [MIN] * (N + 1)

    que = deque()
    que_append = que.append
    que_popleft = que.popleft

    for i in range(1, N + 1):
        if lst[i] == MIN:
            que_append(i)
            lst[i] = 0

        while que:
            tmp = que_popleft()
            for next_, d in G[tmp]:
                if lst[next_] == MIN:
                    lst[next_] = lst[tmp] + d
                    que_append(next_)
                    continue
                
                if lst[next_] == lst[tmp] + d:
                    continue
                else:
                    print ('No')
                    exit()

    print ('Yes')

if __name__ == '__main__':
    main()

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int main(){
  int m,n;
  cin>>m>>n;
  int result = 0;
  int yum[n];
  REP(i,m){
    REP(j,n) cin>>yum[j];
    if(i>0) REP(j,n) yum[j] = 1 - yum[j];
    int mx = 0;
    REP(end,n){
      int val = 0;
      if(end == 0 || end == n-1){
        REP(x,n){
          int y = yum[x];
          if(n != 1 && (x == end || (x != 0 && x != n-1))){
            y = 1-y;
          }
          val += y;
        }
      }else{
        REP(x,n){
          int y = yum[x];
          if(x != end && x != 0 && x != n-1){
            y = 1-y;
          }
          val += y;
        }
      }
      // REP(x,n){
      //   int y = yum[x];
      //   if(x==end){
      //     if(n != 1 && (end == 0 || end == n-1)){
      //       y = 1-y;
      //     }
      //   }else{
      //     if(x != 0 && x != n-1){
      //       y = 1-y;
      //     }
      //   }
      //   val += y;
      // }
      mx = max(mx,val);
    }
    result += mx;
  }
  cout<<result<<endl;
  return 0;
}

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

int main () 
{
  int a, b;

  cin >> a >> b;

  if (a < b) {

    cout << "a" << " < " << "b" << "\n";
  } else if (a > b) {

    cout << "a" << " > " << "b" << "\n";

  } else if (a == b) {

    cout <<  "a" << " == " << "b" << "\n";

    return 0;
  }
  
}

Measured memory_bytes: 1124
a, b, c = map(int, input().split())

if a == 5:
  if (b == 5 and c == 7) or (b == 7 and c == 5):
    print('YES')
  else:
    print('NO')
elif b == 5:
  if (a == 5 and c == 7) or (a == 7 and c == 5):
    print('YES')
  else:
    print('NO')
elif c == 5:
  if (a == 5 and b == 7) or (a == 7 and b == 5):
    print('YES')
  else:
    print('NO')
else:
    print('NO')


Measured memory_bytes: 3064
N=int(input())
ans=0
A=[]
B=[]
aappend=A.append
bappend=B.append
for _ in range(N):
    a,b=map(int,input().split())
    aappend(a)
    bappend(b)
for i in range(N):
    a,b=A[-1-i],B[-1-i]
    a+=ans
    if a%b==0:pass
    else:ans+=(b*((a//b)+1)-a)
print(ans)

Measured memory_bytes: 11048
#幅優先探索
import copy
H,W=map(int,input().split())
MAZE=[0]*H
for i in range(H):
  MAZE[i]=list(str(input()))

dx=[1,0,-1,0]
dy=[0,1,0,-1]

def solve_maze(sy,sx):
  #多次元配列はdeepcopyを使わないといけない
  MAZE1=copy.deepcopy(MAZE)
  MAZE1[sy][sx]='#'
  queue=[]
  queue.append([sy,sx])
  d=[[100000000]*W for i in range(H)]
  d[sy][sx]=0
  while len(queue)>0:
    #Qを取り出す
    Q=queue.pop(0)
    move=d[Q[0]][Q[1]]

    #4方向をループする
    for j in range(4):
      y=Q[0]+dy[j]
      x=Q[1]+dx[j]
      if 0<=y<=(H-1) and 0<=x<=(W-1) and MAZE1[y][x] == '.':
        queue.append([y,x])
        MAZE1[y][x] = '#'
        d[y][x] = move+1
  return move

d_max=0
for i in range(H):
  for j in range(W):
    if MAZE[i][j]=='.':
      d=solve_maze(i,j)
      if d>d_max:
        d_max=d
print(d_max)

Measured memory_bytes: 9364
import numpy as np

N=int(input())
B=np.array(input().split(),dtype=np.int32)

s=[]
min_list=[]
min_list.append(B[0])
for i in range(0,N-1-1):
    min_list.append(min(B[i],B[i+1]))
min_list.append(B[-1])
#print(min_list)
print(sum(min_list))

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

int main(){
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    char c[2000];
    for (int i = 0; i < s.size();i++)
    {
        c[i * 2] = s[i];
        c[(i * 2) + 1] = t[i];
    }
    c[s.size() * 2] = '\0';
    cout << c;
}

Measured memory_bytes: 256
#include<stdio.h>

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

long long int min(long long int a,long long int b)
{
	if(a<b) return a;
	return b;
}
long long int dp[3002][3002];
long long int D(long long int d[], int l,int r)
{
  if( dp[l][r] > 0 )
    return dp[l][r];
	if(l<r)	dp[l][r] = max(d[l]+min(D(d,l+1,r-1),D(d,l+2,r)),d[r]+min(D(d,l,r-2),D(d,l+1,r-1)));
	else if(l==r) dp[l][r] = d[l];
	else
     dp[l][r] = 0;
  return dp[l][r];
}

long long int d[3002];

int main()
{
	long long int n;
	long long int sum=0;
	scanf("%lld",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%lld",&d[i]);
		sum+=d[i];
	}

	// if(D(d,0,n-1)<sum-D(d,0,n-1)) printf("2\n%lld\n",sum-D(d,0,n-1));
	printf("%lld\n",2*D(d,0,n-1)-sum);
	return 0;
}



Measured memory_bytes: 70016