akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <vector>
#include <algorithm>
#define ll long long
const int M=1e9+7;
#define test int t; cin>>t; while(t--)
#define f for(int i=0;i<n;i++)
#define f1 for(int i=1;i<n-1;i++)
#define read(x) ll x; cin>>x;
#define TIME  cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";

using namespace std;
/*ll gcd(ll a , ll b){return b==0?a:gcd(b,a%b);}
int combi(int n, int k)
{
    int C[k+1];
    memset(C, 0, sizeof(C));

    C[0] = 1;

    for (int i = 1; i <= n; i++)
    {
        for (int j = min(i, k); j > 0; j--)
            C[j] = C[j] + C[j-1];
    }
    return C[k];
}
int factorial(int n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll power(ll x,ll n)
{
    if(n==0) return 1;
    if(n&1) return x*power(x,n/2)*power(x,n/2);
    else
        return power(x,n/2)*power(x,n/2);
}*/

/*int gcd(int a, int b){
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

int lcm(int a, int b)
{
    return (a*b)/gcd(a, b);
}*/   //gcd__lcm

ll mod(ll x)
{
    return ((x%M + M)%M);
}
ll add_mod(ll a,ll b)
{
    return mod(mod(a) + mod(b));
}
ll mul_mod(ll a,ll b)
{
    return mod(mod(a) * mod(b));
}  //modular

/*void transpose(vector<vector<ll> >& arr,ll x) {
     for (ll j = 0; j <= x; j++) // transpose
               {
                   for (ll c = j; c <= x; c++)
                   {
                       swap(arr[j][c],arr[c][j]);
                   }
               }

}*/  //transpose

int main(){

  // ios_base::sync_with_stdio(false);
    //cin.tie(nullptr);
    string s; cin>>s;
    int n=s.length()-1;
    cout<<s;
    if(s[n]!='s')
    {
        cout<<"s"<<endl;
    }
    else
    {
        cout<<"es"<<endl;
    }
    TIME
}


Measured memory_bytes: 3760
n = gets.to_i
a = gets.split.map(&:to_i)
color = Array.new(8,0)
any = 0
n.times do |i|
	k = a[i]/400.to_i
	if k>=8
		any += 1
	else
		color[k] = 1
	end
end
cnt = color.count(1)
if cnt == 0
	min = 1
	max = any
else
	min = cnt
	max = cnt + any
end
print "#{min} #{max}"


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

using namespace std;
using LL = long long;

const int MOD = 1e9+7;

class Edge{
public:
    LL from,to, value;
    Edge(int f,int t, int c){
        from = f;
        to = t;
        value = c;
    }
};

std::vector<LL> dijkstra(int s,int N,vector<Edge> E){
    std::vector<LL> ans(N, 1e18);
    std::vector<std::vector<Edge>> Edges(N);
    for(auto e : E){
        Edges.at(e.from).push_back(e);
    }
    priority_queue<pair<LL,LL>, std::vector<pair<LL,LL>>, greater<pair<LL,LL>>> que;
    ans.at(s)= 0;
    que.push(make_pair(0,s));
    while(!que.empty()){
        pair<LL,LL> p = que.top();que.pop();
        if(ans.at(p.second) < p.first)continue;
        for(int i = 0;i < Edges.at(p.second).size();i++){
                if(ans.at(p.second) + Edges.at(p.second).at(i).value < ans.at(Edges.at(p.second).at(i).to)){
                ans.at(Edges.at(p.second).at(i).to) = ans.at(p.second) + Edges.at(p.second).at(i).value;
                que.push(make_pair(ans.at(Edges.at(p.second).at(i).to),Edges.at(p.second).at(i).to));
            }
        }
    }
    return ans;
}

int main()
{
    int N,M,L;cin >> N >> M >> L;
    vector<Edge> Edges;
    for(int i = 0;i < M;i++){
        int a,b,c;cin >> a >> b >> c;
        a--,b--;
        if(c > L)continue;
        Edges.push_back(Edge(a,b,c));
        Edges.push_back(Edge(b,a,c));
    }
    vector<vector<LL>> dists;
    for(int i = 0;i < N;i++){
        dists.push_back(dijkstra(i, N, Edges));
    }
    vector<Edge> E;
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            if(i == j)continue;
            if(dists.at(i).at(j) <= L){
                E.push_back(Edge(i, j, 1));
            }
        }
    }
    vector<vector<LL>> u;
    for(int i = 0;i < N;i++)u.push_back(dijkstra(i, N, E));
    int Q;cin >> Q;
    for(int i = 0;i < Q;i++){
        int a,b;cin >> a >> b;
        a--,b--;
        if(u.at(a).at(b) != 1e18){
            cout<<u.at(a).at(b)-1<<endl;
        }else{
            cout<<-1<<endl;
        }
    }
}


Measured memory_bytes: 12072
#include <cstdio>
#include <algorithm>
using namespace std;
int arr[1001];

int main()  {

    int n, m, idx, diff, sum = 0;
    for (;;) {
        scanf("%d %d", &n, &m);
        if (n == 0 && m == 0) break;
        sum = 0;
        fill(arr, arr+n, 0);
        for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
        sort(arr, arr+n);
        for (int i = n - 1; i >= 1; i--) {
            if (arr[i] > m) continue;
            idx = int(upper_bound(arr, arr+i, m-arr[i]) -arr-1);
            if (arr[i] + arr[idx] <= m && idx != i && idx >= 0 ) sum = max(sum, arr[i]+arr[idx]);
            if (sum == m) break;
        }
        (sum == 0) ? printf("NONE\n") : printf("%d\n", sum);
    }
    return 0;
}



Measured memory_bytes: 2752
import Control.Applicative

main :: IO ()
main = solve <$> readLn >>= putStrLn

solve :: Int -> String
solve x = case (m a, m b) of
  (True, True) -> "AMBIGUOUS"
  (True, False) -> "MMYY"
  (False, True) -> "YYMM"
  _ -> "NA"
  where
    (a, b) = divMod x 100
    m n = n >= 1 && n <= 12


Measured memory_bytes: 508
/*input
1
1

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  vector<long long> cnt(n + 1, 0);
  for (int a = 1; a <= 100; a++) {
    for (int b = 1; b <= 100; b++) {
      for (int c = 1; c <= 100; c++) {
        int cur = a * a + b * b + c * c + a * b + b * c + c * a;
        if (cur <= n) cnt[cur]++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << cnt[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main () {
  long X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  vector<pair<long, long>> data(A + B + C);
  for(int i = 0; i < A + B + C; i++){
    cin >> data.at(i).first;
    if(i < A)data.at(i).second = 0;
    else if(i < A + B)data.at(i).second = 1;
    else if(i < A + B + C)data.at(i).second = 2;
  }
  sort(data.begin(), data.end());
  reverse(data.begin(), data.end());
  long a = 0, b = 0, c = 0, ans = 0;
  for(int i = 0; i < A + B + C; i++){
    if(data.at(i).second == 0){
      if(a == X)continue;
      a++;
      ans += data.at(i).first;
    } else if(data.at(i).second == 1){
      if(b == Y)continue;
      b++;
      ans += data.at(i).first;
    } else {
      c++;
      ans += data.at(i).first;
    }
    if(a + b + c == X + Y)break;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
// #define endl '\n'

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 1e5+5, LG = 17, MOD = 1e9+7;
const int SQ = 320;
const long double EPS = 1e-7;
int n, q;
int a[N], b[N], c[N], d[N];
int tb[17][N];
int lvl[N];
ll sum[N];
vector<int> adj[N];
vector<int> col[N];
int in[N], out[N], tmr;
int cnt[N], sub[N];
void dfs(int node, int par){
  in[node] = ++tmr;
  tb[0][node] = par;
  f(k,1,17)
    tb[k][node] = tb[k-1][tb[k-1][node]];

  for(auto edge : adj[node]){
    int child = a[edge] ^ b[edge] ^ node;
    if(child == par)continue;
    if(a[edge] != node)swap(a[edge], b[edge]);
    lvl[child] = lvl[node] + 1;
    sum[child] = sum[node] + d[edge];
    col[c[edge]].pb(edge);
    dfs(child, node);
  }
  out[node] = tmr;
}
int getLCA(int u, int v){
  if(lvl[u] > lvl[v])swap(u, v);
  int d = lvl[v] - lvl[u];
  f(k,0,17)
    if(d >> k & 1)v = tb[k][v];
  if(u == v)return u;
  for(int k = 16; k >= 0; --k)
  if(tb[k][u] != tb[k][v]){
    u = tb[k][u];
    v = tb[k][v];
  }
  return tb[0][u];
}
bool isPar(int p, int u){
  return in[p] <= in[u] && out[u] <= out[p];
}
bool edgeOnPath(int u, int v, int edge){
  ///check if edge is on path
  if(isPar(u,b[edge])&&isPar(u,a[edge]) && isPar(a[edge], v)&&isPar(b[edge],v))
    return true;
  return false;
}
int u[N], v[N], x[N], y[N];
vector<int> qr[N];
int cntC[N];
ll sumC[N];
void dfs2(int node, int par, int col){

  for(auto edge : adj[node]){
    int child = a[edge] ^ b[edge] ^ node;
    if(child == par)continue;
    cntC[child] = cntC[node] + (c[edge] == col);
    sumC[child] = sumC[node] + (c[edge] == col) * d[edge];
    dfs2(child, node, col);
  }

}
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
  cin >> n >> q;
  f(i,1,n){
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    adj[a[i]].pb(i);
    adj[b[i]].pb(i);
  }

  dfs(1, 1);

  f(i,0,q){
    cin >> x[i] >> y[i] >> u[i] >> v[i];
    qr[x[i]].pb(i);
  }
  vector<ll>ans(q);
  f(i,1,n+1)
    if(col[i].size() < SQ){
      for(auto q : qr[i]){
        int l = getLCA(u[q], v[q]); /// this is the LCA
        for(auto x : col[i]){
          if(edgeOnPath(l, u[q],x)||edgeOnPath(l, v[q],x)){
            cnt[q]++;
            sub[q] += d[x];
          }
        }
        ans[
        q] = sum[u[q]] + sum[v[q]] - 2 * sum[l];
        ans[q] -= sub[q];
        ans[q] += 1ll * cnt[q] * y[q];
      }
    }  else {
      dfs2(1, 1, i); ///sum and count for this color
      for(auto q : qr[i]){
        int l = getLCA(u[q], v[q]); /// this is the LCA
        cnt[q] = cntC[u[q]] + cntC[v[q]] - 2 * cntC[l];
        sub[q] = sumC[u[q]] + sumC[v[q]] - 2 * sumC[l];
        ans[q] = sum[u[q]] + sum[v[q]] - 2 * sum[l];
        ans[q] -= sub[q];
        ans[q] += 1ll * cnt[q] * y[q];
      }
    }

    f(i,0,q)cout << ans[i] << '\n';

  return 0;
}


Measured memory_bytes: 35068
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define REP(i,p,n) for(int i=p;i<n;++i)
#define rep(i,n) REP(i,0,n)

using ll = long long int;
using pll = pair<ll, ll>;

int main()
{
    int a, b;
    cin >> a >> b;

    cout << (a == b ? a + b : (a < b ? (b + (b - 1)) : (a + (a - 1)))) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
signed main()
{
    int w,h,x,y;
    cin>>w>>h>>x>>y;
    cout<<fixed<<setprecision(6)<<(w*h)/(2*1.0)<<" ";
    if(x+x==w && y+y==h)
    cout<<1<<endl;
    else
    cout<<0<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
ll GetDigit(ll num){ return log10(num)+1; } //numの桁数を求める

int main()
{
    string s;
    cin >>s ;
    if(s == "SUN") cout << 7 << endl;
    else if(s == "MON") cout << 6 << endl;
    else if(s == "TUE") cout << 5 << endl;
    else if(s == "WED") cout << 4 << endl;
    else if(s == "THU") cout << 3 << endl;
    else if(s == "FRI") cout << 2 << endl;
    else if(s == "SAT") cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 3616
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 入力値を数値で返却する
def gets_i()
  gets.chomp.to_i
end
a, b = gets_i, gets_i

if a > b
  puts "GREATER"
elsif a < b
  puts "LESS"
else
  puts "EQUAL"
end

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


int main()
{
	int n, k, c = 0; cin >> n >> k;
	int A[n];
	for(int i = 0; i < n; ++i)
		cin >> A[i];
	sort(A, A+n);
	for (int i = n-k; i < n; ++i)
		c += A[i];
	cout << c << endl;
}



Measured memory_bytes: 3460
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<unistd.h>
using uint = unsigned int;
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif

struct Buffer{
    int idx;
    char buf[1025];
    Buffer(){ init(); }
    void init(){ idx = 0; read(0, buf, 1024); }
    void check(){ if(idx == 1024){ init(); } }
    int next(){
        static char notDigits[256] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1, 0,0,0,0,0,0,0,0,0,0,};
        int ret = 0, sign = 1;
        while(check(), notDigits[(int)buf[idx]]){ idx++; }
        if(check(), buf[idx] == '-'){ sign = -1; idx++; }
        while(check(), !notDigits[(int)buf[idx]]){ ret = ret * 10 + buf[idx++] - '0'; }
        return sign * ret;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    Buffer buf;
    int h = buf.next(), w = buf.next();
    vector<vector<short>> cs(10, vector<short>(10));
    // int cs[10][10];
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            cs[i][j] = buf.next();
        }
    }
    for(int i = 0; i < 10; i++){
        for(int j = 0; j < 10; j++){
            for(int k = 0; k < 10; k++){
                cs[j][k] = min((int)cs[j][k], cs[j][i] + cs[i][k]);
            }
        }
    }
    int ans = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            int a = buf.next();
            prints(a);
            if(a != -1){
                ans += cs[a][1];
            }
        }
    }
    cout << ans << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
typedef long long ll;
typedef pair<int,int> pii;

bool is_prime(int k)
{
    for(int j=2;j*j<=k;j++){
        if(k%j==0) {
            return false;
        }
    }
    return true;
}

ll gcd(ll a, ll b)
{
    /* 自然数 a > b を確認・入替 */
    if(a<b){
        ll tmp = a;
        a = b;
        b = tmp;
    }
    if(b==1){
        return 1;
    }
    /* ユークリッドの互除法 */
    ll r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll a, ll b)
{
    ll r=a*b/gcd(a,b);
    return r;
}

int main()
{
    // 入力
    int N,M;
    cin>>N>>M;
    pii ar[M];
    for(int i=0;i<M;i++){
        cin>>ar[i].ss>>ar[i].ff;
    }

    sort(ar,ar+M);

    int lastb=-1;
    int ans=0;
    for(int i=0;i<M;i++){
        if(lastb<=ar[i].ss) {
            ans++;
            lastb=ar[i].ff;
        }
    }
    cout<<ans<<endl;
    return 0;

}

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

int main(){
  ll H, W;
  cin >> H >> W;
  if(H ==1 || W==1){
    cout << 1 << endl;
    return 0;
  }
  ll result = H*W;
  if(result%2!=0) cout << (result+1)/2 << endl;
  else cout << result/2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/numeric>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define oo 0x3f3f3f3f
#define OO 0x3f3f3f3f3f3f3f3f
#define popcount(n) __builtin_popcount(n)
#define popcountll(n) __builtin_popcountll(n)

using namespace std;
//using namespace __gnu_cxx;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const double PI = acos(-1.0), EPS = 1e-6;
const long long inf = 2e12 + 12;
const int MAXN = 100005, MAXM = 1003, mod = 1000000007 , MAXLog = 20;

int n, k;
vector<int> adj[MAXN];
int memo[MAXN];

int fact[MAXN];
int invfact[MAXN];
int mul(int a , int b , int m){
    return (1LL * (a % m) * (b % m)) % m;
}

int powMOD(int x , int n , int m = mod){
    if(!n)return 1;
    int ret = 1;
    if(n & 1)ret = mul(x , powMOD(x , n - 1 , m) , m);
    else{
        int y = powMOD(x , n / 2 , m);
        ret = mul(y , y , m);
    }
    return ret;
}


int nPr(int n , int r){
    if(r < 0 || r > n)return 0;
    return mul(fact[n] , invfact[n - r] , mod);
}


void pre() {
    fact[0] = invfact[0] = 1;
    for (int i = 1; i < MAXN; ++i)
        fact[i] = mul(i, fact[i - 1], mod);

    invfact[MAXN - 1] = powMOD(fact[MAXN - 1], mod - 2, mod);
    for (int i = MAXN - 2; ~i; --i)
        invfact[i] = mul(invfact[i + 1], i + 1, mod);
}


int solve(int u, int par) {
    if (u != 1 && adj[u].size() == 1) {
        return 1;
    }
    int &ret = memo[u];
    if (~ret)
        return ret;
    if (u == 1) {
        ret = nPr(k, adj[u].size() + 1);
        for (int v : adj[u]) {
            if (v == par)
                continue;
            ret = 1LL * ret * solve(v, u) % mod;
        }
    } else {
        ret = nPr(k - 2, adj[u].size() - 1);
        for (int v : adj[u]) {
            if (v == par)
                continue;
            ret = 1LL * ret * solve(v, u) % mod;
        }
    }
    return ret;
}

int main() {
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0), cout.precision(9), cout << fixed;


    cin >> n >> k;
    for (int i = 1; i < n; ++i) {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    pre();

    memset(memo, -1, sizeof memo);
    cout << solve(1, -1) << '\n';


    return 0;
}

Measured memory_bytes: 11648
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
#include <queue>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i, n)cin >> a[i];
    rep(i, n)cin >> b[i];
    ll ps, ms;
    ps = ms = 0;
    rep(i, n){
        if(a[i] < b[i])ps += (b[i]-a[i])/2;
        else ms += a[i]-b[i];
    }
    if(ps-ms >= 0)cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 384
#include <stdio.h>

int main() {
	int a, b,gcb;

	scanf("%d %d", &a, &b);

	if (a > b) {

		while (a % b != 0) {

			gcb = a % b;
		
			a = b;
			b = gcb;

		}
	}

	else if(a<b){
		while (b % a != 0) {

			gcb = b % a;

			b = a;
			a = gcb;

		}
	}

   else gcb = a;

	printf("%d\n",gcb);

	return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#define  nl "\n"
#define forn(i, n) for (int i = 0; i < int(n); i++)
typedef long long ll ;

using namespace std ;

int main() {
    ios_base::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    
    int n ,a,b,c;
    cin >> n ;
    int ans[3] ;
    int cur[3] ;

    forn(i,n) {
        cin >> cur[0] >> cur[1] >> cur[2] ; 
        if(i==0) {
            ans[0] = cur[0] ; 
            ans[1] = cur[1] ;
            ans[2] = cur[2] ; 
            continue ;
        }
        a = ans[0] ; b = ans[1] ; c= ans[2] ;
        ans[0] = max(cur[0]+b,cur[0]+c);
        ans[1] = max(cur[1]+a,cur[1]+c);
        ans[2] = max(cur[2]+b,cur[2]+a);
    }
    cout << *max_element(ans,ans+3) << nl;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<string.h>

int main(){

    char tmp[10];
    int a, b = 0;

    while ( (fscanf(stdin, "%d %d", &a, &b)) != EOF){
        sprintf(tmp, "%d", (a+b));
        printf("%d\n", strlen(tmp));
    }

    return 0;
}

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

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(){
    std::ios::sync_with_stdio(0); cin.tie(0);
    long double x,y;
    cin >> x >> y;
    cout << (ll)(log2(y)- log2(x) + 1) << endl;

}

Measured memory_bytes: 512
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

// 素因数
vector<int> getPrimeFactors(int a) {
    vector<int> s;
    for (int i = 2; i * i <= a; i++) {
        if (a % i != 0) continue;
        while (a % i == 0) {
            a /= i;
            s.push_back(i);
        }
    }
    if (a > 1) {
        s.push_back(a);
    }
    return s;
}

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

    int N;
    cin >> N;

    map<int, int> pf;
    FOR(i, 1, N) {
        auto v = getPrimeFactors(i);
        REP(i, v.size()) {
            pf[v[i]]++;
        }
    }

    set<int> overthree;
    set<int> overfive;
    set<int> overfifteen;
    set<int> overtwentyfive;
    set<int> overseventyfive;
    for (auto kv : pf) {
        if (kv.second + 1 >= 3) {
            overthree.insert(kv.first);
        }
        if (kv.second + 1 >= 5) {
            overfive.insert(kv.first);
        }
        if (kv.second + 1 >= 15) {
            overfifteen.insert(kv.first);
        }
        if (kv.second + 1 >= 25) {
            overtwentyfive.insert(kv.first);
        }
        if (kv.second + 1 >= 75) {
            overseventyfive.insert(kv.first);
        }
    }

    int ans = overseventyfive.size();

    for (auto t: overtwentyfive) {
        int n = overthree.size() - 1;
        if (n < 0) continue;
        ans += n;
    }

    for (auto t: overfifteen) {
        int n = overfive.size() - 1;
        if (n < 0) continue;
        ans += n;
    }

    for (auto t : overthree) {
        int n = overfive.count(t) > 0 ? overfive.size() - 1 : overfive.size();
        if (n < 1) continue;
        ans += n * (n - 1) / 2;
    }
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 256
using System;
using static System.Console;

namespace B
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            var k = int.Parse(ReadLine());
            var line = ReadLine();
            var result = "";
            if (line.Length <= k) result = line;
            else
            {
                result = $"{line.Substring(0, k)}...";
            }

            WriteLine(result);
        }
    }
}

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

string query(int i) {
    cout << i << endl;
    string result;
    cin >> result;
    return result;
};

int main() {
    int n;
    cin >> n;
    int begin = 0, end = n - 1;
    string head = query(begin), tail = query(end);
    if (head != "Vacant" && tail != "Vacant") {
        while (true) {
            auto mid = (begin + end) / 2;
            auto current = query(mid);
            if (current == "Vacant") {
                break;
            }
            if ((current == head) != (begin % 2 == mid % 2)) {
                end = mid;
            } else {
                begin = mid;
                swap(head, current);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 852
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>
#include <numeric>
#include <iterator>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(int i=0;i<(int)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll gcd(ll a, ll b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

int main()
{
    IO;

    ll m; cin >> m;
    cout << m << ":";

    ll x = m;

    vector<ll> p;

    p.push_back(2);
    for (ll n = 3; n <= sqrt(1000000000); ++n) {
        for (ll k = 0; k != p.size(); ++k) {
            if (n % p[k] == 0) { goto xyz; }
            if (p[k] > sqrt(n)) { break; }
        }
        p.push_back(n);
    xyz:;
    }

    rep(i, p.size()) {
        while (x % p[i] == 0) {
            cout << " " << p[i];
            x /= p[i];
        }
        if (x == 1) {
            cout << endl;
            break;
        }
    }

    if (x != 1) {
        cout << " " << x << endl;
    }

}


Measured memory_bytes: 3272
from time import time
from random import randint

from numba import njit
from numpy import int64

@njit('i8(i8[:], i8[:])')
def func(s, x):
    last = [0] * 26
    score = 0
    for i, v in enumerate(x, 1):
        last[v] = i
        c = 0
        for j in range(26):
            c += s[j] * (i - last[j])
        score += s[i * 26 + v] - c
    return score

def main():
    start = time()
    d, *s = map(int, open(0).read().split())
    s = int64(s)
    x = int64(([*range(26)] * 15)[:d])
    M = func(s, x)
    while time() - start < 1.3:
        y = x.copy()
        if randint(0, 1):
            y[randint(0, d - 1)] = randint(0, 25)
        elif randint(0, 1):
            i=randint(0, d - 16)
            j=randint(i, i + 15)
            y[i], y[j] = y[j], y[i]
        else:
            i = randint(0, d - 15)
            j = randint(i + 1, i + 7)
            k = randint(j + 1, j + 7)
            if randint(0, 1):
                y[i], y[j], y[k] = y[j], y[k], y[i]
            else:
                y[i], y[j], y[k] = y[k], y[i], y[j]
        t = func(s, y)
        if t > M:
            M = t
            x = y
    print(*x + 1, sep='\n')

main()

Measured memory_bytes: 111792
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, result, distance int
	fmt.Scan(&n)
	nums := make([]int, n)
	for i:=0; i<n; i++{
		fmt.Scan(&nums[i])
	}

	sort.Ints(nums)
	for i:=0; i<n; i++{
		result += (nums[i] - nums[0]) * (nums[i] - nums[0])
	}

	for p:=nums[0]; p<=nums[n-1]; p++{
		for i:=0; i<n; i++{
			distance += (nums[i] - p) * (nums[i] - p)
		}
		if distance < result{
			result = distance
		}
		distance = 0
	}

	fmt.Println(result)
}

Measured memory_bytes: 1844
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++)

int main() {
    int x;
    int ans = 1;
    rep(i, 5){
        cin >> x;
        if (x == 0) {
            cout << ans << endl;
            return 0;
        }
        else {
            ans++;
        }
    }
}

Measured memory_bytes: 3628
q[1<<18];i,n;
main(a){
	for(;~scanf("%d",&a);)n?q[a]=++i:(n=a);
	for(a=0;--i;a?q[n]<q[i]^q[i]<q[i+1]^q[i+1]<q[n]?a++,n=i+1:0:q[i]<q[i+1]?n--:a++);
	printf("%d",a);
}

Measured memory_bytes: 896
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

void CountingSort(unsigned short*,unsigned short*,int *,int,int);

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */
  j=-1;
  for(i=0;i<n;i++){ /* jに最大値を入れる＋ Aにすべての数を入れる */
    scanf("%d",&A[i]);
    if(j<A[i]) j=A[i];
  }
  
  CountingSort(A,B,C,j,n);
  


  for(i=1;i<=n;i++){
    printf("%d",B[i]); /* Bは 1からn までの要素に入れられるため */
    
    if(i!=n) printf(" ");
    else printf("\n");
  }

  return 0;
}

void CountingSort(unsigned short* A,unsigned short* B,int *C,int k,int n){
  int i;

  for(i=0;i<=k;i++) C[i]=0;/* Cを初期化 */

  for(i=0;i<n;i++) C[A[i]]++;

  for(i=1;i<=k;i++) C[i]=C[i]+C[i-1]; /* 最後の要素は必ず n になる */

  for(i=n-1;i>=0;i--){
    B[C[A[i]]]=A[i]; 
    C[A[i]]--;
  }

  return;
}



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

bool f(string a, string b) {
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    reverse(b.begin(), b.end());
    return a < b;
}
int main() {
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    cout << (f(s, t) ? "Yes" : "No") << '\n';
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    xys: [[(usize1, i32)]; n],
  }
  let mut ans = 0;
  for pat in 0 .. 1 << n {
    let mut valid = true;
    for (i, a) in xys.iter().enumerate() {
      if (pat >> i) & 1 == 0 {
        continue;
      }
      for &(x, y) in a {
        if (pat >> x) & 1 != y {
          valid = false;
        }
      }
    }
    if valid {
      let mut c = 0;
      let mut p = pat;
      while p > 0 {
        if p & 1 == 1 {
          c += 1;
        }
        p >>= 1;
      }
      ans = cmp::max(ans, c);
    }
  }

  puts!("{}\n", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	long long int ans;
    long double a,b,s;
	cin>>a>>b;
	s=a*b;
	printf("%.0Lf",s);
}

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

const int64_t MOD = 1000000007;
typedef int64_t ll;
typedef uint64_t ull;

#define INF LLONG_MAX

#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

// 

signed main() {
  int n, h;
  cin >> n >> h;
  
  vector<int> a(n);
  vector<int> b(n);

  for(int i=0;i<n;i++){
    cin >> a[i] >> b[i];
  }
  sort(a.begin(),a.end(),greater<int>());
  sort(b.begin(),b.end(),greater<int>());
  
  int count = 0;
  for(int i=0;i<n;i++){
    if(h<=0) break;
    if(b[i]>a[0]){
      h -= b[i];
      count++;
    }
    if(i==n-1 || a[0]>=b[i]){
      count += (h+a[0]-1)/a[0];
      h = 0;
    }
  }

  cout << count << endl;
  
  return 0;
}



Measured memory_bytes: 4032
/*

*/
#include <bits/stdc++.h>

using namespace std;

#define ll          long long int
#define mp          make_pair
#define pb          push_back
#define fi          first
#define si          second
#define fastIO      ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F(a,n)      for(int i=0;i<n;i++){cin>>a[i];}
#define F1(a,n)     for(int i=1;i<=n;i++){cin>>a[i];}
#define P(a,n)      for(int i=0;i<n;i++){cout<<a[i]<<' ';}cout<<endl;
#define P1(a,n)     for(int i=1;i<=n;i++){cout<<a[i]<<' ';}cout<<endl;
#define NF(a,n,m)   for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>a[i][j];}}
#define NF1(a,n,m)  for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cin>>a[i][j];}}
#define PNF(a,n,m)  for(int i=0;i<n;i++){for(int j=0;j<m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
#define PNF1(a,n,m) for(int i=1;i<=n;i++){for(int j=1;j<=m;j++){cout<<a[i][j]<<' ';}cout<<endl;}cout<<endl;
const int nax = 1e5 + 1;
const ll mod = 1e11+7;



int main(){
fastIO

	ll n, capacity;
	cin>>n>>capacity;
	ll *weight = new ll[n+1];
	ll *cost = new ll[n+1];
	ll max_cost = 0;
	for(ll i=1; i<=n; i++){
		cin>>weight[i]>>cost[i];
		max_cost += cost[i];
	}
	ll dp[101][max_cost + 2];
	memset(dp, mod, sizeof(dp));
	for(ll i=0; i<=n; i++){
		dp[i][0] = 0;
	}

	for(ll i=1; i<=n; i++){
		for(ll j=0; j<=max_cost; j++){
			ll op1 = dp[i-1][j];
			ll op2 = (cost[i] <= j) ? (weight[i] + dp[i-1][j - cost[i]]) : mod;
			dp[i][j] = min(op1, op2);
		}
	}
	ll ans = 0;
	for(ll i=0; i<=max_cost; i++){
		if(dp[n][i] <= capacity){
			ans = i;
		}
	}

	cout<<ans;
}

Measured memory_bytes: 82456
#include <iostream>
#include <stack>

using namespace std;

stack<int> s;
int main(){
	int a,b,k;
	cin >> a >> b >> k;
	for(int i = a;i <= a + k - 1;i++){
		if(i <= b) cout << i << endl;
	}
	for(int j = b;j >= b - k + 1;j--){
		if(j > a + k - 1) s.push(j);
	}
	while(!s.empty()){
		cout << s.top() << endl;
		s.pop();
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
    int N, A, B;
    scanf("%d %d %d", &N, &A, &B);
    int plan1 = N * A;
    if(plan1 > B) {
        printf("%d\n", B);
    } else {
        printf("%d\n", plan1);
    }
}

Measured memory_bytes: 128
//Jai Bhole Ki
#include <bits/stdc++.h>
using namespace std;
#define fast static int fastline = []() { std::ios::sync_with_stdio(false); cin.tie(NULL); return 0; }();
#define ll long long
#define LL unsigned ll
#define pb push_back
#define pi pair<ll,ll>
#define debug(x) cout<<x<<"\n";
#define debug cout<<"debugged\n";
#define minval -2e9
#define maxval 2e9
long double PI =3.14159265358979323846;
 
const ll M=1e9+7;
const ll inf=1e18;
const ll ms=2e5+5;
fast;
ll k,x;
void solve()
{
    cin>>k>>x;
    ll mini=max(-1000000ll,x-k+1);
    ll maxi=min(1000000ll,x+k-1);
    for(ll st=mini;st<=maxi;st++)
        cout<<st<<" ";
    
}   

int main()
{
 // freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
   // int t;cin>>t;while(t--)
   {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
n = int(input())
plus = []
for i in range(n):
  plus.append(input())

m = int(input())
minus = []
for i in range(m):
  minus.append(input())

uniq = set(plus+minus)

result = []
for i in uniq:
  result.append(plus.count(i)-minus.count(i))

if max(result) < 0:
  print(0)
else:
  print(max(result))
  


Measured memory_bytes: 3060
#include <iostream>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <algorithm>

using namespace std;

int main(int argc, char const* argv[])
{
    int n,k;
    while (cin >> n >> k) 
    {
        if (n == 0 && k==0) 
        {
            break;
        }
        vector<int> vec(n);
        int sum_max=0;
        int j;
        int sum=0;
        for (int i = 0; i < n; i++) 
        {
            cin >> vec[i];

            if (k  == i + 1) 
            {
                for (j = 0; j < k; j++) 
                {
                    sum += vec[i - j];
                }
                sum_max = max(sum ,sum_max);
                sum -= vec[i-k+1];
            }
            else if (k  < i + 1) 
            {
                sum += vec[i];
                sum_max = max(sum ,sum_max);
                sum -= vec[i-k+1];
            }
        }
        cout << sum_max << endl;
    }
    return 0;
}

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

/*
ユーグリッドが正解みたいです.
*/
ll gcd(ll a,ll b){
        if(a<b)swap(a,b);
        ll r = a%b;
        if(r==0)return b;
        if(r==1)return (ll)1;
        return gcd(b,r);
}

int main(){
    int N;cin>>N;
    vector<ll> A(N,0);
    rep(i,N)cin>>A[i];
    //L[i]はA[0]~A[i]までのgcd.iは0~N-1
    //R[i]はA[i]~A[N-1]までのgcd.iは0~N-1
    vector<ll> L(N,-1);L[0]=A[0];
    vector<ll> R(N,-1);R[N-1]=A[N-1];
    for(int i=1;i<N;i++){
        L[i]=gcd(L[i-1],A[i]);
        R[N-1-i]=gcd(R[N-i],A[N-1-i]);
    }//これでセット完了
    //M[i]はA[i]を除いたときのgcd.
    vector<ll> M(N,-1);
    rep(i,N){
        if(i==0)M[i]=R[i+1];
        else if(i==N-1)M[i]=L[i-1];
        else M[i]=gcd(L[i-1],R[i+1]);
    }
    ll ans = 1;
    rep(i,N){
        ans = max(ans,M[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3328
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();

		int i = 0;
		for(; i<100; i++) {
			if(A%2!=0 || B%2!=0 || C%2!=0)
				break;
			
			int na = B/2+C/2;
			int nb = C/2+A/2;
			int nc = A/2+B/2;
			A = na;
			B = nb;
			C = nc;
		}
		
		System.out.println(i<100 ? i : -1);
		sc.close();
	}
}


Measured memory_bytes: 23764
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

int N, M, inf=1e9;
typedef pair<int, int> P;
typedef pair<int, P> PP;
map <P, vector<PP>> mp;
map <P, int> cost;

void dijkstra(P start){
    priority_queue < PP, vector<PP>, greater<PP> > q;
    for (auto itr = mp.begin(); itr != mp.end(); itr++) {
        cost[itr->first] = inf;
    }
    cost[start] = 0;
    q.push(PP(0, start));
    while (q.size()) {
        PP p = q.top();
        q.pop();
        P current_station = p.second;

        for (PP next : mp[current_station]) {
            P next_station = next.second;
            int c = next.first;
            if (cost[next_station] > cost[current_station] + c) {
                cost[next_station] = cost[current_station] + c;
                q.push(PP(cost[next_station], next_station));
            }
        }
    }
}

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cin >> N >> M;
    for (int i = 0; i < M; i++) {
        int p, q, c;
        cin >> p >> q >> c;
        mp[P(p, 0)].push_back(PP(1, P(p, c))); // 駅pで路線cに入る
        mp[P(p, c)].push_back(PP(0, P(q, c))); // 路線cでp->q
        mp[P(q, c)].push_back(PP(0, P(q, 0))); // 駅qで路線cから出る
        mp[P(q, 0)].push_back(PP(1, P(q, c))); // 駅qで路線cに入る
        mp[P(q, c)].push_back(PP(0, P(p, c))); // 路線cでq->p
        mp[P(p, c)].push_back(PP(0, P(p, 0))); // 駅pで路線cから出る
    }

    dijkstra(P(1, 0));

    int ans = cost[P(N, 0)] == 0 || cost[P(N, 0)] == inf ? -1 : cost[P(N, 0)];
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 84788
#include <bits/stdc++.h> 
using namespace std; 
typedef long long ll; 
const int N = 2e5+5;

ll a[N],b[N];

int main()
{	
	ll n,m,x,k;
	scanf("%lld%lld%lld",&n,&m,&k);
	a[0] = b[0] = 0;
	
	for(int i = 1;i <= n;++i) scanf("%lld",&x),a[i] = a[i-1] + x;
	for(int i = 1;i <= m;++i) scanf("%lld",&x),b[i] = b[i-1] + x;
	
	ll res,num,ans = 0;
	for(int i = 1;i <= n;++i){
		if(a[i] > k){
			num = 0;
			res = k;
		}
		else{
			num = i;
			res = k-a[i];
		}
		
		ll pos = lower_bound(b+1,b+m+1,res)-b;
		while((b[pos] > res && pos > 0) || pos > m) pos--;
		ans = max(ans,num+pos);
	}
	for(int i = 1;i <= m;++i){
		if(b[i] > k){
			num = 0;
			res = k;
		}
		else{
			num = i;
			res = k-b[i];
		}
		
		ll pos = lower_bound(a+1,a+n+1,res)-a;
		while((a[pos] > res && pos > 0) || pos > n) pos--;
		ans = max(ans,num+pos);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 6924
H, W = map(int, input().split())
g = []
cols = set()
for _ in range(H):
    r = input()
    if r != "." * W:
        g.append(r)
        for i in range(W):
            if r[i] == "#":
                cols.add(i)
cols = sorted(cols)
for r in g:
    print(*[r[i] for i in cols], sep="")

Measured memory_bytes: 4340
# a〜z
l=['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']

# 入力
w=input()

for x in l:
  if w.count(x)%2!=0:
    print('No')
    exit()

print('Yes')

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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){


}

Node treeMaximum(Node x){


}

Node treeSearch(Node u, int k){


}

Node treeSuccessor(Node x){


}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y



}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = (node *)malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x != NIL) {
    y = x;
    x = (z->key < x->key)? x->left : x->right;
  }
  z->parent = y;
  if(y == NIL) root = z;
  else if(z->key < y->key) y->left = z;
  else y->right = z;
}

void inorder(Node u){
  if(u == NIL) return;
  if(u->left != NIL) inorder(u->left);
  printf(" %d", u->key);
  if(u->right != NIL) inorder(u->right);
}
void preorder(Node u){
  printf(" %d", u->key);
  if(u->left != NIL) preorder(u->left);
  if(u->right != NIL) preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}



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

int main()
{
  int i, j;
  int d, e;
  double diff;
  double min;
  
  while (1) {
    scanf("%d %d", &d, &e);
    if (d == 0 && e == 0) break;
    min = fabs((double) d - e);
    for (i = 0; i <= d/2; i++) {
      for (j = 0; j < d; j++) {
        if (i + j == d) {
          diff = fabs(sqrt(i * i + j * j) - e);
          //printf("%.10f\n", diff);
          if (diff < min) {
            min = diff;
          }
        }
      }
    }
    if ((min - (int)min) < 0.0001) {
      printf("%d\n", (int)min);
    } else {
      printf("%.10f\n", min);
    }
  }

  return 0;
}



Measured memory_bytes: 2032
def RPN(states):
    operator = {
        '+': (lambda x, y: x + y),
        '-': (lambda x, y: x - y),
        '*': (lambda x, y: x * y),
        '/': (lambda x, y: float(x) / y)
    }
    stack = []
    for z in states:
        if z not in operator.keys():
            stack.append(int(z))
        else:
            y = stack.pop()
            x = stack.pop()
            stack.append(operator[z](x, y))
    
    return stack[0]

import sys
states = []
for state in sys.stdin:
    state = list(state.split())
    states.append(state)
    
    
for state in states:
    print(RPN(state))


Measured memory_bytes: 5616