akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define it(a, x) for (auto &a : x)
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vpii vector<pii>
#define vs vector<string>
#define gi greater<int>
#define vc vector<char>
#define vvi vector<vi>
#define vvc vector<vc>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define deb(x) cout << #x << "=" << x << endl;
#define in(i, n) for (auto i = 0; i < n; i++)
#define all(x) begin(x), end(x)
//mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());//random shuffler

ll fxp(ll a, ll b) {
    if (b == 0) return 1;
    if (b % 2 == 0) {
        ll c = fxp(a, b / 2);
        return (c * c) % mod;
    }
    return (a * fxp(a, b - 1)) % mod;
}

void c_p_c() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
}

void solve() {
    int d, t, s;
    cin >> d >> t >> s;
    double ct = (double)d / (double)s;
    if (ct <= (double)t) {
        cout << "Yes";
    } else
        cout << "No";
}

int main(int argc, char const *argv[]) {
    c_p_c();
    solve();
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ　ceil(a)


int main() {
    ll h, n;
    cin >> h >> n;
    vector<ll> vec(n);
    ll tmp = 0;
    rep(i,n){
        cin >> vec.at(i);
        tmp += vec.at(i);
    }

    if(tmp >= h){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    

}


Measured memory_bytes: 1024
# frozen_string_literal: true

_array_size = gets
strings = readlines.map(&:chomp)
sorted_string = strings.map do |string|
  string.chars.sort.join
end

puts sorted_string.group_by(&:itself).map { |_key, value| value.count }.inject(0) { |memo, e|
  case e
  when 1
    memo
  else
    memo + Array(1..(e - 1)).inject(&:+)
  end
}


Measured memory_bytes: 45916
def func(n):
    if n % 2 == 0:
        return int(n / 2)
    else:
        return 3 * n + 1

s = int(input())

a = [-1]
i = 1
while True:
    if i == 1:
        a.append(s)
    else:
        tmp = func(a[i-1])
        if tmp in a:
            print(len(a))
            break
        else:
            a.append(tmp)

    i += 1



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;



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

    ll a,b,n,ans = 0;

    cin>>a>>b>>n;
    ll min;
    if(b > n){
        min = n;
    }
    else{
        min = b-1;
    }

    cout<<floor(a*min/b)<<endl;


    return 0;
}


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

int f(string s,string t,int n){
  for(int i=0;i<n;i++){
    if(!(s[i]=='?' || s[i]==t[i]))return 0;;

  }
  return 1;
}

int main(){
  int i,j,cnt=0;
  string s,t;
  cin>>s;
  cin>>t;
  int n=s.size(),m=t.size();
  for(i=0;i<=n-m;i++){
    if(f(s.substr(n-m-i,m),t,m)==1){
      cnt=n-m-i;
      break;
    }
  }
  if(i==n-m+1){
    cout<<"UNRESTORABLE";
    return 0;
  }
  char c[n];
  for(i=0;i<n;i++){
    if(s[i]=='?')c[i]='a';
    else c[i]=s[i];
  }
  for(i=cnt;i<cnt+m;i++)c[i]=t[i-cnt];
  for(i=0;i<n;i++)cout<<c[i];
  cout<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
typedef set <int> st;
typedef set <char> stc;
typedef vector<int>::iterator itr;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sq(a) a*a
#define cu(a) (sq(a)*a)
#define sf1(a) scanf("%d",&a)
#define sf2(a,b) scanf("%d %d", &a , &b)
#define pf1(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n", a , b)
#define Last(i) ( (i) & (-i) )
 
const int mod = 1000000007;
const int maxn = (int)1e5+30;
const ll nnn = (ll)5e7+5;
const int inf = 1e9+9;
const ll INF = 1e18;

int main() {
   
	ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);	
    
    string s;
    
    bool t = true;
    
    cin >> s;
    
    int  n = s.length();
    
    for(int i =0 ; i < n ; i++){
    	
    	if(s[i] != s[n-1-i]) t = false; 
    	
	}
	
	for(int i = 0; i < (n-1)/2 ; i++){
		
		if(s[i] != s[((n-1)/2) - 1 - i]) t = false; 
		
	}
	
	for(int i = ((n-1)/2)+1; i < n ; i++){
		
		if(s[i] != s[n-1-i]) t = false; 
		
	}
	
	if(t == true) cout << "Yes";
	else cout << "No";
    
    return 0;
    
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000)

def getN():
    return int(input())
def getList():
    return list(map(int, input().split()))
import math

s = input().strip()
t = input().strip()
ans = 0
for i, j in zip(s, t):
    if i == j:
        ans += 1

print(ans)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
typedef pair<ll, bool> Pb;

const ll INF = 1e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
char dir[] = "DRUL";
//↓,→,↑,←

/*
#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
*/
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

const ll mod = 998244353ll;
// const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= mod; b >>= 1;}(x *= a) %= mod; b--;} return x;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5],rfact[fact_table + 5];

void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

bool multicase = false;

ll n, m, k, num, a, b, c, d, e, h, q, ans, sum;

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

string s, t;
ll dp[305][305][305];

void solve() {
    double nx = 0.0, ny = 0.0;
    double rad;
    cin >> rad;
    rad *= 2.0 * Pi / 360.0;
    ll cnt = 0;
    double rad_sum = 0.0;
    while(true){
        nx += 100.0 * cos(rad_sum);
        ny += 100.0 * sin(rad_sum);
        rad_sum += rad;
        cnt ++;
        if(abs(nx) < 0.1 && abs(ny) < 0.1)break;
    }
    p(cnt);
    return;
}

int main() {
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}



Measured memory_bytes: 4120
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main(void){
    long long int i, j, n, x, ans=0, po=0;
    scanf("%lld", &n);
    long long int a[n], suma[n];
    for(i=0; i<n; i++) scanf("%lld", &a[i]);
    suma[0] = a[0];
    for(i=1; i<n; i++) suma[i] = suma[i-1] + a[i];
    for(i=0; i<n; i++) suma[i] = suma[i]%1000000007;
    for(i=0; i<n-1; i++){
        ans += a[i]*((suma[n-1]-suma[i]+1000000007)%1000000007);
        ans = ans%1000000007;
    }
    printf("%lld", ans);
}

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

int main() {
    int N, M, cnt = 0;

    cin >> N >> M;

    int a[N] = {0};

    for (int i = 0; i < M; i++) {
        int l, r;
        cin >> l >> r;
        a[l - 1]++;
        a[r]--;
    }

    for (int i = 1; i < N; i++) {
        a[i] += a[i - 1];
    }

    for (int i = 0; i < N; i++) {
        if (a[i] == M) {
            cnt++;
        }
    }

    cout << cnt << endl;
}

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

int mod = 1000000007;

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

    sort(list.begin(), list.end());

    for (int i = 0; i < N; i++)
        cout << list[i];
}

Measured memory_bytes: 256
/*************************************************************************
	> File Name: abc121_b.cpp
	> Author:lynko 
	> Mail: 
	> Created Time: 2019年03月09日 星期六 20时07分10秒
 ************************************************************************/

#include<bits/stdc++.h>
using namespace std;
int a[1001][1001];
int b[1001];
int main()
{
    int n,m,c;
    cin>>n>>m>>c;
      for(int i=1;i<=m;i++)
       cin>>b[i];
      for(int i=1;i<=n;i++)
         for(int j=1;j<=m;j++)
          cin>>a[i][j];
    int num=0;
       for(int i=1;i<=n;i++)
    {  long long ans=0;
          for(int j=1;j<=m;j++)
       {  // cout<<a[i][j]<<endl;
         ans+=a[i][j]*b[j];
          // cout<<ans<<endl;
       }
       ans+=c;
     if(ans>0)
       num++;
}   cout<<num<<endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

ll gcm(ll a,ll b);

int main(){
  string s;
  int N;
  cin >> s >> N;
  int k = s.length();
  vstring A(k);
  rep(i,k){
    A[i] = s.substr(i,(k-i));
  }
  sort(A.begin(),A.end());
  //rep(i,k) cout << A[i] << endl;
  vstring ans(10000000);
  int judge = 0;
  int last = 0;
  bool ansans = false;
  rep(i,k){
    rep(j,A[i].length()){
      bool ok = false;
      if(i == 0){
        ans[judge] = A[i].substr(0,(j+1));
        judge++;
        last++;
      }
      else{
        if(last < (j+1)){
          ans[judge] = A[i].substr(0,(j+1));
          judge++;
          last = j + 1;
        }
        else if(A[i-1][j] != A[i][j]){
          //cout << "i" << i << "j" << j << endl;
          ok = true;
          for(int t = j;t<A[i].length();t++){
            //cout << "t" << t << endl;
            //cout << judge << endl;
            ans[judge] = A[i].substr(0,(t+1));
            judge++;
          }
          if(ok){
            last = A[i].length();
            break;
          }
        }
      }
      if(judge > 5){
        ansans = true;
        break;
      }
      //cout <<"last" <<  last << endl;
      //cout <<"judge"<< judge << endl;
    }
    if(ansans) break;
  }
  cout << ans[N-1] << endl;
}






Measured memory_bytes: 94208
"use strict"

function Main(input) {
  // const nums = input.split("\n");
  // nums.shift()
  const args = input.split('\n');
  const N = args[0],
    nums = args.slice(1, args.length - 1);

  const tmp = [];
  nums.forEach(e => { if (tmp.indexOf(e) == -1) tmp.push(e) });
  console.log(tmp.length);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11468
def main():
    n = int(input())
    vlis = list(map(int, input().split()))
    clis = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        value = vlis[i] - clis[i]
        if value > 0:
            ans += value
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 61840
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  vector<P> p;
  for(int i=0;i<n;++i) {
    int tmp; cin >> tmp;
    p.push_back({tmp, i});
  }
  sort(p.begin(), p.end());
  reverse(p.begin(), p.end());
  multiset<int> ms;
  ms.insert(-1);
  ms.insert(-1);
  ms.insert(n);
  ms.insert(n);
  ll su = 0;
  for(int i=0;i<n;++i) {
    ll val = p[i].first;
    int pos = p[i].second;
    auto it = ms.lower_bound(pos);
    int l1, l2, r1, r2;
    r1 = *it++;
    r2 = *it--;
    it--;
    l1 = *it--;
    l2 = *it;
    su += val * (l1 - l2) * (r1 - pos);
    su += val * (r2 - r1) * (pos - l1);
    ms.insert(pos);
  }
  cout << su << endl;
}


Measured memory_bytes: 5748
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var N = int.Parse(ReadLine());
        if (N < 1200)
        {
            WriteLine("ABC");
            return;
        }
        if (N < 2800) {WriteLine("ARC");
        return;}
        WriteLine("AGC");
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define TOUPPER(s) transform(s.begin(), s.end(), s.begin(), ::toupper)
#define TOLOWER(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
#define FILLZERO(s, n)                      \
    do {                                    \
        ostringstream os;                   \
        os << setw(n) << setfill('0') << s; \
        s = os.str();                       \
    } while (0);
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
#define INIT                               \
    std::cin.tie(nullptr);                 \
    std::ios_base::sync_with_stdio(false); \
    cout << std::fixed << std::setprecision(10);

constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}
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;
}

signed main() {
    INIT;
    char a, b;
    cin >> a >> b;
    if (b == 'H')
        ans = 1;
    if (a == 'D')
        ans = !ans;
    if (ans)
        cout << "H" << endl;
    else
        cout << "D" << endl;
}

Measured memory_bytes: 3636
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const n = nextInt()
    const a = nextIntArray()
    let ans = 0
    for(let el of a){
        ans += 1/el
    }
    console.log(1/ans)
}
Main()


Measured memory_bytes: 29628
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var np = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var ar = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var odd = ar.Count(v => v % 2 == 1);
        var even = np[0] - odd;
        if (odd == 0 && np[1] == 1) { WriteLine(0);return; }
        WriteLine(odd==0?(long)Pow(2,np[0]):(long)Pow(2, np[0] - 1));
    }
}


Measured memory_bytes: 13268
x,k,d = map(int,input().split())
ima = x
ido = abs(x)//d
nokori = k
if k<ido:
    print(abs(ima)-abs(k*d))
else:
    nokori -= ido
    if ima >= 0:
        ima -= abs(ido*d)
        if abs(ima)>=abs(ima-d):
            ima -= d
            nokori -= 1
        if nokori % 2 ==1:
            print(min(abs(ima+d),abs(ima-d)))
        else:
            print(abs(ima))
    else:
        ima += abs(ido*d)
        if abs(ima)>=abs(ima+d):
            ima += d
            nokori -= 1
        if nokori % 2 ==1:
            print(min(abs(ima+d),abs(ima-d)))
        else:
            print(abs(ima))

Measured memory_bytes: 61772
#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)
using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    ll maxheight = A[0];
    ll ans = 0;

    for(int i = 1; i < N; i++){
        if (A[i] < maxheight){
            ans += (maxheight - A[i]);
        }else{
            maxheight = A[i];
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 4832
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		List<Character> list = new ArrayList<>(Arrays.asList('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'));
		for(char c : s.toCharArray()) {
			list.remove(Character.valueOf(c));
		}
		if(list.isEmpty()) {
			System.out.println("None");
		} else {
			System.out.println(list.get(0));
		}
		sc.close();

	}

}


Measured memory_bytes: 26416
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto M = RD;

	auto a = new long[](N+1);
	foreach (i; 0..M)
	{
		auto L = RD-1;
		auto R = RD;
		++a[L];
		--a[R];
	}

	foreach (i; 0..N)
	{
		a[i+1] += a[i];
	}

	long ans;
	foreach (i; 0..N)
	{
		if (a[i] == M)
		{
			++ans;
		}
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;
    int x;
    cin >> x;
    int foo = x/100;
    x %= 100;
    vi a(6);
    iota(all(a),0);
    vvl dp(7,vl(x+1));
    fori(i,x+1) dp[6][i]=1e9;
    dp[6][0]=0;
    repd(i,5,1){
        fori(j,x+1){
            dp[i][j] = dp[i+1][j];
            if(j>=i) dp[i][j] = min(dp[i][j],dp[i][j-i]+1);
        }
    }
    int ans = (dp[1][x] <= foo);
    cout << ans << endl;
    time_taken();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
using mp = set<pair<ll,ll>>;

ll answer1(ll,ll,ll,ll,ll);
ll nearn(ll,int);
int main() {
  int T;
  ll N;
  ll A,B,C,D;
  cin >> T;
  
  for(int i =0;i<T;i++){
    cin >> N >> A >> B >> C >> D;
    cout << answer1(N,A,B,C,D) << endl;
  }
  
}
 
 


ll nearn(ll a,ll b,bool c){
  if(c){
    return (ll)(a - a%b);
  }else{
   return (ll)(a + (b - a%b)); 
  }
  
}

 
ll answer1(ll N,ll A,ll B,ll C,ll D){
  mp myroute;
  myroute.insert(make_pair(0,N));
  pair<ll,ll> empty = *begin(myroute);
  do{
    ll t = empty.first;
    ll n = empty.second;
    
    myroute.insert( make_pair(D*(n-0)+t,0));
    
    ll ia = nearn(n,5,true);
  
    myroute.insert( make_pair(D*(n-ia)+C+t,ia/5));
    ia = nearn(n,5,false);
    myroute.insert( make_pair(D*(ia-n)+C+t,ia/5));
    
    ia = nearn(n,3,true);
    myroute.insert( make_pair(D*(n-ia)+B+t,ia/3));
    ia = nearn(n,3,false);
    myroute.insert( make_pair(D*(ia-n)+B+t,ia/3));
    
    
    ia = nearn(n,2,true);
    myroute.insert( make_pair(D*(n-ia)+A+t,ia/2));
    ia = nearn(n,2,false);
    myroute.insert( make_pair(D*(ia-n)+A+t,ia/2));
    
    
    myroute.erase(*begin(myroute));
    empty = *begin(myroute);
  
  }while(empty.second != 0);
  
  return empty.first;
}

Measured memory_bytes: 11524
#include <math.h>
#include <iostream>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <string>

#define YES "YES"
#define NO "NO"
#define space ' '

using namespace std;

void func();

int main(void)
{
	
	func();

	return 0;
}

// using matrix	?????????????????´??????
void func()
{
	double a, b, c, d, e, f;
	double x, y;

	while (cin >> a >> b >> c >> d >> e >> f, !cin.eof()){


		cout << fixed << setprecision(3);


		if ((a*e - d*b) == 0)
			x = 0.0, y = 0.0;
		else {
			x = (double)((e*c - b*f) / (a*e - d*b));
			y = (double)((-(d*c) + a*f) / (a*e - d*b));


			if (x == 0)
				x = 0.0;
			if (y == 0)
				y = 0.0;
		}
		cout << x << space << y << endl;


		cout << dec;
	}
}

Measured memory_bytes: 1284
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



h, w = LI()
if h % 3 == 0 or w % 3 == 0:
    print(0)
else:
    ret = INF
    for y in range(1, h):
        ret = min(ret, max(y * w, w // 2 * (h - y), (w - w // 2) * (h - y)) - min(y * w, w // 2 * (h - y), (w - w // 2) * (h - y)))
    h, w = w, h
    for y in range(1, h):
        ret = min(ret, max(y * w, w // 2 * (h - y), (w - w // 2) * (h - y)) - min(y * w, w // 2 * (h - y), (w - w // 2) * (h - y)))
    print(min(h, w, ret))

Measured memory_bytes: 41328
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;

void chmax(ll &a, ll b){
    a = max(a, b);
}

int main() {
    int n;
    cin >> n;
    vector<ll> w(n), s(n), v(n);
    vector<P> ord(n);
    for(int i=0;i<n;i++){
        cin >> w[i] >> s[i] >> v[i];
        ord[i] = P(w[i]+s[i],i);
    }
    sort(ord.begin(), ord.end());
    vector<vector<ll> > dp(n+1, vector<ll>(20001,-1));
    dp[0][0] = 0;
    for(int i=0;i<n;i++){
        for(int j=0;j<=20000;j++){
            if(dp[i][j] < 0) continue;
            ll wi = w[ord[i].second], si = s[ord[i].second], vi = v[ord[i].second];
            chmax(dp[i+1][j], dp[i][j]);
            if(j <= si) chmax(dp[i+1][j+wi], dp[i][j] + vi);
        }
    }
    ll ans = 0;
    for(int i=0;i<=20000;i++){
        chmax(ans, dp[n][i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 160640
N = int(input())
num = 1
factors = []

for i in range(N, 1, -1):
    num *= i

r = 2
while num != 1:
    x = 0
    while num % r == 0:
        num //= r
        x += 1
    if x:
        factors.append(x)
    r += 1

result = 1
for i in factors:
    result *= i+1

print(result % ((10**9)+7))

Measured memory_bytes: 3064
from math import gcd
A, B = map(int, input().split())
g = gcd(A, B)

plist = []

for i in range(2, int(g ** 0.5) + 1):
	if g % i == 0:
		plist.append(i)
		while(g % i == 0):
			g //= i
if g != 1:
	plist.append(g)

print(len(plist) + 1)

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

pair<ll,ll> dfs(int v, vector<vector<int>> &G, vector<bool> &used){
    used[v] = 1;
    ll x = (v < 100100 ? 1 : 0);
    ll y = 1 - x;
    for (auto nv : G[v]) if (!used[nv]) {
        auto p = dfs(nv,G,used);
        x += p.first;
        y += p.second;
    }
    return make_pair(x,y);
}

int main(){
    int n; cin >> n;
    vector<vector<int>> G(200200);
    rep(i,n){
        int x, y; cin >> x >> y;
        G[x].push_back(y+100100);
        G[y+100100].push_back(x);
    }
    vector<bool> used(200200,0);
    ll ans = 0;
    rep(i,200200){
        if(used[i]) continue;
        auto p = dfs(i,G,used);
        if(p.first <= 1 || p.second <= 1) n -= p.first + p.second - 1;
        else ans += p.first * p.second;
    }
    cout << ans - n << endl;
    return 0;
}

Measured memory_bytes: 15664
#include<stdio.h>
int main()
{
    int n,k,i;
    scanf("%d %d",&n,&k);
    int sum=k;
    if(n>=1&&k>=2&&n<=1000&&k<=1000)
    {
        for(i=n;i>1;i--)
        {
            sum=sum*(k-1);
        }
        printf("%d",sum);
    }
   return 0;
}


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

int main() {
	
	string s; cin >> s;
	const int p = 3;
	vector<int> num(p, 0);
	for (int i = 0; i < s.size(); i++) {
		num[s[i] - 'a']++;
	}
	bool can = true;
	for (int i = 0; i < p; i++) {
		if (num[i] != 1) can = false;
	}
	if (can) cout << "Yes" << endl;
	else cout << "No" << endl;
    return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> lv(n);
  for (int&v: lv) cin >> v;
  int ans = 0;
  for (int l = -1; l < n; ++l) {
    for (int r = n; r > l; --r) {
      int value = 0;
      int op = (l+1)+(n-r);
      if (op > k) continue;
      vector<int> d;
      for (int i = 0; i <= l; ++i) {
        d.push_back(lv[i]);
        value += lv[i];
      }
      for (int i = n-1; i >= r; --i) {
        d.push_back(lv[i]);
        value += lv[i];
      }
      sort(d.begin(), d.end());
      // cout << "[lr]" << l <<  " " << r << endl;
      // for (int e: d) {
      //   cout << e << " ";
      // }
      // cout << endl;
      for (int i = 0; i < k-op; ++i) {
        if (i >= d.size()) break;
        if (d[i] >= 0) continue;
        value -= d[i];
      }
      ans = max(ans, value);
    }
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int maxn=105;
int main(){
    int a,b,k;
    while (scanf("%d%d%d",&a,&b,&k)==3) {
        int maxx=-1;
        maxx=max(a, b);
        maxx=max(maxx, k);
        int num=3*maxx-(a+b+k);
        if (num&1) {
            printf("%d\n",num/2+2);
        }
        else{
            printf("%d",num/2);
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#define N 210000
using namespace std;
int a[N],n,m,x,ans[N];
int main()
{
	scanf("%d%d",&n,&x);
	m=2*n-1;
	if(x==1 || x==m) {printf("No\n");return 0;}
	ans[n]=x;ans[n-1]=x-1;ans[n+1]=x+1;
	int j=1;
	for(int i=1;i<=m;i++)
	{
		if(abs(i-n)<=1) continue;
		while(abs(j-x)<=1) j++;
		ans[i]=j;
		j++;
	}
	printf("Yes\n");
	for(int i=1;i<=m;i++) printf("%d\n",ans[i]);
	return 0;
}

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

#define dump(x) cout << (x) << '\n'
#define Int int64_t
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
 
Int INF = 1e18;
int inf = 1e9;
Int mod = 1e9+7;

Int n;

Int cnt;

void rec(vector<vector<Int>> v, vector<Int> win, vector<Int> lose, Int h) {
    if (h == n) {
        cnt++;
        return;
    }
    vector<Int> det;
    for (Int i = 0; i < n; i++) {
        if (i == h) continue;
        if (v[h][i] == 0) {
            det.push_back(i);
        }
    }
    Int m = det.size();
    for (Int bit = 0; bit < (1<<m); bit++) {
        Int w, l;
        w = l = 0;
        for (Int i = 0; i < m; i++) {
            if (bit & (1<<i)) {
                w++;
            } else {
                l++;
            }
        }
        if (win[h] + w != lose[h] + l) continue;
        bool check = true;
        for (Int i = 0; i < m; i++) {
            if (bit & (1<<i)) {
                v[h][det[i]] = 1;
                v[det[i]][h] = -1;
                win[h]++;
                lose[det[i]]++;
            } else {
                v[h][det[i]] = -1;
                v[det[i]][h] = 1;
                win[det[i]]++;
                lose[h]++;
            }
            if (win[det[i]] > n / 2 or lose[det[i]] > n / 2) {
                check = false;
            }
        }
        if (check) {
            rec(v, win, lose, h + 1);
        }
        for (Int i = 0; i < m; i++) {
            if (bit & (1<<i)) {
                v[h][det[i]] = 0;
                v[det[i]][h] = 0;
                win[h]--;
                lose[det[i]]--;
            } else {
                v[h][det[i]] = 0;
                v[det[i]][h] = 0;
                win[det[i]]--;
                lose[h]--;
            }
        }
    }
}

int main() {
    vector<Int> res;
    while (cin >> n and n) {
        Int m;
        cin >> m;
        vector<vector<Int>> v(n, vector<Int>(n, 0));
        vector<Int> win(n, 0), lose(n, 0);
        bool check = false;
        for (Int i = 0; i < m; i++) {
            Int a, b;
            cin >> a >> b;
            a--, b--;
            v[a][b] = 1;
            v[b][a] = -1;
            win[a]++;
            lose[b]++;
            if (win[a] > n / 2 or lose[b] > n / 2) {
                check = true;
            }
        }
        if (check) {
            res.push_back(0);
            continue;
        }
        rec(v, win, lose, 0);
        res.push_back(cnt);
        cnt = 0;
    }
    for (Int i = 0; i < (Int)res.size(); i++) {
        dump(res[i]);
    }
    return 0;
}


Measured memory_bytes: 3068
from sys import stdin
input = stdin.readline

n, k, q = map(int, input().split())
arr = list(int(input()) for _ in range(q))
cnt = [k] * n
for i in arr:
    cnt[i-1] += 1
print('\n'.join(['Yes' if cnt[i]-q>0 else 'No' for i in range(n)]))

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

int main()
{
  long long x;
  cin>>x;
  if(x%500==0)
    cout<<(x/500)*1000;
  else if(x%500!=0)
    cout<<(x/500)*1000 + ((x%500)/5)*5<<endl;
  return 0;
}

Measured memory_bytes: 256
def pp(a,b)
  puts [a,b].join(" ")
end

n = gets.to_i
k = Math.log2(n)
if n == 1 || k == k.to_i
  puts "No"
  exit
end

puts "Yes"
pp(1,2)
pp(2,3)
pp(3,n+1)
pp(n+1,n+2)
pp(n+2,n+3)

((n-3)/2).times do |i|
  t = i*2
  pp(t+4,t+5)
  pp(t+5,n+1)
  pp(n+1,n+t+4)
  pp(n+t+4,n+t+5)
end

if n % 2 == 0
  t = 2**(k.to_i)
  pp(n,n+t)
  pp(n-t+1,2*n)
end

Measured memory_bytes: 4476
#include <bits/stdc++.h>
#define LARB 1
#define RARB 30000
#define inf 1e18
#define zeros(x) ((x^(x-1))&x)
#define endl '\n'
#define eps 1e-9
#define mod 1000000007
#define NMAX 300

using namespace std;

typedef long long ll;
typedef long double ld;

ll n, V[200005], SP[200005], minim=inf;


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

    cin>>n;
    for (int i=1; i<=n; i++)
        cin>>V[i], SP[i] = SP[i-1]+V[i];

    for (int i=2; i<=n; i++)
    {
        ll l = SP[i-1];
        ll r = SP[n] - l;

        ll dif = abs(l-r);
        if (dif < minim)
            minim = dif;
    }
    cout<<minim;
    return 0;
}

Measured memory_bytes: 3328
# coding: utf-8
# Your code here!
n=int(input())
s=list(input())
a=list(map(ord,s))
m=0
for i in range(1,n):
    cnt=0
    flg=0
    tmp=0
    for j in range(n-i):
        if a[j]==a[j+i] and flg==0:
            #print("!")
            flg=1
            tmp=j+i
            cnt+=1
        elif a[j]==a[j+i] and flg==1:
            #print("?")
            cnt+=1
            if tmp>j:
                m=max(m,cnt)
        else:
            #print("$")
            cnt=0
            flg=0
print(m)



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

int main() {
    ll a,b,c;
    std::cin >> a>>b>>c;
    
    for (int i = 1; i < 1000; i++) {
        if( a*i %b == c){
            std::cout << "YES" << std::endl;
            return 0;
        }
    }
    std::cout << "NO" << std::endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;
 
int n;
vector<int> G[MAX+1], color[MAX+1];
int co[MAX+1], ans[MAX+1], A[MAX+1], B[MAX+1], C[MAX+1], D[MAX+1];
 
void dfs(int r, int c) {
    stack<int> S;
    S.push(r);
    co[r] = c;
    color[c].push_back(r);
    while (!S.empty()) {
        int u = S.top(); S.pop();
        for (int i = 0; i < G[u].size(); i++) {
            int v = G[u][i];
            if (co[v] == NIL) {
                co[v] = c;
                color[c].push_back(v);
                S.push(v);
            }
        }
    }
}
 
void assignColor() {
    int id = 0;
    for (int i = 1; i <= n; i++) co[i] = NIL;
    for (int u = 1; u <= n; u++) {
        if (co[u] == NIL) dfs(u, id++);
    }
}
 
int main() {
    int m, k;
    
    cin >> n >> m >> k;
 
    for (int i = 0; i < m; i++) {
        cin >> A[i] >> B[i];
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }
 
    assignColor();
 
    for (int i = 0; i < k; i++) {
        cin >> C[i] >> D[i]; 
    }
 
    for (int i = 1; i <= n; i++) ans[i] = color[co[i]].size() - 1;

    for (int i = 0; i < m; i++) {
        if (co[A[i]] != co[B[i]]) continue;
        ans[A[i]]--;
        ans[B[i]]--;
    }

        for (int i = 0; i < k; i++) {
        if (co[C[i]] != co[D[i]]) continue;
        ans[C[i]]--;
        ans[D[i]]--;
    }
    
    for (int i = 1; i <= n; i++) {
        if (i != 1) cout << " ";
        cout << ans[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 11904
while True:
    [n, x] = map(int, input().split())
    if n==0 and x==0:
        break
    ans = 0
    for a in range(1,n-1):
        for b in range(a+1,n):
            for c in range(b+1,n+1):
                if a+b+c==x:
                    ans += 1
    print(ans)

Measured memory_bytes: 7680
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(s) cout << s << endl;
typedef long long LL;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
   char x,y; cin>>x>>y;
   if(x==y) cout<<"="<<endl;
   else if(x>y) cout<<">"<<endl;
   else cout<<"<"<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
int main() {
    int x, n;
    cin >> x >> n;
    set<int> s;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        s.insert(a);
    }
    for (int i = 0; ; i++) {
        if (s.find(x - i) == s.end()) {
            cout << x - i << endl;
            return 0;
        }
        if (s.find(x + i) == s.end()) {
            cout << x + i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		for(char c : s.toCharArray()) {
			if(c == 'B') {
				if(sb.length() > 0) {
					sb.deleteCharAt(sb.length()-1);
				}
			} else {
				sb.append(c);
			}
		}
		System.out.println(sb.toString());
	}
}

Measured memory_bytes: 22996
# -*- coding: utf-8 -*-
from itertools import permutations
from collections import Counter
def inpl(): return list(map(int, input().split()))
N, C = inpl()

D = [inpl() for _ in range(C)]

G = [Counter() for _ in range(3)]
for i in range(1, N+1):
    for j, c in enumerate(inpl(), start=1):
        G[(i+j)%3][c-1] += 1

ans = 10**9
for p, q, r in permutations(range(C), 3):
    tmp = 0
    for c in range(C):
        tmp += (D[c][p] * G[0][c]
              + D[c][q] * G[1][c]
              + D[c][r] * G[2][c])
    ans = min(ans, tmp)

print(ans)

Measured memory_bytes: 46808
n = int(input())
money = []
tuka = []
for i in range(n):
    li = input().split()
    money.append(float(li[0]))
    tuka.append(li[1])

ans = 0
for j in range(n):
    if tuka[j] == "JPY":
        ans += money[j]
    else:
        ans += 380000 * money[j]
print(ans)

Measured memory_bytes: 3060
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define SORT(c) sort((c).begin(),(c).end())
#define ANS(ans) cout<<(ans)<<endl;
typedef vector<int> VI;


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

int gcd(int x, int y)
{
	int r;

	if (x == 0 || y == 0)  // 引数チェック
	{
		fprintf(stderr, "引数エラーです。\n");
		return 0;
	}

	// ユーグリッドの互除法
	while ((r = x % y) != 0)  // yで割り切れるまでループ
	{
		x = y;
		y = r;
	}
	return y;
}

int main() {

	int n, x;
	cin >> n >> x;
	int temp;

	VI d(n);
	REP(i, n) {
		cin >> temp;
		d[i] = abs(temp - x);
	}
	int g=d[0];
	REP(i, n-1) {
		g = gcd(g, d[i + 1]);
	}

	ANS(g);

	return 0;
}



Measured memory_bytes: 640
#include <bits/stdc++.h>
#define int long long int
#define ldouble long double
#define vin vector<int> 
#define rep(i,a,n) for(i=(a);i<(n);i++)

//setprecision()<<

using namespace std;

void fin(int i,int n,vin &a){
    rep(i,0,n){
        cin>>a.at(i);
    } 
} 
int power(int n,int m){
    int INF=998244353;
    n%=INF;
    int i;
    int sum=1;
    rep(i,0,m){
        sum*=n;
        sum%=INF;
    }
    return sum;
}

signed main() {
    int INF=998244353;
    int i=0;
    int N;
    cin>>N;
    vin D(N);
    fin(i,N,D);
    if(D.at(0)!=0){
        cout<<0<<endl;
        return 0;
    }
    sort(D.begin(),D.end());
    vin count(0);
    count.push_back(1);
    rep(i,1,N){
        if(D.at(i)==0){
            cout<<0<<endl;
            return 0;
            
        }
        else if(D.at(i)==D.at(i-1)+1){
            count.push_back(1);
        }
        else if(D.at(i)==D.at(i-1)){
            count.at(D.at(i))++;
        }
        else{
            cout<<0<<endl;
            return 0;
        }
    }

    int sum=1;
    rep(i,1,count.size()){
        sum=((sum%INF)*power(count.at(i-1),count.at(i)))%INF;
    }
    cout<<setprecision(10)<<sum<<endl;
return 0;
}

Measured memory_bytes: 2168
S=input()
num=len(S)
a=[0]*(num+1)
for i in range(num):
  if S[i]=="<":
    a[i+1]=max(a[i+1],a[i]+1)
for i in range(1,num+1):
  if S[-i]==">":
    a[-(i+1)]=max(a[-(i+1)],a[-i]+1)
print(sum(a))


Measured memory_bytes: 29064
#include <cstdio>
using namespace std;

int a, b, c;
int num_rect;
int num_rhombus;

int main() {
  while (1) {
    if (scanf("%d,%d,%d", &a, &b, &c) != 3) break;
    if (a*a+b*b == c*c) num_rect++;
    if (a == b) num_rhombus++;
  }

  printf("%d\n", num_rect);
  printf("%d\n", num_rhombus);
}

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



int main(){
	int N;
	cin>>N;
	int H[N];
	for(int i=0;i<N;i++){
		cin>>H[i];
	}
	int ans = 0;
	for(int i=1;i<N;i++){
		bool f = true;
		for(int j=0;j<i;j++){
			if(H[j]>H[i])f=false;
		}
		if(f)ans++;
	}
	
	cout<<ans+1<<endl;
	
	
	return 0;
}


Measured memory_bytes: 256