akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
#include <math.h>
#include <map>
#include <numeric>
#include <stack>
#include <queue>
#include <functional>
#include <stdio.h>
#define ll long long
#define pl pair<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll> >
#define vvvl vector<vector<vector<ll> > >
#define vd vector<double>
#define vvd vector<vector<double> >
#define vvvd vector<vector<vector<double> > >
#define vb vector<bool>
#define vvb vector<vector<bool> >
#define vvvb vector<vector<vector<bool> > >
#define rep(i,a) for(ll i = 0;i<a;++i)
#define rep1(i,a) for(ll i = 1;i<a;++i)
#define rrep(i,a) for(ll i = a;i>=0;--i)
#define mod 1000000007
#define inf 10010010010
using namespace std;

//O(logB)
ll mpow(ll a, ll b, ll m){
	if (!b) return 1 % m;
	if (b == 1) return a % m;
	if (b % 2) return (a*mpow(a, b - 1, m)) % m;
	else return mpow((a*a) % m, b / 2, m) % m;
}

int main(){
	ll n, p; cin >> n >> p;
	string s; cin >> s;
	vl c(n);
	c[n - 1] = (s[n - 1]-'0')%p;
	rrep(i, n-2) c[i] = (c[i + 1] + (s[i] - '0')*mpow(10, n - 1 - i, p)) % p;
	if (p == 2 || p == 5){
		ll ans = 0;
		rrep(i, n - 1) if ((s[i]-'0') % p == 0) ans += (i + 1);
		cout << ans << endl;
		return 0;
	}
	map<ll, ll> ngo;
	ll ans = 0;
	rrep(i, n - 1){
		if (c[i] % p == 0) ans++;
		ans += ngo[c[i]%p];
		ngo[c[i] % p]++;
	}
	cout <<ans<< endl;
	return 0;
}

Measured memory_bytes: 2564
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 2e5 + 10;
int N;
LL A[MAX], B[MAX];

int main(void) {
    scanf("%d", &N);
    REP(i, N) scanf("%lld", A + i);
    REP(i, N) scanf("%lld", B + i);

    auto comp = [&](const int l_idx, const int r_idx) {
        return B[l_idx] < B[r_idx];
    };
    priority_queue<int, VI, decltype(comp)> pq(comp);
    REP(i, N) {
        if (A[i] < B[i]) pq.emplace(i);
        else if (A[i] > B[i]) {
            cout << -1 << endl;
            return 0;
        }
    }

    LL cnt = 0;
    while (!pq.empty()) {
        const auto cur_idx = pq.top();
        pq.pop();

        const int pre_idx = (cur_idx - 1 + N) % N;
        const int nxt_idx = (cur_idx + 1) % N;

        const LL cur_minus = B[pre_idx] + B[nxt_idx];

        const LL times = (B[cur_idx] - A[cur_idx]) / cur_minus;

        const LL minus = cur_minus * times;

        const LL val = B[cur_idx] - minus;
        if (times == 0 || val < A[cur_idx]) {
            cout << -1 << endl;
            return 0;
        }
        B[cur_idx] = val;
        if (A[cur_idx] != B[cur_idx]) {
            pq.emplace(cur_idx);
        }

        cnt += times;
    }

    cout << cnt << endl;
}


Measured memory_bytes: 4472
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=2e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

int read(){
    int xx=0,ff=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')ff=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){xx=(xx<<3)+(xx<<1)+ch-'0';ch=getchar();}
    return xx*ff;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
	fastio;

	int n; cin>>n;
	ll d; cin>>d;
	ll x[n], y[n];
	ll ans = 0;
	forn(i,n){
		cin>>x[i]>>y[i];
		if(x[i]*x[i] + y[i]*y[i] <= d*d) ans++;
	}
	cout<<ans<<ln;

	return 0;
}

Measured memory_bytes: 6784
n=int(input())
R=[]
c=0
mc=0
ans="No"
for i in range(n) :
    a,b = map(int,input().split())
    if a==b :
        c+=1
    else:
        c=0
    mc=max(c,mc)
if mc>=3 :
    ans="Yes"
print(ans)

Measured memory_bytes: 9140
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.StringTokenizer;

class Main{

  public static void main(String[] args){

    BufferedReader bfr=new BufferedReader(new InputStreamReader(System.in));
    String str="";
    StringTokenizer stk;
    int tei,takasa;

    try{

    	while(true) {
    		str=bfr.readLine();
    	      if(str=="") {
    	        System.exit(0);
    	      }
    	      tei=Integer.parseInt(str);

    	      str=bfr.readLine();
    	      if(str=="") {
    	        System.exit(0);
    	      }
    	      takasa=Integer.parseInt(str);

    	      if(tei==0 && takasa==0) {
    	    	  System.exit(0);
    	      }
    	      else {
    	    	  System.out.println(BigDecimal.valueOf(((double) tei)*((double) tei)+((double)tei)*Math.sqrt(((double)tei*tei/4)+((double)takasa*takasa))*2).toPlainString());
    	      }
    	}

    } catch (IOException e) {
      System.exit(0);
    }
    catch(NumberFormatException e) {
      System.exit(0);
    }

    catch(NullPointerException e) {
      System.exit(0);
    }
  }
}




Measured memory_bytes: 24208
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

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

const int inf = 3e18;

int d1[305][305];
int d2[305][305];
int N, M, L;

signed main()
{
	ios::sync_with_stdio(false);

	cin >> N >> M >> L;

	rep(i, N) rep(j, N) {
		d1[i][j] = inf;
		d2[i][j] = inf;
	}

	rep(i, N) d1[i][i] = d2[i][i] = 0;

	rep(_, M) {
		int a, b, c; cin >> a >> b >> c;
		--a, --b;
		d1[a][b] = d1[b][a] = c;
	}

	rep(k, N) rep(i, N) rep(j, N) {
		d1[i][j] = min(d1[i][j], d1[i][k] + d1[k][j]);
	}

	rep(i, N) rep(j, N) {
		if (i != j and d1[i][j] <= L) {
			d2[i][j] = 1;
		}
	}

	rep(k, N) rep(i, N) rep(j, N) {
		d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
	}

	int q; cin >> q;

	rep(_, q) {
		int s, t; cin >> s >> t;
		--s, --t;
		cout << (d2[s][t] == inf ? -1 : d2[s][t] - 1) << endl;
	}
}


Measured memory_bytes: 1920
from sys import stdin


def get_result(data):
    N = data[0]
    for a in range(-1000, 1000):
        for b in range(-1000, 1000):
            if (a**5 - b**5) == N:
                return '{} {}'.format(a, b)


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)


Measured memory_bytes: 9072
#include <stdio.h>

int i,j,k,H,W;

void Drawline_0(int W)
{
	for(j=0;j<W;j++){
		if(j%2 == 0){
			printf("#");
		}else{
			printf(".");
		}
	}
	printf("\n");
}

void Drawline_1(int W)
{
	for(j=0;j<W;j++){
		if(j%2 == 1){
			printf("#");
		}else{
			printf(".");
		}
	}
	printf("\n");
}

int main()
{
	for(k=0;;k++){
		scanf("%d %d\n",&H,&W);
			if(H == 0 && W == 0){
				break;
			}

		for(i=0;i<H;i++){
			if(i%2 == 0){
				Drawline_0(W);
			}else{
				Drawline_1(W);
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 576
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String n = sc.nextLine();
        
        int result = n.indexOf("7");
        
        if(result != -1)
        {
            System.out.println("Yes");
        }
        else
        {
            System.out.println("No");
        }
        
    }
}


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

int main() {
  string A,B;
  cin>>A>>B;
  
  int ans = 0;
  
  for(int i=0; i<A.size();i++){    
   
  if(A.at(i)!=B.at(i)){
    
    ans++;
    
  }
  }
  cout<<ans<<endl;
  
}

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

using namespace std;
#define ll long long
#define ld long double
#define rep(i,h) for(int i = 0; i < h; ++i)
#define rep1(i,h) for(int i = 0; i <= h; ++i)
#define rep2(i,k,h) for(int i = k; i < h; ++i)
#define rep3(i,k,h) for(int i = k; i <= h; ++i)
#define INF LLong_MAX // long long INF
#define inf INT_MAX // int inf

typedef pair<int,int> int_pair;
typedef pair<string,string> string_pair;


int main() {
    int n,y;
    cin >> n >> y;
    if(n == y) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
      string s;
      cin>>s;
      for(int i=0;i<s.length();i++)
      {
        if(i%2!=0 && (s[i]!='L' && s[i]!='D' && s[i]!='U'))
         {cout<<"No";return 0;}
        if(i%2==0 && (s[i]!='R' && s[i]!='D' && s[i]!='U'))
         {cout<<"No";return 0;}
      }
      cout<<"Yes";
      return 0;
    }

Measured memory_bytes: 256
inList = []
startCnt = int(input())
goalCnt = 0
minLst = 1000000000000000
for i in range(5):
    A = int(input())
    inList.append(A)
    minLst = min(minLst, A)
ans = (-(-startCnt // minLst)) + 4
print(ans)

Measured memory_bytes: 3060
import sys
sys.setrecursionlimit(10**9)
mod = 998244353
N, S = list(map(int, input().split()))
A = list(map(int, input().split()))

ans = 0
num = [0] * 6020
for i in range(N):
    for j in range(3010, 0, -1):
        num[A[i]+j] += num[j]
        num[A[i]+j] %= mod
    num[A[i]] += i+1
    num[A[i]] %= mod
    ans += num[S] * (N - i)
    ans %= mod
    num[S] = 0
print(ans)


Measured memory_bytes: 42732
#include<cstdio>
#include<vector>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<map>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=1e5+5;
const int MOD=1e9+7;
const double EPS=1e-12;
template <class T>
bool sf(T &ret){ //Faster Input
    char c; int sgn; T bit=0.1;
    if(c=getchar(),c==EOF) return 0;
    while(c!='-'&&c!='.'&&(c<'0'||c>'9')) c=getchar();
    sgn=(c=='-')?-1:1;
    ret=(c=='-')?0:(c-'0');
    while(c=getchar(),c>='0'&&c<='9') ret=ret*10+(c-'0');
    if(c==' '||c=='\n'){ ret*=sgn; return 1; }
    while(c=getchar(),c>='0'&&c<='9') ret+=(c-'0')*bit,bit/=10;
    ret*=sgn;
    return 1;
}
int sign(double x){
    return fabs(x) < EPS ? 0 : x>0 ? 1 : -1 ;
}
map<ll,ll> mp;
int main(void){
    ll n,k;
    sf(n);sf(k);
    for(int i=1;i<=n;i++)   mp[i%k]++;
    ll ans=mp[0]*mp[0]*mp[0];
    if(k%2==1){

    }
    else{
        int t=k/2;
        ans+=mp[t]*mp[t]*mp[t];
    }
    cout <<ans <<endl;

    return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
const string ptn[4] = {"dream", "dreamer", "erase", "eraser"};
const int pn[4] = {5, 7, 5, 6};

int main(){
	string s;
	cin >> s;
	while((int)s.length() != 0){
		bool erased = false;
		for(int i=0; i<4; i++){
			if(s.length() >= pn[i] && s.substr(s.length()-pn[i], pn[i]) == ptn[i]){
				s.erase(s.end()-pn[i], s.end());
				erased = true;
			}
		}
		if(!erased) break;
	}
	
	if((int)s.length() == 0){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back

signed main()
{
  int n,s=0,i;
 cin>>n;
  int a[n];
  unordered_map<int,int>m;
  for(i=0;i<n;i++)
  {
      cin>>a[i];
      m[a[i]]++;
  }
   for(auto it=m.begin();it!=m.end();it++)
      {
          int p=it->second;
        s+=p*(p-1)/2;
          
      }
 
   
  for(i=0;i<n;i++)
  {

      
    int p=m[a[i]];
    
    cout<<s-p*(p-1)/2+(p-1)*(p-2)/2<<endl;
       
  }
 
   
}

Measured memory_bytes: 9160
#include <iostream>
#include <string>
#include <vector>
using namespace std;

void sortString(string* s, int j, int L)
{
    string s1 = s[j];
    string s2 = s[j+1];
    for(int k = 0; k < L; k++)
    {
        if(s1[k] > s2[k])
        {
            //cout << " s1: " << s1[k] << " s2: " << s2[k] << " ";
            s[j] = s2;
            s[j+1] = s1;
            break;
        }
        else if(s1[k] < s2[k])
        {
            break;
        }
    }
}

int main()
{
    int N, L;
    cin >> N >> L;
    string s[N];
    for(int i = 0; i < N; i++)
    {
        cin >> s[i];
    }

    for(int i = 0; i < N; i++)
    {
        for(int j = 0; j < N-1; j++)
        {
            sortString(s, j, L);
            //cout << " i:" << i << " j:" << j << " ";
            //for(int t = 0; t < N; t++) cout << s[t];
        }
    }

    string result = "";
    for(int i = 0; i < N; i++)
    {
        result += s[i];
    }

    cout << result;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define in insert
#define sz(x) ((in)(x).size())
using namespace std;
const int N = 1e5 + 123;


void read_file()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
}

void solve()
{
    string a,b;
    cin >> a >> b;
    int ans = 0;
    for (int i = 0; i < 3; i++) if (a[i] == b[i]) ans++;
    cout << ans << endl;
}

int main()
{
    solve();
    //cerr << printf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
    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 num = sc.nextInt();
        int sum = 0;
        for(int i = 1;i <= num;i++){
            sum = sum + i;
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 20048
#![allow(unused_imports)]

mod pcl {

}

use std::fmt::Debug;
use std::str::FromStr;



fn read_vec<T: FromStr>(n: usize) -> Vec<T>
where
    T::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let v: Vec<_> = s
        .split_whitespace()
        .map(|x| x.parse::<T>().unwrap())
        .collect();
    debug_assert_eq!(v.len(), n);

    v
}

#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum Color {
    Red,
    Green,
    None,
}

fn main() {
    let (mut x, mut y, a, b, c) = {
        let v = read_vec::<i64>(5);
        (v[0], v[1], v[2], v[3], v[4])
    };
    let p = read_vec::<i64>(a as usize);
    let q = read_vec::<i64>(b as usize);
    let r = read_vec::<i64>(c as usize);

    let mut all: Vec<_> = p
        .into_iter()
        .map(|v| (v, Color::Red))
        .chain(q.into_iter().map(|v| (v, Color::Green)))
        .chain(r.into_iter().map(|v| (v, Color::None)))
        .collect();
    all.sort();
    all.reverse();

    let mut z = x + y;
    let mut res = 0;
    for (v, c) in all {
        if z == 0 {
            break;
        }

        match (c, x, y) {
            (Color::Red, 0, _) => continue,
            (Color::Red, _, _) => {
                res += v;
                x -= 1;
                z -= 1;
            }
            (Color::Green, _, 0) => continue,
            (Color::Green, _, _) => {
                res += v;
                y -= 1;
                z -= 1;
            }
            (Color::None, _, _) => {
                res += v;
                z -= 1;
            }
        }
    }

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


Measured memory_bytes: 18676
#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;

#define REP(i,n) for (int (i); i < (n); i++)

int main() {
	int n;
	bool f[4] = {};
	string s;
	cin >> n;
	REP(i, n) {
		cin >> s;
		if (s == "P") f[0] = true;
		if (s == "W") f[1] = true;
		if (s == "G") f[2] = true;
		if (s == "Y") f[3] = true;
	}
	REP(i, 4)if (f[i] == false) {
		puts("Three");
		return 0;
	}
	puts("Four");
}

Measured memory_bytes: 256
#Eans

import sys, math, itertools, collections, bisect
mans = float('inf')
mod = 10 **9 +7
ans = 0
count = 0
pro = 0

N, M = map(int, input().split())
A = sorted(map(int, input().split()))
B = [0] + A[:]
for i in range(N):
  B [i+1] += B[i]

#print('A', A)
#print('B', B)
def solve_binary(mid):
  tmp = 0
  for i, ai in enumerate(A):
    tmp += N - bisect.bisect_left(A, mid-ai)
    #bisect.bisect_left(A, mid-ai)はaiに固定した時の、もう片方の最小の値のインデックス
    #tmpは、aiに固定した時のありうる個数（M)
  return tmp >= M

def binary_search(N):
  ok = 0
  ng = N
  while abs(ok - ng ) > 1:
    mid = (ok + ng) // 2
    if solve_binary(mid):
      ok = mid
    else:
      ng = mid
  return ok


binresult = binary_search(2*10**5+1)
#Xを二分探索で得る
#binresult=ok
#print(binresult)
for i, ai in enumerate(A):
  ans += ai*(N - bisect.bisect_left(A, binresult-ai)) + B[N] - B[bisect.bisect_left(A, binresult-ai)]
  #print(ans, '=', ai, '*', N-bisect.bisect_left(A, binresult-ai), '+', B[N], '-', B[bisect.bisect_left(A, binresult-ai
  count += N - bisect.bisect_left(A, binresult-ai)
ans -= binresult * (count-M)
print(ans)

Measured memory_bytes: 14780
N, C, K = map(int, input().split())
T = sorted([int(input()) for _ in range(N)])

# パラメタの初期化
now = 0
now_f = 1
p = 0
cnt = 0

for t in T:
    # nowの更新
    if now_f == 1:
        now_f = 0
        now = t

    if t <= now + K:
        p += 1
        if p == C:
            p = 0
            cnt += 1
            now_f = 1

    else:
        p = 1
        cnt += 1
        now = t
        now_f = 0


if p == 0:
    print(cnt)
else:
    print(cnt + 1)


Measured memory_bytes: 14172
import java.util.*;

public class Main {
public static void main(String[] args) {
		
Scanner keyboard = new Scanner(System.in); 
		
int N= keyboard.nextInt();
int[] ans = new int[N+1]; 
		
for(int i = 1; i<N+1; i++){
    if(i%15 == 0){
    ans[i] ++;
    }
    if(i%5 == 0){
    ans[i] ++;
    }
    if(i%3 == 0){
    ans[i] ++;
    }
}
		
long sum = 0;

for(int j = 1; j<N+1; j++){
    if(ans[j] ==0){sum +=j;
    }
}

	System.out.println(sum);
	keyboard.close();	

	}
}


Measured memory_bytes: 39676
#include <stdio.h>
int	main(void)
{
	int n,min,max,i;
	long sum;
	int a[10000];
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	min=max=sum=a[0];
	for(i=1;i<n;i++){
		sum+=a[i];
		min=(a[i]<min ? min=a[i] : min);
		max=(a[i]>max ? max=a[i] : max);
	}
	printf("%d %d %ld\n",min,max,sum);
	return	0;
}

Measured memory_bytes: 640
a=int(input())
b=int(input())
c=int(input())
x=int(input())

count=0
for p in range(a+1):
    for q in range(b+1):
        for r in range(c+1):
            if 500*p+100*q+50*r==x:
                count+=1
            

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int N;
pair<iP, int>ha[200000];
ll bit[1 << 18 + 1], res;

ll get(int x) {
	ll a = 0;
	while (x) {
		a = max(a, bit[x]);
		x -= x&-x;
	}
	return a;
}

void add(int x, ll y) {
	while (x <= 1 << 18) {
		bit[x] = max(bit[x], y);
		x += x&-x;
	}
}

int main() {
	cin >> N;
	for (int i = 0; i != N; ++i)
		cin >> ha[i].first.first;
	for (int i = 0; i != N; ++i)
		cin >> ha[i].first.second;
	for (int i = 0; i != N; ++i)
		ha[i].second = i + 1;
	sort(ha, ha + N);
	for (int i = 0; i != N; ++i) {
		add(ha[i].second,get(ha[i].second) + ha[i].first.second);
	}
	cout << bit[1 << 18] << endl;
	return 0;
}

Measured memory_bytes: 6272
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define FD(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define pii pair<int,int>
#define reset(x,y) memset(x, y,sizeof(x))
#define MIN(x,y) if (x > (y)) x = (y)
#define MAX(x,y) if (x < (y)) x = (y)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define EL putchar('\n');
#define mod 1000000007
#define oo 1000006
int read()
{
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
    while (c >= '0' && c <= '9') {x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
void write(int x)
{
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
}
int h,w;
char s[1003][1003];
int f[1003][1003];
void ReadInPut()
{
    h=read();w=read();
    F(i,1,h)F(j,1,w)cin>>s[i][j];
}
void Solve()
{
    f[1][1]=1;
    F(i,1,h)F(j,1,w)
    {
        if(i==1&&j==1)continue;
        if(s[i][j]=='#')continue;
        if(i-1>0&&s[i-1][j]=='.')f[i][j]=(f[i][j]+f[i-1][j])%mod;
        if(j-1>0&&s[i][j-1]=='.')f[i][j]=(f[i][j]+f[i][j-1])%mod;
    }
    cout<<f[h][w];
}
main()
{
//    freopen("t.INP","r",stdin);
  //  freopen(".OUT","w",stdout);
    int sotest=1;
    //cin>>sotest;
    for(int i=1;i<=sotest;i++)
    {
        ReadInPut();
        Solve();
    }
}


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

int lastAtack(){
    return 1;
}

ll atack(ll h){
    if(h == 1) return lastAtack();
    else return 2 * atack(h/2) + 1;
}

int main(){
    ll h,ans;
    cin >> h;
    ans = atack(h);
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = [int(input()) for i in range(n)]
    #a = list(map(int, input().split()))
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    s = [int(i) for i in list(input())]
    k = int(input())
    if max(s[:k]) == 1:
        print(1)
    else:
        for i in s:
            if i > 1:
                print(i)
                return 0

if __name__ == '__main__':
    main()


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

int main(){
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    ll ans = (a%2)*b*1LL*c;
    ans = min(ans, (b%2)*a*1LL*c);
    ans = min(ans, (c%2)*a*1LL*b);
    printf("%lld\n", ans);
    return 0;
}


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

int main(){
    long int x, k, d;
    long int mini, a, b;
    cin >> x >> k >> d;
    if(x<0){
        x=-1*x;
    }
    mini = x%d;
    if(x+k*d >= 0){
        a = x+k*d;
    }else{
        a = -1*(x+k*d);
    }
    if(x-k*d >= 0){
        b = x-k*d;
    }else{
        b = -1*(x-k*d);
    }
    if((k-x/d)%2==0){
        if(x/d<k){
            cout << mini << endl;
        }else{
            cout << min(a, b) << endl;
        }
    }else{
       if(x/d<k){
            cout << -1*(mini-d) << endl;
        }else{
            cout << min(a, b) << endl;
        } 
    }
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n,m,z,ans=0;
	cin>>n>>m;
	for(int i=0;i<n;i++){int cnt=0;for(int j=0;j<m;j++){cin>>z;cnt+=z;}ans=max(ans,cnt);}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define int long long

using namespace std;
using LL = long long;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e19;
const int MOD = (int)1e9 + 7;

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

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

    sort(all(a));
    if(a[n-1] == 2){
        if(a[0] == a[n-1]){
            cout << "second" << endl;
        }else{
            cout << "first" << endl;
        }
        return 0;
    }

    if(a[n-1] == 1){
        cout << "first" << endl;
        return 0;
    }


    LL nim = 0;
    LL sum = 0;
    REP(i, n){
        if((a[i]) & 1){
            nim ^= n-i;
        }
    }

    if(nim != 0){
        cout << "first" << endl;
    }else{
        cout << "second" << endl;
    }
}

Measured memory_bytes: 1024
{-# LANGUAGE TypeApplications, TupleSections #-}

import Control.Monad
import Data.List

main = ((++) <$> (fmap (, 1) <$> ((readLn @ Int) >>= (flip replicateM) getLine)) <*> (fmap (, -1) <$> ((readLn @ Int) >>= (flip replicateM) getLine))) >>= (print . foldl max 0 . fmap (sum . fmap snd) . groupBy ((. fst) . (==) . fst) . sort)


Measured memory_bytes: 4132
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
int N;
int a;
 
multiset <int> q;
 
int main() {
  ios_base::sync_with_stdio(false);
  cin >> N;
  int ans = 0;
  for(int i = 0; i < N; i++) {
    cin >> a;
    if(q.size() == 0 || *q.begin() >= a) {
      ans++;
      q.insert(a);
    } else {
      q.erase(--q.lower_bound(a));
      q.insert(a);
    } 
  }
  cout << ans << endl;
}


Measured memory_bytes: 4992
#include<stdio.h>
 int main(){

   int i,j,n;
   scanf("%d", &n);

   for ( i = 1 ; i <= n ; i++ ){

     if ( i % 3 == 0 ){
       printf(" %d", i);
       continue;
     }
     j = i;
     
     while(1){
       if ( j % 10 == 3 ){
	 printf(" %d", i);
	 break;
       }
       j /= 10;
       if ( j == 0 ) break;
     }

   }

   printf("\n");
   
   return 0;

 }

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    ll n;
    double sum=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        double d;
        string s;
        cin>>d>>s;
        if(s=="JPY")
            sum+=d;
        else
        {
            sum+=(380000.0*d);
        }

    }
    cout<<fixed<<setprecision(8)<<sum<<endl;
}
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define v vector<ll> 
#define vv vector<v>
#define p pair<ll,ll>
#define arrayinput int n; int m; cin>>n>>m; v arr (n+1,-1); for (int i=0; i<n; i++){int temp; cin>>temp;arr[i]=temp;}
#define vp vector<pair<int,p> >
int LIM=2e5+10;
ll MOD=1e9+7;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
    cin>>a>>b;
    for (int i=0; i<=30; i++)
    {
        if (1+(a-1)*i>=b)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
var s:String;i,j:Longint;f:boolean;a:array[0..7]of char=('a','b','d','f','i','p','y','z');
begin
	readln(s);
	for j:=0 to 7 do begin
		f:=false;
		for i:=1 to length(s) do begin
			if s[i]=a[j] then begin
				f:=true;
				break;
			end;
		end;
		if not f then begin
			writeln(a[j]);
			exit;
		end;
	end;
	writeln('None');
end.


Measured memory_bytes: 256
N, Y = map(int, input().split())
for x in range(N+1):
  for y in range(N+1-x):
    z = N - x - y
    if z >= 0 and 10000*x + 5000*y + 1000*z == Y:
      print(str(x)+" "+str(y)+" "+str(z))
      exit()
print("-1 -1 -1")

Measured memory_bytes: 9092
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
 *
 * @author Kenji
 */
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);
        ABC092A solver = new ABC092A();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC092A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int A = in.nextInt();
            int B = in.nextInt();
            int C = in.nextInt();
            int D = in.nextInt();
            out.println(Math.min(A, B) + Math.min(C, D));
        }

    }
}



Measured memory_bytes: 23508
#include<bits/stdc++.h>
#define INF (1e10)
#define mp make_pair
#define pb push_back
#define A 0
#define B 1
#define C 2
using namespace std;
typedef long long int lo;
lo dp[10000005],arr[10000005],n;
lo f(lo i){
	if(i == n) return 0;
    if(i > n) return INF;
    if(dp[i] != -1) return dp[i];
    return dp[i] = min(f(i + 1) + abs(arr[i] - arr[i + 1]),f(i + 2) + abs(arr[i] - arr[i + 2]));
}
int main(){
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
	cin >> n;
    memset(dp,-1,sizeof dp);
	for(lo i=1;i<=n;i++){
		cin >> arr[i];
	}
	cout <<f(1);

}


Measured memory_bytes: 81024
#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
#define elif else if
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define vtr vector<string>
#define vvtr vector<vector<string>>
#define vhar vector<char>
#define mod 100000007
#define elif else if
#define str string

signed main(){
  int N,M,O,P=0,count=0,count2=0,crash=0,nowtab=1;
  double d;
  char C,c;
  str S,T;
  vint v(0);
  cin>>N>>M>>O;
  if(N<O){
    if(M>(O-N))M=M-(O-N);
    else M=0;
    N=0;
  }
  else N=N-O;
  cout<<N<<" "<<M<<endl;
}


Measured memory_bytes: 256
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce

n = int(input())
cnt = 0
ans = [0] * 5
for i in range(n):
    s = input()
    letters = ["M", "A", "R", "C", "H"]
    if s[0] in letters:
        ans[letters.index(s[0])] += 1
# print(ans)
cnt = 0
for i in ans:
    if i >= 1:
        cnt += 1
if cnt < 3:
    print(0)
else:
    ans2 = 1
    without0 = []
    for i in ans:
        if i > 0:
            without0.append(i)
            ans2 *= i
    # print(ans2)
    if cnt == 3:
        print(ans2)
    elif cnt == 4:
        ans3 = 0
        for i in without0:
            ans3 += ans2 // i
        print(ans3)
    else:
        ans4 = 0
        for i in range(len(without0) - 1):
            for j in range(i + 1, len(without0)):
                division = without0[i] * without0[j]
                ans4 += ans2 // division
        print(ans4)

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

public class Main {

	private static Scanner sc;

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
	}

	private void solve() {
        try {
        	long start = System.currentTimeMillis();
        	int N = sc.nextInt();
        	int M = sc.nextInt();
        	int[] array = new int[N];
        	int sum = 0;
        	int count = 0;
        	for(int i=0; i<N; i++) {
        		int num = sc.nextInt();
        		array[i] = num;
        		sum += num;

        	}
        	for(int i=0; i<N; i++) {
        		if(array[i]>= sum*1.0/(4*M)) {
        			count++;
        		}
        	}
        	if(count>=M) {
        		System.out.println("Yes");
        	}else {
        		System.out.println("No");
        	}


        } catch (Exception e) {
            e.printStackTrace();
        }
    }

	private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }

}


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

int main() {
  int N,M;
  cin >> N >> M;
  vector<int> a(50);
  vector<int> b(50);
  for(int i=0; i<M; i++){
    cin >> a.at(i) >> b.at(i);
  }
  
  for(int i=0; i<N; i++){
    int cnt = 0;
    for(int j=0; j<M; j++){
      if(a.at(j) == i+1)
      	cnt++;
      if(b.at(j) == i+1)
      	cnt++;
  	}
    cout << cnt << endl;
  }
}


Measured memory_bytes: 256
#pragma warning(disable:4996)
#include <bits/stdc++.h>
using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T &_t) { for (auto &_e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

int main(void) {
	int N;
	cin >> N;
	vec<int> v(N);
	vec<pair<int, int>> cntE(1'000'01), cntO(1'000'01);
	cin >> v;

	REP(i, 1'000'01) {
		cntE[i].first = 0;
		cntO[i].first = 0;
		cntE[i].second = i;
		cntO[i].second = i;
	}
	REP(i, N) {
		if (i & 1) {
			cntO[v[i]].first++;
		}
		else {
			cntE[v[i]].first++;
		}
	}
	sort(ALL(cntE), greater<>());
	sort(ALL(cntO), greater<>());

	int e1 = cntE[0].second;
	int e2 = cntE[1].second;
	int o1 = cntO[0].second;
	int o2 = cntO[1].second;

	if (e1 != o1) {
		int ans = 0;
		REP(i, N) {
			if (i & 1) {
				if (v[i] != o1)++ans;
			}
			else {
				if (v[i] != e1)++ans;
			}
		}
		cout << ans << endl;
		return 0;
	}
	else {
		int ans1 = 0;
		REP(i, N) {
			if (i & 1) {
				if (v[i] != o2)++ans1;
			}
			else {
				if (v[i] != e1)++ans1;
			}
		}
		int ans2 = 0;
		REP(i, N) {
			if (i & 1) {
				if (v[i] != o1)++ans2;
			}
			else {
				if (v[i] != e2)++ans2;
			}
		}
		cout << min(ans1, ans2) << endl;
		return 0;
	}
	return 0;
}

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

int main(){
	int N,T,A;
	cin>>N>>T>>A;
	
	int H[N];
	for(int i=0;i<N;i++)
		cin>>H[i];
	
	double t[N];
	for(int i=0;i<N;i++)
		t[i]=T-H[i]*0.006;
	
	int ans=1;
	double sa[N];
	
	for(int i=0;i<N;i++){
			sa[i]=t[i]-A;
	}
	
	for(int i=0;i<N;i++){
		if(sa[i]<0)
			sa[i]=-sa[i];
	}
	
	double min=sa[0];
	for(int i=1;i<N;i++){
		if(sa[i]<min){
			min=sa[i];
			ans=i+1;
		}
	}
	
	cout<<ans<<endl;
	return 0;
	
}

Measured memory_bytes: 256
object Main extends App{
  import scala.io.StdIn.readLine
  
  val n = readLine.split(" ").map(_.toInt)
  val x1 = n(0)
  val y1 = n(1)
  val x2 = n(2)
  val y2 = n(3)
  val sidex = n(2) - n(0)
  val sidey = n(3) - n(1)
  
  println((x2 - sidey).toString)
  println((y2 + sidex).toString)
  println((x1 - sidey).toString)
  println((y1 + sidex).toString)

}


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

int main() {
  int N, ans; cin >> N;
  long long a;
  for (int i = 0; i<N; i++) {cin >> a; ans+=a%2;}
  if(ans%2==0) cout << "YES" << "\n";
  else cout << "NO" << "\n";
}
    
  
  

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


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string str;
    cin>>str;
    if(str=="ABC")
        cout<<"ARC"<<"\n";
    else
        cout<<"ABC"<<"\n";

}  

Measured memory_bytes: 3608
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include <ctime>
#include<list>
#include <numeric>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(int i = 0; i < n; i++)
#define FORAB(i, a, b) for(int i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))
#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int128 LLL;
typedef long long LLL;

typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII > VP;
typedef vector<PLL > VPL;
typedef vector<double> VD;
typedef long double ld;

char S[200005];
char t[200005][2], d[200005][2];
queue<int> Q[26][2]; // L = 0, R = 1;
int mark[200005];
int n, q;

int Side(int at) {
	for (int i = 1; i <= q; i++) {
		if (at < 0) return -1;
		if (at >= n) return 1;
		if (S[at] == t[i][0]) {
			if (d[i][0] == 'R') at++;
			else at--;
		}
	}
	if (at < 0) return -1;
	if (at >= n) return 1;
	return 0;
}

int SideLeft() {
	int lo = -1, hi = n - 1;
	while (lo < hi) {
		int mid = (lo + hi + 1) / 2;
		if (Side(mid) == -1) {
			lo = mid;
		}
		else {
			hi = mid - 1;
		}
	}
	return lo;
}

int SideRight() {
	int lo = 0, hi = n;
	while (lo < hi) {
		int mid = (lo + hi) / 2;
		if (Side(mid) == 1) {
			hi = mid;
		}
		else {
			lo = mid + 1;
		}
	}
	return hi;
}

void solve(int ks) {
	scanf("%d %d", &n, &q);
	scanf("%s", S);
	for (int i = 1; i <= q; i++) {
		scanf("%s %s", t[i], d[i]);
	}

	if (Side(0) == 1 || Side(n - 1) == -1) {
		printf("%d\n", 0);
	}
	else {
		int left = SideLeft();
		int right = SideRight();
		printf("%d\n", right - left - 1);
	}
}

int main()
{
#ifdef LOCAL
	double start_time = clock();
	//freopen("C:\\Home\\ContestCodes\\sample.in", "r", stdin);
	//	freopen("out.out", "w", stdout);
#endif


	if (0) {
		int T = 1000;
		scanf("%d", &T);
		for (int ks = 1; ks <= T; ks++) solve(ks);
	}
	else {
		solve(0);
	}

#ifdef LOCAL
	double end_time = clock();
	fprintf(stderr, "Time = %lf\n", (end_time - start_time) / CLOCKS_PER_SEC);
#endif

	return 0;
}


Measured memory_bytes: 1280
// ABC140C.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <vector>
using namespace std;


int main()
{
	int max = 1000000;
	int N;
	cin >> N;
	vector<int>A(N,max);
	vector<int>B(N);
	for (int i = 0; i < N-1; i++)
	{
		cin >> B.at(i);
		if (A.at(i)>B.at(i))
		{
			A.at(i) = B.at(i);
		}
		A.at(i + 1) = B.at(i);
	}
	int ans = 0;
	for (int x : A) {
		ans += x;
	}
	cout << ans << endl;

}

// プログラムの実行: Ctrl + F5 または [デバッグ] > [デバッグなしで開始] メニュー
// プログラムのデバッグ: F5 または [デバッグ] > [デバッグの開始] メニュー

// 作業を開始するためのヒント: 
//    1. ソリューション エクスプローラー ウィンドウを使用してファイルを追加/管理します 
//   2. チーム エクスプローラー ウィンドウを使用してソース管理に接続します
//   3. 出力ウィンドウを使用して、ビルド出力とその他のメッセージを表示します
//   4. エラー一覧ウィンドウを使用してエラーを表示します
//   5. [プロジェクト] > [新しい項目の追加] と移動して新しいコード ファイルを作成するか、[プロジェクト] > [既存の項目の追加] と移動して既存のコード ファイルをプロジェクトに追加します
//   6. 後ほどこのプロジェクトを再び開く場合、[ファイル] > [開く] > [プロジェクト] と移動して .sln ファイルを選択します


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<vector>
#include<string> 
#include<queue>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
#define INF 1e18
#define ll long long
#define mp make_pair
int main()
{
	std::ios::sync_with_stdio(false);
	int i,n,x;
	ll a[200005];
	cin>>n;
	a[0]=0;
	for(i=1;i<=n;i++)
	{
		cin>>x;
		a[i]=(a[i-1]+x);
	}
	int p1=1,p2,p3=3;
	ll ans=INF,minm=INF,maxm;
	for(p2=2;p2<n;p2++)
	{
		minm=INF;
		for(i=p1;i<p2;i++)
		{
			if(abs(a[i]-(a[p2]-a[i]))<minm)
			{
				minm=abs(a[i]-(a[p2]-a[i]));
				p1=i;
			}
			else break;
		}
		minm=INF;
		if(p3<=p2)p3=p2+1;
		for(i=p3;i<=n;i++)
		{
			if(abs((a[i]-a[p2])-(a[n]-a[i]))<minm)
			{
				minm=abs((a[i]-a[p2])-(a[n]-a[i]));
				p3=i;
			}
			else break;
		}
		minm=INF,maxm=0;
		minm=min(a[p1],min(a[p2]-a[p1],min(a[n]-a[p3],a[p3]-a[p2])));
		maxm=max(a[p1],max(a[p2]-a[p1],max(a[n]-a[p3],a[p3]-a[p2])));
		ans=min(ans,maxm-minm);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1920
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>
typedef long long ll;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define REP(i,l,r) for(ll i=l; i<(ll)(r); i++)
#define max(l,r) ((l)>(r)?l:r)
#define min(l,r) ((l)<(r)?l:r)
#define swap(l,r) {ll tp=l;l=r;r=tp;}
const ll MOD = 1000000007;

/////nCk (mod MOD) BEGIN/////
//faccal -> n!, k!^(MOD-2)()
//comb -> nCk (mod MOD)
ll mlpow(ll x, ll p) { //(x^p) % MOD
    ll tmp = 1;
    if(p == 0) return 1;
    while(p != 0) {
        if(p & 1) tmp = tmp*x % MOD;
        x = x*x % MOD;
        p = p >> 1;
    }
    return tmp;
}

#define facMAX 20202
ll fac[facMAX];     //n! (mod MOD)
ll facM2[facMAX];   //(k!)^(MOD-2) (mod MOD)
void faccal(ll up) {
    fac[0] = 1;
    facM2[0] = 1;
    for(int i = 0; i < up + 1; i++){
        fac[i+1] = fac[i] * (i+1) % MOD;
        facM2[i+1] = facM2[i] * mlpow(i+1, MOD-2) % MOD;
    }
}

//nCk = n!*(k!)^(M-2)*((n-k)!)^(M-2)
ll comb(ll n, ll k) {
    if(n == 0 && k == 0) return 1;
    if(n < k || n < 0) return 0;
    ll tmp = (facM2[n-k] * facM2[k]) % MOD;
    return tmp * fac[n] % MOD;
}

int main() {
    int s;
    scanf("%d", &s);
    ll ans = 0;

    if(s > 2){
        ans = 1;
        if(s > 3){
            faccal(10*s);
            int boxm = s/3;
            for(int i = 2; i <= boxm; i++){
                int ts = s-3*i;
                if(ts == 0){
                    ans++;
                    if(ans >= MOD) ans -= MOD;
                }else{
                    ans += comb(ts+i-1, ts);
                    if(ans >= MOD) ans -= MOD;
                }
            }
        }
    }


    printf("%d\n",ans);
}

Measured memory_bytes: 1960
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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<string> s(n);
    REP(i,n){
        cin >> s[i];
    }
    map<string,ll> x;
    REP(i,n){
       x[s[i]] += 1; 
    }
    ll max = 0;
    for(auto itr = x.begin(); itr != x.end(); ++itr) {
        if(max < itr->second){
            max = itr->second;
        }
    }
    for(auto itr = x.begin(); itr != x.end(); ++itr) {
        if(itr->second == max){
            cout << itr->first << endl;
        }
    }
}

Measured memory_bytes: 27648