akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC optimize("O3", "unroll-loops")
//#pragma GCC target("avx2")
#include<bits/stdc++.h>

#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FIXED cout << fixed << setprecision(12)
#define RANDOM srand(94385)
#define all(a) a.begin(), a.end()
#define shuffle(a) \
    for (int i = 0; i < sz(a); ++i) \
        swap(a[i], a[rand() % sz(a)]);
#define enter putchar('\n')
#define space putchar(' ')
#define Mem(a, x) memset(a, x, sizeof(a))
using namespace std;

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

void debug_out() { cerr << '\n'; }

template<typename T, typename ...R>
void debug_out(const T &f, const R &...r) {
    cerr << f << " ";
    debug_out(r...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__);

inline ll read() {
    ll x = 0;
    int f = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9') f |= (ch == '-'), ch = getchar();
    while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
    return x = f ? -x : x;
}

inline void write(ll x) {
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[23];
    int l = 0;
    while (x != 0)s[l++] = x % 10 + 48, x /= 10;
    while (l)putchar(s[--l]);
}

int lowbit(int x) { return x & (-x); }

template<class T>
T big(const T &a1, const T &a2) { return a1 > a2 ? a1 : a2; }

template<typename T, typename ...R>
T big(const T &f, const R &...r) { return big(f, big(r...)); }

template<class T>
T sml(const T &a1, const T &a2) { return a1 < a2 ? a1 : a2; }

template<typename T, typename ...R>
T sml(const T &f, const R &...r) { return sml(f, sml(r...)); }

template<class T, class U>
inline void checkMin(T &x, U y) { if (y < x) x = y; }

template<class T, class U>
inline void checkMax(T &x, U y) { if (y > x) x = y; }

template<class T, class U>
inline bool ifMax(T &x, U y) {
    if (y > x) return x = y, true;
    return false;
}

template<class T, class U>
inline bool ifMin(T &x, U y) {
    if (y < x) return x = y, true;
    return false;
}

const int M = 212345;// 2e5+5
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1000000007;// 1e9+7

// HAVE FREE OPEN IN MAIN FUNCTION

void init() {
    int a = read(), b = read();
    b--;
    int t = b / (a - 1);
    if (t * (a - 1) < b)t++;
    write(t);
    enter;

}

void solve() {

}

int main() {
    init();

    solve();

    return 0;
}

Measured memory_bytes: 256
import math


def get_one_int()->int:
    one_int = int(input())
    return one_int

def make_divisors(num:int)->set:
    divisors = set()
    for i in range(1, math.floor(num ** 0.5) + 1):
        if num % i == 0:
            divisors.add(i)
            divisors.add(num // i)
    return divisors

def count_odd_num(num_set)->int:
    odd_num = 0
    for i in num_set:
        if i % 2 != 0:
            odd_num += 1
    return odd_num

if __name__ == "__main__":
    while True:
        given_num = get_one_int()
        if given_num == 0:
            break
        divisors = make_divisors(given_num)
        odd_num = count_odd_num(divisors)
        odd_num -= 1 # remove 1
        print(odd_num)



Measured memory_bytes: 5708
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

A, B, C, D = mi()

while True:
    C -= B
    if C <= 0:
        print('Yes')
        exit()
    A -= D
    if A <= 0:
        print('No')
        exit()

Measured memory_bytes: 9224
#include <stdio.h>
#define MAX 2000000

int n,a[MAX+1];

void kansu(int i){
    int l,r,k,t;
    l=2*i;
    r=2*i+1;
    if(l <= n && a[l] > a[i])
       k=l;
    else
        k=i;
    if(r <= n && a[r] > a[k])
        k=r;

    if(k != i){
        t=a[i];
        a[i]=a[k];
        a[k]=t;
        kansu(k);
    }
}

int main(void){
    int i;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(i=n/2;i>=1;i--)
        kansu(i);
    for(i=1;i<=n;i++)
        printf(" %d",a[i]);
    printf("\n");
    return 0;
}



Measured memory_bytes: 3812
n=int(input())
x=list(int(input()) for _ in range(n))

import numpy as np

mi=np.argmax(x)

y=np.array(x)

for i in range(n):
	if i!=mi:
		print(x[mi])
	else:
		z=np.ones(n)
		z[i]=0
		print(int(max(y*z)))

Measured memory_bytes: 26268
#pragma GCC target("avx")

#include <cstdio>
/*
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
*/
#include <vector>
#include <algorithm>
/*
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
*/
#include <iomanip>
//#include <random>
#include <utility>
//#include <chrono>


using namespace std;

using int64 = long long;

template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#define getchar_unlocked getchar
#else
#define debug(_) 1728
#endif

template<class T> inline void fastin(T &num) {
  T c;
  num = 0;
  c = getchar_unlocked();
  for (; (c > 47 && c < 58); c = getchar_unlocked()) num = (num << 3) + (num << 1) + c - 48;
}

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

  int n; fastin(n);
  vector<pair<int64, int64>> v;
  for (int i = 0; i < n; ++i) {
    int64 x, l; fastin(x); fastin(l);
    v.emplace_back(x - l, x + l);
  }

  sort(v.begin(), v.end(), [](const pair<int64, int64>& p, const pair<int64, int64>& q){
    return p.second < q.second;
  });

  //debug(v);

  int64 last = v[0].second;
  int ans = 0;

  for (int i = 1; i < n; ++i) {
    if (v[i].first < last) {
      ++ans; continue;
    }
    last = v[i].second;
  }

  //cout << n - ans << endl;
  printf("%d\n", n - ans);

  return 0;
}

Measured memory_bytes: 2420
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		if (Math.abs(x-a) < Math.abs(x-b)) {
			System.out.println("A");
		} else {
			System.out.println("B");
		}

	}
}

Measured memory_bytes: 19924
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define fr(i, a, b) for (ll i = a; i <= b; ++ i)
#define rf(i, a, b) for (ll i = a; i >= b; -- i)

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

int cnt = 0;

int main () {
    to_pray();
    
    int n;
    cin >> n;
    
    for (int i = 1; i <= n; ++ i) {
   		for (int j = i + 1; j <= n; ++ j) {
   			if (i & 1 and !(j & 1))
   				++cnt;
   			if (!(i & 1) and j & 1)
   				++cnt;
   		}
    }
    
    cout << cnt;
    
    cout << '\n';
    return 0;
}

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

int main(void) {
  int n, a, b;
  cin >> n >> a >> b;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    string s = to_string(i);
    int d = 0;
    for (int j = 0; j < s.size(); j++) {
      d += s[j] - '0';
    }
    if (a <= d && d <= b) sum += i;
  }
  cout << sum << 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;

const int MAX_N = 8;
const int MAX_M = 28;
int N, M;
bool G[MAX_N][MAX_N], visited[MAX_N];

int dfs(int u) {
  int v, sum;
  REP(i, N) {
    if (!visited[i]) break;
    if (i == N - 1) return 1;
  }
  sum = 0;
  REP(v, N) {
    if (!G[u][v]) continue;
    if (visited[v]) continue;

    visited[v] = true;
    sum += dfs(v);
    visited[v] = false;
  }
  return sum;
}

main() {
  cin >> N >> M;
  REP(i, M) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    G[a][b] = G[b][a] = true;
  }
  REP(i, N) visited[i] = false;

  visited[0] = true;
  cout << dfs(0) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
const int maxn = 300010;
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	int a, b;
	cin >> a >> b;
	int cnt[4]{};
	++cnt[a], ++cnt[b];
	for(int i = 1;i < 4;++i)if(!cnt[i])cout << i << '\n';

}



Measured memory_bytes: 256
#include <iostream>
#include <memory.h>
using namespace std;
int main(void)
{
  int n,i,j,f,t,k,max;
  char c[101];
  int a[26];
  while(1){
    cin >> n;
    if(!n)break;
    memset(c,0,sizeof(c));
    memset(a,0,sizeof(int)*26);
    for(i=0;i<n;i++)
      cin >> c[i];
    max=0;
    f=1;
    for(i=0;i<n;i++){
      t=c[i]-'A';
      a[t]++;
      for(j=0;j<26;j++)
	if(max<a[j]){
	  k=j;
	  max=a[j];
	}
      for(j=0;j<26;j++){
	if(j==k)continue;
	else if(a[j]+(n-i-1)>=max)
	  break;
      }
      if(j==26){
	f=0;
	cout << (char)(k+'A') << " " << i+1 << endl;
	break;
      }
    }
    if(f)
      cout << "TIE" <<endl;
  }
  return 0;
}

Measured memory_bytes: 3056
#include<bits/stdc++.h>
#define INF 2147483640
using namespace std;
int have[105];
int main()
{
	//freopen("out.txt","w",stdout);
	int x,n;
	cin >> x >> n;
	for(int i=0,j; i<n; i++) cin >> j,have[j]=1;
	int l=x,r=x;
	while(l>=0 && have[l]) l--;
	while(r<=101 && have[r]) r++;
	//cout << l << ' ' << r << '\n';
	if(x-l <= r-x) cout << l;
	else cout << r;
	return 0;
}

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

int main(){
    int n, d;
    cin >> n >> d;
    int check_range = 2 * d + 1;
    if(n%check_range==0){
        cout << n / check_range;
    }
    else {
        cout << n / check_range + 1;
    }
}

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

using namespace std;

using int64 = long long;

int main() {
  string S, T;
  cin >> S >> T;
  S += S;
  S += S;
  if(S.find(T) != string::npos) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;

int main() {
    int s, w; cin >> s >> w;
    if(w >= s) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}


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

int main() {
  string s;cin>>s;
  int n = s.size();
  int a,z;
  rep(i,n) {
    if (s[i]=='A') {
      a=i;
      break;
    }
  }
  rep(i,n) {
    if (s[n-1-i]=='Z') {
      z=n-1-i;
      break;
    }
  }
  cout << z-a+1;
    
}


Measured memory_bytes: 640
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>
#include <math.h>
#include <string>
#include <time.h>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
ll n, m;
int con_1[222222];
int con_n[222222];
bool pos=false;

int main(void)
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int i, u, v; cin>>n>>m;
	for(i=1 ; i<=m ; i++)
	{
		cin>>u>>v;
		if(u==1) con_1[v]=1;
		if(v==n) con_n[u]=1;
	}
	for(i=1 ; i<=n ; i++) if(con_1[i]==1 && con_n[i]==1) pos=true;
	if(pos) cout<<"POSSIBLE";
	else cout<<"IMPOSSIBLE";
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const ll INF = 1LL<<60;
const int ny[4] = {-1,1,0,0}, nx[4] = {0,0,-1,1};
int sy,sx,gy,gx;

int main(){
  int n; cin >> n;
  vector<ll> p;
  p.push_back(2);
  p.push_back(1);
  for(int i = 2; i <= n; i++){
    p.push_back(p[i-1] + p[i-2]);
  }
  cout << p[n] << endl;
  return 0;
}


Measured memory_bytes: 256
// template version 1.4
// {{{ define basic macro
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0LL)
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ten(n) ((int)1e##n)
template<class T, size_t N> size_t sza(const T (&array)[N]) { return N; }
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
template<class T=int> T in() {T x; cin>>x; return (x);}

struct Fast {
  Fast(){
    std::cin.tie(0);
    ios::sync_with_stdio(false);
  }
} fast;

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

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

// }}}
// varible setting{{{

#define infile "../test/sample-1.in"
#define int long long
#define INF 1000000000000000000LL
// #define INF 2147483647
#define MOD 1000000007LL

// }}}

int solve(){
  int n,a;cin>>n>>a;
  int x[n]; rep(i, n) {cin>>x[i];}

  int dp[60][5000];

  rep(i, 60)rep(j, 5000) dp[i][j] = 0;

  dp[0][x[0]-a+2500] = 1;
  dp[0][2500] += 1;

  rep(i, 1, n){
    rep(j, 5000){
      dp[i][j] += dp[i-1][j];
      if (0 <= j+x[i]-a && j+x[i]-a< 5000) dp[i][j+x[i]-a] += dp[i-1][j];
    }
  }

  cout << dp[n-1][2500]-1 << endl;

  return 0;
}

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


Measured memory_bytes: 2560
#include <stdio.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <stdexcept>
#include <vector>
using namespace std;


#define abs(N) ((N>0)?N:-1*N)
#define lt(A,B) ((A>B)?B:A)
#define gt(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)


template <typename T>
class stack{
public :
	const static int MAX = 30000;
	stack<T> (){
		pos = 0;
	}

	void empty(){
		pos = 0;
	}

	bool isEmpty(){
		return (pos == 0);
	}

	bool isFull(){
		return (pos == MAX);
	}

	T pop(){
		if(isEmpty()){
			throw exception();
		}
		return body[--pos];
	}

	void push(T el){
		if(isFull()){
			throw exception();
		}
		body[pos++] = el;
	}

	T top(){
		if(isEmpty()){
			throw exception();
		}
		return body[pos-1];
	}

	T body[MAX];
	int pos;
};


int main(){
	char c[20001];
	cin.getline(c,sizeof(c));
	string str = string(c);
	int len = strlen(c);
	char cmd;
	stack<int> st1;
	stack<pair<int,int> > st2;
	int area=0;
	int l;
	for (int i = 0; i < len; ++i) {
		cmd = str[i];
		switch(cmd){
		case '/':
			if(st1.isEmpty()) break;
			l = st1.pop();
			int subarea;
			subarea = (i-l);
//			cout << l << " - " << i << endl;
			while(!st2.isEmpty() && st2.top().first > l){
				pair<int,int> sub = st2.pop();
				subarea += sub.second;
//				cout << "including : " <<  sub.first << "(" << sub.second << ")" <<endl;
			}
//			cout << "subarea is : " <<subarea << endl;
			area += (i-l);
			st2.push(make_pair(l,subarea));
			break;
		case '\\':
			st1.push(i);
			break;
		}
	}
	println(area);
	int pos = 0;
	print(st2.pos);
	while(pos < st2.pos){
		cout << " " << st2.body[pos++].second;
	}
	cout << endl;


	return 0;
}



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

using namespace std;
int main(){
    //([n][n][n*x] -> n^3 * x)
    long long dp[51][51][2501];
    for (int i=0;i<51;i++) for (int j=0;j<51;j++) for (int k=0;k<2501;k++) dp [i][j][k]=0;
    dp[0][0][0]=1;
    int n,a;
    long long ans=0;
    scanf("%d %d",&n,&a);
    for (int i=0;i<n;i++) {
        //scanf("%d",&x);
        int x;
        cin>>x;
        for (int j=0;j<50;j++) {
            for (int k=0;k<2501;k++) {
                if (dp[i][j][k]){
                    dp[i+1][j][k]+=dp[i][j][k];
                    dp[i+1][j+1][k+x]+=dp[i][j][k];
                }
            }
        }
    }
    for (int i=1;i<=n;i++) ans+=dp[n][i][i*a];
    printf("%lld\n",ans);
    return 0;
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);	
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll ,ll> 			pll;
typedef pair<ld,ld> 			pld;
typedef unordered_map<ll,ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5+7;
const ll 	MAX7 	= 	1e+7+7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9+7;

vll adj[MAXN];ll visit[MAXN]={};
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};

// <------------- Declare Variables Here ------------> //

ll t=1;
ll n,x;
string s;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>s;
	if(s[0]=='7' ||s[1]=='7' ||s[2]=='7'  ) cout<<"Yes\n";
	else cout<<"No\n";
}

int main() {
	fastio;randomINT;
	//cin>>t;
	while(t--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 238032
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define inf 99999999999
#define N 666666
struct str{
	int l,r;
}st[N];
bool cmp(str a,str b){
	if(a.l!=b.l){
		return a.l<b.l;
	} 
	else{
		return a.r<b.r;
	} 
}
signed  main(){
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++) cin>>st[i].l>>st[i].r;
	sort(st+1,st+1+m,cmp);	
	int ans=0;
	st[m+1].l=inf;st[m+1].r=inf;
	int L=st[1].l,R=st[1].r;
	for(int i=2;i<=m+1;i++){
		if(st[i].l<R){
			L=max(st[i].l,L);
			R=min(R,st[i].r);	
		}else{
			L=st[i].l;
			R=st[i].r;
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <set>
#include <algorithm>

using namespace std;
 
string rev(string ss){
    reverse(ss.begin(),ss.end());
    return ss;
}
 
int main(){
    int n;
    cin >> n;
    while(n--){
	string str;
	set<string> s;
	cin >> str;
 
	for(int i = 1 ; i < str.size() ; i++){
	    string l = str.substr(0,i),r = str.substr(i);
	    s.insert(l+r);
	    s.insert(rev(l)+r);
	    s.insert(l+rev(r));
	    s.insert(rev(l)+rev(r));
	    s.insert(r+l);
	    s.insert(rev(r)+l);
	    s.insert(r+rev(l));
	    s.insert(rev(r)+rev(l));
	}
	cout << s.size() << endl;
    }
    return 0;
}

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

int main(){
    int r, g, b;
    cin >> r >> g >> b;
    if((10 * g + b) % 4 == 0) cout << "YES"<< endl;
    if((10 * g + b) % 4 != 0) cout << "NO"<< endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  long long int l,r,i,j,min=2020;
  scanf("%lld %lld",&l,&r);

  if(r-l>=2019){
    min=0;
  }
  else{
    for(i=l;i<r;i++){
      for(j=i+1;j<=r;j++){
        if(((i*j)%2019)<min){
          min=(i*j)%2019;
        }
      }
    }
  }
  printf("%lld",min);
  return 0;
}


Measured memory_bytes: 128
var input = ""
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
 
process.stdin.on('end', function() {
  input = input.split("\n");
  var w = input[0].toLowerCase();
  var count = 0;

  i = 1;
  while (true) {
    arr = input[i].split(" ");
    if (arr[0] == "END_OF_TEXT") { break; }

    for (j = 0; j < arr.length; j++) {
      if (w == arr[j].toLowerCase()) {
        count++;
      }
    }
    i++;
  }
  console.log(count);
});

Measured memory_bytes: 15608
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int a,b;
	cin>>a>>b;
	if(b%a==0){
		cout<<a+b;
	}else{
		cout<<b-a;
	}
}

Measured memory_bytes: 256
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	int[][] l, s;
	int[][][] ls;
	int[] z;
	int r, n, m;
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			n = sc.nextInt(); m = sc.nextInt();
			if( (n|m) == 0 ) break;
			l = new int[n][n];
			s = new int[n][n];
			for(int[] a: l) fill(a, INF);
			for(int[] a: s) fill(a, INF);
			for(int i=0;i<n;i++) l[i][i] = s[i][i] = 0;
			for(int i=0;i<m;i++) {
				int a = sc.nextInt()-1, b = sc.nextInt() - 1, d = sc.nextInt();
				if( sc.next().equals("S") ) s[a][b] = s[b][a] = min(s[a][b], d);
				else l[a][b] = l[b][a] = min(l[a][b], d);
			}
			
			for(int k=0;k<n;k++) for(int i=0;i<n;i++) for(int j=0;j<n;j++) {
				s[i][j] = min(s[i][j], s[i][k]+s[j][k]);
				l[i][j] = min(l[i][j], l[i][k]+l[j][k]);
			}
//			debug(s);
//			debug(l);
			r = sc.nextInt();
			z = new int[r];
			for(int i=0;i<r;i++) z[i] = sc.nextInt()-1;
			System.out.println(dp());
		}
	}
	
	int dp() {
		int dp[][] = new int[r][n];
		for(int[] a: dp) fill(a, INF);
		dp[0][z[0]] = 0;
		for(int k=0;k<r-1;k++) for(int i=0;i<n;i++) {
			for(int j=0;j<n;j++) dp[k+1][j] = min(dp[k+1][j], dp[k][i] + l[z[k]][i] + s[i][j] + l[j][z[k+1]]);
			dp[k+1][i] = min(dp[k+1][i], dp[k][i] + l[z[k]][z[k+1]]);
		}
		
		int min = INF;
		for(int i=0;i<n;i++) min = min(min, dp[r-1][i]);
		return min;
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 16000
def resolve():
	a = []
	bingo = [(0,3,6),(1,4,7),(2,5,8),(0,1,2),(3,4,5)
			 ,(6,7,8),(0,4,8),(2,4,6)]
	for _ in range(3):
		a += list(map(int,input().split()))
	for i in range(int(input())):
		r = int(input())
		if r in a:
			a[a.index(r)]=0
	ans = 'No'
	for i in bingo:
		if a[i[0]] == 0 and a[i[1]]==0 and a[i[2]]==0:
			ans ='Yes'
	print(ans)
resolve()

Measured memory_bytes: 9216
using System;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;

namespace ForAtcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] nm = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            var n = nm[0];
            var m = nm[1];
            long[] h = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            long[,] abs = new long[2, m];
            for (var i = 0; i < m; i++)
            {
                long[] ab = Console.ReadLine().Split(' ').Select(j => long.Parse(j)).ToArray();
                abs[0, i] = ab[0];
                abs[1, i] = ab[1];
            }

            var bad = new HashSet<long>();

            for (var i = 0; i < m; i++)
            {
                if (h[abs[0, i] - 1] >= h[abs[1, i] - 1]) bad.Add(abs[1, i]);
                if (h[abs[0, i] - 1] <= h[abs[1, i] - 1]) bad.Add(abs[0, i]);
            }

            Console.WriteLine(n - bad.Count); 

        }
    }
}

Measured memory_bytes: 55904
{-# LANGUAGE BangPatterns #-}
import qualified Data.IntSet as S

main :: IO ()
main = do
  s <- readLn
  print $ solve s

solve :: Int -> Int
solve s = solve' 1 S.empty s

solve' :: Int -> S.IntSet -> Int -> Int
solve' !n !set s
  | s `S.member` set = n
  | otherwise = solve' (n + 1) set' (f s)
  where
    set' = S.insert s set

f :: Int -> Int
f s
  | even s = s `div` 2
  | otherwise = 3 * s + 1


Measured memory_bytes: 508
import bisect

n=int(input())
s=input()

mlist=[]
for i in range(10):
    mlist.append([])

for i in range(n):
    mlist[int(s[i])].append(i)

answer=[]

for i in range(10):
    if len(mlist[i])>0:
        left=min(mlist[i])
        for j in range(10):
            if len(mlist[j])>0:
                center=bisect.bisect_right(mlist[j], left)
                if center!=len(mlist[j]):
                    center=mlist[j][center]
                    for k in range(10):
                        right=bisect.bisect_right(mlist[k], center)
                        if right!=len(mlist[k]):
                            answer.append([i*100+j*10+k*1])
                else:
                    pass
            else:
                pass
    else:
        pass

print(len(answer))

Measured memory_bytes: 39792
#include <stdio.h>
int main(void){
	int n,i,g[10001]={0},k[10001]={0},d=0,u=0,z,o=0,p;
	scanf("%d",&n);
	for(i=1;i<n+1;i++){
		g[i]=0+i;}
	for(i=0;i<n+1;i++){
		if(g[i]%3==0||g[i]%10==3){
			k[d]=g[i];
			d++;
			u++;
		} else{
		for(z=1;z<g[i];z*=10){
			if((g[i]/z)%10==3){
				k[d]=g[i];
				d++;
				u++;
				break;
			}
		}
	}
	}	
		
		for(d=0;d<u-1;d++){
		printf(" %d",k[d+1]);
		}
		printf("\n");
	return 0;
}

Measured memory_bytes: 688
def main():
    k = int(input())
    ary = [1,2,3,4,5,6,7,8,9]
    cnt = 9
    now = 0
    up_tmp = 0
    if k < 10:
        print(k)
        return
    while True:
        tmp = []
        for i in range(up_tmp,len(ary)):
            a_i = ary[i]
            keta_1 = int(list(str(a_i))[-1])
            if keta_1 != 0:
                cnt += 1
                now = a_i * 10 + keta_1 - 1
                tmp.append(now)

                if cnt == k:
                    print(now)
                    # print(ary)
                    # print(tmp)
                    return
            cnt += 1
            now = a_i * 10 + keta_1
            tmp.append(now)
            if cnt == k:
                print(now)
                # print(ary)
                # print(tmp)
                return
            if keta_1 != 9:
                cnt += 1
                now = a_i * 10 + keta_1 + 1
                tmp.append(now)

                if cnt == k:
                    print(now)
                    # print(ary)
                    # print(tmp)
                    return
        up_tmp = len(ary)
        ary.extend(tmp)



if __name__=='__main__':
    main()


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

using namespace std;

#define ll long long
#define pi pair<int, int>
#define mkp make_pair
#define pb push_back
#define fr first
#define sc second
#define endl '\n'

const int mxn = 1e6 + 5;
const ll MOD =  1e9 + 7;
int arr[mxn];
int n, m, k;
ll l, r;
string s;

ll POW(ll A,ll B,ll R=1)
{while(B){if(B&1)R=R*A%MOD;A=A*A%MOD;B>>=1;}return R;}

void read(){
    cin >> s;
//    for(int i = 0, u, v; i < n; i++){
//        cin >> arr[i];
//    }
}


void solve(){
    s[1] = (char)((int)'R' + 'B' - s[1]);
    cout << s << endl;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int T = 1;
    //cin >> T;
    while(T--) read(), solve();
    return 0;
}


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

typedef long long ll;
int n;
ll k,a[202020];
ll st=-2e18,en=2e18;

int main() {
	cin>>n>>k;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	while(st+1!=en) {
		ll mid=(st+en)/2,cnt=0;
		for(int i=0;i<n;i++) {
			if(a[i]<0) {
				int l=i,r=n;
				while(l+1!=r) {
					int m=(l+r)/2;
					if(a[i]*a[m]<=mid) r=m;
					else l=m;
				}
				cnt+=n-r;
			} else {
				int l=i,r=n;
				while(l+1!=r) {
					int m=(l+r)/2;
					if(a[i]*a[m]<=mid) l=m;
					else r=m;
				}
				cnt+=l-i;
			}
		}
		
		if(cnt<k) st=mid;
		else en=mid;
	}
	cout<<en<<endl;
	return 0;
}

Measured memory_bytes: 1792
N=input()
s=input()

N=int(N)
wn=[]
bn=[]
a=0
b=0

#各行間よりも前と後ろに何個白（黒）があるかをカウント
wn.append(0)
for i in range(N):
    j=N-(i+1)
    if(s[j]=="."):
        a+=1
    if(s[i]=="#"):
        b+=1
    bn.append(a)
    wn.append(b)

bn.reverse()
bn.append(0)
#print(bn)
#print(wn)

#各行間のscore算出
min=1000000
for i in range(N+1):
    score=bn[i]+wn[i]
    if(score<min):
        min=score

print(min)

Measured memory_bytes: 13032
#include <bits/stdc++.h>
#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()
using namespace std;
typedef long long ll;
int main()
{
    int n;
    cin >> n;
    vector<int> d(n);
    REP(i, n)
        cin >> d.at(i);

    sort(ALL(d));

    int ans = d.at(n / 2) - d.at(n / 2 - 1);

    cout << ans << endl;
}


Measured memory_bytes: 768
import java.util.*;
public class Main {
	public static void main(String[] args)  {
		Scanner scan =new Scanner(System.in);
		int n=Integer.parseInt(scan.next());
		int y=Integer.parseInt(scan.next());

		int j;
		for(int i=0;i <= n;++i){//　千円札
			for(int k = 0;k <= n-i;++k){//　五千円札
				j=n-k-i;

				if((1000*i+5000*k+10000*j)==y){
					System.out.print(j+" "+k+" "+i);
					System.exit(0);
				}
			}
		}
		System.out.print("-1 -1 -1");

	}
}
//end


Measured memory_bytes: 22864
A, B = map(int, input().split())
S = input()
check = [i for i in range(10)]
ans = 0

for i in range(A + B + 1):
    if i != A:
        if S[i] == '-':
            print('No')
            ans = 1
            break
        elif int(S[i]) not in check:
            print('No')
            ans = 1
            break
    else:
        if S[i] != '-':
            print('No')
            ans = 1
            break

if ans == 0:
    print('Yes')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
 
template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	out << '(' << p.first << ',' << p.second << ')';
	return out;
}
 
template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	in >> p.first >> p.second;
	return in;
}
 
template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<vector<T> > &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}
 
template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}
 
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll > ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define sz(x) (ll)(x).size()
#define tr1(x) cerr << #x << ": " << x << nl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << nl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<nl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<nl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<sz(a);zz++) cerr<<a[zz]<<" ";cerr<<nl
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<nl
#define epsilon 0.000000001L
#define inf 9999999999999999ll// ~ 10^16
#define nl endl
#define all(x) x.begin(), x.end()
#define r_all(x) x.rbegin(), x.rend()
#define fast()  ios_base::sync_with_stdio(false);cin.tie(NULL)
#define mod 1000000007ll
#define modulo 998244353ll
ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}


int main()
{
    fast();
    ll n,m;
    cin>>n>>m;
    vs s(n);
    cin>>s;

    vv v(n,vi (m,0));
    vv h=v;

    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
        {
            if(s[i][j]=='#')
                continue;
            //horizontal
            if(j>0 && s[i][j-1]!='#')
            {
                h[i][j]=h[i][j-1];
            }
            else
            {
                h[i][j]=1;
                for(ll k=j+1;k<m;k++)
                {
                    if(s[i][k]=='#')
                        break;
                    h[i][j]++;
                }
            }
            //vertical
            if(i>0 && s[i-1][j]!='#')
                v[i][j]=v[i-1][j];
            else
            {
                v[i][j]=1;
                for(ll k=i+1;k<n;k++)
                {
                    if(s[k][j]=='#')
                        break;
                    v[i][j]++;
                }
            }
        }
    }
    ll ans=0;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<m;j++)
        {
            ans=max(ans,h[i][j]+v[i][j]-1);
        }
    }
    cout<<ans<<nl;
}


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

using namespace std;

int main(void) {
    int n, a[110], cnt = 0;
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i];

    for (int i = n - 1; i >= 0; i--)
        for (int j = 0; j < i; j++) {
            if (a[j] <= a[j + 1]) continue;
            swap(a[j], a[j + 1]);
            cnt++;
        }
    
    for (int i = 0; i < n; i++) {
        if (i) cout << " ";
        cout << a[i];
    }
    cout << endl;
    cout << cnt << endl;

    return 0;
}


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

using namespace std;

int main() {
vector<int>n(3);
for(int i=0;i<3;i++){
   cin>>n[i];
}
sort(n.begin(),n.end());
int a=0;
while(!(n[0]==n[1]&&n[1]==n[2])){
   if(n[1]==n[2]){
      n[0]+=2;
      a++;
   }
   else{
      n[0]++;
      n[1]++;
      a++;
   }
   sort(n.begin(), n.end());
}
cout<<a<<endl;
   return 0;
}





Measured memory_bytes: 3612
#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define MOD 1000000007

using namespace std;

int main(){
	int N;
	scanf("%d", &N);
	vector<int> a(N);
	int sum = 0;
	rep(i, N)scanf("%d", &a[i]);
	rep(i, N)sum += a[i];
	printf("%d", sum - N);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

long f(long b, long n){
    if(n < b) return n;
    else return f(b, n/b) + n%b;
}

int main(){
    long n;
    long k;
    long ans = __LONG_MAX__;
    cin >> n;
    cin >> k;
    long m = n-k;
    if (m < 0){
        cout << -1 << endl;
        return 0;
    }
    if(n == k){
        cout << n+1 << endl;
        return 0;
    }else{
        if(k == f(n, n)) ans = n;
        for(long i = 2; (i-1)*(i-1) <= m; i++){ 
            if(m%(i-1) == 0){
                if(k == f(i, n)) ans = min(ans, i);
                if(k == f(m/(i-1)+1, n)) ans = min(ans, m/(i-1)+1);
            }
        }
    }
    if(ans == __LONG_MAX__) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 384
// This file is a "Hello, world!" in D language by DMD for wandbox.
import std.algorithm, std.conv, std.stdio, std.array, std.math, std.string;

void main()
{
  const N = readln.chomp.to!long;
  const V = readln.split.map!(to!long).array;
  const C = readln.split.map!(to!long).array;

  long ans;
  foreach (b; 0..2.pow(N)) {
    long X, Y;
    foreach (n; 0..N) {
      if (!(b >> n & 1)) continue;
      X += V[n];
      Y += C[n];
    }
    const temp = X - Y;
    if (ans < temp) ans = temp;
  }
  ans.writeln;
}

// DMD reference:
//   https://dlang.org/dmd-linux.html

// D language references:
//   https://dlang.org
//   http://www.kmonos.net/alang/d/ ( Japanese )


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define maxn 103
#define mod 1000000007
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int,int> pi;

int n;
int ar[maxn][2];

int main() {
	scanf("%d",&n);
	for( int i = 1 ; i <= n ; i++ )
		scanf("%d%d",&ar[i][0],&ar[i][1]);
	for( int i = 2 ; i < n ; i++ )
		if(ar[i-1][0] == ar[i-1][1])
			if(ar[i][0] == ar[i][1])
				if(ar[i+1][0] == ar[i+1][1]) {
					puts("Yes");
					exit(0);
				}
	puts("No");
	return 0;
}

Measured memory_bytes: 3756
# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
import numpy as np
import time
sys.setrecursionlimit(10**6)
input = sys.stdin.readline


def main():
    a, b, h, m = map(int, input().split())

    print((a**2+b**2-2*a*b*math.cos(math.radians(30*h-(11/2.0)*m)))**(1/2))


if __name__ == '__main__':
    main()


Measured memory_bytes: 27216
#include <iostream>
#include <cstring>
#include <algorithm>


const long long mod = 1e9 + 7;
const int maxn = 1e5 + 5;
int seq[maxn];
long long bin(long long x , long long n){
    if (n == 0) return 1;
    if (n == 1) return x;
    long long ret = 1;
    while(n){
        if (n & 1) ret = ret * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return ret;
}
int main(){
    int t;
    std::cin >> t;
    for(int i = 1; i <= t; ++ i){
        int tmp;
        std::cin >> tmp;
        seq[tmp] ++;
    }
  //  std::sort(seq + 1, seq + 1 + t);
    long long ret = 1;
    bool chk = true;
    if (t & 1){
        for(int i = t - 1; i >= 2; i -= 2){
            if (seq[i] != 2) return !(std::cout << "0");
        }
        return !(std::cout << bin(2,t/2));
    }else {
        for(int i = t - 1; i >= 1; i -= 2){
            if (seq[i] != 2) return !(std::cout << "0");
        }
        return !(std::cout << bin(2,t/2));
    }
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long 
const int INF = 1e9;
const int MOD = INF+7;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.begin(),v.end()
#define MP make_pair
#define pb push_back
using P = pair<int,int>;

signed main(){
    int a[5];
    rep(i,5) cin >> a[i];

    int ans = 0;
    int MAX = 0;
    rep(i,5){
        ans += a[i];
        if(a[i] % 10){
            ans += 10 - a[i] % 10;
            MAX = max(MAX,10-a[i]%10);
        }
    }

    put(ans - MAX);
    
}


Measured memory_bytes: 256
import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] h = new int[n];
        int[] a = new int[n];
        int[] count = new int[n];
      
        for(int i = 0; i < n; i++){
          h[i] = sc.nextInt();
        }
      
        int ans = 0;
        for(int i = 0; i < m; i++){
          int road1 = sc.nextInt()-1;
          int road2 = sc.nextInt()-1;
          a[road1] += 1;
          a[road2] += 1;
          if(h[road1] > h[road2]){
            count[road1] += 1;
          }
          if(h[road1] < h[road2]){
            count[road2] += 1;
          }
        }
      
       for(int i = 0; i < n; i++){
         if(a[i] == count[i] || a[i] == 0){
           ans++;
         }
       }
        
       System.out.println(ans);
	}
}

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

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

	int odd = (N % 2 == 0) ? N / 2 : N / 2 + 1;

	cout <<fixed << setprecision(12) << (float)odd / N << endl;

	return 0;
}

Measured memory_bytes: 256
import collections
import itertools

def getint(): return int(input())
def getints(): return list(map(int, input().split()))


n = getint()
a = getints()
b = getints()

res = 0

for i in range(n):
    se = i + 1
    es = i
    tmp = sum(a[0:se]) + sum(b[es:])
    res = max(tmp, res)

print(res)

Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>



using namespace std;


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

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

#define MAX_H (2000)
#define MAX_W (2000)

using namespace std;

int num_lrss[MAX_H][MAX_W] = {}, num_udss[MAX_H][MAX_W] = {};

int main(int argc, char *argv[]) {
  // read inputs
  int H, W;
  char css[MAX_H][MAX_W + 1];
  scanf("%d %d", &H, &W);
  // printf("H = %d, W = %d\n", H, W);
  for (int i = 0; i < H; i++) {
    scanf("%s", css[i]);
    // printf("%s\n", css[i]);
  }

  // solve
  // calculate num_lrss
  for (int i = 0; i < H; i++) {
    int cur = 0, nxt;
    while (cur < W) {
      int num = 0;
      nxt = W;
      for (int j = cur; j < W; j++) {
        if (css[i][j] == '#') {
          nxt = j + 1;
          break;
        }
        num++;
      }
      for (int j = cur; j < nxt; j++) {
        num_lrss[i][j] = num;
      }
      cur = nxt;
    }
  }
  // for (int i = 0; i < H; i++) {
  //   for (int j = 0; j < W; j++) {
  //     printf("%d ", num_lrss[i][j]);
  //   }
  //   printf("\n");
  // }
  // calculate num_udss
  for (int j = 0; j < W; j++) {
    int cur = 0, nxt;
    while (cur < H) {
      int num = 0;
      nxt = H;
      for (int i = cur; i < H; i++) {
        if (css[i][j] == '#') {
          nxt = i + 1;
          break;
        }
        num++;
      }
      for (int i = cur; i < nxt; i++) {
        num_udss[i][j] = num;
      }
      cur = nxt;
    }
  }
  // for (int i = 0; i < H; i++) {
  //   for (int j = 0; j < W; j++) {
  //     printf("%d ", num_udss[i][j]);
  //   }
  //   printf("\n");
  // }
  // calc ans
  int ans = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (css[i][j] == '.') {
        ans = max(ans, num_lrss[i][j] + num_udss[i][j] - 1);
      }
    }
  }
  printf("%d\n", ans);

  return 0;
}


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

long x, y;

int main() {
    int N, A[10010], B; cin >> N;
    for(int i=0; i<N; ++i) cin >> A[i];
    for(int i=0; i<N; ++i){
        cin >> B;
        if(A[i]>=B) y += A[i]-B;
        else{
            x += (B-A[i]+1)/2;
            y += (B-A[i])%2;
        }
    }
    if(x<y) cout << "No" << endl;
    else cout << "Yes" << endl;
	return 0;
}


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

#define ll long long
#define Fi first
#define Se second
#define Pb push_back
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
#define vvp vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(a) printf("%s\n",(a).c_str())

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m) for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m) for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x) for(auto &item:(x))

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

template<typename TypeInt> //最大公約数
TypeInt GCD(TypeInt a,TypeInt b){
    if(a%b==0) return b;
    else return GCD(b,a%b);
}
template<typename TypeInt> //最小公倍数
TypeInt LCM(TypeInt a,TypeInt b){
    return a*b/GCD(a,b);
}

int IN_int(){
    int x;
    scanf("%d",&x);
    return x;
}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

const int NMAX = 200;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    CIN(a,b);
    int ans=(1+(a-b-1))*(a-b-1)/2;
    printf("%d\n",ans-b);

    return 0;
}


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

int main(){
  int n,x;
  char sta;
  long long cnt = 0;
  bool judge = false;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> sta >> x;
    if(sta == '(') cnt += x;
    else cnt -= x;
    if(cnt < 0) judge = true;
  }
  if(cnt != 0 || judge) cout << "NO" << endl;
  else cout << "YES" << endl;
}

Measured memory_bytes: 1160