akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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(a>b){a=b;return 1;}return 0;}
#if loc||local
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  ll N,W;
  cin>>N>>W;
  vector<ll> w(N),v(N);
  rep(i,N){
    cin>>w[i]>>v[i];
  }

  map<ll,vector<ll>> item;
  rep(i,N){
    item[w[i]].emplace_back(v[i]);
  }
  for(auto& elm:item){
    sort(begin(elm.second),end(elm.second),greater<>());
  }

  int id=0;
  auto a = vec<ll>(4,0);
  vector<ll> b(4,INF);
  for(auto elm:item){
    a[id] = elm.second;
    b[id] = elm.first;
    id++;
  }
  for(auto& ai:a){
    reverse(ai.begin(),ai.end());
    ai.emplace_back(0);
    reverse(ai.begin(),ai.end());
  }

  rep(i,4)for(int j=1;j<a[i].size();++j){
    a[i][j]+=a[i][j-1];
  }

  rep(i,4)dump(a[i]);
  dump(b);

  ll ans = 0;
  rep(i,a[0].size())rep(j,a[1].size())rep(k,a[2].size())rep(l,a[3].size()){
    if(b[0]*i+b[1]*j+b[2]*k+b[3]*l>W)continue;
    chmax(ans,a[0][i]+a[1][j]+a[2][k]+a[3][l]);
    dump(i,j,k,b[0]*i,b[1]*j,b[2]*k,a[0][i]+a[1][j]+a[2][k]);
  }
  cout<<(ans)<<endl;

  

}

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

int main() {
int e1,e2,e3,e4;
cin >> e1 >> e2 >> e3 >> e4;

  if(e1==e2&&e3==e4){
        cout<< "yes" <<endl;
      } else if(e1==e3&&e2==e4) {
         
        cout<< "yes" <<endl; 
        } else if(e4==e1&&e2==e3) {
          cout<< "yes" <<endl;
        } else {
         cout<< "no" <<endl;
      }
  return 0;

}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
#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##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while (a > 0 && c > 0) {
        c -= b;
        if (c <= 0) break;
        a -= d;
    }
    write(a > 0 ? "Yes" : "No");
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define lt long long
using namespace std;
const int N=1e5+5;
const int mod=1e9+7;
const int inf=0x3f3f3f;
int ans[N];
void init()
{
	for (int x=1;x<=100;x++)
		for (int y=1;y<=100;y++)
			for (int z=1;z<=100;z++)
				ans[x*x+y*y+z*z+x*y+y*z+z*x]++;
}
int main()
{
	int n;
	int cnt=0;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		if (i%2==1 && a%2==1) cnt++;
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 3592
using System;

class A
{
	static void Main()
	{
		var h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		Console.WriteLine((new TimeSpan(h[2], h[3], 0) - new TimeSpan(h[0], h[1], 0)).TotalMinutes - h[4]);
	}
}


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

using namespace std;

typedef long long ll;

#define mod 1000000007

int sum(int a, int b) {
    return (a + b) % mod;
}

int sub(int a, int b) {
    return (a - b + mod) % mod;
}

int a[110];
int dp[110][100010];

int n;
int go(int pos, int k) {
    if(pos == n) return k == 0;

    int ans = 0;

    for(int i = 0; i <= a[pos] && i <= k; i++) {
        ans += go(pos + 1, k - i);
    }

    return ans;
}

int memo[110][100010];

int main() {
    ios_base::sync_with_stdio(false);

    int k;
    cin >> n >> k;

    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int pos = n; pos >= 0; --pos) {
        for (int r = 0; r <= k; r++) {
            if (pos == n) memo[pos][r] = r == 0;
            else {

                int ans = 0;

                int mn = r - min(a[pos], r);
                int mx = r;

//                for (int i = 0; i <= a[pos] && i <= r; i++) {
//                    ans += memo[pos + 1][r - i];
//                }

                memo[pos][r] = sub(memo[pos + 1][mx], (mn > 0 ? memo[pos + 1][mn - 1] : 0));
            }
        }
        // prefix sum
        if(pos > 0)
        for(int i = 1; i <= k; i++) {
            memo[pos][i] = sum(memo[pos][i], memo[pos][i - 1]);
        }
    }

//    cout << go(0, k) << endl;
    cout << memo[0][k] << endl;
}

/*
 * M
**/

Measured memory_bytes: 43264
#! /usr/bin/python
# -*- coding: utf-8 -*-
# ALDS1_3_B: Queue

if __name__ == "__main__":
    # 数字入力　行数＋数字(1行1文字)
    N_Q = list(input().split())
    n, q = int(N_Q[0]), int(N_Q[1])
    time = 0
    FIN = []

    L = [input().split() for i in range(n)]
    temp_name = ""
    temp_time = 0

    while len(L) > 0:
        process_name = L[0][0]
        process_time = int(L[0][1])
        # print("process_name = {}, process_time = {}".format(process_name, process_time))

        if process_time <= q:
            time = time + process_time
            FIN.append([process_name, time])
            L.pop(0)
            # print("L = {}".format(L))
            # print("FIN = {}".format(FIN))
        else:
            time = time + q
            temp_name = L[0][0]
            temp_time = int(L[0][1]) - q
            L.pop(0)
            L.append([temp_name, temp_time])
            # print("L = {}".format(L))
    for i in range(len(FIN)):
        print("{} {}".format(FIN[i][0], FIN[i][1]))


Measured memory_bytes: 17036
num = int(input())
line = [int(line) for line in input().split()]

sum_step = 0
max_value = 0
for i, x in enumerate(line):
    if i == 0:
        max_value = x
        continue
    if max_value > x:
        sum_step += max_value - x
    else:
        max_value = x

print(sum_step)

Measured memory_bytes: 94148
k, n = map(int, input().split())
dist = list(map(int, input().split()))
maximum = 0
total = 0
for i in range(1, n):
    diff = dist[i] - dist[i - 1]
    total += diff
    maximum = max(diff, maximum)

diff = k - dist[n - 1] + dist[0]
maximum = max(diff, maximum)

print(total + diff - maximum)

Measured memory_bytes: 26436
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  ll N, A, B; cin >> N >> A >> B;
  vector<ll> X(N); REP(i, N) cin >> X[i];
  vector<ll> diff(N-1); REP(i, N-1) diff[i] = abs(X[i]-X[i+1]);

  ll ans = 0;
  REP(i, N-1) ans += min(diff[i]*A, B);
  cout << ans << endl;
}

Measured memory_bytes: 1792
//#define anjn
//      Anjan Agarwala - anjn98

//#define opti
#ifdef opti
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#endif

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, 
                  tree_order_statistics_node_update> ordered_set;

//ll power(ll x,ll y,ll p){ll r=1; x=x%p; while(y){ if(y&1) r= r*x%p; y=y>>1; x=x*x%p; } return r; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int csrand(int l=0, int r=1e9){
  uniform_int_distribution<int> uid(l, r);
  return uid(rng);
}

#define PR(x) cout<<#x<<": "<<x<<"\n";
#define PR1(x,y) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<"\n";
#define PR2(x,y,z) cout<<#x<<": "<<x<<"  |  "<<#y<<": "<<y<<"  |  "<<#z<<": "<<z<<"\n";
#define ED cout<<'\n';

#define IO              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FILEIO          freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define all(v)          v.begin(),v.end()
#define endl            '\n'
#define fr1(j,n)        for(int j=0;j<n;j++)
#define fr(n)           for(int i=0;i<n;i++)
#define trav(x,s)       for(auto x:s)
#define PB              push_back
#define pii             pair<int,int>
#define pll             pair<long long int,long long int>
#define F               first
#define S               second 
#define binf            2000000000000000001
#define mod             1000000007

const int N=2e5+99; 



int32_t main() 
{
    IO
	
        

    ll n; cin>>n;
    ll a[n];
    fr(n) cin>>a[i];    

    ll xx=0;

    fr(n) xx=a[i]-xx;

    xx=xx/2LL;

    vector<ll> b(n,0);

    fr(n)
    {
        b[i]=2*xx;
        xx=a[i]-xx;            
    }
    fr(n) cout<<b[i]<<" ";
    ED

}




 
    
    

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,  //less_equal
             tree_order_statistics_node_update> oset; 
typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = 1e6 + 5;
const int MOD = 1e9 + 7;
const int MAXK = 2e3 + 2;
#define sz(x) (int)(x).size()
#define f first
#define s second





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

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

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

int main()
{
  int N, M; cin >> N >> M;
  vector<vector<int>> G(N);
  for (int i = 0; i < M; i++)
  {
    int x, y; cin >> x >> y;
    x--; y--;
    G[x].push_back(y);
  }
  int S, T; cin >> S >> T;
  S--; T--;

  vector<vector<int>> check(N, vector<int>(3, -1));
  queue<pair<int, int>> q;
  check[S][0] = 0;
  q.push(make_pair(S, 0));

  while (!q.empty())
  {
    pair<int, int> tmp = q.front(); q.pop();
    int v = tmp.first, num = tmp.second, nextnum = (num + 1) % 3;
    for (int nv : G[v])
    {
      if (check[nv][nextnum] != -1) continue;
      check[nv][nextnum] = check[v][num];
      if (nextnum == 0) check[nv][nextnum]++;
      q.push(make_pair(nv, nextnum));
    }
  }

  cout << check[T][0] << endl;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
  int H,W;
  cin>>H>>W;
  vector<vector<char>> A(H,vector<char>(W)),B(H,vector<char>(W));
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++){
      cin>>A[i][j];
      B[i][j]=A[i][j];
    }
  for(int i=0;i<H;i++)A[i][0]='#',B[i][W-1]='#';
  for(int i=0;i<H;i+=2)
    for(int j=0;j<W-1;j++)A[i][j]='#';
  for(int i=1;i<H;i+=2)
    for(int j=1;j<W;j++)B[i][j]='#';
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++)cout<<A[i][j];
    cout<<endl;
  }
  cout<<endl;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++)cout<<B[i][j];
    cout<<endl;
  }
}

Measured memory_bytes: 4140
import java.util.*
object MainKt {
  @JvmStatic fun main(args:Array<String>) {
    val N=readLine()!!.toInt()
    val A=(1..N).map{
      readLine()!!
    }
    val map=HashMap<String,Int>()
    for(number in A) {
      map.get(number) ?.let {map.remove(number)} ?: number.let {map.put(number,1)}
    }
    println(map.size)
  }
}


Measured memory_bytes: 52312
import math as mt
import sys, string
from collections import Counter, defaultdict
input = sys.stdin.readline

MOD = 1000000007

I = lambda : int(input())
M = lambda : map(int, input().split())
Ms = lambda : map(str, input().split()) 
ARR = lambda : list(map(int, input().split()))

def main():
    t = I()
    if t >= 30:
        print("Yes")
    else:
        print("No")

# testcases
tc = 1
for _ in range(tc):
    main()

Measured memory_bytes: 68768
// author: hjy
// Problem:
#include<bits/stdc++.h>
//#pragma GCC optimize(2)
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define rep(i,n) for(register int i=0; i<(int)(n); ++i)
#define per(i,n) for(register int i=(int)(n)-1; i>=0; --i)
#define rep1(i,n) for(register int i=1; i<=(int)(n); ++i)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<"="<<x<<'\n'
template<typename T1, typename T2>
inline bool umin(T1 &a, const T2 &b) { return a > b ? a = b, true : false; }
template<typename T1, typename T2>
inline bool umax(T1 &a, const T2 &b) { return a < b ? a = b, true : false; }
inline int read() {
	int x=0,ng=0;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-') ng=1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return ng?-x:x;
}
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const int seed=20040305;

string s;
int n;
int cnt[30];
ll res=0;
ll f[30];

int main()
{
	cin>>n>>s;
	rep(i,n) cnt[s[i]-'a']++;
	f[0]=cnt[0]+1;
	for(int i=1;i<26;i++) f[i]=f[i-1]*(cnt[i]+1)%mod;
	printf("%lld",(f[25]-1)%mod);
}


Measured memory_bytes: 512
hoge=input()
a=int(hoge[0])
b=int(hoge[1])
c=int(hoge[2])
d=int(hoge[3])
f=0
for i in [-1,1]:
  for j in [-1,1]:
    for k in [-1,1]:
      if(a+i*b+j*c+k*d==7):
        if(i==1):
          x="+"
        else:
          x="-"
        if(j==1):
          y="+"
        else:
          y="-"
        if(k==1):
          z="+"
        else:
          z="-"
        if(f==0):
          print(str(a)+x+str(b)+y+str(c)+z+str(d)+"=7")
          f+=1

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t,n,a,b;
	t = 1;
	while(t--) {
	  cin >> n >> a >> b;
      cout << min(n * a, b) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
class Node:
    def __init__(self, data):
        self.data = data
        self.next = None

class Queue:
    def __init__(self):
        self.head = None
        self.last = None
        self._size = 0

    def enqueue(self, data):
        if self.last is None:
            self.head = Node(data)
            self.last = self.head
        else:
            self.last.next = Node(data)
            self.last = self.last.next
            
        self._size += 1

    def dequeue(self):
        if self.head is None:
            return None
        else:
            to_return = self.head.data
            self.head = self.head.next
            self._size -= 1
            
            if self._size == 0:
                self.head = None
                self.last = None
            return to_return
        
    def size(self):
        return self._size
    
def inside(y,x,H,W):
    if 0<=y<H and 0<=x<W:
        return True
    else:
        return False
    
def addQueueIfPossible(new_y, new_x, new_val, data, queue):
    if inside(new_y, new_x, H, W) and data[new_y][new_x]==-1:
        data[new_y][new_x] = new_val
        queue.enqueue((new_y, new_x, new_val))
        return True
    else:
        return False

H, W = map(int,input().split())

data = []
for _ in range(H):
    data.append([0 if it=='#' else -1 for it in input()])



queue = Queue()
for y in range(H):
    for x in range(W):
        if data[y][x] == 0:
            queue.enqueue((y,x,0))

while queue.size() > 0:
    y, x, val = queue.dequeue()
    # up
    addQueueIfPossible(y-1, x, val+1, data, queue)
    # down
    addQueueIfPossible(y+1, x, val+1, data, queue)
    # right
    addQueueIfPossible(y, x+1, val+1, data, queue)
    # down
    addQueueIfPossible(y, x-1, val+1, data, queue)

print(val)

Measured memory_bytes: 183004
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int factor = (int) Math.pow(100, in.nextInt());
    int nth = in.nextInt();
    if(nth == 100) {
      nth++;
    }
    System.out.println(nth*factor);
  }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

template <typename T>
bool chmin(T & a, const T & b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	string S;
	cin >> n;
	cin >> S;

	int l = 0;
	int r = count(all(S), '.');
	int ans = r;
	rep(i, n) {
		if (S[i] == '.') {
			r--;
		}
		else {
			l++;
		}
		chmin(ans, r + l);
	}

	dunk(ans);
	
	return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int N;
    cin >> N;
    
    map<int,int> mp;
    rep(i, N) {
        int a;
        cin >>a;
        ++mp[a];
    }

    vec<int> ans;
    for(auto [f,e]:mp){
        ans.push_back(((e%2)==0?2:1));
    }

    if(ans.size()==1 && ans[0] == 1){
        cout << 1 << endl;
        return 0;
    } else if(ans.size() ==1 && ans[0]==2){
        cout << 0 << endl;
        return 0;
    }

    int l=0;
    int r=ans.size()-1;
    while(r-l>=1){
        if(r-l>1){
            if(ans[l]==1) {
                ++l;
                continue;
            }
            if(ans[r]==1) {
                --r;
                continue;
            }
            if(ans[l]==2&&ans[r]==2){
                ans[l]=1;
                ans[r]=1;
            }
        } else if(r-l ==1){
            if(ans[l]!=ans[r]){
                cout << ans.size()-1 << endl;
                return 0;
            } else {
                cout << ans.size() << endl;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 8444
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n,i,j,x,flag=0,sum=0,sum2=0,mul=1,maxi = INT_MIN;
    string s,ss;
    cin>>s>>ss;
    if(s.size()>ss.size())
        cout<<"GREATER"<<endl;
    else if(s.size()<ss.size())
        cout<<"LESS"<<endl;
    else
    {
        for(i = 0 ;i<s.size();i++)
        {
            if(s[i]>ss[i])
            {
                flag =1 ;
                break;
            }
            else if(s[i]<ss[i])
            {
                flag =2 ;
                break;
            }
        }
        if(flag == 0 )
            cout<<"EQUAL"<<endl;
        else if(flag ==1)
            cout<<"GREATER"<<endl;
        else
            cout<<"LESS"<<endl;
    }


}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int> pii;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
const int Maxs=3005;
char sx[Maxs],sy[Maxs];
int dp[Maxs][Maxs];
pii pre[Maxs][Maxs];
int main(){
	scanf("%s%s",sx+1,sy+1);
	int n=strlen(sx+1);
	int m=strlen(sy+1);
	rep(i,Maxs)rep(j,Maxs)pre[i][j]=make_pair(-1,-1);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(sx[i]==sy[j]){
				if(chkmax(dp[i][j],dp[i-1][j-1]+1)){
					pre[i][j]=make_pair(i-1,j-1);
				}
			}
			if(chkmax(dp[i][j],dp[i-1][j])){
				pre[i][j]=make_pair(i-1,j);
			}
			if(chkmax(dp[i][j],dp[i][j-1])){
				pre[i][j]=make_pair(i,j-1);
			}
		}
	}
	vector<char>seq;
	int tx=n,ty=m;
	while(pre[tx][ty]!=make_pair(-1,-1)){
		int nx=pre[tx][ty].first,ny=pre[tx][ty].second;
		if(tx-nx==1&&ty-ny==1){
			seq.push_back(sx[tx]);
		}
		tx=nx;
		ty=ny;
	}
	for(int i=SZ(seq)-1;i>=0;i--){
		cout<<seq[i];
	}
	cout<<endl;
	return 0;
}

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

int main(int argc, char const *argv[])
{
	long long a,b,c,k;
	cin>>a>>b>>c>>k;
	if (k%2LL==1LL)
	{
		cout<<b-a<<endl;
	}
	else
	{
		cout<<a-b<<endl;
	}
	return 0;
}


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

#define say(obj) (cout << (obj) << endl)
#define endline (cout << endl)
#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "yes" << endl) : (cout << "no" << endl))
#define Yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to, cost;
	edge_(ll to, ll cost) : to(to), cost(cost) {}
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr int		INF = (int)1e7;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template <typename T>
T getSum(std::vector<T>& v) {
	T ret = 0;
	for (T& x : v) ret += x;
	return ret;
}

template <typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template <typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template <typename T>
ostream& operator << (ostream& os, const vector<vector<T>>& mat) {
	for (const vector<T>& m : mat) os << m << endl;
	return os;
}

template <typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

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

template <typename T>
ostream& operator << (ostream& os, const set<T>& s) {
	for (const T& x : s) os << x << " ";
	return os;
}

ostream& operator << (ostream& os, const edge e) {
	os << "{to: " << e.to << ", cost: " << e.cost << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/

int main()
{
	ll N;
	vll C(5);
	cin >> N >> C;

	vll Ct = C;
	sortall(Ct);
	ll mi = Ct[0];

	ll ans = 5;
	ans += ceil(double(N) / mi) - 1;
	say(ans);

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define each(a, x) for (auto& a : (x))
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define int long long
#define yn(x) puts((x ? "Yes" : "No"))
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
const int MX = 1e5 + 5, INF = 5LL << 57, MOD = 1e9 + 7;

int N, M;
string S;
vi va, vb;
int ss[5555];
vi r, g, b;

void input() {
  ;
  ;
  cin >> N;
  cin >> S;
  rep(i, 0, 5554) { ss[i] = -1; }
  rep(i, 0, N - 1) {
    if (S[i] == 'R') {
      ss[i + 1] = 1;
      r.push_back(i + 1);
    }
    if (S[i] == 'G') {
      ss[i + 1] = 2;
      g.push_back(i + 1);
    }
    if (S[i] == 'B') {
      ss[i + 1] = 4;
      b.push_back(i + 1);
    }
  }
}

int leftc[9][5555];
int rsize[5555], gsize[5555], bsize[5555];
int sizes[9][5555];
void solve() {
  int ans = 0;
  sizes[ss[1]][1] = 1;
  rep(i, 2, N) {
    sizes[1][i] = sizes[1][i - 1];
    sizes[2][i] = sizes[2][i - 1];
    sizes[4][i] = sizes[4][i - 1];
    sizes[ss[i]][i] = sizes[ss[i]][i] + 1;
  }
  // // 16000000. n^2 made.
  // leftc[1][N] = 0;
  // leftc[2][N] = 0;
  // leftc[4][N] = 0;
  // rrep(i, N - 1, 1) {
  //   leftc[4][i] = leftc[4][i + 1];
  //   leftc[2][i] = leftc[2][i + 1];
  //   leftc[1][i] = leftc[1][i + 1];
  //   leftc[ss[i]][i] = leftc[ss[i]][i + 1] + 1;

  //   debug2(i,leftc[ss[i]][i]);
  // }
  // debug2(leftc[1][0], r.size());
  // debug2(leftc[2][0], g.size());
  // debug2(leftc[4][0], b.size());

  rep(i, 1, N) {
    ;
    rep(j, i + 1, N) {
      ;
      if (i == j) continue;
      if (ss[i] == ss[j]) continue;

      int left = 7;
      left -= (ss[i] | ss[j]);
      // debug2(i, j);
      // debug(left);
      int ngk = 2 * j - i;
      ans += sizes[left][N] - sizes[left][j];
      // debug(ans);

      if (ngk <= j || ngk > N) continue;
      // j ikoude  nanko?
      if (ss[ngk] == left) ans--;
    }
  };
  cout << ans << endl;
}
signed main() {
  cout << setprecision(12);
  input();
  solve();
  return 0;
}

Measured memory_bytes: 3856
#include <iostream>
#include <string>
using namespace std;
int main(){
	string s;
	while (getline(cin, s), !cin.eof()){
		while (1){
			size_t p = s.find("@");
			if (p == string::npos)break;
			s.replace(p, 3, string(int(s[p + 1] - '0'), s[p + 2]));
		}
		cout << s << "\n";
	}
}

Measured memory_bytes: 1192
fileprivate struct Scanner {
    private var elements = [String]()
    private var index = 0
    
    mutating func peek() -> String {
        while elements.count == index {
            elements = readLine()!.split(separator: " ").map(String.init)
            index = 0
        }
        return elements[index]
    }
    
    mutating func next() -> String {
        let value = peek()
        index += 1
        return value
    }
    
    mutating func nextInt() -> Int {
        return Int(next())!
    }
    
    mutating func nextDouble() -> Double {
        return Double(next())!
    }
}

func main() {
    var scanner = Scanner()
    let N = scanner.nextInt()
    let K = scanner.nextInt()
    let A = (0 ..< N).map { _ in scanner.nextInt() }
    
    for i in K ..< N {
        if A[i - K] < A[i] {
            print("Yes")
        } else {
            print("No")
        }
    }
}

main()


Measured memory_bytes: 21524
n = int(input())
b = []
for i in range(n):
    x,y = map(int,input().split())
    b.append([y,x])
b.sort()
ans = 'Yes'
t = 0
for i in range(n):
    t += b[i][1]
    if t>b[i][0]:
        ans='No'
print(ans)


Measured memory_bytes: 35608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
const long double PI = (acos(-1));
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
int ctoi(char c)
{
    switch (c)
    {
    case '0':
        return 0;
    case '1':
        return 1;
    case '2':
        return 2;
    case '3':
        return 3;
    case '4':
        return 4;
    case '5':
        return 5;
    case '6':
        return 6;
    case '7':
        return 7;
    case '8':
        return 8;
    case '9':
        return 9;
    default:
        return 0;
    }
}
int main()
{
    int n, d, x;
    cin >> n >> d >> x;
    vector<int> A(n);
    int sum = x;
    rep(i, n)
    {
        int a;
        cin >> a;
        for (int j = 1; j <= d; j+=a)
        {
            sum++;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int R=1,C=1,H[2000010]={0};
int N[2000010]={2100000000};
//ヒープに入れる
void hin(int a){
  int i=C++;
  for(N[R]=a;a>N[H[i/2]];i/=2)H[i]=H[i/2];
  H[i]=R++;
}
//ヒープから最小値を取り出す
int hout(){
  int rt=H[1],nt=1,i=0,k=H[--C];
  while(nt-i){
    H[i=nt]=k;
    if(i*2  <C&&N[  k  ]<N[H[i*2  ]])H[i]=H[nt=i*2  ];
    if(i*2+1<C&&N[H[nt]]<N[H[i*2+1]])H[i]=H[nt=i*2+1];
  }
  return rt;
}
void prih(){
  int i,j=0;
  for(i=0;i<C;i++){
    if(i==1<<j){
      printf("\n");
      j++;
    }
    printf("%d ",N[H[i]]);
  }
  printf("\n");
}
int main(){
  int a;
  char s[1000];
  while(scanf("%s",s),s[2]-'d'){
    if(s[0]=='i'){
      scanf("%d",&a);
      hin(a);
    }
    else printf("%d\n",N[hout()]);
    //prih();printf("\n");
  }    
  return 0;
}



Measured memory_bytes: 11564
#include<algorithm>
#include<bitset>
#include<iostream>
#include<iomanip>
#include<set>
#include<string>
#include<math.h>
#include<string>
#include<queue>
#include<vector>
using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;

//--------------
//#define DEBUG
//--------------

#ifdef DEBUG
	#define debugprint(x) cout<<x<<" "
	#define debugendl cout<<endl
	#define debug(x) x
#else
	#define debugprint(x)
	#define debugendl
	#define debug(x)
#endif

class zahyo{
	public:
	int x;
	int y;
	zahyo(){
		x=0;
		y=0;
	}
	zahyo(int x_,int y_){
		x=x_;
		y=y_;
	}
	void print(){
		cout<<x<<" "<<y;
	}
	zahyo operator+(zahyo add){
		add.x=this->x+add.x;
		add.y=this->y+add.y;
		return add;
	}
	zahyo operator-(zahyo add){
		add.x=this->x-add.x;
		add.y=this->y-add.y;
		return add;
	}
	zahyo operator*(int t){
		zahyo temp;
		temp.x=this->x*t;
		temp.y=this->y*t;
		return temp;
	}
	zahyo operator%(int t){
		zahyo temp(this->x%t,this->y%t);
		return temp;
	}
	zahyo operator/(int t){
		zahyo temp(this->x/t,this->y/t);
		return temp;
	}
	bool operator==(const zahyo add) const{
		if(add.x==this->x and add.y==this->y){return true;}
		else{return false;}
	}
	bool operator!=(const zahyo add) const{
		if(add.x==this->x or add.y==this->y){return false;}
		else{return true;}
	}
	bool operator<(const zahyo add) const{
		if(this->x<add.x){return true;}
		else if(this->x==add.x and this->y<add.y){return true;}
		else{return false;}
	}
	bool operator>(const zahyo add) const{
		if(this->x>add.x){return true;}
		else if(this->x==add.x and this->y>add.y){return true;}
		else{return false;}
	}
	void input(){
		cin>>x>>y;
	}
};

zahyo ways[4];

bool IsInBoard(int x,int maxx, int y,int maxy){
	if(x>=0 and x<maxx and y>=0 and y<maxy){
		return true;
	}
	else{
		return false;
	}
}

int main(){
	int n,w;
	int shina[100][2];
	int dp[10001]={};
	cin>>n>>w;
	for(int i=0;i<n;i++){
		cin>>shina[i][0]>>shina[i][1];
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<=w;j++){
			if(j>=shina[i][1]){
				dp[j]=max(dp[j],dp[j-shina[i][1]]+shina[i][0]);
			}
		}
	}
	int ans=0;
	for(int i=0;i<w+1;i++){
		ans=max(ans,dp[i]);
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 3152
import java.util.Scanner;

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

		int n = sc.nextInt();
		int[] c = new int[n - 1];
		int[] s = new int[n - 1];
		int[] f = new int[n - 1];

		for (int i = 0; i < n - 1; i++) {
			c[i] = sc.nextInt();
			s[i] = sc.nextInt();
			f[i] = sc.nextInt();
		}

		for (int i = 0; i < n; i++) {
			int t = 0;
			for (int j = i; j < n - 1; j++) {
				while (t < s[j] || t % f[j] != 0) {
					t++;
				}
				t += c[j];
			}
			System.out.println(t);
		}
		sc.close();
	}

}


Measured memory_bytes: 25704
N, K = map(int, input().split())
mod = int(1e9) + 7
X = [0 for _ in range(K)]
def doubling(n, m):
  y = 1
  base = n
  while m != 0:
    if m % 2 == 1:
      y *= base
      y %= mod
    base *= base
    base %= mod
    m //= 2
  return y
SS = 0
for i in range(K, 0, -1):
  d = K // i
  S = doubling(d, N)
  if d > 1:
    for j in range(2, d+1):
      S -= X[j*i-1]
      S %= mod
  X[i-1] = S
  SS += i * S
  SS %= mod
print(SS)

Measured memory_bytes: 11408
n, a, b, c = map(int, input().split())
l = []
for i in range(0, n):
    l.append(int(input()))

def find(idx, a1, b1, c1):
    if idx == n:
        if min(a1, b1, c1) == 0:
            return 100000000
        return abs(a - a1) + abs(b - b1) + abs(c - c1) - 30
    r0 = find(idx + 1, a1, b1, c1)
    r1 = find(idx + 1, a1 + l[idx], b1, c1) + 10
    r2 = find(idx + 1, a1, b1 + l[idx], c1) + 10
    r3 = find(idx + 1, a1, b1, c1 + l[idx]) + 10
    return min(r0, r1, r2, r3)

print(find(0, 0, 0, 0))

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

int main() {
    string str;
    cin >> str;
    int zero = 0, one = 0;
    for (int i = 0; i < str.length(); i++) {
        if (str[i] == '0')++zero;
        else ++one;
    }
    cout << min(zero, one) * 2 << endl;
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin >> n;
	int m = n % 10;
	if (m == 2 || m == 4 || m == 5 || m == 7 || m == 9) {
		cout  << "hon" << endl;
	} else if (m == 0 || m == 1 || m == 6 || m == 8) {
		cout  << "pon" << endl;
	} else {
		cout  << "bon" << endl;
	}
}

Measured memory_bytes: 3648
#include <algorithm>
#include <iostream>
#include <vector>

unsigned int partition(std::vector<int>& A, int p, int r)
{
	int x = A[r];
	unsigned int i = p - 1;
	for(int j = p; j < r; j++){
		if(A[j] <= x){
			i++;
			std::swap(A[i], A[j]);
		}
	}
	std::swap(A[i+1], A[r]);
	return i + 1;
}

void Output(std::vector<int>& A, unsigned int q)
{
	for(unsigned int i=0; i < A.size(); i++){
		if(i == q){
			std::cout << "[" << A[i] << "]";
		}else{
			std::cout << A[i];
		}
		if(i < A.size()-1){
			std::cout << " ";
		}else{
			std::cout << std::endl;
		}
	}
}

int main()
{
	int n;
	std::cin >> n;
	std::vector<int> A(n);
	for(int i=0; i<n; i++){
		std::cin >> A[i];
	}
	Output(A, partition(A, 0, n - 1));
	return 0;
}

Measured memory_bytes: 3096
import math

len_a, len_b, deg_C = map(int,input().split(" "))
rad_C = math.radians(deg_C)

#area
S = (1/2) * len_a * len_b * math.sin(rad_C)
#Length
L = len_a + len_b + math.sqrt(len_a ** 2 + len_b ** 2 - 2 * len_a * len_b * math.cos(rad_C))
#height
h = len_b * math.sin(rad_C)

print("{:.5f}\n{:.5f}\n{:.5f}".format(S,L,h))

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

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

  for (int i = 0; i <= k; i++) {
    for ( int j = 0; j <= (k-i); j++)
    if (a < pow(2,i) * b && pow(2,i) * b < pow(2,j) * c) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;

}

Measured memory_bytes: 4084
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
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; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int dp[1010][1010];
int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];

int main() {
	ll n, ans = 0;
	cin >> n;
	vector <ll>a(n + 1), b(n);
	rep(i, n + 1) {
		cin >> a[i];
	}
	rep(i, n) {
		cin >> b[i];
	}
	rep(i, n) {
		if (b[i] - a[i] <= 0) {
			ans += b[i];
		}
		else {
			ll zero = 0;
			ans += a[i] + min(a[i + 1], b[i] - a[i]);
			a[i + 1] = max(a[i + 1] + a[i] - b[i], zero);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
s=input().split();
x=int(s[0])
y=int(s[1])
list1=[2]
list2=[4,6,9,11]
list3=[1,3,5,7,8,10,12]
ans=0;
if((x in list1) and (y in list1)): ans=1
elif((x in list2) and (y in list2)):ans=1
elif((x in list3) and (y in list3)):ans=1
if(ans==1):print("Yes")
else:print("No")
    



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
constexpr ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N)cin >> A[i];
    vector<ll> B(100000);
    REP(i,N)B[A[i]]++;
    ll ans = 0;
    REP(i,99998){
        chmax(ans,B[i] + B[i+1] + B[i+2]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 4704
#!/usr/bin/env python3
import sys


def solve(X: int, Y: int):
    return 'Alice' if abs(X-Y) > 1 else 'Brown'


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    print(solve(X, Y))

if __name__ == '__main__':
    main()


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

# define REP(i,n) for (int i=0;i<(n);++i)
# define PER(i,n) for (int i=(N-1);i>=0;--i)
# define rep(i,a,b) for(int i=a;i<(b);++i)
# define p(s) std::cout << s ;
# define pl(s)  std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define yes(j) std::cout << (j ? "yes" : "no") << endl;
# define all(v) v.begin(),v.end()
# define showVector(v) REP(i,v.size()){p(v[i]);p(" ")} pl("")
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;}
typedef long long int ll;
typedef pair<ll,ll> P_ii;
typedef pair<double,double> P_dd;

template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}

template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<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);
}


const int MOD = 1000000007;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;

void addM(long long &a, long long b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

void mulM(long long &a, long long b) {
    a = ((a%MOD)*(b%MOD))%MOD ;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

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

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

vector<int> g[200005];
vector<ll> val(200005, 0);
vector<ll> ans(200005, 0);

void dfs(int v, int p){
    ans[v] = val[v] + (p != -1 ? ans[p] : 0);
    for(auto&& s : g[v]) {
        if(s == p) continue;
        dfs(s, v);
    }
}

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

    cout << N * (N-1) / 2 << endl;

    return 0;
}

Measured memory_bytes: 9472
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>

typedef long long ll;

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	int n;
	while (cin>>n){
		int t = (1+n)*n/2;
		cout<<t<<endl;
	}
	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define sb __builtin_popcount
#define MOD (ll)1000000007

long long values[600000];

int32_t main()
{
    long long ans = 0, tmp = 0;

    string s;
    cin >> s;
    int n = s.size() + 1;
    vector<int> rate;
    rate.push_back(0);
    for (int i = 1; i < n; i++)
    {
        if (s[i - 1] == '<')
        {
            rate.push_back(rate[i - 1] + 1);
        }
        else
        {
            rate.push_back(rate[i - 1] - 1);
        }
    }
    values[0] = 1;
    // case 1
    for (int i = 1; i < n; i++)
    { // scan input array from left to right

        if (rate[i] > rate[i - 1])
        {

            values[i] = values[i - 1] + 1; // case 1, a
        }
        else
            values[i] = 1; // case 1,b
    }

    ans = values[n - 1]; // case 2

    for (int i = n - 2; i >= 0; i--)
    { // scan input array from right to left

        if (rate[i] > rate[i + 1])
        {

            tmp = values[i + 1] + 1; // case 2, a
        }
        else
            tmp = 1; // case 2, b

        ans += max(tmp, values[i]); // maximum of the two values for child (i)
        values[i] = tmp;
    }

    cout << ans - n;

    return 0;
}

Measured memory_bytes: 9076
use std::io::stdin;
use std::str::FromStr;


// fn read_non_str<T: FromStr>() -> T {
//     let mut s = String::new();
//     // stdin $B4X?t(B -> Stdin $B9=B$BN(B -> readline $B4X?t(B
//     // .ok() $B$O(B Result enum $B$N4X?t$G!"(BReslt -> Option $B$K$9$k(B
//     stdin().read_line(&mut s).ok();
//     s.trim().parse().ok().unwrap()
// }


fn read_vec<T: FromStr>() -> Vec<T> {
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


fn main() {
    let input: Vec<i32> = read_vec();
    let dot = input[0] * input[1];

    if dot % 2 == 0 {
        println!("Even");
    } else {
        println!("Odd");
    }
}


Measured memory_bytes: 4352
L, R = gets.chomp.split.map(&:to_i)
(puts 0; exit) if R - L >= 2019 - L % 2019

min = 2018
L.upto(R - 1) do |i|
  (i + 1).upto(R) do |j|
    min = [i * j % 2019, min].min
    (puts 0; exit) if min == 0
  end
end
puts min


Measured memory_bytes: 1788
def main():
    
    n = int(input())

    n_list = []
    for i in range(n):
        a_list = []
        a = int(input())
        for j in range(a):
            x,y = map(int, input().split())
            x -= 1
            a_list.append([x,y])
        if a == 0:
            a_list.append([0])
        n_list.append(a_list)

    #print(n_list)
    ans = [0]
    for j in range(0,2**n):
        tmp = bin(j)
        tmp = str(int(tmp[2:])).zfill(n)
        #print('tmp')
        #print(tmp)
        
        
        break_on = 0
        for k in range(n):
            if tmp[k] == '1':
                #print(n_list[k])
                if n_list[k][0] != [0]:
                    for h in n_list[k]:
                        #print('########')
                        #print(k)
                        #print(h[1])
                        #print(tmp[h[0]])
                        if h[1] != int(tmp[h[0]]):
                            break_on = 1
                            break
                    if break_on == 1:
                        break
            if break_on == 1:
                break
            
            if tmp[k] == '0':
                continue
        
        if break_on == 0:
            #print('tmp.count()')
            #print(tmp.count('1'))
            ans.append(tmp.count('1'))
    
    #print(ans)
    print(max(ans))
    


            



if __name__ == '__main__':
    main()



Measured memory_bytes: 3444
/* ***********************************************
Author        :taciturnity
Created Time  :2020/2/19 15:22:48
File Name     :TEST.cpp
************************************************ */

#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define ll long long
#define INF 0x3f3f3f3f
#define bug puts("--------------")
const int N = 1e5 + 10;
using namespace std;
int dp[120][120];
int a[120];	
int k;
int dfs(int pos,int sta,int lead,int limit){
	if(pos == -1) return sta == k;
	if(!lead&&!limit&&dp[pos][sta]!=-1) return dp[pos][sta];
	int up = limit?a[pos]:9;
	int tmp = 0;
	for(int i = 0;i <= up;++i){
		if(lead&&i == 0) tmp += dfs(pos - 1,sta,lead,limit&&i == a[pos]);
		else tmp += dfs(pos-1,sta + (i == 0?0:1),lead&&i == 0,limit&&i == a[pos]);
	}
	if(!limit&&!lead) dp[pos][sta] = tmp;
	return tmp;
}
int main(){
	string s;
	cin >> s;

	cin >> k;
	int l = s.size();
	int pos = 0;
	memset(dp,-1,sizeof dp);
	for(int i = l-1;i >= 0;-- i){
		a[pos++] = s[i] - '0';
	}
	cout <<	dfs(pos-1,0,1,1);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Bye return 0
#define ll long long

using namespace std;

void solve(){
    int n; cin>>n;
    set<string> item;
    while(n--){
        string str; cin>>str;
        item.insert(str);
    }
    cout<<item.size()<<endl;
}

int main(){
    solve();
    Bye;
}

Measured memory_bytes: 19100
#中心を通る時面積は二等分される
#つまり大きくない方の面積の最大値はw*h/2
#x、yが中心の時面積を2等分する直線は無限に引くことができる
#中心でない時、中心との結ぶ線は1本しか弾けない

w,h,x,y=list(map(int,input().split()))
if 2*x==w and 2*y==h:
  print(w*h/2,1)
else:
  print(w*h/2,0)

Measured memory_bytes: 9096