akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int s=0,w=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}
int n,m,q,a[2010][2010];
int po[2010][2010],ba[2010][2010];
int ob[2010][2010],zb[2010][2010];
int main(){
// 	freopen("duty.in","r",stdin);
// 	freopen("duty.out","w",stdout);
	n=read(); m=read(); q=read();
	for(int i=0;++i<=n;){
		char ch;
		for(int j=0;++j<=m;)
			ch=getchar(),a[i][j]=(ch=='1');
		ch=getchar();
	}
	for(int i=0;++i<=n;)
		for(int j=0;++j<=m;){
			po[i][j]=po[i-1][j]+po[i][j-1]-po[i-1][j-1]+a[i][j];
			ba[i][j]=ba[i-1][j]+ba[i][j-1]-ba[i-1][j-1]+(a[i][j]&a[i-1][j])+(a[i][j]&a[i][j-1]);
			ob[i][j]=ob[i][j-1]+(a[i][j]&a[i-1][j]);
		}
	for(int j=0;++j<=m;)
		for(int i=0;++i<=n;)
			zb[i][j]=zb[i-1][j]+(a[i][j]&a[i][j-1]);
	for(int i=0;++i<=q;){
		int sx=read(),sy=read(),ex=read(),ey=read();
		int Sp=po[ex][ey]-po[sx-1][ey]-po[ex][sy-1]+po[sx-1][sy-1];
		int Sb=ba[ex][ey]-ba[sx-1][ey]-ba[ex][sy-1]+ba[sx-1][sy-1];
		printf("%d\n",Sp-Sb+ob[sx][ey]-ob[sx][sy-1]+zb[ex][sy]-zb[sx-1][sy]);
	}
	return 0;
}

Measured memory_bytes: 80640
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int n;
vi a;

int main(){
	cin>>n;
	a=vi(n);
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a.rbegin(),a.rend());
	int res=0;
	for(int i=0;i<n;i++) res+=a[i]*(i%2==0?1:-1);
	cout<<res<<endl;
}

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

#define F first
#define S second
#define ll long long
#define pb push_back
#define endl '\n'

using namespace std;

int main()
{
	ios_base :: sync_with_stdio(false) ;
	cin.tie(0); cout.tie(0) ;
	string a , b; 
	cin >> a >> b ;
	string x = a.substr(0 , a.size()) ; 
	string y = b.substr(0 , a.size()) ; 
	cout << (x == y ? "Yes" : "No") << endl ; 
	return 0 ; 
}



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

int main(){
    int x;
    cin >> x;
    if(x>=30){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<math.h>
#include<utility>
using namespace std;

int main(){
    int num[3];
    for(int i=0;i<3;i++) cin >> num[i];

    for(int i=0;i<2;i++){
        int min = num[i];
        int idx = i;
        for(int j = i+1;j<3;j++){
            if(min > num[j]){
                min = num[j];
                idx = j;
            }
        }
        int tmp = num[idx];
        num[idx] = num[i];
        num[i] = tmp; 
    }

    cout << num[0] << " " << num[1] << " " << num[2] << endl; 
}


Measured memory_bytes: 3088
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    h,w,n = IR(3)
    k = max(h,w)
    print(math.ceil(n/k))
    return

#Solve
if __name__ == "__main__":
    solve()


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

using namespace std;

int main() {
    vector<long long> a,b,c;
    int n;
    long long x,y;
    long long z;
    long long ans = 0;

    cin >> n;

    for(int i = 0;i < n;i++){
        cin >> z;
        a.push_back(z);
    }
    for(int i = 0;i < n;i++){
        cin >> z;
        b.push_back(z);
    }
    for(int i = 0;i < n;i++){
        cin >> z;
        c.push_back(z);
    }
    
    sort(a.begin(),a.end());
    sort(c.begin(),c.end());

    for(int i = 0;i < n;i++){
        x = lower_bound(a.begin(),a.end(),b[i]) - a.begin();
        y = upper_bound(c.begin(),c.end(),b[i]) - c.begin();
        y = c.size() - y;

        ans += x*y;
    }

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 3316
#include<bits/stdc++.h>
 
using namespace std;
#define ll  long long
#define ld  long double
 
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN=1e5 + 5;
int main() {
   ll n,k;
  cin>>n>>k;
  int c=0;
   while(n!=0)
   {
       c++;
       n/=k;
       
   }
   cout<<c<<endl;
    return 0;
}

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

typedef long long ll; 
typedef pair<int,int > pp;

 
#define sz(x) (int)x.size() 
#define PI acos(-1)
int const N=5e5;
int  mod = 998244353,oo = 1e9;
ll OO = 3e18;

ll a,b;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>a>>b;
	ll g=__gcd(a,b);
	int cnt=1;
	for(ll i=2;i*i<=g;i++){
		if(g%i==0)cnt++;
		while(g%i==0)g/=i;
	}
	if(g>1)cnt++;
	cout<<cnt;
	return 0;
}



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

int main(){

    int x;
    cin>>x;

    if(x==0){
        cout<<1<<endl;
    }else{
        cout<<0<<endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)

#define INF 1000000001;
#define MOD 1000000007;
#define INF64 1000000000000000001;

#define F first
#define S second

#define Pii pair<SINT32,SINT32>
#define Pll pair<SINT64,SINT64>


using namespace std;

int main() {

	SINT32 N = 0;
	SINT32 Y = 0;

	cin >> N;
	cin >> Y;
	
	rep(i,0,N+1) {
		rep(j,0,N+1-i) {
			if ((N-i-j) >= 0) {
				if ((i*10000) + (j*5000) + ((N-i-j)*1000) == Y) {
					cout << i << " " << j << " " << (N-i-j) <<endl;
					return 0;
				}
			}
		}
	}

	cout << -1 << " " << -1 << " " << -1 <<endl;
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

//  DATA.erase(std::unique(DATA.begin(), DATA.end()), DATA.end());	//ソート後に使用

//	DATA.insert(DATA.begin() + X, 0);	//X番目の要素に0を挿入


//	vector<vector<SINT32>> DP(N,vector<SINT32>(3));	//2次元配列

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

// 	vector<pair<int,pair<int,int>>> DATA(M);
//	cin >> DATA[i].first;
//	cin >> DATA[i].second.first;
//	cin >> DATA[i].second.second;


//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();	//key以上を探す
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();


/* 文字列回転
	string N;
	cin >> N;
	N = N[N.length()-1] + N.substr(0,N.length()-1);
*/
/* 文字列合成
	string N,M;
	cin >> N >> M;
	SINT64 ans = 0;
	ans = stoi(N+M);
*/



/* SET コンテナ
	set<SINT32> DATA;
	for (SINT32 i = 0; i < N; i++) {
		SINT32 buf;
		cin >> buf;
		DATA.insert(buf);
	}

	//全表示
    set<string>::iterator it; //  イテレータを用意
    for(it = DATA.begin(); it != DATA.end(); it++) {
        cout << *it << endl;
    }

	//N番目を一部表示
	set<string>::iterator it; //  イテレータを用意
	it = DATA.begin();
	rep (i,0,N) {
		it++;
	}
	cout << *it << endl;
*/

/* map
	map<string,SINT32> mp;
	SINT32 N = 0;
	SINT32 mx = 0;

	cin >> N;
	for (SINT32 i = 0; i < N; i++) {
		string s;
		cin >> s;
		mp[s]++;
	}
	for(auto it=mp.begin();it!=mp.end();it++) {
		mx=max(mx,it->second);
	}

*/

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <sstream>
using namespace std;

int main() {
	int t, x;
	cin >> t >> x;
	
	float T = t;
	float X = x;
	
	cout << T /  X << endl;
	return 0;
}

Measured memory_bytes: 256
n,a,b=map(int,input().split())
MOD=10**9+7
def inv(a):
  return pow(a,MOD-2,MOD)
def choose(n,r):
  if r==0 or r==n:
    return 1
  else:
    A=B=1
    for i in range(r):
      A=A*(n-i)%MOD
      B=B*(i+1)%MOD
    return A*inv(B)%MOD
print((pow(2,n,MOD)-1-choose(n,a)-choose(n,b))%MOD)

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

int main(){
  
	int a,b,c,k;
  	int sum=0;
  	cin >> a >> b >> c >> k;
  	while(k!=0&&a!=0){
      sum += 1;
        a--;
      	k--;
    }
  
  while(k!=0&&b!=0){
    	b--;
    	k--;
  }
  while(k!=0&&c!=0){
    sum -= 1;
    	c--;
    	k--;
  }
  
  cout << sum << endl;
  return 0;
      	

}

Measured memory_bytes: 3624
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

//素因数分解
map<ll, int> prime_factor(ll n) {
    map<ll, int> ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1)
        ret[n] = 1;
    return ret;
}

int main() {
    ll N;
    cin >> N;
    auto factor = prime_factor(N);
    int res = 0;
    for(auto x : factor) {
        ll num = x.first;
        ll cnt = x.second;
        for(int i = 1;; i++) {
            int n = (i * (i + 1)) / 2;
            if(n > cnt) {
                res += i - 1;
                break;
            }
        }
    }
    cout << res << endl;
    return 0;
}

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

#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long w,h,x,y;
    cin >> w >> h >> x >> y;
    int q = 0;
    double sq = (w*h)/2.0;
    if (x == w/2 && y == h/2 && w%2 == 0 && h%2 == 0) {
        q++;
    }
    printf("%.9f %d\n", sq, q);
    return 0;
}


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

int main()
{
    int n,sum,m,x;
    cin>>n;
    m = n;
    sum = 0;
    for(int i=8;i>=0;i--){
        int a = 1;
        for(int j=0;j<i;j++){
            a *= 10;
        }
        x = m/a;
        if(x == 0){
            continue;
        }else{
            sum += x;
            m -= x*a;
        }
    }
    if(n%sum == 0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

#define min(a,b) ((a>b)?b:a)

int main(){
  int n,a,b,c,i,mm,tmp;
  scanf("%d",&n);
  if(n==2){
    scanf("%d%d",&a,&b);
    mm=min(a,b);
    for(i=1;i<mm;i++){
      if(a%i==0&&b%i==0){
        printf("%d\n",i);
      }
    }
  }else{
    scanf("%d%d%d",&a,&b,&c);
    tmp=min(a,b);
    mm=min(tmp,c);
    for(i=1;i<mm;i++){
      if(a%i==0&&b%i==0&&c%i==0){
        printf("%d\n",i);
      }
    }
  }
  return 0;
}


Measured memory_bytes: 2040
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=400005;
int n,m,i,j,k,head[N],adj[N],nxt[N],col[N],num,num1,num2;
long long ans;
void dfs(int x)
{
	++k;
	for(int y=head[x];y;y=nxt[y])
		if(col[adj[y]]==col[x])
			j=0;
		else if(col[adj[y]]==0)
		{
			col[adj[y]]=-col[x];
			dfs(adj[y]);
		}
}
int main()
{
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;++i)
	{
		scanf("%d%d",&j,&k);
		adj[i*2-1]=k;
		nxt[i*2-1]=head[j];
		head[j]=i*2-1;
		adj[i*2]=j;
		nxt[i*2]=head[k];
		head[k]=i*2;
	}
	for(i=1;i<=n;++i)
		if(col[i]==0)
		{
			++num;
			col[i]=1;
			j=1,k=0;
			dfs(i);
			if(j)
			{
				if(k==1)
					++num1;
				else
					++num2;
			}
		}
	ans=1ll*(num-num1)*(num-num1);
	ans+=1ll*num2*num2;
	ans+=1ll*num1*num1;
	ans+=2ll*num1*(n-num1);
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 7040
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define repc(i, s, t) for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    var(int, N);
    vector<pii> a(N);
    rep(i, 0, N) {
        read(a[i].first);
        a[i].second = i;
    }

    sort(all(a));
    int ans = 0;
    rep(i, 0, N) {
        if ((a[i].second & 1) != (i & 1)) {
            ++ans;
        }
    }

    print(ans / 2);

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
vector<int> ans, oya;

void dfs1(int a, int b, vector<vector<int>> &G){
    oya[a] = b;
    for(int x: G[a]){
        if(x == b) continue;
        dfs1(x, a, G);
    }
    return;
}

void dfs(int p, int x, vector<vector<int>> &G){
    ans[p] += x;
    for(int i: G[p]){
        if(i == oya[p]) continue;
        dfs(i, ans[p], G);
    }
    return;
}

int main(){
    int n, q;
    cin >> n >> q;
    vector<vector<int>> G(n);
    rep(i, n - 1){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a); 
    }
    ans.resize(n);
    oya.resize(n);
    dfs1(0, -1, G);
    rep(i, q){
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }
    dfs(0, 0, G);
    rep(i, n){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 24320
#include <iostream>

using namespace std;

int main()
{
	int a, b, c, d;

	cin >> a >> b >> c >> d;

	if (a + b == c + d)
		cout << "Balanced" << endl;
	else if (a + b < c + d)
		cout << "Right" << endl;
	else
		cout << "Left" << endl;

	return 0;
}

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

int main(){
  string s,t;
  cin>>s>>t;
  int ans=t.size();
  for(int i=0; i<s.size()-t.size()+1; i++){
    int temp=0;
    for(int j=0; j<(int)t.size(); j++){
      if(s[i+j]!=t[j]) temp++;
    }
    if(ans>temp) ans=temp;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
string S;
int main(){
  cin >> S;
  int ret = 1000;
  
  int l = S.length();
  for(int i=0;i<l-2;i++){
    int cand = (S[i] - '0') * 100 + (S[i+1] - '0') * 10 + (S[i+2] - '0');
    ret = min(ret,abs(cand - 753));
  }
  cout << ret << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 500010
#define int long long
using namespace std;
typedef long long ll;
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int A[N],n,L,T,t,cnt,W[N];
signed main()
{
	n=read(); L=read(); T=read();
	for(int i=0;i<n;i++) A[i]=read(), W[i]=read();
	for(int i=0;i<n;i++)
	{
		A[i]+=(W[i]==1? 1:-1)*T;
		(t+=A[i]/L)%=n; A[i]%=L;
		if(A[i]<0) t--,A[i]+=L;
	}
	sort(A,A+n);
	for(int i=0;i<n;i++) printf("%lld\n",A[((t+i)%n+n)%n]%L);  
	return 0;
}

Measured memory_bytes: 6016
l, r = gets.split.map(&:to_i)
r = [l + 2019, r].min

tmp_min = 2019
(l..r - 1).each do |i|
  (i + 1..r).each do |j|
    cand = i * j % 2019
    tmp_min = cand if tmp_min > cand
  end
end
puts tmp_min


Measured memory_bytes: 1916
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#define int long long 
#define ld long double
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define ff first
#define ss second
#define endl '\n'
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)
#define loop(i,l,r) for(int i=l;i<r;i++)
#define rloop(i,r,l) for(int i=r;i>=l;i--)
#define watch(x) cerr<<(#x)<<"= "<<(x)<<endl;
#define watcharr(a) cerr<<(#a)<<"("<<sz(a)<<")= ";rep(i,sz(a))cerr<<a[i]<<",";cerr<<'\n';
#define inf 2000000000000000000LL
#define mod 1000000007
#define mod1 998244353
#define FASTIO std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;

int n,k;
int a[3005];
int dp[3005][3005];

signed main() {
    FASTIO;
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    //     freopen("stderr.txt", "w", stderr);
    // #endif

    // int tt=1;
    // cin>>tt;
    // while(tt--){
        cin>>n;
        int t;
        rep(i,n) cin>>a[i];
        for(int l=n-1;l>=0;l--){
            for(int r=l;r<n;r++){
                if(l==r) dp[l][r]=a[l];
                else dp[l][r]=max(a[l]-dp[l+1][r],a[r]-dp[l][r-1]);
            }
        }
        // rep(i,n){ rep(j,n) cerr<<dp[i][j]<<' '; cerr<<endl;}
        cout<<dp[0][n-1]<<endl;

          
        
    // }
    cerr<<"Time Elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<" sec";
    return 0;   
}

Measured memory_bytes: 70016
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,sum=0;
  cin>>n;
  int a[n],b[n],c[n-1];
  for(int i=0;i<n;++i)
   cin>>a[i];
   
  for(int i=0;i<n;++i)
  {cin>>b[i];
   sum+=b[i];
  }
  for(int i=0;i<n-1;++i)
    cin>>c[i];
  for(int i=0;i<n-1;++i)
  {if(a[i+1]-a[i]==1)
      sum+=c[a[i]-1];
  }
  cout<<sum;
  return 0;
}

Measured memory_bytes: 256
N,Y = map(int,input().split())
cnt10 = 0
cnt5 = 0
cnt1 = 0
def wrong():
	print('-1 -1 -1')
	exit()
all1000 = int(Y / 1000)
if all1000 % 1 != 0:
	wrong()
for x in range(all1000 + 1):
	for y in range(all1000 - x + 1):
		if N - x - y < 0:
			break
		if x * 10 + y * 5 + (N - x - y) == all1000:
			print('{} {} {}'.format(x,y,N - x - y))
			exit()
print('-1 -1 -1')


Measured memory_bytes: 3064
S=input()
S1=list(str(s)  for s in S)
A=1
B1=0
B2=0
C=1
if S1[0] != 'A':
  A=0
  
for s in S1[2:-1]:
  if s=='C':
    B1=1
    B2+=1

for s in S1[1::]:
  if s=='C':
    pass
  elif s.isupper():
    C=0
    
if A==1 and B1==1 and B2==1 and C==1:
    print('AC')
else:
  print('WA')

    




Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    private static List<Queen> queenList;

    private static String ansQueenPermutation = "";

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int k = Integer.parseInt(scan.next());
        queenList = new ArrayList<Queen>(8);
        for (int i = 0; i < k; i++) {
            int r = Integer.parseInt(scan.next());
            int c = Integer.parseInt(scan.next());
            queenList.add(new Queen(r, c));
        }
        scan.close();

        permutation("01234567", "");

        for (int i = 0; i < 8; i++) {
            int queen = Integer.parseInt(ansQueenPermutation.substring(i, i + 1));
            for (int j = 0; j < 8; j++) {
                if (j == queen) {
                    System.out.print("Q");
                } else {
                    System.out.print(".");
                }
            }
            System.out.println("");
        }
    }

    private static void permutation(String s, String ans) {
        if (s.length() == 1) {
            String permu = ans + s;
            int[] permuR = new int[8];
            int[] permuC = new int[8];
            for (int i = 0; i < 8; i++) {
                permuR[i] = i;
                permuC[i] = Integer.parseInt(permu.substring(i, i + 1));
            }

            // 入力の制約チェック
            for (Queen queen : queenList) {
                if (queen.c != permuC[queen.r]) {
                    return;
                }
            }

            // 斜め方向の制約チェック
            for (int i = 0; i < 8; i++) {
                for (int j = i + 1; j < 8; j++) {
                    if (permuR[i] - permuR[j] == permuC[i] - permuC[j]) {
                        return;
                    }
                    if (permuR[i] + permuC[i] == permuR[j] + permuC[j]) {
                        return;
                    }
                }
            }

            ansQueenPermutation = permu;
            return;
        }

        for (int i = 0; i < s.length(); i++) {
            permutation(s.substring(0, i) + s.substring(i + 1), ans + s.charAt(i));
        }
    }

    static class Queen {
        int r;
        int c;

        public Queen(int r, int c) {
            this.r = r;
            this.c = c;
        }
    }

}



Measured memory_bytes: 65608
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let N = lines.shift().split(/\s/).map((v) => v - 0)[0];
    let H = lines.shift().split(/\s/).map((v) => v - 0);
    let ans = 1, max = H[0];
    for (let n = 1; n < N; n++) {
        if (max <= H[n]) ans++;
        if (max < H[n]) max = H[n];
    }
    console.log(ans);
}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
n,y=gets.split.map &:to_i
(0..n).each{|i|(0..n-i).each{|j|
	k=n-i-j
	if i*1000+j*5000+k*10000==y
		puts [k,j,i]*' '
		exit
	end
}}
puts '-1 -1 -1'

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

int n, k, x[15];
bool can[2222222];

vector<int> v;

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=k;i++) {
		int T;
		scanf("%d",&T);
		x[T] = 1;
	}
	can[0] = true;
	for(int i=1;;i++) {
		if(can[i/10] && !x[i%10]) can[i] = true;
		if(can[i] && i >= n) {
			printf("%d\n",i);
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

template<class T> using V = vector<T>;
template<class T,class U> using P = pair<T,U>;

#define REP(i,n) for(int i = 0; i < int(n); i++)
#define FOR(i, m, n) for(int i = int(m);i < int(n);i++)
#define ALL(obj) (obj).begin(),(obj).end()

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

vector<int> dy = { 0,0,1,-1 };
vector<int> dx = { 1,-1,0,0 };

template<class T> void corner(bool flg, T hoge) {
	if (flg) {
		cout << hoge << endl;
		exit(0);
	}
	else return;
}

template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {
	o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;
}

template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {
	o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;
}

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

template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {
	o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}

void print(void) {
	cout << endl;
}

template <class Head> void print(Head&& head) {
	cout << head;
	print();
}

template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {
	cout << head << " ";
	print(forward<Tail>(tail)...);
}

void YN(bool flg) {
	cout << ((flg) ? "YES" : "NO") << endl;
}

void Yn(bool flg) {
	cout << ((flg) ? "Yes" : "No") << endl;
}

void yn(bool flg) {
	cout << ((flg) ? "yes" : "no") << endl;
}

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

	if(N == 1){
		cout << "Yes" << endl;
		cout << 2 << endl;
		cout << 1 << " " << 1 << endl;
		cout << 1 << " " << 1 << endl;
		return 0;
	}

	V<ll> A(100000+1,-1);
	ll cnt = 3, idx = 3;
	while(cnt <= 100000){
		A[cnt] = idx;
		cnt += idx;
		idx++;
	}

	if(A[N] == -1){
		cout << "No" << endl;
		return 0;
	}
	else {
		cout << "Yes" << endl;
	}

	ll M = A[N];
	V<V<int>> B(M);

	idx = 0;
	REP(i,M){
		B[i%M].push_back(idx);
		B[(i+1)%M].push_back(idx);
		idx++;
	}
	REP(i,M-1){
		if (idx == N) break;
		for (int j = i + 2; j < M; ++j) {
			if (i == 0 && j == M - 1) continue;
			B[i].push_back(idx);
			B[j].push_back(idx);
			idx++;
		}
	}
	
	//ans
	cout << M << endl;
	REP(i, M) {
		cout << M - 1; REP(j, B[i].size()) cout << " " << B[i][j]+1; cout << endl;
	}
	


	return 0;
}



Measured memory_bytes: 3072
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

int N;
int cnt = 1;
int ans = 1;

int A[11];

int main(){
	
	cin>>N;
	
	REP( i, N ){
		cin>>A[i];
		ans *= 3;
		if( A[i] % 2 == 0 ) cnt *= 2;
	}
	
	cout<<ans-cnt<<endl;
	
	return 0;

}

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

typedef long lint;
typedef long long llint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }


int main(void) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    int xdiff, ydiff;
    xdiff = x2 - x1;
    ydiff = y2 - y1;

    int a1, a2, a3, a4;
    a1 = x2 - ydiff;
    a2 = y2 + xdiff;
    a3 = x2 - ydiff - xdiff;
    a4 = y2 + xdiff - ydiff;

    cout << a1 << " " << a2 << " " << a3 << " " << a4;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
    int a,b,c;
    scanf("%d %d %d",&a, &b, &c);
    printf("%d",max(0, c - a + b));
}

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

int main() {
	string w;
	bool ok=1;
	cin >> w;
	map<char,int> m;

	rep(i,w.size())
		if(m.count(w.at(i)))
			++m.at(w.at(i));
		else
			m[w.at(i)] = 1;

	for(auto p : m)
		if(p.second%2)
			ok = 0;

	cout <<((ok) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
import math 

n, k = map(int,input().split())

result = 0

for i in range(1,n+1):
	if i < k :

		log_i = math.log2(k/i)
		ceil_i = math.ceil(log_i)

		result += math.pow(0.5, ceil_i)/n

	else:
		result += 1/n

print(result)

Measured memory_bytes: 3060
#include <cstdio>
#include <deque>
#include <algorithm>
#include <vector>
#include <tuple>

using namespace std;

vector<int> B;

int main()
{
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int b;
    scanf("%d", &b);
    B.push_back(b);
  }
  bool failed = false;
  deque<int> choices;
  for (int i = 0; i < n; i++) {
    int last = -1;
    int k = 0;
    for (int j = 0; j < n; j++) {
      if (B[j] == -1) continue;
      k++;
      if (B[j] == k) last = j;
    }
    if (last == -1) {
      failed = true;
      break;
    }
    else {
      choices.push_front(B[last]);
      B[last] = -1;
    }
  }
  if (failed) {
    printf("-1\n");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    printf("%d\n", choices[i]);
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double

lin n,m,c;
lin b[21],a[21][21];

int main(void)
{
    cin >> n >> m >> c;
    rep(i,m)
    {
        cin >> b[i];
    }
    rep(i,n)
    {
        rep(j,m)
        {
            cin >> a[i][j];
        }
    }

    lin res = 0;
    rep(i, n)
    {
        lin x = 0;
        rep(j,m)
        {
            x += a[i][j]*b[j];
        }
        x += c;
        if(x > 0)
            res++;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
// ITP1_7_C:   Spreadsheet
// 2017.7.27

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
	int e[101][101];
	int R, C, r, c;
	int s, total;

	scanf("%d%d", &R, &C);
	for (r = 1; r <= R; r++) {
		for (c= 1; c <= C; c++) scanf("%d", &e[r][c]);
	}
	
	for (r = 1; r <= R; r++) {
		s = 0;
		for (c = 1; c <= C; c++) s += e[r][c];
		e[r][0] = s;
	}
	total = 0;
	for (c = 1; c <= C; c++) {
		s = 0;
		for (r = 1; r <= R; r++) s += e[r][c];
		e[0][c] = s;
		total += s;
	}
	for (r = 1; r <= R; r++) {
		for (c = 1; c <= C; c++) printf("%d ", e[r][c]);
		printf("%d\n", e[r][0]);
	}
	for (c = 1; c <= C; c++) printf("%d ", e[0][c]);
	printf("%d\n", total);
	return 0;
}



Measured memory_bytes: 2052
function main(input: string) {
  let num: number = Number(input.split(" ")[0]);
  const arrD: string[] = input
    .split("\n")
    .slice(1)
    .filter((val: string) => val !== "");
  const regD: RegExp = new RegExp(`[${arrD.join("")}]`, "g");
  while (num.toString().match(regD) != null) {
    num += 1;
  }
  console.log(num);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 12864
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define per(i,a,n) for(int i=(n)-1;i>=(a);i--)
#define MP make_pair

typedef double db;

const db EPS = 1e-8;

inline int sign(db a) {
	return a < -EPS ? -1 : a > EPS;
}

inline int cmp(db a, db b){
	return sign(a-b);
}

struct P {
	db x, y;
	P() {
	}
	P(db _x, db _y) :
			x(_x), y(_y) {
	}
	P operator+(P p) {
		return P(x + p.x, y + p.y);
	}
	P operator-(P p)  {
		return P(x - p.x, y - p.y);
	}
	P operator*(db d) {
		return P(x * d, y * d);
	}
	P operator/(db d) {
		return P(x / d, y / d);
	}
	bool operator<(P p) const {
		int c = sign(x - p.x);
		if (c)
			return c == -1;
		return sign(y - p.y) == -1;
	}
	db dot(P p) {
		return x * p.x + y * p.y;
	}
	db det(P p) {
		return x * p.y - y * p.x;
	}
	db distTo(P p) { return (*this-p).abs(); }

	db alpha() {
		return atan2(y, x);
	}
	void read() {
		cin>>x>>y;
	}
	db abs() {
		return sqrt(abs());
	}
	db abs2() {
		return x * x + y * y;
	}
	P rot90(){
		return P(-y,x);
	}
};

#define cross(p1,p2,p3) ((p2.x-p1.x)*(p3.y-p1.y)-(p3.x-p1.x)*(p2.y-p1.y))
#define crossOp(p1,p2,p3) sign(cross(p1,p2,p3))

P isLL(P p1, P p2, P q1, P q2) {
	db a1 = cross(q1, q2, p1), a2 = -cross(q1, q2, p2);
	return (p1 * a2 + p2 * a1) / (a1 + a2);
}

bool intersect(db l1,db r1,db l2,db r2){
	if(l1>r1) swap(l1,r1); if(l2>r2) swap(l2,r2); 
	return !( cmp(r1,l2) == -1 || cmp(r2,l1) == -1 );
}

bool isSS(P p1, P p2, P q1, P q2){
    return intersect(p1.x,p2.x,q1.x,q2.x) && intersect(p1.y,p2.y,q1.y,q2.y) && 
    crossOp(p1,p2,q1) * crossOp(p1,p2,q2) <= 0 && crossOp(q1,q2,p1)
            * crossOp(q1,q2,p2) <= 0;
}

bool isMiddle(db a, db m, db b) {
    return sign(a - m) == 0 || sign(b - m) == 0 || (a < m != b < m);
}
 
bool isMiddle(P a, P m, P b) {
    return isMiddle(a.x, m.x, b.x) && isMiddle(a.y, m.y, b.y);
}

bool onSegment(P p1, P p2, P q){
	return crossOp(p1,p2,q) == 0 && isMiddle(p1, q, p2);
}

P proj(P p1, P p2, P q) {
    P dir = p2 - p1;
    return p1 + dir * (dir.dot(q - p1) / dir.abs2());
}

P reflect(P p1, P p2, P q){
	return proj(p1,p2,q) * 2 - q;
}

db nearest(P p1,P p2,P q){
	P h = proj(p1,p2,q);
	if(isMiddle(p1,h,p2))
		return q.distTo(h);
	return min(p1.distTo(q),p2.distTo(q));
}

db getrad(P p1,P p2){
	return atan2l(p1.det(p2),p1.dot(p2));
}

db incircle(P p1, P p2, P p3){
	db A = p1.distTo(p2);
	db B = p2.distTo(p3);
	db C = p3.distTo(p1);
	return sqrtl(A*B*C/(A+B+C));
}

int main(){
	int n;cin>>n;
	rep(i,0,n){
		P p1,p2,q1,q2;
		p1.read(),p2.read(),q1.read(),q2.read();
		P ret = isLL(p1,p2,q1,q2);
		printf("%0.10f %0.10f\n",ret.x,ret.y);
	}

	return 0;
}

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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n;
    cin >> n;
    long long a[n + 1], dp[n + 1];
    for(long long i = 1; i <= n; i++) {
        cin >> a[i];
        dp[i] = 0;
    }
    if(n == 1)
        cout << 0 << endl;
    else {
        dp[1] = 0;
        dp[2] = abs(a[1] - a[2]);
        for(long long i = 3; i <= n; i++) {
            dp[i] = min(abs(a[i] - a[i - 2]) + dp[i - 2], abs(a[i] - a[i - 1]) + dp[i - 1]);
        }
        cout << dp[n] << endl;
    }
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define LL long long int
#define DL double
#define MLL map<LL,LL>::iterator
#define MSL map<string,L>::iterator
#define MLS map<LL,string>::iterator
#define MSS map<string,string>::iterator
#define MCL map<char,LL>::iterator
#define SL set<LL>::iterator
#define SS set<string>::iterator
#define VL V<LL>::iterator
#define G getline
#define SZ size()
#define IN insert
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM emptm()
#define V vector
#define Q queue
#define DQ deque
#define PQ prioritm_queue
#define ST stack
#define FI first
#define MAn 1e18
#define MIN -1e18
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
V<LL>v;
map<LL,LL>u;
void Y()
{
    cout<<"Yes"<<endl;
}
void N()
{
    cout<<"No"<<endl;
}
int main()
{
    FAST;
    LL n,m,i,j,k,p,q,o,l,s,t,z=0,r;
    string a,b,c;
    cin>>n;
    k=0;
    for(i=1;i<=n;i++)
    {
        if(i<10 || (i>99&&i<1000) ||(i>9999 && i<100000))
        {
            k++;
        }
    }
    cout<<k<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
int main(void){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    
    int X=x2-x1;
    int Y=y2-y1;
    
    int x3=x2-Y;
    int y3=y2+X;
    int x4=x3-X;
    int y4=y3-Y;
    
    cout<<x3<<' '<<y3<<' '<<x4<<' '<<y4<<endl;
  
   
}

Measured memory_bytes: 3560
/* Don't quit suffer now and live the rest of your live as a champion */
#include <bits/stdc++.h>
#define int long long
#define lp(i , N) for(ll i = 0; i < ll (N) ; i++)
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define debug(x) cout<<" [ " << #x << " is: " << x << " ] "<<endl;
using namespace std;
typedef long long ll;
typedef long double ld;
const long double EPS = 1e-6;
const long double pi = acos(-1);
const long long MOD = 1e9 + 7;
signed main(){
    FAST
    int n , r;
    cin >> n >> r;
    if(n < 10) cout << (100 * (10 - n) ) + r << endl;
    else cout << r << endl;
    return 0;
}


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

int ans;//main関数の後ろに置くときは＝０が必要

string s;

int main() {

cin>>s;
rep(i,3)
if(s[i]=='1')
{
	ans++;
}
cout<<ans<<endl;

  return 0;
}

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

int main()
{
	int N;
	scanf("%d", &N);
	std::vector<int> B(N + 1);
	for (int i{1}; i <= N - 1; i++)
		scanf("%d", &B[i]);
	B[0] = B[N] = 1 << 30;

	int64_t sum{};
	for (int i{}; i < N; i++)
		sum += std::min(B[i], B[i + 1]);

	printf("%lld\n", sum);

	return 0;
}

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

int main() {
  int N, T;
  cin >> N >> T;
  vector<vector<int>> vec(N, vector<int>(2));

  for (int i = 0; i < N; i++) {
    cin >> vec.at(i).at(0) >> vec.at(i).at(1);
  }

  int m = 1001;

  for (int i = 0; i < N; i++) {
    if (vec.at(i).at(1) > T) {
      continue;
    }
    if (m > vec.at(i).at(0)) {
      m = vec.at(i).at(0);
    }
  }

  if (m == 1001) {
    cout << "TLE" << endl;
  } else {
    cout << m << endl;
  }
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, a[101010], b[101010], A, B, x[101010], y[101010], z[101010];
void solve(){
	cin >> A >> B >> n;
	int mia = INF, mib = INF, mi = INF;
	for(int i = 0; i < A; i++){
		cin >> a[i];
		chmin(mia, a[i]);
	}
	for(int i = 0; i < B; i++){
		cin >> b[i];
		chmin(mib, b[i]);
	}
	chmin(mi, mia+mib);
	for(int i = 0; i < n; i++){
		cin >> x[i] >> y[i] >> z[i];
		chmin(mi, a[x[i]-1]+b[y[i]-1]-z[i]);
	}
	
	cout << mi << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;


int N,K,A[200005];
int n[200005];
signed main(){
	cin>>N>>K;
	rep(i,N){
		cin>>A[i];
	}
	rep(i,K){
		memset(n,0,sizeof(n));
		rep(j,N){
			int l=j-A[j],r=j+A[j]+1;
			chmax(l,0ll);chmin(r,N);
			n[l]++;n[r]--;
		}
		bool flag=true;
		rep(j,N){
			n[j+1]+=n[j];
			A[j]=n[j];
			if(n[j]!=N)flag=false;
		}
		if(flag){
			break;
		}
	}
	rep(i,N)cout<<A[i]<<" ";
	cout<<endl;
}


Measured memory_bytes: 6720
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;
 
int main()
{
    ll n,k;
    cin >> n >> k;
    vector<P> ab(n);
    for(int i = 0; i < n; i++) cin >> ab[i].first >> ab[i].second;
    sort(ab.begin(),ab.end());
    for(int i = 0; i < n; i++){
        k -= ab[i].second;
        if(k <= 0){
            cout << ab[i].first << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>

#define SIZE 200000


using namespace std;

int main() {
    unsigned long long int N,N2,D;
    long long int prime[30];
    long long int expo[30];


 cin >> N;

 D = 2;
 long nb_prime,i;
 nb_prime = 0;
 if ((N%D) == 0) {
   expo[nb_prime] = 1;
   N = N/D;
   prime[nb_prime] = D;
   while ((N%D) == 0) {
     N = N/D;
     expo[nb_prime]++;
   }
   nb_prime++;
 }
 D++;
 while (D*D <= N) {
   if ((N%D) == 0) {
     expo[nb_prime] = 1;
     prime[nb_prime] = D;
     N = N/D;
     while ((N%D) == 0) {
       N = N/D;
       expo[nb_prime]++;
     }
     nb_prime++;
   }
   D+=2;
 }
 if (N > 1) {
   expo[nb_prime] = 1;
   prime[nb_prime] = N;
   nb_prime++;
 }
long long int r,s;
r = 0;
for (i=0;i<nb_prime;i++) {
  s = 1;
  while (expo[i] >= s) {
    expo[i] -= s;
    s++;
    r++;
  }
}
cout << r << endl;
  return 0;

}


Measured memory_bytes: 3676
n = int(input())
a = list(map(int, input().split()))
low = float("inf")
for i in range(n):
    x = 0
    while True:
        if a[i] %2 == 0:
            x += 1
            a[i] /= 2
        else:
            if x < low:
                low = x
            x = 0
            break
print(low)


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

	lli n,m;cin>>n>>m;
	lli s[m]; char c[m];
	REP(i,0,m){cin>>s[i]>>c[i]; s[i]--;}

	REP(i,0,1000){
		string A = to_string(i);
		if(A.size()!=n)continue;
		bool ok = true;
		REP(i,0,m)if(A[s[i]] != c[i])ok = false;
		if(ok){cout<<i<<endl;return 0;}
	}
	cout<<-1<<endl;


	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <complex>
#include <algorithm>
using namespace std;
// ------ Defines ------ //
#define Point complex<long double>
#define px real()
#define py imag()
// ------ Classes ------ //
class Segment {
public:
	Point p1, p2;
	Segment(Point p1_, Point p2_) : p1(p1_), p2(p2_) {};
	Segment(long double p1x, long double p1y, long double p2x, long double p2y) : p1(Point(p1x, p1y)), p2(Point(p2x, p2y)) {};
	friend bool operator==(const Segment& s1, const Segment& s2) { return (s1.p1 == s2.p1 && s1.p2 == s2.p2) || (s1.p1 == s2.p2 && s1.p2 == s2.p1); }
	friend bool operator!=(const Segment& s1, const Segment& s2) { return !(s1 == s2); }
};
class Line {
public:
	Point p1, p2;
	Line(Point p1_, Point p2_) : p1(p1_), p2(p2_) {};
	Line(long double p1x, long double p1y, long double p2x, long double p2y) : p1(Point(p1x, p1y)), p2(Point(p2x, p2y)) {};
	friend bool operator==(const Line& s1, const Line& s2) { return (s1.p1 == s2.p1 && s1.p2 == s2.p2) || (s1.p1 == s2.p2 && s1.p2 == s2.p1); }
	friend bool operator!=(const Line& s1, const Line& s2) { return !(s1 == s2); }
};
// ------ Functions ------ //
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
Point crp(Segment a, Segment b) {
	Point c = b.p2 - b.p1;
	long double d1 = abs(crs(c, a.p1 - b.p1));
	long double d2 = abs(crs(c, a.p2 - b.p1));
	return a.p1 + (a.p2 - a.p1) * (d1 / (d1 + d2));
}
int q, px1, py1, px2, py2, qx1, qy1, qx2, qy2;
int main() {
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		scanf("%d%d%d%d%d%d%d%d", &px1, &py1, &px2, &py2, &qx1, &qy1, &qx2, &qy2);
		Point p = crp(Segment(px1, py1, px2, py2), Segment(qx1, qy1, qx2, qy2));
		printf("%.9Lf %.9Lf\n", p.px, p.py);
	}
	return 0;
}

Measured memory_bytes: 2744
#include <stdio.h>

int main(void) {
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int max;
	max = a;
	int min1,min2;
	min1 = b;
	min2 = c;
	if(max < b){
		max = b;
		min1 = a;
		min2 = c;
	}
	if(max < c){
		max = c;
		min1 = a;
		min2 = b;
	}
	if(max == min1 + min2){
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	
	return 0;
}


Measured memory_bytes: 128
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef pair<int, int> P;

int main()
{
    int n;
    string s;
    cin >> n >> s;
    vector<int> R_array(n);
    vector<int> G_array(n);
    vector<int> B_array(n);
    int Rnum = 0, Gnum = 0, Bnum = 0;
    rep(i, n){
        R_array[i] = 0;
        G_array[i] = 0;
        B_array[i] = 0;
    }
    for(int i = n-1; i >= 0; i--){
        if(s[i] == 'R') Rnum++;
        else if(s[i] == 'G') Gnum++;
        else if(s[i] == 'B') Bnum++;
        R_array[i] = Rnum;
        G_array[i] = Gnum;
        B_array[i] = Bnum;
    }

    /*
    rep(i,n){
        cout << R_array[i] << " " << G_array[i] << " " << B_array[i] << endl;
    }
    cout << endl;
    */
   long long tot = 0;
   rep(i, n-2){
       char firstChar = s[i];
       for(int j = i + 1; j < n-1; j++){
           if(firstChar != s[j]){
               char secondChar = s[j];
               if(firstChar != 'R' && secondChar != 'R'){
                   tot += R_array[j];
                   if(j + j - i < n){
                       if(s[j + j - i] == 'R') tot--;
                   }
               }else if(firstChar != 'G' && secondChar != 'G'){
                   tot += G_array[j];
                    if(j + j - i < n){
                       if(s[j + j - i] == 'G') tot--;
                   }
               }else if(firstChar != 'B' && secondChar != 'B'){
                   tot += B_array[j];
                    if(j + j - i < n){
                       if(s[j + j - i] == 'B') tot--;
                   }
               }
           }
       }
   }
   cout << tot << endl;
    

}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;

int main() {
	int h,w;
	string s;
	cin>>h>>w;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>s;
			if(s=="snuke"){
				cout<<char(j+65)<<i+1<<endl;
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 384