akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h> 
using namespace std;
#define For(i,n) for(int i=1;i<=n;i++)
#define Fork(i,k,n) for(int i=k;i<=n;i++)
#define ForkD(i,k,n) for(int i=n;i>=k;i--)
#define Rep(i,n) for(int i=0;i<n;i++)
#define ForD(i,n) for(int i=n;i;i--)
#define RepD(i,n) for(int i=n;i>=0;i--)
#define Forp(x) for(int p=pre[x];p;p=next[p])
#define Forpiter(x) for(int &p=iter[x];p;p=next[p])  
#define Lson (o<<1)
#define Rson ((o<<1)+1)
#define MEM(a) memset(a,0,sizeof(a));
#define MEMI(a) memset(a,0x3f,sizeof(a));
#define MEMi(a) memset(a,128,sizeof(a));
#define MEMx(a,b) memset(a,b,sizeof(a));
#define INF (0x3f3f3f3f)
#define F (1000000007)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define vi vector<int> 
#define pi pair<int,int>
#define SI(a) ((a).size())
#define Pr(kcase,ans) printf("Case #%d: %lld\n",kcase,ans);
#define PRi(a,n) For(i,n-1) cout<<a[i]<<' '; cout<<a[n]<<endl;
#define PRi2D(a,n,m) For(i,n) { \
						For(j,m-1) cout<<a[i][j]<<' ';\
						cout<<a[i][m]<<endl; \
						} 
#pragma comment(linker, "/STACK:102400000,102400000")
#define ALL(x) (x).begin(),(x).end()
#define gmax(a,b) a=max(a,b);
#define gmin(a,b) a=min(a,b);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
ll mul(ll a,ll b){return (a*b)%F;}
ll add(ll a,ll b){return (a+b)%F;}
ll sub(ll a,ll b){return ((a-b)%F+F)%F;}
void upd(ll &a,ll b){a=(a%F+b%F)%F;}
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
	while(isdigit(ch)) { x=x*10+ch-'0'; ch=getchar();}
	return x*f;
} 
multiset<int> S;
int main()
{
//	freopen("B.in","r",stdin);
//	freopen(".out","w",stdout);
	
	int n=read();
	For(i,n) S.insert(read());
	int m=read();
	For(i,m) {
		int p=read();
		if (S.count(p)) {
			multiset<int>::iterator it=S.find(p);
			S.erase(it);
		} else {
			puts("NO");
			return 0;
		}
	}
	puts("YES");
	
	return 0;
}


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

#define For(i, l, r) for(register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for(register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)

using namespace std;

typedef long long ll;

template<typename T> inline bool chkmin(T &a, T b) {return b < a ? a = b, 1 : 0;}
template<typename T> inline bool chkmax(T &a, T b) {return b > a ? a = b, 1 : 0;}

inline int read() {
    int x(0), sgn(1); char ch(getchar());
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
    for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
    return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("E.in", "r", stdin);
	freopen ("E.out", "w", stdout);
#endif
}

const int N = 410;

struct Node {

	int col[4];

	Node GetNext() {
		return (Node){ col[1], col[2], col[3], col[0] };
	}

} a[N], a1, a2, a3, a4;

inline bool operator < (const Node &lhs, const Node &rhs) {
	For (i, 0, 3)
		if (lhs.col[i] != rhs.col[i])
			return lhs.col[i] < rhs.col[i];
	return false;
}

map<Node, int> M;

inline void Update(Node cur, int val) {
	For (i, 0, 3) {
		M[cur] += val;
		cur = cur.GetNext();
	}
}

int main() {

	File();

	int n = read();
	For (i, 1, n) {
		For (j, 0, 3) a[i].col[j] = read();
		Update(a[i], 1);
	}

	long long ans = 0;
	For (i, 1, n) {
		Update(a[i], - 1);
		For (j, i + 1, n) {
			Update(a[j], - 1);
			For (t, 0, 3) {
				a1 = (Node) {a[j].col[1], a[i].col[0], a[i].col[3], a[j].col[2]};
				a2 = (Node) {a[i].col[1], a[j].col[0], a[j].col[3], a[i].col[2]};
				a3 = (Node) {a[j].col[1], a[j].col[0], a[i].col[1], a[i].col[0]};
				a4 = (Node) {a[i].col[3], a[i].col[2], a[j].col[3], a[j].col[2]};
				a[j] = a[j].GetNext();

				if (!M[a1] || !M[a2] || !M[a3] || !M[a4]) continue ;
				long long res = 1;
				res *= M[a1]; Update(a1, -1);
				res *= M[a2]; Update(a2, -1);
				res *= M[a3]; Update(a3, -1);
				res *= M[a4]; 
				Update(a1, 1);
				Update(a2, 1);
				Update(a3, 1);
				ans += res;
			}
			Update(a[j], 1);
		}
	}
	printf ("%lld\n", ans);

	return 0;

}


Measured memory_bytes: 20352
#include <iostream>
#include <cstdio>
#include <cstring>
#include <set>
using namespace std;
set<string> s;

int main(){
    int t;
    string com, str;
    cin >>t;
    while(t--){
        cin >> com >> str;
        if(com == "insert"){
            s.insert(str);
        }
        else{
            if(s.count(str)){
                cout << "yes" << endl;
            }
            else{
                cout << "no" << endl;
            }
        }
    }
}



Measured memory_bytes: 32560
#!/usr/bin/env python3

from numba import njit

def main():
    k = int(input())
    print(getresult(k))

@njit
def getresult(k):
    res = 0
    for a in range(1, k + 1):
        for b in range(1, k + 1):
            for c in range(1, k + 1):
                res += gcd(gcd(a, b), c)
    return res

@njit("i4(i4, i4)", cache=True)
def gcd(x, y):
    if x < y:
        x, y = y, x  # x >= y
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

if __name__ == "__main__":
    main()


Measured memory_bytes: 109600
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


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

  vector<int> w(N), v(N);
  REP(i, N) cin >> w[i] >> v[i];

  const int MAX = 100100;
  vector<int> dp(MAX, INF);
  dp[0] = 0;

  REP(i, N) RREP(j, MAX){
    if(j+v[i] < MAX) chmin(dp[j+v[i]], dp[j]+w[i]);
  }

  int ans = -INF;
  REP(i, MAX){
    if(dp[i] <= W) chmax(ans, i);
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 1024
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    A, B = [int(x) for x in input().split()]

    for i in range(100000):
        if i * 8 // 100 == A and i // 10 == B:
            print(i)
            return
    else:
        print(-1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
from collections import deque

N = int(input())

S = deque()

name = {'M' : 0, 'A' : 0, 'R' : 0, 'C' : 0, 'H' : 0}

for i in range(N):
    S.append(input())
    if S[i][0] in name:
        name[S[i][0]] += 1

conbi = 0
count = deque()

for alp in name.values():
    count.append(alp)
    
for i in range(3):
    for l in range(i+1, 5):
        for n in range(l+1, 5):
            if count[i] != 0 and count[l] != 0 and count[n] != 0:
                conbi += count[i] * count[l] * count[n]
print(conbi)

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

int main(){
    long long n, cp = 0, cm = 0;
    int a[10000], b[10000];
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++)  cin >> b[i];
    for(int i = 0; i < n; i++){
        if(a[i] > b[i]) cm += 1LL * (a[i] - b[i]);
        else cp += 1LL * (b[i] - a[i])/2;
    }
    if(cp >= cm)  cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 384
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc =new Scanner(System.in);
    String s =sc.next();
    String S[] =s.split("",0);
    if(s.length()%2==1){System.out.println("No");System.exit(0);}
    for(int i=0;i<s.length();i++){
      if(i%2==0){if(S[i].equals("h")){continue;}
                 else{System.out.println("No");System.exit(0);}}
      if(i%2==1){if(S[i].equals("i")){continue;}
                 else{System.out.println("No");System.exit(0);}}}
    System.out.println("Yes");
  }
}

Measured memory_bytes: 22996
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

DP = [0] * (H + 1)

for i in range(len(DP)):
    if i == 0 or DP[i] != 0:
        for j in range(N):

            if i + A[j] <= H:
                if DP[i + A[j]] != 0:
                    DP[i + A[j]] = min(DP[i + A[j]], DP[i] + B[j])
                else:
                    DP[i + A[j]] = DP[i] + B[j]

            else:
                if DP[H] == 0:
                    DP[H] = DP[i] + B[j]
                else:
                    DP[H] = min(DP[H], DP[i] + B[j])

print(DP[H])

Measured memory_bytes: 41708
#include <iostream>
#include <functional>
#include <vector>
using namespace std;
typedef long long ll;

// 1-indexed
// 親nodeはk/2, 子nodeは2kと2k+1
// update(k,x): k番目の要素をxに更新
// query(a,b): 区間[a:b)に対して二項演算した結果を返す
// operator[k]: k番目の要素を返す

template <typename T>
class SegmentTree {
    using F = function<T(T, T)>;
    int n;
    F f;
    T t;
    vector <T> dat;

public:
    SegmentTree() {};
    SegmentTree(F f, T t) : f(f), t(t) {}

    void init(int n_) {
        n = 1;
        while (n < n_) n <<= 1;
        dat.assign(n << 1, t);
    }

    void build(const vector <T> &v) {
        auto n_ = (int)v.size();
        init(n_);
        for (int i = 0; i < n_; i++) dat[n + i] = v[i];
        for (int i = n - 1; i > 0; i--) dat[i] = f(dat[(i << 1) | 0], dat[(i << 1) | 1]);
    }

    void set_val(int k, T x) {
        dat[k += n] = x;
        while (k >>= 1) dat[k] = f(dat[(k << 1) | 0], dat[(k << 1) | 1]);
    }

    T query(int a, int b) {
        T vl = t, vr = t;
        for (int l = a + n, r = b + n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) vl = f(vl, dat[l++]);
            if (r & 1) vr = f(dat[--r], vr);
        }
        return f(vl, vr);
    }
};


// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A&lang=jp
void AOJ_DSL_2_A() {
    ll n, q, c, x, y;
    cin >> n >> q;

    // 1点更新、区間min
    auto f = [](int a, int b) { return min(a, b); };
    SegmentTree<int> seg(f, 2147483647);
    seg.build(vector<int>(n, 2147483647));
    while (q--) {
        cin >> c >> x >> y;
        if (c) cout << seg.query(x, y + 1) << "\n";
        else seg.set_val(x, y);
    }
}


// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
void AOJ_DSL_2_B() {
    ll n, q, c, x, y;
    cin >> n >> q;
    // 1点加算、区間sum
    auto f = [](ll a, ll b) { return a + b; };
    SegmentTree<ll> seg(f, 0LL);
    seg.build(vector<ll>(n, 0LL));
    while (q--) {
        cin >> c >> x >> y;
        if (c) cout << seg.query(x - 1, y) << "\n";
        else seg.set_val(x - 1, seg.query(x - 1, x) + y);
    }
}


// verified
//   https://atcoder.jp/contests/abc125/tasks/abc125_c
int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); }
void AtCoder_2019_4_27_C() {
    int n, a;
    cin >> n;
    SegmentTree<int> seg(gcd, 0);
    for (int i = 0; i < n; i++) { cin >> a; seg.set_val(i, a); }
    int ans = 1;
    for (int i = 0; i < n; i++) ans = max(ans, gcd(seg.query(0, i), seg.query(i + 1, n)));
    cout << ans << "\n";
}

int main() {
    // AOJ_DSL_2_A();
    AOJ_DSL_2_B();
    // AtCoder_2019_4_27_C();
    return 0;
}


Measured memory_bytes: 5720
a = int(input())
Ar = list(map(int, input().split()))
Br = []
for r in Ar:
  if r % 2 == 0:
    Br.append(r)
cnt = 0
for r in Br:
  while r % 2 != 1:
    r /= 2
    cnt += 1
print(cnt)

Measured memory_bytes: 4148
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int n = sc.nextInt();
		
		// 計算
		int result = n/2;
		if(n%2 == 1) result++;
		
		
		// 出力
		System.out.println(result);
	}
}


Measured memory_bytes: 21460
package main

import "fmt"

func main() {
	var s string
	var str string
	//input
	fmt.Scan(&s)

	//process
	for _, c := range s {
		if c == 'B' {
			if str != "" {
				str = string([]rune(str)[:len(str)-1])
			}
		} else {
			str = str + string(c)
		}
	}
	fmt.Println(str)
}


Measured memory_bytes: 512
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
A = np.array(lr())
A.sort()
pos = A[A>0]
zero = A[A==0]
neg = A[A<0]

def check(x):
    # x以下の数がK個以上ある時、Trueを返す
    count = 0 #最後に２で割る
    if x >= 0:
        count += len(zero) * N
    count += (np.searchsorted(A, x//pos, side='right')).sum()
    count += (N - np.searchsorted(A, (-x-1)//(-neg), side='right')).sum()
    count -= np.count_nonzero(A * A <= x) #ペアなので自分自身は駄目
    assert count % 2 == 0
    count //= 2
    return count >= K

left = - 10 ** 19 # NG
right = 10 ** 19 # OK
while right > left + 1:
    mid = (left+right) // 2
    if check(mid):
        right = mid
    else:
        left = mid

print(right)
# 46

Measured memory_bytes: 32312
#include<iostream>
#include<string>

using namespace std;

int main(){
  string str;
  cin>>str;
  
  int count[2]={};
  
  for(int i=0;i<str.length();i++){
    if(i%2==0){
      if(str[i]=='0'){
        count[0]++;
      }
      else{
        count[1]++;
      }
    }
    else{
      if(str[i]=='0'){
        count[1]++;
      }
      else{
        count[0]++;
      }
    }
  }
  
  if(count[0]>count[1])cout<<count[1];
  else cout<<count[0];
}

Measured memory_bytes: 512
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>

#define MAX_N 100000

struct Info {
    int A, B;
};

int N;
std::vector<Info> infos;

int main() {
    std::cin >> N;
    for(int ind_N=0; ind_N < N; ind_N++){
        int tmpA, tmpB;
        std::cin >> tmpA >> tmpB;
        Info tmpInfo = {tmpA, tmpB};
        //printf("%daaaa\n", tmpInfo.A);
        infos.push_back(tmpInfo);
    }

    std::sort(infos.begin(), infos.end(),
        [](const Info& x, const Info& y) {return x.A < y.A;} );
    
    int lastLank = 0;
    int lastPoint = 0;
    int cc = 0;
    int ans = 0;

    for(auto itr = infos.begin(); itr != infos.end(); ++itr) {
 //       printf("%d %d\n", itr->A, itr->B);

        //終端
        if(cc == N-1){
            ans += itr->B;
        }
        //真ん中のとき
        int difLank =(itr->A) - lastLank;
        int difPoint = (itr->B) - lastPoint;
        ans += difLank;

        lastLank = itr->A;
        lastPoint = itr->B;

        cc ++;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <bitset>
#include <cmath>

using namespace std;

int main()
{

    bitset<18> subset;
    
    int n;
    cin >> n;

    int upper = pow(2, n);
    for (int i = 0; i < upper; i++)
    {
        subset = i;
        
        cout << i << ":";        
        for (int j = 0; j < n; j++)
        {
            if (subset[j])
            {
                cout << ' ' <<  j;
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 3284
fn get_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().to_string()
}

fn readln<T>() -> T
    where
        T: std::str::FromStr,
        <T as std::str::FromStr>::Err: std::fmt::Debug {
    get_line().parse().unwrap()
}

use std::collections::VecDeque;

fn main() {
    let k = readln();

    let mut bs = vec![true; k];
    let mut q = VecDeque::new();
    q.push_back((1, 1));

    let mut res = 0;

    while let Some((i, d)) = q.pop_front() {
        if i == 0 {
            res = d;
            break;
        }

        bs[i] = false;

        let j = (i * 10) % k;
        if bs[j] {
            q.push_front((j, d));
        }
        let j = (i + 1) % k;
        if bs[j] {
            q.push_back((j, d + 1));
        }
    }

    println!("{}", res);
}

Measured memory_bytes: 6396
n = int(input())
a = [int(i) for i in input().split()]

cnt = [0]*n
for i in range(n,0,-1):
  total = sum(cnt[i*k-1] for k in range(1,n//i+1))
  if total % 2 != a[i-1]:
    cnt[i-1] = 1

b = [i+1 for i in range(n) if cnt[i] > 0]

print(sum(cnt))
print(*b)

Measured memory_bytes: 14132
#include<stdio.h>

void print(int A[],int N){
  int i;
  for( i = 0 ; i < N; i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}
    
void sort(int A[], int N){
  int i,j,v; 
  for (i=1; i < N; i++) {
    v = A[i];
    j = i - 1; 
    while (j >= 0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    print(A,N); 
  }
}
int main(){
  int N,i,j;
  int A[100];
  
  scanf("%d",&N);
  for( i = 0 ; i < N; i++) scanf("%d",&A[i]);
  
  print(A,N);
  sort(A,N);

  return 0;
}



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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n,x;
    cin >> n >> x;

    if (n == 2) {
        if (x == 2) {
            cout << "Yes" << endl;
            rep(i, 3) cout << i+1 << endl;
        } else {
            cout << "No" << endl;
        }
        return 0;
    }

    if (x == 1 or x == 2 * n - 1) {
        cout << "No" << endl;
        return 0;
    }

    vi ans(2 * n - 1, -1);
    set<int> s;
    rep(i, 2 * n - 1) s.insert(i);

    if (x >= 3) {
        ans[n - 2] = x - 2;
        ans[n - 1] = x + 1;
        ans[n]     = x;
        ans[n + 1] = x - 1;
        s.erase(x - 3);
        s.erase(x);
        s.erase(x - 1);
        s.erase(x - 2);
    } else {
        ans[n - 2] = x + 2;
        ans[n - 1] = x - 1;
        ans[n]     = x;
        ans[n + 1] = x + 1;
        s.erase(x + 1);
        s.erase(x - 2);
        s.erase(x - 1);
        s.erase(x);
    }

    rep(i, 2 * n - 1) {
        if (ans[i] < 0) {
            ans[i] = *(s.begin()) + 1;
            s.erase(ans[i] - 1);
        }
    }

    cout << "Yes" << endl;
    rep(i, 2 * n - 1) {
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 11648
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  string t;
  cin >> s >> t;
  int count=0;
  for(int i=0;i<s.size();i++){
    if(s[i]!=t[i])count++;
  }
  
  cout << count << endl;
}


Measured memory_bytes: 3828
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_D main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions

#endif
ll N, W;
vl w, v;
map<pll,ll> dp;
ll dfs(ll n, ll wt) {
    if (n >= N) return 0;
    
    if (dp.count(pll(n,wt)) > 0) return dp[pll(n,wt)];

    ll yes = 0, no = 0;
    if (wt+w[n] <= W) {
        yes = dfs(n + 1, wt + w[n]) + v[n];
    }
    no = dfs(n + 1, wt);
    
    ll ret = max(yes, no);
    dp[pll(n,wt)] = ret;

    return ret;
}

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

    cin >> N >> W;
    w = vl(N);
    v = vl(N);
    REP(i, N) cin >> w[i] >> v[i];

    ll ans = dfs(0, 0);

    cout << ans << endl;
    dp.clear();

    return 0;
}

Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
int main(){
  char word[12];
  cin >> word;
  if(word[0]=='A'){
    bool de=false;
    int index;
    for(int i=2; i<strlen(word)-1; i++){
      if(word[i]=='C'){
        de=true;
        index=i;
        break;
      }
    }
     if(de){
       bool de2=true;
       for(int i=0; i<strlen(word); i++){
         if(word[i]<97 && i!=0 && i!=index){
           de2=false;
           break;
         }
       }
       if(de2){
         cout << "AC\n";
         return 0;
       }
       else{
         cout << "WA\n";
         return 0;
       }
     }
      else{
        cout << "WA\n";
        return 0;
      }
  }
  
  else{
    cout << "WA\n";
    return 0;
  }
  
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c<<" "<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int N, A[1000000], cnt;

void Out(const vector<int> G) {
	cout << G.size() << endl;
	cout << G.back();
	for (int i = G.size() - 2; i >= 0; i--) {
		cout << ' ' << G[i];
	}
	cout << endl;
	cout << cnt << endl;
	for (int i = 0; i < N; i++)
		cout << A[i] << endl;
}

void InsertionSort(int g) {
	for (int i = g; i < N; i++) {
		int v = A[i], j = i - g;
		while (j >= 0 && A[j] > v) {
			A[j + g] = A[j];
			j -= g;
			cnt++;
		}
		A[j + g] = v;
	}
}
void ShellSort(const vector<int> G) {
	cnt = 0;
	for (int i = G.size() - 1; i >= 0; i--) {
		InsertionSort(G[i]);
	}
}

int main()
{
	vector<int> G;
	cin >> N;
	int calc = 1;
	while (calc <= N) {
		G.push_back(calc);
		calc = calc * 3 + 1;
	}
	for (int i = 0; i < N; i++)
		cin >> A[i];
	ShellSort(G);
	Out(G);
	return 0;
}



Measured memory_bytes: 6900
// template version 1.6
// {{{ define basic macro
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
// varibable settings
#define int long long
#define INF 1000000000000000000LL
// #define INF 2147483647
#define MOD 1000000007LL
// #define MOD 998244353LL
#define infile "../test/sample-1.in"

#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)
template<class T, size_t N> size_t sza(const T (&array)[N]) { return N; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T=int> T in() {T x; cin>>x; return (x);}
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

// dump macro
#ifdef PCM
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
#define fi first
#define se second

// }}}

int solve(){
  int n,k;cin>>n>>k;
  int t[n];
  int d[n];
  vector<pair<int, int>> x;
  rep(i, n){
    cin>>t[i]>>d[i];
    x.pb(make_pair(d[i], t[i]));
  }
  dump_1d(t, n);
  dump_1d(d, n);
  sort(all(x));
  reverse(all(x));
  dump(x);

  set<int> s;
  stack<int> q;
  int y = 0;
  int ans = 0;
  int sum = 0;
  rep(i, n){
    int c = x[i].second;  // class
    int v = x[i].first;  // value

    if (!s.count(c)){  // new
      y++;
      s.insert(c);
      sum += v;
      if (i >= k and !q.empty()){
        sum -= q.top();
        q.pop();
      }
      else if(i >= k and q.empty()){
        break;
      }
    }
    else{
      if (i <= k-1) {
        sum += v;
        q.push(v);
      }
    }

    if (i >= k-1) {
      chmax(ans, sum + (y*y));
    }
    dump(i, sum, y, ans);
  }

  cout << ans << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 6640
#include <stdio.h>

int main() {
	int coordinates[10][10] = {0};
	int x, y, size;
	int max = 0;
	int blank = 0;
	int i, j;

	while(scanf("%d,%d,%d", &x, &y, &size) != EOF) {
		coordinates[x][y]++;
		if(x > 0) coordinates[x - 1][y]++;
		if(x < 9) coordinates[x + 1][y]++;
		if(y > 0) coordinates[x][y - 1]++;
		if(y < 9) coordinates[x][y + 1]++;
		if(size == 1) continue;

		if(x > 0) {
			if(y > 0) coordinates[x - 1][y - 1]++;
			if(y < 9) coordinates[x - 1][y + 1]++;
		}
		if(x < 9) {
			if(y > 0) coordinates[x + 1][y - 1]++;
			if(y < 9) coordinates[x + 1][y + 1]++;
		}
		if(size == 2) continue;

		if(x > 1) coordinates[x - 2][y]++;
		if(x < 8) coordinates[x + 2][y]++;
		if(y > 1) coordinates[x][y - 2]++;
		if(y < 8) coordinates[x][y + 2]++;
	}

	for(i = 0; i < 10; i++) {
		for(j = 0; j < 10; j++) {
			if(coordinates[i][j] == 0)
				blank++;
			else if(coordinates[i][j] > max)
				max = coordinates[i][j];
		}
	}

	printf("%d\n%d\n", blank, max);

	return 0;
}

Measured memory_bytes: 600
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    # n = int(input().rstrip())
    n = int(input().rstrip())
    past_max = float("inf")
    ans = 0
    for p in [int(p) for p in input().rstrip().split(" ")]:
        if p < past_max:
            past_max = p
            ans += 1
    print(ans)

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 91408
// https://atcoder.jp/contests/abc063/tasks/abc063_b
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <stack>
#include <queue>
#include <iomanip>
#include <set>
#include <bitset>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(size_t i = 0; i < (n); ++i)

int main()
{
    string S;
    cin >> S;
    vector<int> cnts(26, 0);
    REP(i, S.size())
    {
        ++cnts[S[i] - 'a'];
    }
    REP(i, 26)
    {
        if (cnts[i] > 1)
        {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] x = new int[n];
        int[] y = new int[n];

        for (int i=0; i<n; i++) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        double total = 0;

        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                if (i == j) continue;

                total += Math.sqrt(Math.pow(x[i]-x[j], 2) + Math.pow(y[i]-y[j], 2));
            }
        }
        
        System.out.println(total/n);
    }
}

Measured memory_bytes: 22228
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }
//ミョ(-ω- ?)
int main() {
    ll n;
    cin >> n;
    vector<ll> a(n,0);
    rep(i,n)cin >> a[i];
    ll q;
    cin >> q;
    unordered_map<ll,ll> query;
    for(auto b : a)query[b]++;
    ll res = 0;
    for(auto r : query)res +=  r.first * r.second;
    rep(i,q){
        ll b,c;
        cin >> b >> c;
        ll move = query[b];
        res -= b * query[b];
        res += c * query[b];
        query[b] = 0;
        query[c] += move;
        cout << res << endl;
    }
    return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  int d;
  if (a == b) {
    d = c;
  } else if (b == c) {
    d = a;
  } else {
    d = b;
  }
  cout << d << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
		int h = sc.nextInt();
        int w = sc.nextInt();
    
		// 出力
		System.out.println((n - h + 1) * (n - w + 1));
	}
}

Measured memory_bytes: 21716
Scanf.scanf "%d %d %d" (fun x k d ->
    let x = abs x in
    let c = x / d in
    Printf.printf "%d\n" @@
        if c >= k then x - d * k else
            abs (if (c - k) mod 2 = 0 then x - d * c else x - d * (c + 1))
)

Measured memory_bytes: 3808
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int a,b,c;
string s;

int main()
{

    ios::sync_with_stdio(false);
    cin.tie(0);
    
	cin>>a>>b>>c;
	
	swap(a,b);
	swap(a,c);
	
	cout<<a<<" "<<b<<" "<<c;
	
	
}







Measured memory_bytes: 256
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS())

def main():
    N, Q = GIS()
    s = input()
    d = [0]
    c = 0
    for i in range(1, len(s)):
        if s[i] == 'C' and s[i-1] == 'A':
            c += 1
        d.append(c)
    for q in range(Q):
        l, r = GIS()
        print(d[r-1] - d[l-1])



main()


Measured memory_bytes: 55372
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * 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;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TrickOrTreat solver = new TrickOrTreat();
        solver.solve(1, in, out);
        out.close();
    }

    static class TrickOrTreat {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();

            boolean[] statuses = new boolean[n + 1];

            for (int i = 0; i < k; i++) {
                int d = in.nextInt();
                for (int j = 0; j < d; j++) {
                    int a = in.nextInt();
                    statuses[a] = true;
                }
            }

            int result = 0;
            for (int i = 1; i < statuses.length; i++) {
                if (statuses[i]) {
                    result++;
                }
            }
            out.append(String.valueOf(n - result));
        }

    }
}



Measured memory_bytes: 46096
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ini(n) scanf("%d",&n)
#define inl(n) scanf("%lld",&n)
#define ini2(n,m) scanf("%d%d",&n,&m)
#define inl2(n,m) scanf("%lld%lld",&n,&m)
#define prnti(n) printf("%d",n)
#define prnti2(n, m) printf("%d %d",n,m)
#define prntl(n) printf("%lld",n)
#define prntl2(n, m) printf("%lld %lld",n,m)
#define SP() printf(" ")
#define NL() printf("\n")
int main()
{
    int n;
    cin >> n ;
    vector<int> a(n+2);
    for(int i=1;i<n;i++)
    {
        int k;
        cin >> k;
        a[k]++;
    }
    for(int i=1;i<n+1;i++)
    {
        cout << a[i] << endl;
    }
}


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

using namespace std ;

#define N 200000

int tot = 1 , Max , n ;
int nex[2*N] , fire[N] , to[2*N] ;
int Ans[N] , Out[N] , book[N] ;

void add(int u , int v){
    nex[++tot] = fire[u] ;
    fire[u] = tot ;
    to[tot] = v ;
    return ;
}

void dfs(int x , int fr ){
    int t = 0 ;
    for(int i = fire[x] ; i ; i = nex[i] ){
        int v = to[i] ;
        if( ( i ^ 1 ) == fr ) continue ;
        t++ ; if( book[t] ) t++ ;
        Ans[i / 2] = t ;
    }
    book[Ans[fr / 2]] = 0 ;
    for(int i = fire[x] ; i ; i = nex[i] ){
        int v = to[i] ;
        if( ( i ^ 1 ) == fr ) continue ; 
        book[Ans[i / 2]] = 1 ;
        dfs( v , i ) ;
    }
}

int main()
{
    scanf("%d" , &n ) ;
    for(int i = 1 ; i <= n - 1 ; i++ ){
        int u , v ;
        scanf("%d%d" , &u , &v ) ;
        add( u , v ) ; add( v , u ) ;
        Out[u]++ , Out[v]++ ;
    }
    int Max = 0 ;
    for(int i = 1 ; i <= n ; i++ ) Max = max( Max , Out[i] ) ;
    dfs( 1 , 0 ) ;
    printf("%d\n" , Max ) ;
    for(int i = 1 ; i <= n - 1 ; i++ ) printf("%d\n" , Ans[i] ) ;
    return 0 ;
}

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

int main() {
    int64_t N ;
    cin >> N;
    vector<int64_t> A(N);
    for ( int64_t i = 0; i < N; ++i){
        cin >> A[i];
    }
    
    vector<int64_t> B;
    B.push_back(A[0]);
    for ( int64_t i = 1; i < N; ++i){
        if ( A[i] != A[i-1] ){
            B.push_back(A[i]);
        }
    }
    vector<int64_t> C;
    if ( B[0] < B[1] ) C.push_back(B[0]);
    for ( int64_t i = 1; i < B.size()-1; ++i){
        if ( B[i-1] < B[i] and B[i] > B[i+1] ) C.push_back(B[i]);
        if ( B[i-1] > B[i] and B[i] < B[i+1] ) C.push_back(B[i]);
    }
    if ( C.size() % 2 != 0 and B[B.size()-1] > B[B.size()-2] ){
        C.push_back(B[B.size()-1]);
    }
    
    int64_t all = 1000;
    if ( C.size() % 2 == 0 ){
        int64_t num = 0, rest = 0;
        for ( int64_t i = 0; i < C.size(); ++i){
            if ( i % 2 == 0 ){
                num = all / C[i];
                rest = all % C[i];
            } else {
                all = rest + num * C[i];
            }
        }
    } else {
        int64_t num = 0, rest = 0;
        for ( int64_t i = 0; i < C.size()-1; ++i){
            if ( i % 2 == 0 ){
                num = all / C[i];
                rest = all % C[i];
            } else {
                all = rest + num * C[i];
            }
        }
    }
    cout << all << endl;
    
    return 0;
}


Measured memory_bytes: 3600
#include<iostream>
#include<map>
using namespace std;
int main(){
	int n;
	cin >> n;
	map<int,int> a;
	int tmp;
	for(int i=0;i<n;i++){
		cin >> tmp;
		a[tmp]++;
	}
	int ans=0;
	for(auto itr=a.begin();itr!=a.end();itr++){
		if(itr->second%2==1) ans++;
	}
	cout << ans << endl;
}


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

using namespace std;

const int MAXN = 200001;

int n,m;
int prev1[MAXN];
int cur[MAXN];

priority_queue<int> pql;
priority_queue<int, vector<int>, std::greater<int>> pqr;

int main(){
   ios::sync_with_stdio(false);
   cin.tie(0);
   
   cin >> n >> m;
   for(int k = 1; k <= n; k++){
      cin >> prev1[k];
   }
   
   fill(begin(cur),end(cur),1);
   
   
   
   int i = 1;
   while( i <= m){
      pql = priority_queue<int>();
      pqr = priority_queue<int,vector<int>, std::greater<int>>();
   
      for(int k = 1; k <= n; k++){
         while(!pqr.empty() && pqr.top() < k) pqr.pop();
         cur[k] += pqr.size();
         pqr.push(k+prev1[k]);
      }
      for(int k = n; k >= 1; k--){
         while(!pql.empty() && pql.top() > k) pql.pop();
         cur[k] += pql.size();
         pql.push(k-prev1[k]);
      }
      
      bool done = true;
      for(int k = 1; k <= n; k++){
         prev1[k] = cur[k];
         cur[k] = 1;
         if(prev1[k] < n) done = false;
      }
      
      if(done) break;
      i++;
   }
   
   for(int k = 1; k <= n; k++){
      cout << prev1[k] << " ";
   }
   
   
   
   return 0;
}

Measured memory_bytes: 7348
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>

#define REP(i, N) for (ll i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define INF ll(1e9)
#define INFL ll(1e18)
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int ctoi(char c) {return c - '0';}

class AStationAndBus {
public:
	void solve(std::istream& in, std::ostream& out) {
	    string S;
	    in >> S;
	    string ans = "No";
	    REP(i, S.size()) {
	        if (S[0] != S[i]) ans = "Yes";
	    }
	    out << ans << '\n';
	}
};


int main() {
	AStationAndBus solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a=sc.nextInt();
    int b=sc.nextInt();
    int c=sc.nextInt();
    int d=sc.nextInt();
    int e=sc.nextInt();
    
   int x=a+b+c+d+e;
   System.out.println(15-x);
  }
}

Measured memory_bytes: 35628
s = input()[::-1]
cnt = [0] * 2020
cnt[0] = 1
tens = 1
rem = 0
ans = 0
for c in s:
    rem = (rem + (ord(c) - ord('0')) * tens) % 2019
    ans += cnt[rem]
    cnt[rem] += 1
    tens = tens * 10 % 2019
print(ans)


Measured memory_bytes: 9300
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!long;

    long r;
    foreach (x; 1..N) {
        if (x^^2 > N) break;
        if (N%x == 0) {
            auto m = N/x - 1;
            if (x*m + x == N && N/m == N%m) r += m;
        }
    }
    writeln(r);
}

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

int main(){
	int k;
    string s;
    
    cin>>k;
    cin>>s;
    int l=s.length();
    
    if(l<=k){
    	cout<<s<<endl;
	}else{
		for(int i=0;i<k;i++){
			cout<<s[i];
		}
		cout<<"..."<<endl;
	}
    
    return 0;
}

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

int main() {
  int a, b, k, counter = 0; cin >> a >> b >> k;
  for(int i = min(a, b); i >= 1; i--) {
    if(a%i == 0 && b%i == 0) counter++;
    if(counter == k) {
      cout << i << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


int main(){
    int n,m;
    cin >> n >> m;
    int ans = 0;
    for(int i=1;i*i<=m;i++){
        if(m % i ==0){
            if(i >= n) ans=max(ans,m/i);
            if(m/i >= n) ans=max(ans,i);
        }
    }
    cout <<ans << endl;
}



Measured memory_bytes: 256
n,m,x=map(int,input().split())
mlist = list(map(int,input().split()))

pre=post=0

for i in range(x):
    if i in mlist:
        pre += 1

for i in range(x,n+1):
    if i in mlist:
        post += 1

print(min(pre,post))




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

/*
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <ctype.h>
*/


using namespace std;

typedef pair<int , int > pii;
typedef pair<long , long> pll;
typedef pair<pii , int > piii;
typedef pair<pll , long > plll;
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector <pii> vii;
typedef vector<pll> vll;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned long long int ulli;
typedef long long int lli;
typedef double d;
typedef float f;
typedef string s;
typedef char ch;
typedef pair<int,ll> pill;

#define loop(n) for(int i = 0; i < (n); i++)
#define lp(x , s , e) for(int x = (s); x < (e); x++)
#define lpe(x , s , e) for(int x = (s); x <= (e); x++)
#define readline(s) getline(cin,s)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x)  (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define F first
#define S second
#define EPS 1e-7
#define modulo ll (1e9 + 7)
const long double PI = 3.141592653589793238L;
#define MP make_pair
#define PB push_back
#define all(a) a.begin(),a.end()
#define clr(x , val) memset((x) , (val) , sizeof(x))
#define endl '\n'

ll power(ll a, ll b)
{
    ll res = 1;
    for(int i = 0; i<b; i++)
       res *= a;

    return res;
}



int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
	string x;
	cin >> x;
	if (x[2] == x[3] && x[4] == x[5])
	{
		cout << "Yes" << endl;
	}
	else
		cout << "No" << endl;
     return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define f(i, a, b) for(ll i = a; i <= b; ++i)
#define ff(i, a, b) for(ll i = a; i < b; ++i)
#define F(i, a, b) for(ll i = a; i >= b; --i)
#define FF(i, a, b) for(ll i = a; i > b; --i)
#define x first
#define y second
#define X real()
#define Y imag()
using namespace std;
typedef complex<ll> P;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;

const ll N = 2e5+7;
deque<ii> dq;
ll n, m, ans, cnt, now, sub = 0, a[N], f[N], d[N];
bool ok = 0;

signed main(){
//	freopen("PERFECT1.inp","r",stdin);
//	freopen("PERFECT1.out","w",stdout);
//	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m;
	f(i,1,n) cin >> a[i];
	f(i,1,n){
		while(!dq.empty() && dq.back().x < a[i]) dq.pop_back();
		while(!dq.empty() && dq.front().y <= i-m) dq.pop_front();
		dq.push_back({a[i], i});
		if(i >= m) f[i] = dq.front().x;
//		cout << "f["<<i<<"] = "<<f[i]<<"\n";
	}
//	cout <<"\n";
	while(dq.size()) dq.pop_back();
	f(i,1,n){
		while(!dq.empty() && dq.back().x > a[i]) dq.pop_back();
		while(!dq.empty() && dq.front().y <= i-m) dq.pop_front();
		dq.push_back({a[i], i});
		if(i >= m) d[i] = dq.front().x;
//		cout << "d["<<i<<"] = "<<d[i]<<"\n";
	}
	ans = 1;
	f(i,m+1,n){
		ans += 1;
		if(f[i] == a[i] && a[i-m] < d[i]) ans -= 1;
	}
	cnt = 0, now = -1;
	a[n+1] = -1;
	f(i,1,n+1){
		if(now < a[i]){
			cnt += 1;
			now = a[i];
		}else{
			now = a[i];
			if(cnt >= m){
				ans -= 1;
				ok = 1;
			}
			cnt = 1;
		}
	}
	
	cout << ans+ok;
}



Measured memory_bytes: 6144
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 09/05/20 22:47:54
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  struct Point {
    int x=0,y=0;
    double angle() const {
      return atan2(y, x) + M_PI;
    }
    double dist() const {
      return sqrt((double)(ll)x*x + (ll)y*y);
    }
    Point operator+(Point p) const {
      return {x+p.x, y+p.y};
    }
    Point operator-(Point p) const {
      return {x-p.x, y-p.y};
    }
  };
  vector<Point> P;
  P.reserve(n);
  for (int i = 0; i < n; i++) {
    int x,y; cin>>x>>y;
    P.push_back({x, y});
  }
  sort(P.begin(), P.end(), [](auto l, auto r) {return l.angle() < r.angle();});

  double ans = 0;
  for (int i = 0; i < n; i++) {
    Point p;
    for (int j = i; j < i+n; j++) {
      p = p + P[j%n];
      ans = max(ans, p.dist());
    }
  }
  cout <<fixed<<setprecision(10)<< ans << endl;

  return 0;
}


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

int main() {
    string s;

    cin >> s;

    for (int i = 0; i < s.size(); i++) {
        if ((i + 1) % 2 == 1) {
            if (s[i] == 'L') {
                cout << "No" << endl;
                return 0;
            }
        } else {
            if (s[i] == 'R') {
                cout << "No" << endl;
                return 0;
            }
        }
    }

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    int a, b;
    cin >> a >> b;
    cout << max(a + b, max(a - b, a * b)) << endl;
}

int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}

Measured memory_bytes: 256
#include <stdio.h>

#define N 10000
#define INFTY 1000000000
#define WHITE 0
#define GRAY 1
#define BLACK 2 

int n, Arr[N][N];
int color[N], d[N];
int Q[N], head, tail;

void BFS(int);
void enqueue(int);
int dequeue(void);

int main()
{
  int i, j;
  int u, k, v;

  scanf("%d", &n);

  head = 0;
  tail = n;
  
  for( i = 0 ; i < n ; i++ )
    for( j = 0 ; j < n ; j++ )
      Arr[i][j] = 0;

  for( i = 0 ; i < n ; i++ ){
    scanf("%d%d", &u, &k);
    u--;
    for( j = 0 ; j < k ; j++ ){
      scanf("%d", &v);
      v--;
      Arr[u][v] = 1;
    }
  }

  BFS(0);

  return 0;
}

void BFS(int s)
{
  int i, u, v;

  for( u = 0 ; u < n ; u++ ){
    color[u] = WHITE;
    d[u] = INFTY;
  }
  
  color[s] = GRAY;
  d[s] = 0;
  enqueue(s);

  while( head != tail ){
    u = dequeue();
    for( v = 0 ; v < n ; v++ ){
      if( Arr[u][v] == GRAY && color[v] == WHITE ){
	color[v] = GRAY;
	d[v] = d[u] + 1;
	enqueue(v);
      }
    }
    color[u] = BLACK;
  }

  for( i = 0 ; i < n ; i++ ){
    printf("%d ", i+1);
    if( d[i] == INFTY ) printf("-1\n");
    else printf("%d\n", d[i]);
  }
}

void enqueue(int x)
{
  Q[tail] = x;
  tail = (tail + 1) % N;
}

int dequeue(void)
{
  int x;

  x = Q[head];
  head = (head + 1) % N;
  return x;
}

Measured memory_bytes: 2876
from bisect import*

N,M,K=map(int,input().split())
*A,=map(int,input().split())
*B,=map(int,input().split())

sa=[0]+[0]*N
i=0
while i<N:
    sa[i+1]=sa[i]+A[i]
    i+=1

sb=[0]+[0]*M
j=0
while j<M:
    sb[j+1]=sb[j]+B[j]
    j+=1

i=bisect_right(sa,K)-1
ans=0
while 0<=i:
    j=bisect_right(sb,K-sa[i])-1
    ans=max(ans,i+j)
    i-=1

print(ans)

Measured memory_bytes: 49280
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

      int a = sc.nextInt();
      int b = sc.nextInt();

 if (a < b){
System.out.println("a < b");
}else if (a > b){
System.out.println("a > b");
}else if (a == b){
System.out.println("a == b");
}

}
}


Measured memory_bytes: 26240