akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>

using namespace std;

void print_vec(vector<int>& V) {
    for(const auto v : V) { 
      cerr << v << " ";
    } cerr << endl;
}

int MOD = static_cast<int>(1e9+7);
int n;
int main() {
  string s;
  cin >> n;
  cin >> s;

  vector<int> dp_prev(n, 0);
  vector<int> csum(n,0);
  dp_prev[0] = 1;
  vector<int> dp(n, 0);

  //print_vec(dp_prev);
  for(int i = 0; i < n-1; i++) {
    fill(dp.begin(), dp.end(), 0);
    csum[0] = dp_prev[0];
    for(int i = 1; i < n; i++) {csum[i] = csum[i-1] + dp_prev[i]; csum[i] %= MOD;}

    for(int k = 0; k <= i+1; k++) {
      if(s[i] == '<') {
        dp[k] = k-1 >= 0 ? csum[k-1] : 0;
      } else {
        dp[k] = (MOD + csum[n-1] - (k-1 >= 0 ? csum[k-1] : 0)) % MOD;
      }
    }
    dp_prev = dp;
  //  print_vec(dp_prev);
  }
  int ans = 0;
  for(const auto x: dp_prev) {
    ans += x;
    ans %= MOD;
  }
  cout << ans << endl;
}


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

ll a[20], mult[20];
ll solve(int left, int right){
	if(left+1==right) return 0;
	ll mn=(ll) 1e13;
	for(int i=left+1; i<right; ++i){
		mult[i]=mult[left]+mult[right];
		mn=min(mn, a[i]*mult[i]+solve(left, i)+solve(i, right));
		mult[i]=0;
	}
	return mn;
}


int main() {
	int N;
	cin >> N;
	for(int i=0; i<N; ++i) cin >> a[i];
	mult[0]=mult[N-1]=1;
	cout << a[0]+a[N-1]+solve(0, N-1) << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=5005;
int mod;
inline int Add(int x,int y){
    return (x+=y)>=mod?x-mod:x;
}
inline int Sub(int x,int y){
    return (x-=y)<0?x+mod:x;
}
inline int Mul(int x,int y){
    return 1ll*x*y%mod;
}
int n,k;
int dp[max_n];
int gx(int x){
    if(x<=k+1)return x-1;
    return n+2-x;
}
int main(){
    scanf("%d%d",&n,&mod);
    k=n/2;
    dp[0]=1;
    for(int i=n;i>=2;i--){
        int x=gx(i);
        for(int j=x;j<=n;j++){
            dp[j]=Add(dp[j],dp[j-x]);
        }
    }
    int ans=0;
    for(int i=0;i<=n;i++)ans=Add(ans,Mul(dp[i],n-i));
    printf("%d\n",ans);
    return 0;
}

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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef long double ld ;

const ll MOD = 1e9 + 7 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

int main()
{
    ll x, val, ans = 0 ;
    cin >> x ;
    if (x >= 500) {
        val = x / 500 ;
        ans += (val * 1000) ;
        x = (x - (val * 500)) ;
    }
    if (x >= 5) {
        val = x / 5 ;
        ans += (val * 5) ;
        x = (x - (val * 5)) ;
    }
    cout << ans ;


    return 0 ;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <vector>
#include <iomanip>
using namespace std;


int main(){
    // input
    int N; cin >> N;
    vector<int> A(N);
    vector<int> B(N);
    for (int i = 0; i < N; ++i){
        cin >> A.at(i);
        B.at(i) = A.at(i);
    }

    // compute
    sort(B.begin(),B.end(),greater<int>());//昇順ソート
    int max1 = B.at(0);
    int max2 = B.at(1);
    for (int i = 0; i < N; ++i){
        int del = A.at(i);
        if (del == max1){
            cout << max2 << endl;
        }
        else cout << max1 << endl;
    }

    // output
}



Measured memory_bytes: 3200
#include<iostream>
#include<cmath>
#define REP(i,s,n) for(int i=0;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace  std;

int main(){
  long double n;
  // cout << n*n/19.6<<endl;
  // cout << int(35.0+1.2)<<endl;
  while (cin>>n){
    cout <<int(n*n/19.6/5+2) << endl;
  }
  return 0;
}



Measured memory_bytes: 3236
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var a = o.l();
  var b = o.l();
  var x = [], y = [];
  for(var i = 0; i < 3; i++){
    if(a[i] < b[i]){
      x.push(a[i]);
      y.push(b[i]);
    }
  }
  var ans = solve(n,x,y);
  x = [], y = [];
  for(var i = 0; i < 3; i++){
    if(b[i] < a[i]){
      x.push(b[i]);
      y.push(a[i]);
    }
  }
  return solve(ans,x,y);
}

function solve(n,a,b){
  var l = a.length;
  if(l === 0)return n;
  if(l === 1){
    var x = n/a[0]|0;
    n -= x*a[0];
    n += x*b[0];
    return n;
  }
  if(l === 3){
    var dp = xArray(-1,n+1);
    dp[0] = n;
    for(var i = 0; i < 3; i++){
      var x = a[i], y = b[i];
      for(var j = x; j <= n; j++){
        if(dp[j-x] === -1)continue;
        dp[j] = Math.max(dp[j], dp[j-x] + y - x);
      }
    }
    return Math.max(...dp);
  }
  var x1, y1, x2, y2;
  if((b[0]-a[0])/a[0] < (b[1]-a[1])/a[1]){
    x1 = a[1], y1 = b[1], x2 = a[0], y2 = b[0];
  }else{
    x1 = a[0], y1 = b[0], x2 = a[1], y2 = b[1];
  }
  var x = n/x1|0, r = n;
  for(var i = 0; i <= 5000 && i <= x; i++){
    var xi = x-i;
    var y = n-xi*x1, xx = y/x2|0;
    y -= xx*x2;
    y += xi*y1;
    y += xx*y2;
    if(r < y)r = y;
  }
  return r;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<char,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

    int n;
    cin >> n;

    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            for (int k = 1; k <= n; ++k) {
                ll tmp = __gcd(i, j);
                tmp = __gcd(tmp, (ll)k);
                ans += tmp;
            }
        }        
    }


    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main(){
  string s;
  std::cin >> s;

  int maxlen = -1;
  for(int i=0; i<s.size(); i++){
    int now_len = 0;
    for(int j=i; j<s.size(); j++){
      if( s.at(j) == 'A' || s.at(j) == 'C' || s.at(j) == 'G' || s.at(j) == 'T'){
        now_len += 1;
      }else{
        break;
      }
    }
    if(maxlen < now_len){
      maxlen = now_len;
    }
  }
  std::cout << maxlen << '\n';
  return 0;
}


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

int main() {
    int S;
    int h, m, s;
    
    cin >> S;
    
    s = S % 60;
    m = ( S - s ) / 60 % 60;
    h = ( ( S - s ) / 60 - m ) / 60;
    
    cout << h << ":" << m << ":" << s << endl;
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

namespace modCalc {
    LL add() {
        return 0;
    }
    template<typename H, typename... T>
    LL add(H h, T... t) {
        return (h + add(t...))%mod;
    }

    template<typename H, typename... T>
    LL sub(H h, T... t) {
        return (h - add(t...) + mod)%mod;
    }

    LL mul() {
        return 1;
    }
    template<typename H, typename... T>
    LL mul(H h, T... t) {
        return (h*mul(t...))%mod;
    }

    LL pow(LL x, LL y) {
        LL res = 1;
        while(y != 0) {
            if(y%2) {
                res = mul(x, res);
                y--;
            }else{
                x = mul(x, x);
                y /= 2;
            }
        }
        return res;
    }

    LL div(LL x, LL y) {
        return mul(x, pow(y, mod - 2));
    }

    LL fact(LL n) {
        LL res = 1;
        FOR(i, 1, n + 1)
            res = mul(res, i);
        return res;
    }
}

int main() {
    vector<LL> v(63, 0);
    LL N;
    cin >> N;
    vector<LL> A(N);
    REP(i, N) {
        cin >> A[i];
    }

    for(auto i : A) {
        for(LL j = 0;0 < i;j++, i /= 2) {
            v[j] += i&1;
        }
    }

    LL res = 0;
    for(LL i = 0;i < 63;i++) {
        res = modCalc::add(res, modCalc::mul(modCalc::pow(2, i), v[i], N - v[i]));
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

int main() {
  string s;
  cin >> s;
  bool ans = true;
  if (s[2] != s[3]) ans = false;
  if (s[4] != s[5]) ans = false;
  cout << (ans?"Yes":"No") << endl;

  return 0;
}

Measured memory_bytes: 256
tar_len = input()
targets = list(map(int, input().split()))

count = 0

while True:
    exist_odd = False
    for target in targets:
        if target%2 != 0:
            exist_odd = True
    if exist_odd: break
    count += 1
    targets = list(map(lambda x: x/2, targets))
    
print(count)

Measured memory_bytes: 3060
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

int n;
vector<int> a, child;
vector<vector<int>> edge;
int dp[5001][5001][2];
int sub[5001][2];

void dfs(int v, int par){
    if(a[v] > 0){
        dp[v][0][0] = a[v];
    }else{
        dp[v][0][1] = a[v];
    }

    child[v] = 1;

    for(int u : edge[v]){
        if(u == par){
            continue;
        }
        dfs(u, v);
        for(int i = 0; i < child[v]; i++){
            for(int j = 0; j < child[u]; j++){
                rep(k1, 2) rep(k2, 2){
                    sub[i+j][k1|k2] = min(sub[i+j][k1|k2], dp[v][i][k1] + dp[u][j][k2]);
                    if(k2 == 0 && dp[u][j][k2] < INF || dp[u][j][k2] < 0){
                        sub[i+j+1][k1] = min(sub[i+j+1][k1], dp[v][i][k1]);
                    }
                }

            }
        }
        child[v] += child[u];
        for(int i = 0; i < child[v]; i++){
            rep(k, 2){
                dp[v][i][k] = sub[i][k];
                sub[i][k] = INF;
            }
        }
    }
}

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

    cin >> n;
    a = vector<int>(n + 1);
    rep(i, n) cin >> a[i+1];

    edge = vector<vector<int>>(n + 1, vector<int>());
    rep(i, n - 1){
        int u, v;
        cin >> u >> v;
        edge[u].push_back(v);
        edge[v].push_back(u);
    }

    rep(i, n+1) rep(j, n+1) rep(k, 2) dp[i][j][k] = INF;
    rep(i, n+1) rep(k, 2) sub[i][k] = INF;

    child = vector<int>(n + 1);
    dfs(1, 0);

    int ans = INF;
    rep(i, n + 1){
        if(dp[1][i][0] != INF){
            ans = min(ans, i);
        }
        if(dp[1][i][1] < 0){
            ans = min(ans, i);
        }
    }
    cout << ans << endl;

    return 0;
}


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

int main()
{
	//stack<int> q,w;
	//freopen("in.txt","r",stdin);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL),cout.tie(nullptr);
    string s;
    cin>>s;
 
    replace(s.begin(),s.end(),',',' ');

cout<<s<<endl;

 

 
 return 0;

    
}

Measured memory_bytes: 3620
#include<stdio.h>

int n,A[2000];

 int so(int i,int m){
  int res;
  if(m==0)
    return 1;
  if(i>= n)
    return 0;
  res = so(i+1,m) || so(i+1,m-A[i]);
  return res;
}

int main(){

  int i,q,m;

  scanf("%d",&n);

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

    scanf("%d",&A[i]);

  }

  scanf("%d",&q);

  for(i = 0;i<q;i++){
    scanf("%d",&m);
    if(so(0,m) == 1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}



Measured memory_bytes: 1996
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <vector>

using namespace std;
using ll = long long;

int main()
{
  ll n = 0;
  cin >> n;

  vector <ll> vec(n);

  for (auto& e: vec) {

    cin >> e;

  }
  ll cnt = 0;

  sort(vec.begin(), vec.end());
  
  for (ll i = 0; i < n; i++) {

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

      if (vec[i] == vec[j]) {
        continue;
      }

      for (ll k = j + 1; k < n; k++) {

        if (vec[j] == vec[k]) {
          continue;
        }
        
        if (vec[k] < (vec[i] + vec[j])) {
          cnt++;
        }
      }
    }
  }

  cout << cnt << endl;

}

Measured memory_bytes: 3616
#include<iostream>
#include<cmath>
using namespace std;
int main(){
  int n,x,y,t,tt=0,xx=0,yy=0,f=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>t>>x>>y;
    f+=t-tt<x-xx+y-yy||(t-tt-x+xx-y+yy)%2;
    xx=x;yy=y;tt=t;
  }
  if(f)cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}

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

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


void Main() {
    int n;
    cin >> n;
    bool flag = true;
    vector<vector<int>> vec(n+1, vector<int>(3));
    for (int i = 1; i < n+1; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> vec.at(i).at(j);
        }
    }
    for (int i = 0; i < n; i++)
    {
        int xlen = 0;
        int ylen = 0;
        int total = 0;
        xlen = abs(vec[i][1] - vec[i + 1][1]);
        ylen = abs(vec[i][2] - vec[i + 1][2]);
        total= abs(vec[i][0] - vec[i + 1][0]);
        if (total - (xlen + ylen) >= 0) {
            if ((total - xlen - ylen) % 2 == 0) {
                continue;
            }
            else {
                flag = false;
                break;
            }
        }
        else {
            flag = false;
            break;
        }
    }
    if (flag) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


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

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

int main(){
  int h, w;
  cin >> h >> w;
  
  vector <string> s(h);
  for (int i = 0; i < h; i++){
    cin >> s.at(i);
  }
  
  int d[] = {-1, 1};
  bool flag = true;
  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++){
      if (s.at(i).at(j) == '#'){
        bool ngb_sharp = false;
        for (int k : d){
          if (0 <= i + k && i + k < h){
            if (s.at(i + k).at(j) == '#') ngb_sharp = true;
          }
          if (0 <= j + k && j + k < w){
            if (s.at(i).at(j + k) == '#') ngb_sharp = true;
          }
        }
        if (ngb_sharp == false){
          flag = false;
          break;
        }
      }
    }
    if (flag == false) break;
  }
  if (flag == true) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
class FactMod():
    '''
    modの値が素数の時のfactと組み合わせを求める
    フェルマーの小定理を用いているため、modが素数以外の時は使えない
    '''

    def __init__(self, n, mod):
        '''
        コンストラクタ
        f:nまでの i!の値を　配列に入れる
        inv: (i!)^-1　の値を配列に入れる
        '''
        self.f = [1]*(n+1)
        for i in range(1, n+1):
            self.f[i] = self.f[i-1]*i % mod

        self.inv = [pow(self.f[-1], mod-2, mod)]
        for i in range(1, n+1)[::-1]:
            self.inv.append(self.inv[-1]*i % mod)
        self.inv.reverse()

    def fact(self, n):
        '''
        n!の値を返す
        '''
        return self.f[n]


N, M = map(int, input().split())

mod = 10**9+7
ans = 0
F = FactMod(max(N, M), mod)

if abs(N-M) == 1:
    ans = F.fact(N)*F.fact(M) % mod
elif N == M:
    ans = F.fact(N)*F.fact(N)*2 % mod
else:
    ans = 0

print(ans)


Measured memory_bytes: 11052
N = int(input())
S = input()
 
sm_w = [0]*(N+1)
sm_b = [0]*(N+1)
 
for i in range(N):
    s = S[i]
    sm_w[i+1] += sm_w[i]
    sm_b[i+1] += sm_b[i]
    if s == '.':
        sm_w[i+1] += 1
    else:
        sm_b[i+1] += 1
 
ans = 2**60
for i in range(N+1):
    left_b = 0
    if i!=0:
        left_b = sm_b[i]
    right_w = 0
    if i!=N:
        right_w = sm_w[N] - sm_w[i]
    ret = left_b + right_w
    ans = min(ans, ret)
print(ans)

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

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

	ll ans =0;
	ll sum = 0;
	ll res = 0;
	fx(N+1) {
		sum += N - x;
		res += x;
		if (x>=K-1) {
			ans += sum - res + 1;
			ans %= MOD;
		}
	}
	ce(ans)
    return 0;
}



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

int main() {
    int n;
    cin >> n;
    vector<int> l(n);
    for (auto& e : l) cin >> e;
    sort(l.begin(), l.end());
    int m = l.back();
    l.pop_back();
    cout << (accumulate(l.begin(), l.end(), 0) > m ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
   int n;
  scanf("%d",&n);
   char S[n];
   scanf("%s",S);
   int count=0;
    for(int i=0;i<n-2;i++){
           if (S[i]=='A' && S[i+1]=='B' && S[i+2]=='C'){
              count++;
           }
        }
   
    printf("%d",count);
    
    return 0;
}


Measured memory_bytes: 1736
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
using namespace std;

int main() {
	map<long long int, long long int>mp;
	//cout << fixed << setprecision(10);
	long long int n, m, a[2000][2000] = {}, b,x,y,z, k, sum = 0, d=1, w, h,typ=0;
	long long dp[200005] = {}, memo[200005] = {};
	string str,str2;
	cin >> n>>m;
	n = (n - m) * 100 + m * 1900;
	for (int i = 1; i <= m; i++) {
		n *= 2;
	}
	cout << n;

}


Measured memory_bytes: 256
def main():
	inputList= list(map(int, input().split()))
	score =[1,0,-1]
	ans =0
	for i in range(len(inputList)-1):
		if inputList[3] >= inputList[i]:
			inputList[3] = inputList[3] - inputList[i]
			ans = ans + inputList[i]*score[i]
		else:
			ans = ans + inputList[3]*score[i]
			return ans
	return ans
     
if __name__ == '__main__':
	print(main())

Measured memory_bytes: 9152
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;

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

string s;

string dfs(int i, string ans){
  if(i >= s.length()) return ans;

  if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
    return dfs(i + 1, ans + s[i]);
  }
  return ans;
}

int main(){
  cin >> s;
  string tmp, ans;
  for(int i = 0; i < s.length(); ++i){
    tmp = dfs(i, "");
    if(ans.length() < tmp.length()) ans = tmp;
  }

  cout << ans.length() << endl;


}


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

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

int main() {
	int l;
	while (cin >> l, l) {
		vector<int> num(l);
		REP(i, l) cin >> num[i];
		
		int now = 32, pos = 0;
		bool itiro = true;
		
		while (now > 0) {
			if (itiro) now -= (now - 1) % 5;
			else {
				now -= num[pos++];
				pos %= l;
			}
			if (now > 0) cout << now << endl;
			else puts("0");
			itiro = !itiro;
		}
	}
	return 0;
}

Measured memory_bytes: 1192
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int n;
    while(cin >> n, n){
        vector<pair<int,int>> v;
        int a, b;
        for(int i = 0; i < n; i++){
            cin >> a >> b;
            v.push_back({b, a});
        }
        sort(v.begin(), v.end());
        int sum = 0;
        bool judge = true;
        for(int i = 0; i < n; i++){
            sum += v[i].second;
            if(sum > v[i].first)   judge = false;
        }

        if(judge)   cout << "Yes" << endl;
        else        cout << "No" << endl;
    }
    return 0;
}


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

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

using namespace std;

int main() {
    int h,w; cin >> h >> w;
    vector<vector<char>> vec(h,vector<char>(w));
    string tmp;
    rep(y, h) {
        cin >> tmp;
        rep(x, w) {
            vec[y][x] = tmp[x];
        }
    }


    // left
    vector<vector<int>> l(h,vector<int>(w,0));
    rep(y, h) {
        rep(x, w) {
            if(vec[y][x] == '#') {
                l[y][x] = 0;
            }else if(x == 0) {
                l[y][x] = 1;
            }else {
                l[y][x] = l[y][x-1] + 1;
            }
        }
    }
    //right
    vector<vector<int>> r(h,vector<int>(w,0));
    rep(y, h) {
        for(int x=w-1; x >= 0; x--) {
            if(vec[y][x] == '#') {
                r[y][x] = 0;
            }else if(x == w-1) {
                r[y][x] = 1;
            }else {
                r[y][x] = r[y][x+1] + 1;
            }
        }
    }
    // bottom
    vector<vector<int>> b(h,vector<int>(w,0));
    rep(x, w) {
        rep(y, h) {
            if(vec[y][x] == '#') {
                b[y][x] = 0;
            }else if(y == 0) {
                b[y][x] = 1;
            }else {
                b[y][x] = b[y-1][x] + 1;
            }
        }
    }
    // top
    vector<vector<int>> t(h,vector<int>(w,0));
    rep(x, w) {
        for(int y=h-1; y >= 0; y--) {
            if(vec[y][x] == '#') {
                t[y][x] = 0;
            }else if(y == h-1) {
                t[y][x] = 1;
            }else {
                t[y][x] = t[y+1][x] + 1;
            }
        }
    }

    int ans = 0;
    rep(y, h) {
        rep(x, w) {
            ans = max(ans, (l[y][x] + r[y][x] + t[y][x] + b[y][x] - 3));
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {

  ll x;
  cin >> x;

  //ループ処理で何回で目標金額を超えるかシミュレーションする
  ll ans = 0,a = 100;
  while (a < x) {
    a += a/100; //1%複利の切り捨ての方法
    ++ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include<iostream>
#include<string>
#include<array>
#include<algorithm>
#include<deque>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<list>

int main(void) {
	using namespace std;
	int N,cnt = 0;
	string A, B, C;
	cin >> N >> A >> B >> C;
	for (int i = 0; i < N;i++) {
		if (A[i] == B[i] && B[i] == C[i] && A[i] == C[i]) {
			cnt += 0;
		}
		else if (A[i] == B[i]) {
			cnt += 1;
		}
		else if (B[i] == C[i]) {
			cnt += 1;
		}
		else if (A[i] == C[i]) {
			cnt += 1;
		}
		else {
			cnt += 2;
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define all(x) x.begin(),x.end()
#define YES {cout << "YES\n"; return;}
#define NO {cout << "NO\n"; return;}

const int INF=INT_MAX;
const ld PI=acos(-1);//3.1415926535897932384626433
const ld E=2.71828183;
const int MOD=1e9+7;

vi bfs(vector<vi>adj,int src){
    //adjacency list, not-weighted, possibly directed ,src is 1-indexed, adj[0].size()=0!!!
    //for n vertices, adj.size()=n+1. (constructed via push_back() ).

    queue<int>q;
    q.push(src);
    vi dst(adj.size(),INF);
    dst[src]=0;
    while(!q.empty()){
        int c=q.front();
        q.pop();
        for(int nbr:adj[c]){
            if(dst[nbr]==INF){
                dst[nbr]=dst[c]+1;
                q.push(nbr);
            }
        }
    }
    return dst;
}
vi bfsParents(vector<vi>adj,int src){
    vi parents=vi(adj.size(),INF);
    parents[src]=-1;
    queue<int>q;
    q.push(src);
    vi dst(adj.size(),INF);
    dst[src]=0;
    while(!q.empty()){
        int c=q.front();
        q.pop();
        for(int nbr:adj[c]){
            if(dst[nbr]==INF){
                parents[nbr]=c;
                dst[nbr]=dst[c]+1;
                q.push(nbr);
            }
        }
    }
    return parents;
}
vi shortestPath(vector<vi>adj,int src,int dst){
    vi bfsParetns=bfsParents(adj,src);
    vi ans;
    while(src!=dst){
        if(bfsParetns[src]==INF)
            return {};
        ans.push_back(src);
        src=bfsParetns[src];
    }
    return ans;
}
int powMod(int base,int exp,int mod){
    //(base^exp) %mod
    int ans=1;
    for(int i=0; i<exp; i++)
        ans=((ans%mod)*(base%mod))%mod;
    return ans;
}
vi divisorsOf(int n){
    //vector of divisors of n (inc. 1 , excl.n)
    vi ans;
    for(int i=1; i*i<=n; i++){
        if(n%i==0)
            ans.push_back(i);
        if(i*i!=n && i!=1)
            ans.push_back(n/i);
    }
    return ans;
}
int gcd(int a,int b){
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);
}

ld log (ld a,ld b){return log(b)/log(a);}
ll power(ll base, ll exp){
    ll res=1;
    while(exp){
        exp--;
        res*=base;
    }
    return res;
}
void solve();
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin >> t;
    while(t--)
        solve();
    return 0;
}
void solve (){
    int n;
    cin >> n;
    string s,t;
    cin >> s >> t;
    for(int i=0; i<n; i++)
        cout << s[i]<<t[i];
    cout << "\n";
}

Measured memory_bytes: 3608
import math
import fractions

def ceil(x):
    return math.ceil(x)
def floor(x):
    return math.floor(x)

def countX(X) :
    if X > B :
        return 0
    minX = ceil(fractions.Fraction(A, X))
    maxX = floor(fractions.Fraction(B, X))

    return maxX - minX + 1

A , B , C , D = map(int,input().split())

ans = B - A + 1

# 最小公倍数
Z = C * D // fractions.gcd(C,D)

ans -= countX(C)
ans -= countX(D)
ans += countX(Z)

print(int(ans))


Measured memory_bytes: 5076
#include <iostream>
#include <vector>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v, n) sort(v, v+n)
#define print(x) cout << x << endl;

using namespace std;


int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, L;
    cin >> N >> L;
    
  	vector<string> S(N);
  	REP(i, N){
    	cin >> S[i];
    }
  	sort(S.begin(), S.end());
  	
  	string ans="";
    REP(i, N){
    	ans += S[i];
    }
  	
  	print(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &&x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define INSEG(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void PSUM(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(0); ios::sync_with_stdio(false);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    vector<int> A(N);
    cin >> A;
    int g = 0;
    FORE(x, A) {
        g = __gcd(g, x);
    }
    cout << g << endl;
    return (0^_^0);
}



Measured memory_bytes: 1024
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

N = INT()
a = LIST()

a.sort(reverse = True)
print(sum(a[1:2*N:2]))

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

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define pmod 1000000007
#define maxn 100005
#define IN freopen("input.txt","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(int i=a ; i<=b ; i++)
#define INF 1000000000
#define ll long long int
#define eps (1e-8)
#define sq(x) ( (x)*(x) )

using namespace std;

typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
priority_queue<pii,vector<pii>, greater<pii> > q;
ll res=0;
int a[1000],b[1000],c1[1051],d1[1051];
int main()
{int N,m;
cin>>N>>m;
FOR (i,1,m){int c,d;
    cin>> c>>d;
    q.push(mp(c,d));
    c1[i]=c;d1[i]=d;
    //if (c==3 && d==86) cout<<123<<endl;
}
int t=1;int k=0;
while (!q.empty()){
    int c1=q.top().first;
    int d1=q.top().second;
    q.pop();
    if (!q.empty()){int c2=q.top().first;
    int d2=q.top().second;
    //if (c1==3 && d1==86) cout<<"dm"<<" "<<c2<<" "<<d2<<endl;
    //if (k<=10) {k++;cout<<c1<<" "<<d1<<" "<<c2<<" "<<d2<<endl;}

        if (d1>=c2){

        q.pop();
        q.push(mp(c1,max(d1,d2)));


    }
    else {res+=2*(d1-c1);}
    }
    else {res+=2*(d1-c1);}
}
cout<<res+N+1<<endl;
/*FOR(i,1,m){ bool u=0;
    FOR(j,1,t-1){
        if (c1[i]>=a[j] && d1[i]<=b[j]) u=1;

    }
    if (u==0) cout<<i<<" "<<c1[i]<<" "<<d1[i]<<endl;
}*/
         return 0;
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 vector<vector<int>> A = vector<vector<int>> (3,vector<int>(3));
  for(auto &l:A)
    for(auto &a:l)
      cin >> a;
  int q,x;
  cin >> q;
  set<int> B;
  while(q--){
    cin >> x;
    B.insert(x);
  }
  vector<vector<bool>> M = vector<vector<bool>> (3,vector<bool>(3,false));
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      if(B.find(A[i][j])!=B.end())
        	M[i][j] = 1;
  int vd = 0,vd2=0;
  bool output = false;
  for(int i=0;i<3;i++){
    int cnt = 0,cnt2=0;
    for(int j=0;j<3;j++)
      cnt+=M[i][j],cnt2+=M[j][i];
    if(cnt==3 or cnt2==3)
      output = true;
    vd+=M[i][i];
    vd2+=M[2-i][i];
  }
  if(vd==3 or vd2==3)
    output=true;
  cout << (output?"Yes\n":"No\n");
}

Measured memory_bytes: 256
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long MOD = 1e9 + 7;
const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}



int main() {

  long n;

  cin >> n;
  vector<long> a(n);
  vector<long> b(n);

  vector<pair<long, long>> amax(n);
  // vector<pair<long,long>> bmax(n);

  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    amax[i] = make_pair(i, a[i] + b[i]);
  }


  sort(amax.begin(), amax.end(), [](pair<long, long>&l, pair<long, long>&r) {
    return l.second > r.second;
  });




  long ans = 0;
  long tk =0;
  long ao = 0;
  for(int i=0;i<n;i++){
    if (i%2==0){
      tk+=a[amax[i].first];
    }else{
      ao+=b[amax[i].first];
    }
  }



  cout << tk-ao << endl;


}




















Measured memory_bytes: 3328
#include <iostream>
#include <string.h>
using namespace std;
int n;
int a[101];
long long memo[101][21];

long long res(int i,int sum){
    if(sum<0||sum>20) return 0;
    if(memo[i][sum]!=0) return memo[i][sum];
    if(i==n-1) return memo[i][sum]=(sum==a[n-1]);
    return memo[i][sum]=res(i+1,sum+a[i])+res(i+1,sum-a[i]);
}

int main(){
    cin >> n;   
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    memset(memo,0,sizeof(memo));
    cout << res(1,a[0]) << endl;
    return 0;
}

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

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long, long> pll;

const int INF = 1 << 29;
const double EPS = 1e-9;
const int MOD = 100000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
struct Node {
  int key;
  Node *prev, *next;
  ~Node() { cerr << "delete" << this << endl; }
};
Node *nil;

void init() {
  nil = (Node *)malloc(sizeof(Node));
  nil->next = nil;
  nil->prev = nil;
}
void insert(int key) {
  Node *x = (Node *)malloc(sizeof(Node));
  x->key = key;
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}
Node *listSearch(int key) {
  Node *cur = nil->next;
  while (cur != nil && cur->key != key) {
    cur = cur->next;
  }
  return cur;
}

void deleteNode(Node *t) {
  if (t == nil)
    return;
  t->prev->next = t->next;
  t->next->prev = t->prev;
  free(t);
}
void deleteFirst() { deleteNode(nil->next); }
void deleteLast() { deleteNode(nil->prev); }

void deleteKey(int key) { deleteNode(listSearch(key)); }
void printList() {
  Node *cur = nil->next;
  int isf = 0;
  while (true) {
    if (cur == nil)
      break;
    if (isf++ > 0) {
      printf(" ");
    }
    printf("%d", cur->key);
    cur = cur->next;
  }
  printf("\n");
  return ;
}
int main() {
  int N;
  cin >> N;
  init();
  char buf[20];
  for (int i = 0; i < N; i++) {
    string str;
    int x;
    scanf("%s", buf);

    if (buf[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    }else if(strlen(buf) <= 6){
      scanf("%d", &x);
      deleteKey(x);
    }else if(buf[0] == 'd' && buf[6] == 'F'){
      deleteFirst();
    }else if(buf[0] == 'd' && buf[6] == 'L'){
      deleteLast();
    }
  }
  printList();
}

Measured memory_bytes: 32412
n,m = map(int,input().split())
x = [int(i) for i in input().split()]
x.sort()
xx = []
for i in range(len(x)-1):
  xx.append(abs(x[i]-x[i+1]))
xx.sort()
print(sum(xx[:-(n-1)])if n!=1 else sum(xx))


Measured memory_bytes: 13840
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
 
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
typedef
tree<
  pair<int,int> ,
  null_type,
  less<pair<int,int> >,
  rb_tree_tag,
  tree_order_statistics_node_update>
order_set;

int df[200010];
int main(){
	order_set A;
	int n;
	cin>>n;
	for(int i=0;i<n;i++)cin>>df[i];
	for(int i=0;i<n;i++)A.insert(mp(df[i],i));
	for(int i=0;i<n;i++){
		A.erase(mp(df[i],i));
		cout<<(*A.find_by_order((n/2) - 1)).first<<'\n';;
		A.insert(mp(df[i],i));
	}
}


Measured memory_bytes: 15488
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var ai = Sarray();
            var cnt = 0L;
            foreach (var a in ai)
            {
                for (var t = a; t % 2 == 0; t >>= 1)
                    ++cnt;
            }
            WriteLine(cnt);
        }
 
        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 29572
N,M = list(map(int,input().split()))
xls = list(map(int,input().split()))
xls.sort()
dls =[xls[i+1]-xls[i] for i in range(M-1)]
dls.sort()

if N >= M:
    ans = int(0)
else:
    ans = sum(dls[0:M-N])

print(ans)

Measured memory_bytes: 13968
l = []
l = [int(i) for i in input().split()] 
sum = 0

for i in range(2):
	if l[0] >= l[1]:
		sum = sum + l[0]
		l[0] = l[0] - 1
	else:
		sum = sum + l[1]
		l[1] = l[1] - 1

print(sum)

Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<climits>
#include<cstring>
#include<queue>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    cout << a/b << " " << a%b << " " ;
    printf("%.5f\n", double(a)/b);
    return 0;
}

Measured memory_bytes: 3232
function Main(input: string) {
  const lines = input.split('\n');
  const params = lines[0].split(' ').map(x => parseInt(x));

  const a = params[0]; // Aピザの値段
  const b = params[1]; // B
  const c = params[2]; // AB
  const x = params[3]; // Aの枚数
  const y = params[4]; // Bの枚数

  const cost = (i: number, j: number, k: number) =>
    a * i + b * j + c * k;

  // A: x
  let min = interval(0, x)
    .map(i => cost(i, Math.max(0, y - (x - i)), 2 * (x - i)))
    .reduce((n, m) => Math.min(m, n));
  // B: y
  min = interval(0, y)
    .map(i => cost(Math.max(0, x - (y - i)), i, 2 * (y - i)))
    .reduce(
      (n, m) => Math.min(m, n),
      min);

  console.log(min);
}

function interval(start: number, end: number): number[] {
  if (start > end) return [];

  let a: number[] = [];
  for (let i = start; i <= end; i++) {
    a.push(i);
  }
  return a;
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 15136
#include <stdio.h>

typedef struct {
    int x,y,a;
} data;

int main()
{
    int w,h,n;
    data data[100];
    int i,j;

    scanf("%d %d %d",&w,&h,&n);
    for (i = 0; i < n; i++)scanf("%d %d %d",&data[i].x,&data[i].y,&data[i].a);
    int maxmin[4] = {0,w,0,h};
    int ans = w * h;

    for (i = 0; i < n; i++)
    {
        switch (data[i].a)
        {
        case 1:
            if(maxmin[0] < data[i].x)maxmin[0] = data[i].x;
            break;
        case 2:
            if(maxmin[1] > data[i].x)maxmin[1] = data[i].x;
            break;
        case 3:
            if(maxmin[2] < data[i].y)maxmin[2] = data[i].y;
            break;
        default:
            if(maxmin[3] > data[i].y)maxmin[3] = data[i].y;
            break;
        }
    }
    if(maxmin[0] < maxmin[1] && maxmin[2] < maxmin[3])
    {
        printf("%d",(maxmin[1] - maxmin[0]) * (maxmin[3] - maxmin[2]));
    }
    else
    {
        printf("0");
    }
    
}

Measured memory_bytes: 256
s = {"a": input(), "b": input(), "c": input()}
i = {"a": 0, "b": 0, "c": 0}

winner = None
player = "a"

while True:
    if i[player] == len(s[player]):
        winner = player.upper()
        break
    n = i[player]
    i[player] += 1
    player = s[player][n]

print(winner)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    //cout << n << " " << m << endl;
    vector <int> hight(n);
    vector <bool> isGood(n);
    for(int i = 0; i < hight.size(); i++){
        cin >> hight[i];
        isGood[i]=true;
    }
    #if 0
    for(int i = 0; i < hight.size(); i++){
        cout << hight[i] << " ";
    }
    cout << endl;
    #endif
    int pathNum = 0;
    while(pathNum<m){
        pathNum++;
        int index1,index2;
        cin >> index1 >> index2;
        index1--;
        index2--;
        if(hight[index1] > hight[index2]){
            isGood[index2]=false;
        }else if(hight[index2]> hight[index1]){
            isGood[index1]=false;
        }else{
            isGood[index2]=false;
            isGood[index1]=false;
        }
    }
   int result = 0;
    for(int i = 0; i < isGood.size(); i++){
        if(isGood[i]==true){
            result++;
        }
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3792
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for(inti=a;i<=b;i++)

#define MOD 1000000009
typedef long long int ll;
typedef vector<int>vi;
typedef pair<int,int>pi;



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

   vector<ll> v(n+1,0);
for(ll index = 0 ;index< n;index++)
{
    ll c ;
    cin>>c;
    v[index+1]=v[index]+c;

}

ll ans = LONG_MAX;
for(ll index = 1 ;index < n;index++)
    ans =min(ans,abs(v[index]-(v[n]-v[index])));


cout<<ans<<endl;



 return 0;
}


Measured memory_bytes: 4840
a = int(input()) # \500
b = int(input()) # \100
c = int(input()) #  \50
x = int(input())

# 0 <= a,b,c <= 50 -> Order = 50*50*50
# 力技で全探索でも計算量的には余裕で間に合う.
cnt = 0
for i1 in range(a+1):
    for i2 in range(b+1):
        for i3 in range(c+1):
            if i1 * 500 + i2 * 100 + i3 * 50 == x:
                cnt += 1
print(cnt)

Measured memory_bytes: 3060
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
        
    ios_base::sync_with_stdio(0);
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    ll n,m;
    cin>>n>>m;
    vector<pair<ll,ll> > x;
    for(ll i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        x.push_back(make_pair(a,b));
    }
    sort(x.begin(), x.end());
    ll sum=0, cnt=0;
    for(ll i=0;i<x.size();i++){
        ll fi = x[i].first, se=x[i].second;
        if(sum==m)  break;
        if(sum+se<=m){
            sum += se;
            cnt += ((ll)fi*se); 
           // cout<<"A: "<<sum<<" "<<cnt<<endl;
        }
        else{
            //cout<<"Left: "<<(m-sum)<<endl;
            //cout<<"Price: "<<fi<<endl;
            cnt += (fi*(m-sum));
            sum += (m-sum);
            //cout<<"B: "<<sum<<" "<<cnt<<endl;
        }
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 2420
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=2000 +117;
const int MM=2000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
vector<int> p[NN]={};
char s[NN]={};
int cnt[NN]={};
int sum[NN]={};
int low[NN]={};
void dfs(int x,int fa){
	cnt[x]=(s[x]=='1');
	sum[x]=0;
	int s=0;
	int mi=0;
	int lg=0;
	for(int i=0;i<p[x].size();++i){
		int cur=p[x][i];
		if(cur!=fa){
			dfs(cur,x);
			cnt[x]+=cnt[cur];
			sum[x]+=sum[cur]+cnt[cur];
			s^=(sum[cur]+cnt[cur])&1;
			mi=max(mi,low[cur]+cnt[cur]);
			if(low[cur]+cnt[cur]==mi){
				lg=sum[cur]+cnt[cur];
			}
		}
	}
	low[x]=max(s,mi+lg-sum[x]);
}
int solve(int x){
	dfs(x,0);
	if(low[x]==0)return sum[x];
	else return 1e9;
}
int main(){
	//open();
	n=read();
	scanf("%s",s+1);
	for(int i=1;i<n;++i){
		int a=read(),b=read();
		p[a].push_back(b);
		p[b].push_back(a);
	}
	int ans=1e9;
	for(int i=1;i<=n;++i){
		ans=min(ans,solve(i));
	}
	if(ans==1e9)printf("-1\n");
	else printf("%d\n",ans/2);
	close();
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  
  cout << ( a+b+c == 2*max({a,b,c}) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256