akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const int INF = 1001001001;

bool check(int a, string str)
{
	if(a%15 == 0)
		return str == "FizzBuzz";
	if(a%5 == 0)
		return str == "Buzz";
	if(a%3 == 0)
		return str == "Fizz";
	return a == atoi(str.c_str());
}

int main()
{
	int n, m;
	while(scanf("%d%d", &n, &m), n){
		set<int> player;
		rep(i, n)
			player.insert(i);
		
		set<int>::iterator itr = player.begin();
		rep(i, m){
			char str[1024];
			int len;
			do{
				fgets(str, 1024, stdin);
				len = strlen(str);
				if(str[len-1] == '\n'){
					str[len-1] = '\0';
					--len;
				}
			}while(len==0);
			
			if(player.size() > 1){
				if(check(i+1, str))
					++itr;
				else
					player.erase(itr++);
				if(itr == player.end())
					itr = player.begin();
			}
		}

		int roop = 0;
		for(itr=player.begin(); itr!=player.end(); ++itr, ++roop)
			printf("%d%c", *itr+1, roop+1==player.size() ? '\n' : ' ');
	}
	return 0;
}

Measured memory_bytes: 1132
use std::io;
use std::io::BufRead;

fn main() {
    let stdin = io::stdin();
    let stdin_lock = stdin.lock();

    let mut splitted = stdin_lock.split(b'\n');
    let (n, k) = parse_two_nums(splitted.next().unwrap().unwrap().as_ref());

    let mut sushi_params = splitted.map(|line_res| {
            let line = line_res.unwrap();
            parse_two_nums(line.as_ref())
        })
        .collect::<Vec<(usize, usize)>>();
    sushi_params.sort_by(|a, b| b.1.cmp(&a.1));

    let mut not_duplicated = Vec::with_capacity(n);
    let mut duplicated = Vec::with_capacity(n);
    let mut dup_check = vec![false; n+1];
    for &(type_num, d_point) in sushi_params.iter() {
        if !dup_check[type_num] {
            not_duplicated.push(d_point);
            dup_check[type_num] = true;
        } else {
            duplicated.push(d_point);
        }
    }

    let mut sums_at_nth = Vec::with_capacity(not_duplicated.len() + 1);
    sums_at_nth.push(0);
    let mut total = 0;
    for d_point in not_duplicated.iter() {
        total += *d_point;
        sums_at_nth.push(total);
    }

    let mut sums_at_nth2 = Vec::with_capacity(duplicated.len() + 1);
    sums_at_nth2.push(0);
    total = 0;
    for d_point in duplicated.iter() {
        total += *d_point;
        sums_at_nth2.push(total);
    }

    let mut ans = 0;
    for i in 0..k+1 {
        let dup_num = i;
        let not_dup_num = k - dup_num;

        if sums_at_nth.len() > not_dup_num && sums_at_nth2.len() > dup_num {
            let temp = sums_at_nth[not_dup_num] + sums_at_nth2[dup_num] + not_dup_num * not_dup_num;
            if ans < temp {
                ans = temp;
            } else {
                break;
            }
        }
    }

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

fn parse(num_bytes: &[u8]) -> usize {
    let mut digit = num_bytes.iter()
        .take_while(|byte| is_num_byte(**byte))
        .count() as u32 - 1;
    num_bytes.iter()
        .take_while(|b| **b != b' ')
        .fold(0, |mut total, byte| {
            let num = 10_u32.pow(digit) * (*byte - b'0') as u32;
            total += num as usize;

            if let Some(checked) = digit.checked_sub(1) {
                digit = checked;
            }
            total
        })
}

fn parse_two_nums(multi_num_bytes: &[u8]) -> (usize, usize) {
    let mut not_num_idx: usize = 0;
    for (idx, byte) in multi_num_bytes.iter().enumerate() {
        if !is_num_byte(*byte) {
            not_num_idx = idx;
            break;
        }
    }
    not_num_idx += 1;
    (parse(&multi_num_bytes[0..not_num_idx]), parse(&multi_num_bytes[not_num_idx..]))
}

fn is_num_byte(byte: u8) -> bool {
    for b in b'0' .. b'9'+1 {
        if b == byte { return true }
    }
    false
}

Measured memory_bytes: 8444
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#define FOR(i,x,y) for(int (i)=(x); (i)<(y);(i++))
#define INT long long
#define MOD 1000000007
#define oo 978654321
#define OO 9999999987654321ll
using namespace std;

INT n, g[100010];
vector<INT> G[100010];

int dfs(int v, int p)
{
    int ret = 0;
    for(int w : G[v])
        if( p != w )
            ret ^= dfs(w, v) + 1;
    return ret;
}

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i = 0, a, b ; i < n-1 ; i++ )
        cin>>a>>b, G[a].push_back(b), G[b].push_back(a);
    cout<<(dfs(1, 1)?"Alice":"Bob")<<endl;;
}


Measured memory_bytes: 10368
#include <cstdio>
#include <cstring>
#include <deque>
#define MAXN 1000010
using namespace std;

int n;
int a[MAXN],cnta;
int p[MAXN];
deque<int> S;

void input(){
	static char str[MAXN];
	scanf("%s",str+1);
	n=strlen(str+1);
	for(int i=0;i<n;i++) a[i]=str[n-i]-'0';
}

void mul(){
	for(int i=0;i<n;i++) a[i]*=9;
	for(int i=0;i<n;i++)
		if(a[i]>=10){
			a[i+1]+=a[i]/10;
			a[i]%=10;
		}
	if(a[n]) n++;
	for(int i=0;i<n;i++) cnta+=a[i];
}

void add(){
	a[0]+=9;
	cnta+=9;
	for(int i=0;i<n;i++)
		if(a[i]>=10){
			a[i]-=10;
			a[i+1]+=1;
			cnta-=9;
		}else break;
	if(a[n]) n++;
}

bool check(int k){
	if(n<=4){
		int res=0;
		for(int i=n-1;i>=0;i--)
			res=res*10+a[i];
		if(res<k) return 0;
	}
	if(k<cnta) return 0;
	return (k-cnta)%9==0;
}

int gao(){
	int cnt=0;
	while(1){
		add();
		cnt++;
		if(check(9*cnt)) return cnt;
	}
}

int main(){
#ifdef DEBUG
	freopen("E.in","r",stdin);
#endif
	input();
	mul();
	printf("%d\n",gao());
	return 0;
}


Measured memory_bytes: 6528
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	int n;
	cin>>n;
	vector<int> h(n);
	REP(i, n) cin>>h[i];
	REP(i, n) {
		cout<<h[n - 1 - i];
		if(i != n - 1) cout<<" ";
		else cout<<endl;
	}
}

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

int main(){
	int a,b,k;
	cin >> a >> b >> k;
	if(b-a+1<2*k){
		for(int i=a;i<=b;i++){
			cout << i <<endl;
		}
	}
	else{
		for(int j=a;j<=a+k-1;j++){
			cout << j <<endl;
		}
		for(int l=b-k+1;l<=b;l++){
			cout << l << endl;
		}
	}
	return 0;
}

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

typedef long long ll;
typedef vector<long long> vll;
typedef vector<vector<long long>> mll;
typedef vector<pair<long long, long long>> vpl;
typedef pair<long long, long long> pll;
#define minimize(var, val) (var = min((val), var))

const long long MOD = 1e9 + 7;

int main() {
    ll n, k;
    cin >> n >> k;
    vll a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vll dp(k + 1), nx;
    dp[0] = 1;
    for (int person = 0; person < n; person++) {
        nx = vll(k + 2, 0);
        for (int candies = 0; candies <= k; candies++) {
            ll ways = dp[candies] % MOD;
            nx[candies] += ways;
            nx[min(candies + a[person], k) + 1] -= ways;
        }
        for (int i = 0; i <= k; i++)
            dp[i] = (nx[i] + (i > 0 ? dp[i - 1] : 0) + MOD) % MOD;
    }
    cout << (dp[k] % MOD) << endl;
}

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

#define pb push_back
#define ll long long
#define maxn 200005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
const int mod = 1e9+7;
map<ll,ll>mp;
ll solve(ll x){
    if(mp.count(x)){
        return mp[x];
    }
    if(x <= 1){
        return mp[x] = 1;
    }
    else{
        return mp[x] = solve(x/2) * 2 + 1;
    }
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    cout << solve(n) << '\n';
}

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

void evenOdd() {
	//freopen("even_odd.txt", "r", stdin);
	int a, b;
	cin >> a >> b;

	if (a*b % 2 == 0)
		cout << "Even" << endl;
	else
		cout << "Odd" << endl; 
}

int main() {
	evenOdd();
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

int solve(const vector<int> &height) {
  int n = height.size();
  vector<int> to_left(n), to_right(n);
  {
    stack<int> st;
    for (int i = 0; i < n; ++i) {
      while (!st.empty() && height[st.top()] >= height[i])
        st.pop();
      if (st.empty()) to_left[i] = 0;
      else to_left[i] = st.top() + 1;
      st.push(i);
    }
  }
  {
    stack<int> st;
    for (int i = n - 1; i >= 0; --i) {
      while (!st.empty() && height[st.top()] >= height[i])
        st.pop();
      if (st.empty()) to_right[i] = n - 1;
      else to_right[i] = st.top() - 1;
      st.push(i);
    }
  }
  int result = 0;
  for (int i = 0; i < n; ++i)
    result = max(result, (to_right[i] - to_left[i] + 1 + 1) * height[i]);
  return result;
}

int main() {
  int nr, nc;
  scanf("%d %d", &nr, &nc);
  vector<vector<int>> field(nr, vector<int>(nc));
  for (int y = 0; y < nr; ++y) {
    string line(nc, ' ');
    scanf("%s", &line[0]);
    for (int x = 0; x < nc; ++x)
      field[y][x] = (line[x] == '#');
  }
  array<vector<int>, 2> lcp_down = {vector<int>(nr - 1), vector<int>(nr - 1)};
  int result = 0;
  for (int x = nc - 1; x >= 0; --x) {
    for (int y = 0; y + 1 < nr; ++y)
      for (int inv = 0; inv < 2; ++inv)
        if ((field[y][x] == field[y + 1][x]) ^ inv) ++lcp_down[inv][y];
        else lcp_down[inv][y] = 0;
    vector<int> lcps;
    for (int y = 0; y + 1 < nr; ++y) {
      int invy = field[y][x], invy1 = field[y + 1][x];
      lcps.push_back(lcp_down[invy ^ invy1][y]);
    }
    result = max(result, nc - x);
    result = max(result, solve(lcps));
  }
  printf("%d\n", result);
  return 0;
}


Measured memory_bytes: 18048
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<utility>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long lo;
const int mod=1000000007,N=500005;
lo a,b,c,d,e,f,g,h[N],arr[N];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	// freopen("in.txt","r",stdin);
	// freopen("out.txt","w",stdout);
	lo arr[33]={0,1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	cin >> a;
	cout << arr[a] << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a)), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve() {
  ll N, M; cin >> N >> M;
  vector<ll> a(N);
  ld sum = 0;
  rep(i, N) {
    cin >> a[i];
    sum += a[i];
  }
  ll cnt = 0;
  rep(i, N) {
    if (a[i] >= sum / (4*M)) cnt++;
  }
  if (cnt >= M) Yes();
  else No();
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 888
#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;
typedef vector<P> Pol;
D eps=1e-9;
inline D dot(P a,P b){
	return real(conj(a)*b);
}
inline D cro(P a,P b){
	return imag(conj(a)*b);
}
int ccw(P a,P b,P c){
	if(cro(b-a,c-a)>eps) return 1;
	if(cro(b-a,c-a)<-eps) return -1;
	if(abs(abs(a-c)+abs(c-b)-abs(a-b))<eps) return 0;
	return -1;
}
inline P perp(L l,P p){
	D t=dot(p-l.fs,l.fs-l.sc)/norm(l.fs-l.sc);
	return l.fs+t*(l.fs-l.sc);
}
inline bool iSP(L s,P p){
	P a=s.fs,b=s.sc,c=p;
	return abs(abs(a-c)+abs(c-b)-abs(a-b))<eps;
}
inline D dSP(L s,P p){
	P q=perp(s,p);
	return iSP(s,q) ? abs(p-q) : min(abs(p-s.fs),abs(p-s.sc));
}
inline bool iLSex(L l, L s){		//intersect(excluding endpoint)
	return cro(l.sc-l.fs,s.fs-l.fs)*cro(l.sc-l.fs,s.sc-l.fs)<-eps;
}
inline P intLL(L a,L b){
	D t=cro(a.sc-a.fs,a.sc-b.fs)/cro(a.sc-a.fs,b.sc-b.fs);
	return b.fs+t*(b.sc-b.fs);
}
inline Pol convexcut(Pol p,L l){	//left
	Pol ret;
	rep(i,p.size()){
		if(ccw(l.fs,l.sc,p[i])!=-1) ret.pb(p[i]);
		L s=L(p[i],p[(i+1)%p.size()]);
		if(iLSex(l,s)) ret.pb(intLL(l,s));
	}
	return ret;
}
int N;
Pol pol,polc;
P p[100];
bool check(D m){
	rep(i,N){
		P a=p[i],b=p[(i+1)%N];
		P x=(b-a)*P(0,1);
		x=x/abs(x)*m;
		L l=L(a+x,b+x);
		pol=convexcut(pol,l);
	}
	return pol.size()==0;
}

int main(){
	while(true){
		cin>>N;
		if(N==0) break;
		pol.clear();
		rep(i,N){
			int xx,yy;
			cin>>xx>>yy;
			p[i]=P(xx,yy);
			pol.pb(p[i]);
		}
		polc=pol;
		D ub=10000,lb=0;
		rep(tt,40){
			pol=polc;
			D m=(ub+lb)/2;
			if(check(m)) ub=m;
			else lb=m;
		}
		printf("%.12f\n",ub);
	}
}

Measured memory_bytes: 1240
import java.util.Scanner;

public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n,i;
		n=sc.nextInt();
		i=sc.nextInt();
		if(i==n)
			System.out.println(1);
		else
		{
			System.out.println(n-i+1);
		}
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
const int maxn = 234567;
int a[maxn], v[maxn];
int main(){
	int n; cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	vector<int> good;
	for(int i = n; i >= 1; i--){
		int sum = 0;
		for(int j = i + i; j <= n; j += i) sum ^= v[j];
		v[i] = sum ^ a[i];
		if(v[i]) good.push_back(i);
	}
	cout << good.size() << endl;
	for(int v : good) cout << v << " ";
	cout << endl;
	return 0;
}

Measured memory_bytes: 3064
#include<stdio.h>


int main(void)
{
    int i,n;

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

    if(n<100){
        if(i==0)
            printf("%ld",n);
        else if(i==1)
            printf("%ld",100*n);
        else
            printf("%ld",10000*n);
    }
    else if(n==100){
        if(i==0)
            printf("%d",n+1);
        else if(i==1)
            printf("%d",100*(n+1));
        else
            printf("%d",10000*(n+1));
    }
    return 0;
}


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

#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif

signed main(){

  int n; cin >> n;
  vector<double> v(n);
  for(int i = 0; i < n; i++){
    cin >> v[i];
  }
  sort(v.begin(),v.end());

  while(v.size() > 1){
    double x = (v[0] + v[1]) / 2;
    v.erase(v.begin());
    v.erase(v.begin());
    v.push_back(x);
    sort(v.begin(),v.end());
  }
  cout << v[0] << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
namespace Sample
{
  class Sample
  {
    static void Main(string[] args)
    {
    string str=Console.ReadLine();
      char[] tochar=str.ToCharArray();
 

      if(tochar[0]==tochar[1]&&tochar[1]==tochar[2]){
        Console.WriteLine("Yes");
        }else if(tochar[1]==tochar[2]&&tochar[2]==tochar[3])
      {Console.WriteLine("Yes");
        }
      else{
        Console.WriteLine("No");
       }
        
        
   

      
      
    }
    
  }

}


Measured memory_bytes: 25748
#include <bits/stdc++.h>
using namespace std;
int main()
{
       string s;
       cin >> s;
       int sum = 0;
       int len = s.length();
       for (int i = 0; i < len; i++)
       {
              sum += s[i] - 48;
       }
       if (sum % 9 == 0)
              cout << "Yes" << endl;
       else
       {
              cout << "No" << endl;
       }

       return 0;
}

Measured memory_bytes: 3708
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int M,T,P,R;
	while(cin>>M>>T>>P>>R,M+T+P+R){
		bool h[51][11]={0};
		int pe[51][11]={0};
		int sum[51]={0};
		int co[51]={0};
		int m,t,p,ju;
		rep(i,R){
			cin>>m>>t>>p>>ju;
			t--;p--;
			if(!ju){//OK
				h[t][p]=true;
				sum[t]+=m+20*pe[t][p];
				co[t]++;
			}else pe[t][p]++;
		}
		int out[51];
		rep(i,50)out[i]=i;
		loop(i,1,T)for(int j=T-1;j>=i;j--){
			if(co[out[j-1]]<co[out[j]])swap(out[j-1],out[j]);
			else if(co[out[j-1]]==co[out[j]]&&sum[out[j-1]]>sum[out[j]])
				swap(out[j-1],out[j]);
			else if(co[out[j-1]]==co[out[j]]&&
					sum[out[j-1]]==sum[out[j]]&&
					out[j-1]<out[j])
				swap(out[j-1],out[j]);

		}
		rep(i,T){
			if(i){
				if(co[out[i-1]]==co[out[i]]&&sum[out[i-1]]==sum[out[i]])cout<<"=";
				else cout<<',';
			}
			cout<<out[i]+1;
		}
		cout<<endl;
	}
}

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

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    
		String str = "";
		try {
			while ((str = in.readLine()) != null) {
				String[] p = str.split(" ");
				int a = Integer.parseInt(p[0]);
				int b = Integer.parseInt(p[2]);
				
				if (p[1].equals("+")) System.out.println(a + b);
				if (p[1].equals("-")) System.out.println(a - b);
				if (p[1].equals("*")) System.out.println(a * b);
				if (p[1].equals("/")) System.out.println(a / b);
				
				if (p[1].equals("?")) break;
			}
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

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

int main() {
  int n;
  cin >> n;
  int a;
  cin >> a;
  bool t = false;
  
  for(int i=0; i < a+1; i++){
    int tn = n - i;
    if(tn % 500 == 0){
      t = true;
    }
  }
  
  if(t){
    cout << "Yes" << endl;
  }else{
	cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
typedef long long ll;

const int N = 1e5 + 5;

int n, mod;
vector<int> g[N];
int ans[N], par[N], sub[N];

void dfs(int u, int p) {
  par[u] = p;
  sub[u] = 1;
  for(auto v : g[u]) {
    if(v != p) {
      dfs(v, u);
      sub[u] = (1LL * sub[u] * (1 + sub[v])) % mod;
    }
  }
}

void dfs2(int u, int p) {
  int len = sz(g[u]);
  if(len == 0) {
    ans[u] = (1 + p) % mod;
    return;
  }
  vector<int> left(len, 0), right(len, 0);
  for(int i = 0; i < len; i++) {
    int v = g[u][i], j = len - i - 1;
    int w = g[u][j];
    left[i] = (1 + sub[v]) % mod;
    right[j] = (1 + sub[w]) % mod;
    if(i > 0) {
      left[i] = (1LL * left[i] * left[i - 1]) % mod;
      right[j] = (1LL * right[j] * right[j + 1]) % mod;
    }
  }
  ans[u] = ((1LL + p) * left[len - 1]) % mod;
  for(int i = 0; i < len; i++) {
    int v = g[u][i];
    int nxt = (1 + p) % mod;
    if(i > 0) nxt = (1LL * nxt * left[i - 1]) % mod;
    if(i < len - 1) nxt = (1LL * nxt * right[i + 1]) % mod;
    dfs2(v, nxt);
  }
}

int main()
{
  cin >> n >> mod;
  for(int i = 0; i + 1 < n; i++) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(0, -1);
  for(int i = 0 ; i < n ; i++)
    if(~par[i]) {
      for(auto it = g[i].begin(); it != g[i].end(); it++)
        if(*it == par[i]) {
          g[i].erase(it);
          break;
        }
    }
  dfs2(0, 0);
  for(int i = 0; i < n; i++)
    cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 20224
let nAndLog n = n, n |> double |> log10 |> floor |> int

stdin.ReadLine() |> int
|> nAndLog
|> fun (n, l) ->
    [for k in 0..l do
        yield match k with
              | 0 -> 9
              | 2 -> 900
              | 4 -> 90000
              | _ -> 0]
    |> Seq.sum
    |> (+) (
        match l with
        | 0 -> n - 9
        | 2 -> n - 900 - 99
        | 4 -> n - 90000 - 9999
        | _ -> 0
        )
|> printfn "%d"


Measured memory_bytes: 14044
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int A = Integer.parseInt(sc.get());
		int B = Integer.parseInt(sc.get());
		System.out.println(Math.max(A - 2 * B, 0));
	}
}

class Main {
	public static void main(String... args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<String>() {
			StringTokenizer line;

			public String get() {
				while (line == null || !line.hasMoreTokens()) try {
					line = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
				return line.nextToken();
			}
		});
	}
}

Measured memory_bytes: 23380
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;

int main() {
	int N, Y;
	int x = -1;
	int y = -1;
	int z = -1;

	cin >> N >> Y;

	for (int i = 0; i <= N; i++) {
		for (int j = 0; j <= N - i; j++) {
			if (i * 10000 + j * 5000 + (N - i - j) * 1000 == Y) {
				x = i;
				y = j;
				z = N - i - j;
				break;
			}
		}
	}
	

	cout << x << ' ' << y << ' ' << z << endl;

	return 0;
}

Measured memory_bytes: 256
//package atcoder;
 
import java.util.*;
//import java.math.BigDecimal;
 
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		int X = sc.nextInt();
		int sum = 500*K;
		if(sum>=X) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
			}
	}
}

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s,t,u;
  int a,b;
  cin >>s>>t>>a>>b>>u;

  if(s == u)
    cout << a-1 << " " << b << endl;
  else
    cout << a << " " << b-1 << endl;

  return 0;
}


Measured memory_bytes: 888
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var ary = ToIntArray(input.ReadLine(), n);

        bool reverse = false;
        var li = new LinkedList<int>();

        for(int i=0; i<n; i++) {
            if (reverse) li.AddFirst(ary[i]);
            else li.AddLast(ary[i]);

            reverse = !reverse;
        }

        var sb = new StringBuilder();

        if (reverse) {
            foreach (var x in li.Reverse()) {
                sb.Append(x);
                sb.Append(' ');
            }
        } else {
            foreach (var x in li) {
                sb.Append(x);
                sb.Append(' ');
            }
        }

        return sb;
    }


    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 51264
import java.util.*;

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

        int A = sc.nextInt();
        int B = sc.nextInt();

        if ((A + B) % 2 == 0)
            System.out.println((A + B) / 2);
        else
            System.out.println("IMPOSSIBLE");

    }
}

Measured memory_bytes: 23892
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  long long n,a,b;

  cin >> n >> a >> b;

  long long m = n / (a + b);

  long long l = n - m * (a + b);

  long long k = l > a ? a : l;

  cout << m * a + k;

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
cnt = 0
k = (n-1)//2
a = (k+1)//2
b = k - a
for i in range(1, a+1):
    print(i, 2*a+1-i)
    cnt += 1
    if cnt == m:
        exit()
for i in range(b):
    print(2*a+1+i, n - (n+1)%2 - i)
    cnt += 1
    if cnt == m:
        exit()

Measured memory_bytes: 9280
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String crossSection = in.nextLine();
        int highIndex = 0;
        int height = 0;
        int maxHeight = 0;
        for (int i = 0; i < crossSection.length(); i++) {
            char c = crossSection.charAt(i);
            if (c == '/') {
                height++;
            } else if (c == '\\') {
                height--;
            }

            if (height > maxHeight) {
                maxHeight = height;
                highIndex = i;
            }
        }

        List<Integer> areas;
        if (highIndex == 0) {
            areas = findAreas(reverseCrossSection(crossSection));
            Collections.reverse(areas);
        } else if (highIndex == crossSection.length() - 1) {
            areas = findAreas(crossSection);
        } else {
            String firstPart = crossSection.substring(0, highIndex + 1);
            String secondPart = reverseCrossSection(crossSection.substring(highIndex + 1));
            List<Integer> areas1 = findAreas(firstPart);
            List<Integer> areas2 = findAreas(secondPart);
            areas = new ArrayList<>(areas1);
            Collections.reverse(areas2);
            areas.addAll(areas2);
        }

        int totalArea = 0;
        for (Integer area : areas) {
            totalArea += area;
        }

        System.out.println(totalArea);
        System.out.print(areas.size());

        for (Integer area : areas) {
            System.out.print(" " + area);
        }

        System.out.println();
    }

    private static String reverseCrossSection(String crossSection) {
        String reversed = new StringBuilder(crossSection).reverse().toString();
        reversed = reversed.replace('/', 'u');
        reversed = reversed.replace('\\', '/');
        reversed = reversed.replace('u', '\\');
        return reversed;
    }

    private static List<Integer> findAreas(String crossSection) {
        Stack<Character> downStack = new Stack<>();
        int currentArea = 0;
        List<Integer> areas = new ArrayList<>();
        for (int i = 0; i < crossSection.length(); i++) {
            char c = crossSection.charAt(i);
            switch (c) {
                case '/':
                    if (!downStack.empty()) {
                        currentArea += downStack.size() * 2 - 1;
                        downStack.pop();
                        if (downStack.empty()) {
                            areas.add(currentArea / 2);
                            currentArea = 0;
                        }
                    }
                    break;
                case '\\':
                    downStack.push(c);
                    currentArea += downStack.size() * 2 - 1;
                    break;
                case '_':
                    currentArea += downStack.size() * 2;
                    break;
            }
        }
        return areas;
    }
}



Measured memory_bytes: 30212
#include<iostream>
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
using ll=long long;
int main()
{
    int a,b,c;
    cin>>c;
    b=c/100;
    a=c%100;
    if(1<=b&&b<=12)
    {
        if(1<=a&&a<=12)
            printf("AMBIGUOUS\n");
        else
            printf("MMYY\n");
    }
    else
    {
        if(1<=a&&a<=12)
            printf("YYMM\n");
        else
            printf("NA\n");
    }
    return 0;
}


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

using namespace std;

const int N=2e5+5;
int n,m,a[N],b[N],ans,num;
struct node
{
	int l,r,c;
}A[N];

int solve(int lim)
{
    for(int i=1;i<=m;i++) 
		b[i]=(a[i]>=lim);
    num=0;
    int i=1;
    while(i<m)
    {
        if(b[i]!=b[i+1]) 
		{
			i++;
			continue;
		}
        A[++num].l=i;
		A[num].c=b[i];
        while(i<m && b[i+1]==b[i]) 
			i++;
        A[num].r=i;
    }
    if(num==0) 
		return b[1];
    A[0].r=0;
    for(int i=1;i<=num;i++)
    {
        int l=A[i-1].r+1;
		int r=A[i].l-1;
        if(l>r) 
			continue;
        int mid=(l+r)/2;
        A[i-1].r=mid;
		A[i].l=mid+1;
    }
    int l=A[num].r+1;
	int r=m,mid;
    if(l<=r) 
	{
		mid=(l+r)/2;
		A[num].r=mid;
	}
    for(int i=1;i<=num;i++) 	
		if(A[i].l<=n && A[i].r>=n) 
			return A[i].c;
}
int main()
{
    scanf("%d",&n);
    m=2*n-1;
    for(int i=1;i<=m;i++) 
		scanf("%d",&a[i]);
    int l=1,r=m;
    while(l<=r)
    {
        int mid=(l+r)/2;
        if(solve(mid)) 
			ans=mid,l=mid+1;
        else 
			r=mid-1;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 2432
l, r = map(int, input().split())
mod = 2019
if r-l >= 2019:
    print(0)
else:
    ans = 2020
    for i in range(l, r+1):
        for j in range(i+1, r+1):
            if i%mod == 0 or j%mod == 0:
                ans = 0
                break
            ans = min(ans, (i*j)%mod)
        if ans == 0:
            break
    print(ans)


Measured memory_bytes: 64752
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/
const int MOD = 1000000007;

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, k; cin >> n >> k;
  vector<int> a(n); REP(i, n) cin >> a[i];
  vector<vector<long long> > dp(n + 1, vector<long long>(k + 1, 0));
  vector<vector<long long> > sum(n + 1, vector<long long>(k + 1, 0));
  REP(i, n + 1) dp[i][0] = sum[i][0] = 1;
  FOR(j, 1, k + 1) sum[0][j] = 1;
  // REP(i, n) FOR(j, 1, k + 1) REP(k, min(a[i] + 1, j + 1)) {
  //   (dp[i + 1][j] += dp[i][j - k]) %= MOD;
  // }
  REP(i, n) FOR(j, 1, k + 1) {
    if (j <= a[i]) dp[i + 1][j] = sum[i][j];
    else dp[i + 1][j] = (sum[i][j] - sum[i][j - a[i] - 1] + MOD) % MOD;
    sum[i + 1][j] = (sum[i + 1][j - 1] + dp[i + 1][j]) % MOD;
  }
  cout << dp[n][k] << '\n';
  return 0;
}


Measured memory_bytes: 159088
#include <string>
#include <vector>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <map>
using namespace std;


#define prec(i) cout << fixed << setprecision(i)

const long long int MOD = 1000000007;

long long int fact(long long int k) {
	long long int sum = 1;
	for (long long int i = 2; i <= k; i++)
		sum *= i;

	return sum;
}

int ctoi(char c) {
	if (c >= '0' && c <= '9')
		return c - '0';
	else
		return -1;
}

long long int pow_mod(int a, int b) {
	long long int  ans = 1;
	for (int i = 0; i < b; i++)
		ans = (ans * a) % MOD;

	return ans;
}

vector<int> a;


int main()
{
	long long int a1, a2, a3;

	cin >> a1 >> a2 >> a3;

	if(a1 + a2 + a3 >= 22)
		cout << "bust" << endl;
	else
		cout << "win" << endl;


	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
int i=n/100;
int j=n%100;
if(1<=i&&i<=12){
if(1<=j&&j<=12)
printf("AMBIGUOUS\n");
else
 printf("MMYY\n");
}
else{
if(1<=j&&j<=12)
printf("YYMM\n");
else
 printf("NA\n");
}
}


Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdlib>

using namespace std;

#define int long long
#define LL long long
#define ULL unsigned long long

const int LL_INF = ~(ULL)0 >> 1;

typedef pair<int, int> P;

P s[202], pho[1002];

signed main() {
    int m, n;

    while (cin >> m, m) {
        for (int i = 0; i < m; ++i) {
            int x, y;
            cin >> x >> y;
            s[i] = P(x, y);
        }

        cin >> n;
        for (int i = 0; i < n; ++i) {
            int x, y;
            cin >> x >> y;
            pho[i] = P(x, y);
        }

        sort(s, s + m);
        sort(pho, pho + n);

        for (int i = 0; i < n - m; ++i) {
            int count = 0;
            int nx = s[count + 1].first - s[count].first, ny = s[count + 1].second - s[count].second, pre = i;

            for (int j = i; j < n; ++j) {
                if ((pho[j].first - pho[pre].first != nx) || (pho[j].second - pho[pre].second != ny)) continue;

                if (count == m - 2) {
                    cout << pho[i].first - s[0].first << " " << pho[i].second - s[0].second << endl;
                }
                count++;
                nx = s[count + 1].first - s[count].first;
                ny = s[count + 1].second - s[count].second;
                pre = j;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1180
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
vector<pair<int,pair<int,int> > >G;
int parent[1<<17],rankt[1<<17];
pair<int,int>x[1<<17],y[1<<17];
int find(int a)
{
	return a!=parent[a]?parent[a]=find(parent[a]):a;
}
int unite(int a,int b)
{
	int pa=find(a),pb=find(b);
	if(rankt[pa]<rankt[pb])
	{
		parent[pb]=pa;
	}
	else
	{
		parent[pa]=pb;
		if(rankt[pa]==rankt[pb])rankt[pb]++;
	}
}
main()
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		parent[i]=i;
		cin>>x[i].first>>y[i].first;
		x[i].second=y[i].second=i;
	}
	sort(x,x+n);
	sort(y,y+n);
	for(int i=0;i<n-1;i++)
	{
	G.push_back(make_pair(abs(x[i+1].first-x[i].first),make_pair(x[i].second,x[i+1].second)));
	G.push_back(make_pair(abs(y[i+1].first-y[i].first),make_pair(y[i].second,y[i+1].second)));
	}
	sort(G.begin(),G.end());
	long ans=0;
	for(int i=0;i<G.size();i++)
	{
		int nx=G[i].second.first,ny=G[i].second.second,cost=G[i].first;
		int px=find(nx),py=find(ny);
		if(px==py)continue;
		else
		{
			ans+=cost;
			unite(px,py);
		}
	}
	cout<<ans<<endl;
}


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

int main() {
  int N, K, x[101];
  cin >> N >> K;
  for (int i = 0; i < N; i++) cin >> x[i];
    
  int ans = 0;
  for (int i = 0; i < N; i++) {
    int tmp = min(x[i], K-x[i]);
    ans += tmp;
  }
  cout << 2 * ans << endl;
}

Measured memory_bytes: 3596
N,M=map(int, input().split())
p="POSSIBLE"
S=set()
a=[]
for _ in range(M):
    A, B = map(int, input().split())
    if A == 1:
        a.append(B)
    else:
        S.add((A,B))
print(p if any([(i,N) in S for i in a]) else "IM"+p)

Measured memory_bytes: 66904
N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

max_v = 0

for i in range(N):
    y = 0
    cnt = 0
    for j in range(N):
        cnt += A[y][j] 
        if i == j:
            y = 1
            cnt += A[y][j]
    max_v = max(max_v, cnt)
print(max_v)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#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, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    int N, L, L_max = 0, total = 0;
    cin >> N;
    REP(i, N) {
        cin >> L;
        L_max = max(L, L_max);
        total += L;
    }
    if (total - L_max > L_max) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

using namespace std;

double binom(int m,int k,double p)
{
	double x=pow(p,k)*pow(1-p,m-k);
	for(int i=0;i<k;i++)
		x*=(m-i)/(i+1.);
	return x;
}

int main()
{
	for(int n,m,L;cin>>n>>m>>L;){
		vector<double> ps(n);
		vector<int> ts(n),vs(n);
		for(int i=0;i<n;i++) cin>>ps[i]>>ts[i]>>vs[i],ps[i]/=100;
		
		vector<vector<double>> ss(n,vector<double>(m+1));
		for(int i=0;i<n;i++)
			for(int j=0;j<=m;j++)
				ss[i][j]=binom(m,j,ps[i]);
		
		vector<double> res(n);
		for(int i=0;i<n;i++)
			for(int j=0;j<=m;j++){
				double temp=1;
				for(int k=0;k<n;k++) if(k!=i){
					double win=0;
					for(int l=0;l<=m;l++)
						// l/vs[i]+j*ts[i] < l/vs[k]+l*ts[k]
						if((L+j*ts[i]*vs[i])*vs[k]<(L+l*ts[k]*vs[k])*vs[i])
							win+=ss[k][l];
					temp*=win;
				}
				res[i]+=ss[i][j]*temp;
			}
		
		for(int i=0;i<n;i++)
			printf("%.8f\n",res[i]);
	}
}

Measured memory_bytes: 1384
//精選10問⑤の類題
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
    public class ABC_090_C
    {
        public static void Main()
        {
            var str = Console.ReadLine().Split(' ');
            var a = int.Parse(str[0]);
            var b = int.Parse(str[1]);
            var result = 0;

            for (int i =a;i<=b;i++){
                string num = i.ToString();
                if (num[0] == num[4] && num[1] == num[3])
                {
                    result++;
                }
            }
            Console.WriteLine(result);
            Console.Read();
        }

    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#define rep(i, N) for(int (i)=0;(i)<(N);(i)++)
using namespace std;

int main(){
    int N, min, max, j, count=0;
    long min_cost=1000000, temp_cost;
    cin >> N;
    vector<int> a(N);
    rep(i, N) cin>>a[i];
    max = *max_element(a.begin(), a.end());
    min = *min_element(a.begin(), a.end());
    for(int i = min; i < max; i++){
        temp_cost=0;
        rep(j, N){
            temp_cost += (a[j]-i)*(a[j]-i);
        }
        if(min_cost>=temp_cost){
            min_cost=temp_cost;
            count+=1;
        }
    }
    if(count==0)min_cost=0;
    cout<<min_cost<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))

int compare_int(const void *a, const void *b){return *(int*)a - *(int*)b;}

int main(void){
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int h[n];
	int hMax=0;
	for(int i=0;i<n;i++){
		scanf("%d",&h[i]);
		hMax=MAX(h[i],hMax);
	}
	qsort(h,n,sizeof(int),compare_int);
	
	int min=hMax/a,max=hMax/b+1;
	int ans=0;
	while(max-min>1){
		int mid=min+(max-min)/2;
		ans=0;
		for(int i=0;i<n;i++){
			if(h[i]>mid*b){
				ans+=(h[i]-mid*b)/(a-b);
				if((h[i]-mid*b)%(a-b))ans++;
				if(ans>mid)break;
			}
		}
		if(ans>mid)min=mid;
		else max=mid;
	}
	printf("%d",max);
	return 0;
}

Measured memory_bytes: 892
import sys
from collections import defaultdict

#+++++
		
def main():
	n, k = map(int, input().split())
	aal = list(map(int, input().split()))
	
	sss = [0]*(n+1)
	si=0
	for i, a in enumerate(aal):
		si+=a-1
		sss[i+1]=si%k
	
	count=0
	mkl_dict=defaultdict(lambda :0)
	for j in range(n+1):
		sj=sss[j]
		if j-k >= 0:
			mkl_dict[sss[j-k]]-=1
		count += mkl_dict[sj]
		mkl_dict[sj] += 1
			
	print(count)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 111308
#include<bits/stdc++.h>
using namespace std;
long long int w[105];
long long int v[105];
long long int dp[105][100005];
long long int func(int W,int n)
{
    if(n==0||W==0)
    return 0;
    if(dp[n][W]!=-1)
    return dp[n][W];
    long long int maxi;
    if(w[n-1]>W)
    {
        return func(W,n-1);
    }
    else
    {
        maxi=max(v[n-1]+func(W-w[n-1],n-1),func(W,n-1));
    }
    return dp[n][W]=maxi;
}
int main()
{
    int n,W;
    cin>>n>>W;
    memset(dp,-1,sizeof(dp));
    memset(w,0,sizeof(w));
    memset(v,0,sizeof(v));
    for(int i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    }
    cout<<func(W,n);
}

Measured memory_bytes: 85720
K,N = map(int,input().split())
A = list(map(int,input().split()))

ans = 10**16

for i in range(N-1):
    tmp = K-(A[i+1]-A[i])
    ans = min(tmp,ans)

tmp = K-(K+A[0]-A[N-1])
ans = min(tmp,ans)

print(ans)

Measured memory_bytes: 77516
def main():
    import sys
    from copy import copy
    input = sys.stdin.readline

    N, M, Q = map(int, input().split())
    ABCD = [list(map(int, input().split())) for i in range(Q)]

    def dfs(num_list):
        if len(num_list) == N:
            nonlocal s
            tmp_s = 0
            for a, b, c, d in ABCD:
                if num_list[b-1] - num_list[a-1] == c:
                    tmp_s += d
            s = max(tmp_s, s)

            return
        else:
            for i in range(num_list[-1], M+1):
                dfs(num_list+[i])

    s = 0
    for i in range(1, M+1):
        dfs([i])
    print(s)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9344
#include <iostream>
#include <vector>
#define rep(S, L) for (int i = S; i < L; ++i)
using namespace std;

int main() {
  int n;
  cin >> n;
  int a[100] = {};
  int mi = 100;
  int ma = -100;

  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    mi = min(a[i], mi);
    ma = max(a[i], ma);
  }
  int d[202] = {};
  for (int i = mi; i <= ma; ++i) {
    for (int j = 0; j < n; ++j) {
      d[i + 100] += (a[j] - i) * (a[j] - i);
    }
  }
  int ans = 100000000;

  for (int i = mi; i <= ma; ++i) {
    if (d[i + 100] < ans) {
      ans = d[i + 100];
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3132
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        const int ConstVal = 753;
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var min = int.MaxValue;

            for (var i = 0; i < s.Length - 2; i++)
            {
                min = Math.Min(Math.Abs(ConstVal - int.Parse(s.Substring(i, 3))), min);
            }
            Console.WriteLine(min);
        }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323
#define ll long long int
#define vi vector <int>
#define vl vector <ll>
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define MOD 1000000007
ll power(ll a, ll b) { //a^b
	ll res = 1;
	a = a % MOD;
	while (b > 0) {
		if (b & 1) {res = (res * a) % MOD; b--;}
		a = (a * a) % MOD;
		b >>= 1;
	}
	return res;
}
 
ll gcd(ll a, ll b) {return (b == 0) ? a : gcd(b, a % b);}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n;
	cin>>n;
	vl v(n);
	for(ll i=0;i<n;i++)
	    cin>>v[i];
	vl prev(n);
	prev[0]=v[0];
	ll ans=0;
	for(ll i=1;i<n;i++){
	    prev[i]=max(prev[i-1],v[i]);
	    ans+=max(0LL,prev[i]-v[i]);
	}
	cout<<ans<<"\n";
}

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

using namespace std;
#define lint long long

int main() {
    int N;
    cin >> N;
    vector<lint> a(N);
    
    int cnt = 0;
    
    for(int i = 0; i < N; ++i){
        cin >> a[i];
        cnt += a[i] % 2;
    }
    sort(a.begin(), a.end());
    
    if(cnt == 0){
        cout << "second" << endl;
    } else {
        cout << "first" << endl;
    }
    
}

Measured memory_bytes: 1024