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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int N,M,Q;
vi a,b,c,d;
vi A;

int dfs( int ni, int pre ){
    int ret = 0;
    if( ni == N ){
        Rep(i,Q){
            if( A[b[i]-1] - A[a[i]-1] == c[i] ) ret += d[i];
        }
    }else{
        Repe(i,M+1,pre){
            A[ni] = i;
            ret = max( ret, dfs(ni+1,i) );
        }
    }
    return ret;
}


int main() {

    Scd3(N,M,Q);

    A.resize(N);
    a.resize(Q);
    b.resize(Q);
    c.resize(Q);
    d.resize(Q);

    Rep(i,Q){
        Scd2(a[i],b[i]);
        Scd2(c[i],d[i]);
    }

    printf ("%d\n", dfs(0,1) );

    return 0;
}



Measured memory_bytes: 3836
n = int(input())
lis = list(map(int, input().split()))

if 0 in lis:
    print(0)
    exit()

ans = 1
for i in lis:
    ans *= i
    if ans >= 10**18:
        break

if ans > 10**18:
    print("-1")
else:
    print(ans)

Measured memory_bytes: 84844
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> void get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'; t=getchar());
	if(t=='-')neg=true,t=getchar();
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) get1(a),get1(b)
#define get3(a,b,c) get1(a),get2(b,c)
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int n,a[100111];
int main()
{
	get1(n);
	for(int i=1;i<=n;i++)
		get1(a[i]);
	int mx=*max_element(a+1,a+n+1),mn=*min_element(a+1,a+n+1);
	if(mx-mn>1)puts("No");
	else if(mx==mn)
	{
		if(mx==n-1||mx*2<=n)puts("Yes");
		else puts("No");
	}
	else
	{
		int single=0;
		for(int i=1;i<=n;i++)single+=(a[i]==mn);
		if(single<mx&&mx<=single+(n-single)/2)puts("Yes");
		else puts("No");
	}
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int min(int a,int b);

int main(void)
{
    int n=0,sum=0;
    int b[101]={};
    scanf("%d",&n);
    for(int i=0;i<n-1;i++) scanf("%d",&b[i]);
    sum+=b[0]+b[n-2];
    for(int i=0;i<n-1;i++){
        sum+=min(b[i],b[i+1]);
    }
    printf("%d",sum);
    return 0;
}

int min(int a,int b){
    return a<b?a:b;
}


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

X = INT()
n = X//200

print(10-n)

Measured memory_bytes: 10548
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
  int n;
  cin >> n;
  vector<int> h(n), dp(n, INT_MAX);
  rep(i, n) cin >> h[i];
  dp[0] = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= 2; j++) {
      if (i >= j) dp[i] = min(dp[i], dp[i - j] + abs(h[i] - h[i - j]));
    }
  }
  cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <memory>
#include <iomanip>
#include <numeric>
#include <functional>
#include <new>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <climits>
#include <cctype>
#include <ctime>

#define REP(i, n) for(int (i) = 0; i < n; i++)
#define FOR(i, a, n) for(int (i) = a; i < n; i++)
#define FORR(i, a, n) for(int (i) = a; i <= n; i++)
#define for_each(q, s) for(typeof(s.begin()) q=s.begin(); q!=s.end(); q++)
#define sz(n) n.size()
#define pb(n) push_back(n)
#define all(n) n.begin(), n.end()

template<typename T> T gcd(T a, T b) {
    if(!b) return a;
    return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

using namespace std;

typedef long long ll;
typedef long double ld;

int K;

int main(void) {
    for( ; ~scanf("%d", &K) && K != 0; ) {
        int sum = 0, tmp;
        for(int i = 0; i < K * (K - 1) / 2; i++) {
            scanf("%d", &tmp); sum += tmp;
        }
        printf("%d\n", sum / (K - 1));
    }
    return 0;
}

Measured memory_bytes: 1188
n = int(input())
l = list(map(int,input().split()))

ans = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            len = l[i]+l[j]+l[k]
            ma = max(l[i],max(l[j],l[k]))
            res = len - ma
            if ma<res and l[i] != l[j] and l[j] != l[k] and l[k] != l[i]:
                ans += 1
                
print(ans)

Measured memory_bytes: 9212
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
signed main() {
  cout << fixed << setprecision(20);
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> a(n+1),b(m+1);
  a[0]=0;
  b[0]=0;
  REP2(i, n){
  int aa;
    cin >>aa;
    a[i]=a[i-1]+aa;
  }REP2(i, m){
  int bb;
    cin >>bb;
    b[i]=b[i-1]+bb;
  }	int ia = 0, ib = 0;
 
	while (ia < n && a[ia + 1] <= k)
	{
		ia++;
	}
 
	while (ib < m && a[ia] + b[ib + 1] <= k)
	{
		ib++;
	}
int ans = ia + ib;
	while (0 <= --ia)
	{
		while (ib < m && a[ia] + b[ib + 1] <= k)
		{
			ib++;
		}
		ans=max(ans, ia + ib);
	}
	cout << ans;
	return 0;
}

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

int main(){
	
	int counter=0;
	string row, column;
	cin>>row>>column;
	for(int i=0; i<row.length(); i++){
		if(row[i]==column[row.length()-1-i]){
			counter++;
		}
	}
	if(counter==row.length()){
		cout<<"YES"<<endl;
	}
	else{
		cout<<"NO"<<endl;
	}

	return 0;	
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
// using namespace __gnu_pbds;
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
 
 
#define F first
#define S second
#define ll long long
#define pb push_back
#define db double
#define ld long double
#define ppb pop_back
#define pii pair<int, int>
#define pll pair<long long, long long>
#define piii pair<int, pii>
#define all(x) (x).begin(),(x).end()
#define __ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//#define int long long
 
const int N = 1e5 + 1, inf = 2e9 + 7, mod = 1e9 + 7;
const ll INF = 2e18 + 7, MOD = 1e15 + 7;
 
 
signed main() { __
    // freopen("a.in", "r", stdin);
    // freopen("a.out", "w", stdout);
    string s;
    cin>>s;
    if(s[2] == s[3] && s[5] == s[4]) cout<<"Yes";
    else cout<<"No";
    return 0;
}


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

int main(){
  ios::sync_with_stdio(false);
  cin.tie();
  int s,w;
  cin>>s>>w;
  if(w>=s){
    cout<<"unsafe"<<endl;
  }else{
    cout<<"safe"<<endl;
  }
  return 0;
}

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

vector<int> getDivisors(int n) {
  vector<int> res;
  for (int i = 1; i <= sqrt(n); i++) { 
    if (n % i == 0) { 
      if (n / i == i) {
        res.push_back(i);
      } else {
        res.push_back(i);
        res.push_back(n/i);
      }
    } 
  }
  return res; 
}

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

    int n, ans = 0;
    cin >> n;
    for (int i = 1 ; i <= n; i++) {
        for (int j = 1 ; i * j <= n; j++) {
            if (n - i * j > 0) ans++;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3660
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;

void main()
{ 
	auto values = readln().split().to!(int[]);
	int ans = values[2] - (values[0] - values[1]);
	ans = max(ans, 0);

	writefln("%d", ans);
}

Measured memory_bytes: 256
#include<stdio.h>
#define mod (long long)(1e9+7)
long long a[300010];
int main()
{
	int n,i,j;long long res=0,d=1;scanf("%d",&n);
	for(i=0;i<n;i++)
	    scanf("%lld",&a[i]);    
	for(j=0;j<60;j++)
	{
		long long c=0;
		for(i=0;i<n;i++)
		{
			if(a[i]&1)c++;
			a[i]>>=1;
		}
		res+=(((c*(n-c))%mod)*d)%mod;
		d*=2;
		d%=mod;
	}    
	printf("%lld\n",res%mod);
}

Measured memory_bytes: 2560
#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, j, k, a, b, c;
  scanf("%lld%lld%lld%lld", &a, &b, &c, &k);
  if(k % 2) {
    printf("%lld", b - a);
  } else {
    printf("%lld", a - b);
  }
  return 0;
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};

int main(){
  int n; cin >> n;
  vector<string> s(n);
  rep(i, n) cin >> s[i];
  int ans = 0;
  rep(i, n) {
    rep(j, SZ(s[i])-1) if(s[i][j] == 'A' && s[i][j+1] == 'B') ++ans;
  }
  int a=0, b=0, c=0;
  rep(i, n) {
    if(s[i].front() == 'B' && s[i].back() == 'A') ++c;
    else if(s[i].front() == 'B') ++b;
    else if(s[i].back() == 'A') ++a;
  }
  if(c == 0) {
    ans += min(a, b);
  }
  else {
    ans += c-1;
    if(a > 0) {
      ++ans;
      --a;
    }
    if(b > 0) {
      ++ans;
      --b;
    }
    ans += min(a, b);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  string s,t,u;
  cin >> s >>t;
  int a,b;
  cin >> a >>b;
  cin >>u;
  if(s==u)a--;
  if(t ==u)b--;
  cout << a <<" "<<b<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin >> A >> B;
  if(A + B == 3)
    cout << 3 << endl;
  else if(A + B == 4)
    cout << 2 << endl;
  else if(A + B == 5)
    cout << 1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
 
using namespace std;
 
int main()
{
  int n, m, l;
  int a[100][100];
  int b[100][100];
 
  cin >> n >> m >> l;
 
  // ??????A
  for ( int i = 0; i < n; i++ )
  {
    for ( int j = 0; j < m; j++ )
    {
      cin >> a[ i ][ j ];
    }
  }
 
  // ??????B
  for ( int i = 0; i < m; i++ )
  {
    for ( int j = 0; j < l; j++ )
    {
      cin >> b[ i ][ j ];
    }
  }
 
  // n ?? l ???§????????????C?????????
  for ( int i = 0; i < n; i++ )
  { 
    for ( int j = 0; j < l; j++ )
    {
      long long sum = 0;  // long long == long long int
      for ( int k = 0; k < m; k++ )
      {
        sum += a[ i ][ k ] * b[ k ][ j ];
       }
      if ( j ) cout << " ";
      cout << sum;
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1232
#include <stdio.h>

int main()
{ float a, b;
	scanf("%f %f", &a, &b);
	if (a>b) { printf("a > b\n"); }
	else if (a < b)
	{
		printf("a < b\n");
	}
	else { printf("a == b\n"); }

	return 0;
}


Measured memory_bytes: 2048
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 d = sc.nextInt();
      int E = sc.nextInt();
      int F = sc.nextInt();
      Set<Integer> sugarSet = new HashSet<>();
      for(int i = 0; i <= F; i++) {
        for(int j = 0; j <= F; j++) {
          int s = i * c + j * d;
          if(s <= F)
            sugarSet.add(s);
        }
      }

      Set<Integer> waterSet = new HashSet<>();
      for(int i = 0; i <= F; i++) {
        for(int j = 0; j <= F; j++) {
          int w = i * 100 * a + j * 100 * b;
          if(w <= F)
            waterSet.add(w);
        }
      }

      double p = 0.0;
      int[] res = new int[2];
      for(int water : waterSet) {
        for(int sugar : sugarSet) {
          if(water / 100 * E < sugar || sugar + water > F) continue;
          double curP = sugar * 100.0 / (sugar + water);
          if(p < curP) {
            p = curP;
            res[0] = water;
            res[1] = sugar;
          }
        }
      }
      if(p - 0 < 1e-10) {
          for(int water : waterSet)
            if(water > 0 && water <= F) {
                res[0] = water;
                break;
            }
      }
        
      System.out.println((res[0] + res[1]) + " " + res[1]);
  }
}

Measured memory_bytes: 24236
N, C = gets.split.map(&:to_i)
ds = [] # [[x_11,...],...,[x_m1,...]]
C.times do
  line = gets.split.map(&:to_i)
  ds << line
end
cs = []
N.times do
  line = gets.split.map(&:to_i)
  cs << line
end
mod0 = Array.new(0)
mod1 = Array.new(0)
mod2 = Array.new(0)
for i in 0..(N-1) do
  for j in 0..(N-1) do
    modNum = ((i+1)+(j+1)) % 3
    if modNum == 0 then
      mod0.push(cs[i][j])
    elsif modNum == 1 then
      mod1.push(cs[i][j])
    else
      mod2.push(cs[i][j])
    end
  end
end
mod = [mod0, mod1, mod2]
costs = Array.new(0)
for c in 1..C do
  costs.push(mod.map{|m| m.reduce(0){ | sum, n | sum + ds[n-1][c-1] } })
end
res = 1000000000000000000000000000000000000000000000000000000
for c1 in 1..C do
  for c2 in 1..C do
    for c3 in 1..C do
      cost1 = costs[c1-1][0]
      cost2 = costs[c2-1][1]
      cost3 = costs[c3-1][2]
      if ( c1 != c2 && c2 != c3 && c3 != c1) then
        res = res > (cost1+cost2+cost3) ? (cost1+cost2+cost3) : res
      end
    end
  end
end
p res



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

using namespace std;
typedef long long ll;
const int maxn = 1e5+10;
int n,m;
ll fun5(ll x){
	return x*x*x*x*x;
} 
int main(){
	ll x,a,b,ib;
	cin >> x;
	for(a=-1000;a<=1000;a++){
		ll b5 = fun5(a)-x;
		for(b=-1000;b<=1000;b++){
			if(fun5(b)==b5){
				cout << a << " " << b << endl;
				return 0;
			}	
		}
	}
	return 0;
} 

Measured memory_bytes: 3644
#include"bits/stdc++.h"
using namespace std;

void Main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	while (true) {
		C = C - B;
		if (C <= 0) {
			cout << "Yes" << endl;
			break;
		}
		A = A - D;
		if (A <= 0) {
			cout << "No" << endl;
			break;
		}
	}
}


int main() {
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 3596
/**
 * Road to ROI
**/ 
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define forn for(int i=0;i<n;i++)
#define form for(int j=0;j<m;j++)
#define pb push_back
#define mp make_pair
#define sc second
#define f first
#define kek cout<<"\n"
#define all(v)        ((v).begin()), ((v).end())
#define pob pop_back()
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b+c>=22) cout<<"bust";
  else cout<<"win";
  return 0;
}

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

#define FOR(i,l,r) for(int i = (l);i < (r);i++)
#define ALL(x) (x).begin(),(x).end()
template<typename T> bool chmax(T& a,const T& b){return a < b ? (a = b,true) : false;}
template<typename T> bool chmin(T& a,const T& b){return b < a ? (a = b,true) : false;}
typedef long long ll;

int N;
const int MAX_N = 1 << 18;
ll A [MAX_N * 2];

ll rec(ll cur)
{
	if(A [cur]) return A [cur];
	ll x = rec(cur * 2 + 1),y = rec(cur * 2 + 2);
	if(x == y){
		return A [cur] = x;
	}
	return A [cur] = abs(x - y);
}

int main()
{
	scanf("%d",&N);
	N = 1 << N;
	FOR(i,0,N){
		scanf("%lld",&A [i + N - 1]);
	}

	printf("%lld\n",rec(0));

	return 0;
}


Measured memory_bytes: 4352
#include <stdio.h>

char buf[100];
int l[10], v[2];

int main() {
	while (scanf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", l, l + 1, l + 2, l + 3, l + 4, l + 5, l + 6, l + 7, l + 8, l + 9, v, v + 1) != -1) {
		int total = 0;
		int i;
		
		for (i = 0; i < 10; i++) total += l[i];
		
		int now = 0;
		for (i = 0; i < 10; i++) {
			now += l[i];
			if (now * v[1] >= (total - now) * v[0]) {
				break;
			}
		}
		printf("%d\n", i + 1);
	}
	return 0;
}

Measured memory_bytes: 2584
use proconio::input;
use proconio::marker::{Chars};
use std::iter::Iterator;
use std::collections::HashSet;

fn main() {
    input! {
    x: f64,
    }

    let mut ans = 0;
    let mut en : f64 = 100.0;
    loop {


        if en >= x {
            break;
        }

        en = en * 1.01;
        en = en.floor();
        ans = ans + 1;

    }

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


Measured memory_bytes: 2688
from collections import defaultdict
import heapq
N,M,S = map(int,input().split())
E=[list(map(int,input().split())) for _ in range(M)]

C=[list(map(int,input().split())) for _ in range(N)]

A_max=max([a for _,_,a,_ in E])*N

D=defaultdict(lambda :[])

for u,v,a,b in E:
    u-=1;v-=1
    for from_a in range(A_max+1):
        if from_a-a<0:
            continue
        from_state_u=(u,from_a)
        to_state_v=(v,from_a-a)
        D[from_state_u].append((b,to_state_v))

        from_state_v=(v,from_a)
        to_state_u=(u,from_a-a)
        D[from_state_v].append((b,to_state_u))

for n,[c,d] in enumerate(C):
    for a in range(A_max+1):
        a_after=min(A_max,a+c)
        from_state=(n,a)
        to_state=(n,a_after)
        D[from_state].append((d,to_state))


start=(0,min(A_max,S))
Q=[(0,start)]

Dist=defaultdict(lambda :float('inf'))

Dist[start]=0

while Q:
    q = heapq.heappop(Q)
    cur_time,cur_state=q

    if Dist[cur_state]<cur_time:
        continue
    for cost,next_state in D[cur_state]:
        next_time = cost+cur_time

        if Dist[next_state]>next_time:
            Dist[next_state]=next_time
            heapq.heappush(Q,(next_time,next_state))

for dest in range(1,N):
    ans=float("inf")
    for a in range(A_max+1):
        state=(dest,a)
        ans=min(ans,Dist[state])
    print(ans)


Measured memory_bytes: 155688
#include <iostream>
#include <iomanip> //! for setprecision(10)
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>

using namespace std;

typedef long long LL;

#define dump(c) { for (auto it = c.begin(); it != c.end(); ++it) if (it == c.begin()) cout << *it; else cout << ' ' << *it; cout << endl; } 
#define rep(i,n) for (int i = 0; i < (n); ++i)

const int MOD = 1000000007;

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

    int N;
    cin >> N;
    set<int> A;
    rep(i, N) {
        int a;
        cin >> a;
        if (A.find(a) == A.end()) {
            A.insert(a);
        } else {
            cout << "NO" << endl;
            return 0;
        } 
    }

    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 9600
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor, ceil
from bisect import bisect_left
from itertools import combinations
setrecursionlimit(100000)

INF = int(1e10)
MOD = int(1e9 + 7)

def main():
    from builtins import int, map
    A, B = input().split()
    A = int(A)

    if A == 0:
        print(0)
        exit()

    B = int(B.replace(".", ""))
    if A == 0 or B == 0:
        print(0)
        exit()
    AB = int(A * B) // 100
    print(AB)

if __name__ == '__main__':
    main()

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

int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<int> W(N, 0);
    vector<int> E(N, 0);
    rep(i, N) {
            W[i] = (i == 0 ? 0 : W[i - 1]) + (S[i] == 'W' ? 1 : 0);
            E[N - 1 - i] = (i == 0 ? 0 : E[N - 1 - (i - 1)]) + (S[N - 1 - i] == 'E' ? 1 : 0);
    }
    int ans = 1e6;
    rep(i, N) {
        ans = min(ans, W[i] + E[i]);
    }
    cout << ans - 1 << endl;
    return 0;
}

Measured memory_bytes: 3076
#include <bits/stdc++.h>
#include<utility>
#include<algorithm>

#define pan(i,n) for(int i=0;i<n;i++)
#define pans(i,n,a) for(int i=a;i<n;i++)
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define INF 1e9+7
#define PI 3.141592653
#define inf 200007
#define P pair<ll,ll>

using namespace std;

int main(){
    int sx,sy,tx,ty;
    cin>>sx>>sy>>tx>>ty;
    string ans="",a="",b="",c="",d="";
    int x=abs(sx-tx),y=abs(sy-ty);
    pan(i,y+1){
        if(i==0){
            a+='L';
            b+='R';
        }
        if(i<y){
            a+='U';
            b+='D';
            c+='U';
            d+='D';
        }
        else{
            a+='U';
            b+='D';
        }
    }
    pan(i,x+1){
        if(i<x){
            a+='R';
            b+='L';
            c+='R';
            d+='L';
        }
        else{
            a+='R';
            b+='L';
        }
    }
    a+='D';
    b+='U';
    ans+=c+d+a+b;
    // cout<<c<<endl;
    // cout<<d<<endl;
    // cout<<a<<endl;
    // cout<<b<<endl;
    cout<<ans;
}

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
  int N; cin >> N;
  string s; cin >> s;
  
  for(int i=0;i<s.size();i++){
    int t = N;
    if(s[i]+N>'Z') t = t - 26;
    s[i] = s[i]+t;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>            /*さて、いっくよ〜♪*/
#include<string.h>           /*まずは文字列用の配列を用意します♪*/
int main(){                  /*そして成功のおまじない♪*/
  char str[21];              /*ここで文字列を用意しました♪*/
  int i,j;                   /*文字列の長さを取得するi,for文用のjを用意します♪*/
  scanf("%s",str);           /*文字列を入力してもらいます♪*/
  i=strlen(str);             /*文字列の長さを取得します♪*/
  for(j=i;j>0;j--){          /*for文を使い、後ろから出力します♪*/
    printf("%c",str[j-1]);   /*出力時は 'c' なので要注意です!!*/
  }                          /*(((^ω^==^ωギャアアアアアアアアアア*/
  printf("\n");              /*最後に改行を忘れない♪*/
  return(0);                 /*最後はreturn(0)でお片づけ♪*/
}                            /*お疲れ様♪*/

                             /*参考になってくれれば、嬉しいな♪*/

Measured memory_bytes: 520
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,i,j,k,n,m,x,y,ans = 0;
	string	s;

	cin >> n;

	n = n % 10;
	if (n == 3) {
		s = "bon";
	} else if ( n<=1 || n == 6 || n == 8) {
		s = "pon";
	} else {
		s = "hon";
	}

	cout << s << endl;
	return 0;
}


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

using namespace std;

#define ll long long
//#define mx 0
#define mn 1e9
#define vec(dt) vector<dt>
#define pr(x, y) pair<x,y>
#define loop(x, n) for(ll x = 0; x < n; x++)
#define in_arr(n) loop(i,n){cin>>a[i];}
#define out_arr(n) loop(i,n){cout<<a[i];}

inline void boost() {
    cin.tie(0), cout.tie(0), cin.sync_with_stdio(0), cout.sync_with_stdio(0);
}

const int N = 1e5 + 5;
bool a[N];
int w[N];

int main() {
    boost();
    int n, m;
    cin >> n >> m;
    int c;
    string s;
    int sub = 0, pen = 0;
    while(m--)
    {
        cin >> c >> s;
        if (s == "AC") {
            if (a[c]) continue;
            else
            {
                a[c] = true;
                sub++;
                pen+=w[c];
            }
        }
        else{
            w[c]++;
        }
    }
    cout<<sub<<" "<<pen;

}



Measured memory_bytes: 768
import java.util.*;

public class Main {
  public  static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = Integer.parseInt(sc.next());
    int[] l = new int[n];
    int count = 0;
    int tempSum = 0;
    for(int i = 0; i < n; i++) {
      l[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(l);
    for(int i = 0; i < n - 2; i++) {
      for(int j = i + 1; j < n - 1; j++) {
        tempSum = l[i] + l[j];
        for(int k = j + 1; k < n; k++) {
          if(tempSum > l[k]) count++;
          else break;
        }
      }
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 25928
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long int A, B, C, K;
  cin >> A >> B >> C >> K;
  if(K <= A){
    cout << K << endl;
  }else if(K <= A + B){
  	cout << A << endl;
  }else{
    cout << A - (K - A - B) << endl;
  }
  return 0;
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MOD 1000000007
#define INF 100100100

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


int main(){
  string s;
  cin >> s;
  int zero = 0;
  int one = 0;
  for(auto a : s){
    if(a == '0') zero++;
    if(a == '1') one++;
  }
  cout << min(zero, one) * 2 << endl;
}



Measured memory_bytes: 512
#include<iostream>
using namespace::std;
int main(){
int n,k,i,j;
cin>>n;
int h[n+1];
for(i=1;i<=n;i++)
{
    cin>>j;
    h[j]=i;
}
for(i=1;i<=n;i++)
{
   cout<<h[i];
  cout<<" ";
}
}

Measured memory_bytes: 1152
//#pragma GCC optimize(2)
#include<set>
#include<map>
#include<stack>
#include<cmath>
#include<ctime>
#include<queue>
#include<cstdio>
#include<vector>
#include<climits>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
int read(){
    int f=1,x=0;char c=getchar();
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}
    while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
    return f==1?x:-x;
}
#define MAXN 1000
#define INF 0x3f3f3f3f
int main(){
	int a=read(),b=read();
	printf("%d\n",max(a+b,max(a-b,a*b)));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

template<typename T>
struct Max_Flow{
    struct edge{
        int to; T cap; int rev;
        edge(int to, T cap, int rev) : to(to), cap(cap), rev(rev) {}
    };

    vector<vector<edge>> es;
    vector<bool> used;
    const T INF_T;

    Max_Flow(int n) : INF_T(numeric_limits<T>::max()){
        es.resize(n), used.resize(n);
    }

    void add_edge(int from, int to, T cap, bool directed = true){
        es[from].eb(to, cap, sz(es[to]));
        es[to].eb(from, directed? 0 : cap, sz(es[from])-1);
    }

    T dfs(int now, int t, T flow){
        if(now == t) return flow;
        used[now] = true;
        for(auto &e: es[now]){
            if(!used[e.to] && e.cap > 0){
                T f = dfs(e.to, t, min(flow, e.cap));
                if(f > 0){
                    e.cap -= f;
                    es[e.to][e.rev].cap += f;
                    return f;
                }
            }
        }
        return 0;
    }

    T max_flow(int s, int t){
        T flow = 0;
        for(;;){
            fill(all(used), false);
            T f = dfs(s, t, INF_T);
            if(f == 0) return flow;
            flow += f;
        }
    }
};

int main(){
    int H, W;
    cin >> H >> W;
    int N = H*W;
    string S[H];
    Max_Flow<ll> G(2*N+2);
    int s = 2*N, t = 2*N+1;
    int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
    rep(i, H){
        cin >> S[i];
        rep(j, W){
            rep(k, 4){
                int ni = i+dx[k], nj = j+dy[k];
                if(ni < 0 || ni >= H || nj < 0 || nj >= W){
                    G.add_edge(N+i*W+j, t, inf);
                }
                else{
                    G.add_edge(N+i*W+j, ni*W+nj, inf);
                }
            }
            if(S[i][j] == '.'){
                G.add_edge(i*W+j, N+i*W+j, 1);
            }
            else{
                G.add_edge(i*W+j, N+i*W+j, inf);
                G.add_edge(s, i*W+j, inf);
            }
        }
    }
    ll ans = G.max_flow(s, t);
    cout << (ans < inf? ans : -1) << endl;
}

Measured memory_bytes: 8068
#include<stdio.h>
int main(void){

int n, m, l;
int A[100][100]={{0}};
int B[100][100]={{0}};
long int C[100][100]={{0}};

scanf("%d %d %d",&n, &m, &l);

    // 行列A入力
    for (int i = 0; i < n; i++)
        {
        for (int j = 0; j < m; j++)
            {
                scanf("%d",&A[i][j]); 
            }
        }
// 行列B入力
    for (int i = 0; i < m; i++)
        {
        for (int j = 0; j < l; j++)
            {
                scanf("%d",&B[i][j]); 
            }
        }

// 行列C計算
    for (int i = 0; i < n; i++)
        {
        for (int j = 0; j < l; j++)
            {
                for (int k = 0; k < m; k++)
                {
                    C[i][j]+=A[i][k]*B[k][j];
                }
            }
        }

// 行列C出力
    for (int i = 0; i < n; i++){
        for (int j = 0; j < l; j++){
            printf("%ld",C[i][j]);
            if(j!=l-1)printf(" ");
        }
        printf("\n");
    }

return 0;
}


Measured memory_bytes: 2104
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define sz(a) (ll)(a).size()
#define endl "\n"

typedef tree<pair<ll,ll> ,null_type,less<pair<ll,ll> >,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//K-th smallest
//cout << k << "kth smallest: " << *A.find_by_order(k-1) << endl;
//NO OF ELEMENTS < X
//cout << "No of elements less than " << X << " are " << A.order_of_key(X) << endl;

const int MAXN = 200005;
ll val[MAXN];
vector<ll>ans;

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

 	ll n;
 	cin >> n;
 	ll a[n + 1];
 	for(int i=1;i<=n;i++) cin >> a[i];
 	for(int i=n;i>=1;i--)
 	{
 		ll temp = 0;
 		for(int j=2*i;j<=n;j+=i) temp ^= val[j];
 		val[i] = (temp ^ a[i]);
 		if(val[i]) ans.pb(i);	
 	}	
 	reverse(ans.begin(), ans.end());
 	cout << sz(ans) << endl;
 	for(auto it : ans) cout << it << " ";
 	cout << endl;
    return 0;
}

Measured memory_bytes: 5108
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define	ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define pb push_back
#define ll long long
#define ld long double
using namespace std; 
 
const int N = 2e5 + 1000, OO = 1e9 + 100, M = 1e9 + 7, P = 6151, SQ = 120, lg = 100;
typedef pair <int, int> pii;

int32_t main() {
    use_fast;
    int n, ans = 0;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0; i < n - 2; i++) 
    	if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
    		ans++;
    cout << ans << endl;
	return 0; 
}
/*
be carefull :
1- if not solve after 20 min, read again twice
2- after submit read the code again
3- fun with contest
4- ... 
*/	

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

int main(){
  int n,m;
  cin>>n>>m;
  vector <int> b(n,0);
  rep(i,m){
    int a;
    cin>>a;
    a--;
    b[a]=1;
  }
  vector <ll> d(n+1,0);
  d[0]=1;
  if (b[0]!=1) d[1]=1;
  for (int i=1;i<n;i++){
    if (b[i]==1) continue;
    d[i+1]+=d[i]%MOD+d[i-1]%MOD;
    d[i+1]=d[i+1]%MOD;
  }
  cout<<d[n];
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

static const ll MOD = 1000000007;
static const int MX = 200005;

ll fact[MX];
ll invfact[MX];

ll mod_pow(ll x, ll n, ll mod){
  if(n==0) return 1;
  ll res = mod_pow(x * x % mod, n / 2, mod);
  if(n & 1) res = res * x % mod;
  return res;
}
ll mod_comb(ll n, ll k, ll p){
  if(n<0 || k<0 || n<k) return 0;
  return (((fact[n] * invfact[k]) % MOD) * invfact[n-k]) % MOD;
}
void comb_init(){
  fact[0] = fact[1] = 1;
  for(ll i=2; i<MX; i++) fact[i] = (fact[i-1] * i) % MOD;
  invfact[0] = invfact[1] = 1;
  for(ll i=2; i<MX; i++) invfact[i] = mod_pow(fact[i], MOD-2, MOD);
}

ll solve(ll N, ll K, ll x){
  if(K < x) return 0;
  if(N-K < x-1) return 0;

  ll b = K - x;
  ll r = (N-K) - (x-1);

  ll ret = mod_comb(b + (x-1), b, MOD);
  ret *= mod_comb(r + x, r, MOD);
  ret %= MOD;
  return ret;
}


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

  REP(i,1,K+1){
    cout << solve(N, K, i) << endl;
  }
  
  return 0;
}


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

int main(){
	ll n; cin >> n;
	ll a[3 * n];
	for(ll i = 0; i < 3 * n; ++i) cin >> a[i];
	ll ans = 0;
	sort(a, a + 3 * n, [&](ll a, ll b){return a > b;});
	for(ll i = 1; i <= 2 * n - 1; i += 2) ans += a[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
int main(void)
{
	int a, b, r;
	int rectangle = 0, rhombus = 0;
	while(scanf("%d,%d,%d", &a, &b, &r) == 3)
	{
		if(a == b)
			rhombus++;
		else if(a*a + b*b == r*r)
			rectangle++;
	}
	printf("%d\n%d\n", rectangle, rhombus);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long i,j,k,a,b,c=0,d,n,m,t=1,x;
long long A[4];
for(i=0;i<4;i++) cin>>A[i];
sort(A,A+4);
if(A[0]==1 && A[1]==4 && A[2]==7 && A[3]==9) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
return 0;
}


Measured memory_bytes: 3596
import copy
#h, w = [2,3]
#a = [[1,2,3],[0,1,1]]
h, w = [int(i) for i in input().split()]
a = [[int(i) for i in input().split()] for j in range(h)]
b = copy.deepcopy(a)
buf = 0
count = 0
for i,ai in enumerate(a):
    for j,aij in enumerate(ai):
        if aij % 2 != 0:
            buf = 1
            if i == h-1 and j == w-1:
                continue
            elif j != w-1:
                count += 1
                a[i][j+1] += 1
                #print(i+1,j+1,i+1,j+2)
            else:
                count += 1
                a[i+1][j] += 1
                #print(i+1,j+1,i+2,j+1)
print(count)
buf = 0
count = 0
for i,ai in enumerate(b):
    for j,aij in enumerate(ai):
        if aij % 2 != 0:
            buf = 1
            if i == h-1 and j == w-1:
                continue
            elif j != w-1:
                count += 1
                b[i][j+1] += 1
                print(i+1,j+1,i+1,j+2)
            else:
                count += 1
                b[i+1][j] += 1
                print(i+1,j+1,i+2,j+1)

Measured memory_bytes: 10664
import java.io.PrintStream
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`);
    try {
        solve(scanner, System.out);
    } finally {
        scanner.close();
    }
}

fun solve(scanner: Scanner, print: PrintStream) {
    print.println(if(scanner.nextInt() == 0) 1 else 0)
}


Measured memory_bytes: 35968
# -*- coding: utf-8 -*-

import sys
import copy
import math

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~

N = int(input())

ans = N * (N - 1) // 2

print(ans)

Measured memory_bytes: 3444
from itertools import permutations
h,w=map(int,input().split())
C=[list(map(int,input().split())) for i in range(10)]

cost=[C[i][1] for i in range(10)]
for i in range(10):
    if i!=1:
        keiyu=[x for x in range(10) if x!=1 and x!=i]
        for j in range(9):
            perm=permutations(keiyu,r=j)
            for k in perm:
                k=[i]+list(k)+[1]
                tmp=0
                for l in range(len(k)-1):
                    tmp+=C[k[l]][k[l+1]]
                cost[i]=min(tmp, cost[i])

from collections import defaultdict
count=defaultdict(int)
for i in range(h):
    A=list(map(int,input().split()))
    for a in A:
        count[a]+=1

ans=0
t=[x for x in range(10) if x!=1]
for i in t:
    ans+=cost[i]*count[i]
print(ans)

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

namespace ABC
{
    class ProgramA
    {
        static void Main(string[] args)
        {
            var inputs = Console.ReadLine().Split(" ");
            var x = long.Parse(inputs[0]);
            var a = long.Parse(inputs[1]);
            var result = x < a ? 0 : 10; ;
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 27476
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
    string S;
    cin >> S;

    long res = 0, cnt = 0;

    for (char c: S) {
        if (c == 'B') cnt++;
        if (c == 'W') res += cnt;
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 640
cards = input()
times = int(input())
card = cards.split(" ")
result = "No"
wktimes = 0
idx = 0
div = int(card[0]) / int(card[1])
while ( 2 ** idx ) <= div:
  idx = idx + 1
wktimes = idx
card[1] = int(card[1]) * ( 2 ** idx)

idx = 0
div = int(card[1]) / int(card[2])
while ( 2 ** idx ) <= div:
  idx = idx + 1
wktimes = wktimes + idx
card[2] = int(card[2]) * ( 2 ** idx)
if wktimes <= times:
  result = "Yes"
print (result)

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

vector<int> g[100005];
ll ans;
int k;
const int mod = 1e9+7;

void dfs (int from, int now, int cnt) {
  int a;
  if (cnt==0) a=k-1;
  else a=k-2;
  for (auto x: g[now]) {
    if (x==from) continue;
    ans=ans*a%mod;
    a--;
    dfs (now,x,1);
  }
}
    
int main() {
  int n;
  cin>>n>>k;
  rep(i,n-1) {
    int a,b;
    cin>>a>>b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  ans=k;
  dfs(-1,0,0);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 10368
N,K = map(int,input().split())
P = list(map(int,input().split()))
Q = list()
for i in range(N-K+1):
  if i == 0:
    Q.append(sum(P[i:i+K]))
  else:
    Q.append(Q[i-1]-P[i-1]+P[i+K-1])
print((max(Q)+K)/2)

Measured memory_bytes: 25060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			if (H == 0 && W == 0) {
				break;
			} else {
				for (int j = 0; j < W; j++) {
					System.out.print("#");
				}
				System.out.print("\n");
				for (int i = 1; i < H - 1; i++) {
					System.out.print("#");
					for (int j = 1; j < W - 1; j++) {
						System.out.print(".");
					}
					System.out.println("#");
				}
				for (int j = 0; j < W; j++) {
					System.out.print("#");
				}
				System.out.println("\n");
			}
		}
		sc.close();
	}

}


Measured memory_bytes: 34604
S = input()

zero = 0
one = 0
ret = 0
for s in S:
    if s == "0":
        if one > 0:
            ret += 2
            one -= 1
        else:
            zero += 1
    elif s == "1":
        if zero > 0:
            ret += 2
            zero -= 1
        else:
            one += 1

print(ret)        


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

int main(){
    int n, far = 0, close = 1000;
    cin >> n;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        far = max(x, far);
        close = min(x, close);
    }
    cout << far - close << endl;
}

Measured memory_bytes: 3592
import java.math.BigInteger;
import java.util.Scanner;

//Zig-Zag Numbers
public class Main{

	int MOD, M = 10000;
	
	int[] s;
	int n;
	//idx, free, isUp, pre, M
	int[][][][][] dp;
	
	int get(int k, int f, int u, int pre, int m, boolean zero){
		if(k==n)return zero?0:m==0?1:0;
		int res = 0;
		if(zero){
			res+=get(k+1,f,u,0,0,true);
			for(int p=1;p<10;p++){
				res+=get(k+1,f,0,p,p%MOD,false);
				if(k+1!=n)res+=get(k+1,f,1,p,p%MOD,false);
			}
			return res%M;
		}
		if(dp[k][f][u][pre][m]!=-1)return dp[k][f][u][pre][m];
		if(f==1){
			if(u==1){
				for(int p=pre+1;p<10;p++){
					res+=get(k+1,f,1-u,p,(m*10+p)%MOD,false);
				}
			}
			else{
				for(int p=0;p<pre;p++){
					res+=get(k+1,f,1-u,p,(m*10+p)%MOD,false);
				}
			}
		}
		else{
			if(u==1){
				for(int p=pre+1;p<=s[k];p++){
					if(p==s[k])res+=get(k+1,0,1-u,p,(m*10+p)%MOD,false);
					else res+=get(k+1,1,1-u,p,(m*10+p)%MOD,false);
				}
			}
			else{
				int t = Math.min(pre-1, s[k]);
				for(int p=0;p<=t;p++){
					if(p==s[k])res+=get(k+1,0,1-u,p,(m*10+p)%MOD,false);
					else res+=get(k+1,1,1-u,p,(m*10+p)%MOD,false);
				}
			}
		}
		return dp[k][f][u][pre][m] = res%M;
	}
	
	int f(String r){
		n = r.length();
		s = new int[n];
		for(int i=0;i<n;i++)s[i]=r.charAt(i)-'0';
		dp = new int[n+1][2][2][10][MOD];
		for(int i=0;i<=n;i++)for(int j=0;j<2;j++)for(int k=0;k<2;k++)for(int p=0;p<10;p++)for(int m=0;m<MOD;m++)dp[i][j][k][p][m]=-1;
		int res = 0;
		res += get(1, 1, 0, 0, 0, true);
		for(int p=1;p<=s[0];p++){
			if(p==s[0]){
				res+=get(1,0,0,p,p%MOD,false);
				if(n!=1)res+=get(1,0,1,p,p%MOD,false);
			}
			else{
				res+=get(1,1,0,p,p%MOD,false);
				if(n!=1)res+=get(1,1,1,p,p%MOD,false);
			}
		}
		return res%M;
	}
	
	void run(){
		Scanner sc = new Scanner(System.in);
		String A = sc.nextBigInteger().subtract(BigInteger.ONE).toString(), B = sc.next();
		MOD = sc.nextInt();
		System.out.println((f(B)-f(A)+M)%M);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 90000