akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	while(n--)
	{
		int a;
		cin>>a;
		if(a%2==0)
			if(a%3 && a%5)
			{
				cout<<"DENIED";
				return 0;
			}
	}
	cout<<"APPROVED";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define db double
#define pb push_back
#define wrln cout<<'\n';
#define pii pair<int,int>

using namespace std;
const int H=1e9+7;
const int N=2e5+100;

unsigned long long res,f[N],a[N],n;

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

   // freopen("test11.INP","r",stdin);
   // freopen("test.OUT","w",stdout);

    cin>>n;
    for (int i=1; i<=n; i++)
    {
        cin>>a[i];
        f[i]=a[i]+f[i-1];
    }
    for (int i=n; i>0; i--)
    {
        res+= ( (a[i]%H) *  (f[i-1]%H ) ) %H;
        res%=H;
    }

    cout<<res;
}


Measured memory_bytes: 6772
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	A, P := getInt(), getInt()
	P += A * 3
	out(P / 2)
}


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

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);

    for (int i = 0; i < n; i++)
    {
        cin >> x.at(i);
        y.at(x.at(i)-1) = i+1;
    }
    for (int i = 0; i < n; i++)
    {
        cout << y.at(i) << " ";
    }
    cout << endl;
}

Measured memory_bytes: 3916
h,w=gets.split.map(&:to_i)
s=h.times.map{gets.chomp}


ans=0
if s[0][0]=='#'
  if s[-1][-1]=='#'
    ans+=1
    s.each do |si|
      si.size.times do |j|
        si[j]= si[j]=='.' ? '#' : '.'
      end
    end
  else
    s.reverse!
    s.each do |si|
      si.reverse!
    end
  end
end
s.push([])
dp=Array.new(h+1){Array.new(w+1,Float::INFINITY)}
dp[0][0]=0
h.times do |hi|
  w.times do |wj|
    dp[hi][wj+1]=[dp[hi][wj+1],dp[hi][wj]+(s[hi][wj]==s[hi][wj+1] ? 0 : 1)].min
    dp[hi+1][wj]=[dp[hi+1][wj],dp[hi][wj]+(s[hi][wj]==s[hi+1][wj] ? 0 : 1)].min
  end
end
puts (dp[h-1][w-1]+1)/2+ans

Measured memory_bytes: 1916
N = gets.chomp.to_i
A = gets.chomp.split.map(&:to_i)
B = gets.chomp.split.map(&:to_i)
C = gets.chomp.split.map(&:to_i)
ans = 0
(1..N-1).each do |i|
  if A[i] - A[i-1] == 1
    ans += B[A[i]-1]
    ans += C[A[i]-2]
  else
    ans += B[A[i]-1]
  end
end
ans += B[A[0]-1]
puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#define MP make_pair
using ll = long long;
using namespace std;

int main()
{
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b > c+d)
    cout << "Left" << endl;
  else if(a+b < c+d)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
  return 0;
}


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

int main(){
  int A, B, K;
  cin >> A >> B >> K;
  int i = A,num = 0;
  while(true){
    if(A % i == 0 && B % i ==0){
      num++;
    }
    if(num >= K)break;
    i--;
  }
  cout << i << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>

using namespace std;
const int MX=100011;
int n,a[MX];
int cal(){
	bool hs1=false;
	for(int i=1;i<=n;i++)if(a[i]==1)hs1=true;
	if(hs1){
		int S=0;
		for(int i=1;i<=n;i++)S^=((a[i]-1)&1);
		return S;
	}
	int c[2]={0};
	for(int i=1;i<=n;i++)++c[a[i]&1];
	if(c[1]==1)return -1;
	return c[0]&1;
}
inline int gcd(int x,int y){if(x<y)swap(x,y);while(y)x%=y,swap(x,y);return x;}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]);
	int r=-1,T=0;
	while(1){
		if(~(r=cal())){
			puts((r^T)?"First":"Second");
			break;
		}
		else{
			T^=1;
			for(int i=1;i<=n;i++)a[i]>>=1;
			int g=0;
			for(int i=1;i<=n;i++)g=gcd(g,a[i]);
			for(int i=1;i<=n;i++)a[i]/=g;
		}
	}
	return 0;
}


Measured memory_bytes: 512
from math import sqrt

N = int(input())
loc = [[int(j) for j in input().split()] for i in range(N)]
dist = []
for i in range(N):
  for j in range(i + 1, N):
    dist.append(sqrt((loc[j][0] - loc[i][0]) ** 2 + (loc[j][1] - loc[i][1]) ** 2))
sum = 0
for d in dist:
  sum += d
print(sum * 2 / N)

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

int boubleSort(int A[], int N) {
    int cnt = 0;
    bool flag = 1;
    for (int i = 0; flag; ++i) {
        flag = 0;
        for (int j = N-1; j > i; --j) {
            if (A[j] < A[j-1]) {
                swap(A[j], A[j-1]);
                flag = 1;
                cnt++;
            }
        }
    }
    return cnt;
}

int main() {
    int N; cin >> N;
    int A[100];
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
    }
    int cnt;

    cnt = boubleSort(A, N);

    for (int i = 0; i < N; ++i) {
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3100
n,k=map(int,input().split())
arr1=list(map(int,input().split()))
arr1=sorted(arr1)
arr2=list(map(int,input().split()))
arr2=sorted(arr2,reverse=True)
l=-1
r=10**12+1
while r-l!=1:
  m=(r+l)//2
  tmp=0
  for i in range(n):
    if arr1[i]>m//arr2[i]:
      tmp+=(arr1[i]-m//arr2[i])
  if tmp<=k:
    r=m
  else:
    l=m
print(r)

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()

void solve() {
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n - 1);
  for (auto &i : a) cin >> i;
  for (auto &i : b) cin >> i;
  for (auto &i : c) cin >> i;
  int ans = 0, old = -2;
  for (auto &i : a) {
    ans += b[i - 1];
    if (old == i - 1) ans += c[i - 2];
    old = i;
  }
  cout << ans << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) solve();
}


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

typedef long long ll;

const int maxn = 200005;

int a[2*maxn];
ll t[2*maxn];

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm

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

    for( int i = 2; i <= 2*n; i++ ){
        t[i] = t[i-1] + (a[i] - a[i-1] + k)%k;
    }

    ll sol = 1LL << 60;
    for( int i = n; i <= 2*n; i++ )
        sol = min(sol, t[i] - t[i - n+1]);

    cout << sol << "\n";

    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
#include <string.h>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

int N, M, Q;
const int MAX_NM = 2000;
const int MAX_Q = 200000;
string S[MAX_NM];
int X1[MAX_Q], Y1[MAX_Q], X2[MAX_Q], Y2[MAX_Q];

int main(){
  cin >> N >> M >> Q;
  REP(i, N) cin >> S[i];
  REP(i, Q) cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
  REP(i, Q) {
    X1[i]--;
    Y1[i]--;
    X2[i]--;
    Y2[i]--;
  }

  int blue[N][M], vert[N][M], hori[N][M];
  REP(i, N) REP(j, M) {
    blue[i][j] = 0;
    vert[i][j] = 0;
    hori[i][j] = 0;
  }

  REP(i, N) {
    REP(j, M) {
      if(i > 0) {
        blue[i][j] += blue[i - 1][j];
        vert[i][j] += vert[i - 1][j];
        hori[i][j] += hori[i - 1][j];
      }
      if(j > 0) {
        blue[i][j] += blue[i][j - 1];
        vert[i][j] += vert[i][j - 1];
        hori[i][j] += hori[i][j - 1];
      }
      if(i > 0 && j > 0) {
        blue[i][j] -= blue[i - 1][j - 1];
        vert[i][j] -= vert[i - 1][j - 1];
        hori[i][j] -= hori[i - 1][j - 1];
      }
      if(S[i][j] == '1') {
        blue[i][j]++;
        if(i > 0 && S[i - 1][j] == '1') vert[i][j]++;
        if(j > 0 && S[i][j - 1] == '1') hori[i][j]++;
      }
    }
  }

  REP(i, Q) {
    ll ans = 0;
    ll b = 0, v = 0, h = 0;
    b += blue[X2[i]][Y2[i]];
    v += vert[X2[i]][Y2[i]];
    h += hori[X2[i]][Y2[i]];
    if(X1[i] > 0) {
      b -= blue[X1[i] - 1][Y2[i]];
      v -= vert[X1[i]][Y2[i]];
      h -= hori[X1[i] - 1][Y2[i]];
    }
    if(Y1[i] > 0) {
      b -= blue[X2[i]][Y1[i] - 1];
      v -= vert[X2[i]][Y1[i] - 1];
      h -= hori[X2[i]][Y1[i]];
    }
    if(X1[i] > 0 && Y1[i] > 0) {
      b += blue[X1[i] - 1][Y1[i] - 1];
      v += vert[X1[i]][Y1[i] - 1];
      h += hori[X1[i] - 1][Y1[i]];
    }
    cout << b - v - h << endl;
  }

  return 0;
}



Measured memory_bytes: 55936
// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
void solve(){
    ll a, b, n;
    cin>>a>>b>>n;
    ll x = min(b-1, n);
    cout<<(a*x)/b - a*(x/b)<<"\n";
}
int main(){ 
        hs;
        ll t;
        t=1;
        // cin>>t;
        for (int i=1; i<=t; i++){
                //cout<<"Case #"<<i<<": ";
                solve();
         }
        return 0; 
}

Measured memory_bytes: 3512
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>

using namespace std;

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

int main(){


	while(1){
		int m = 0, f = 0, r = 0;
		cin >> m >> f >> r;
		if(m == -1 && f == -1 && r == -1){
			break;
		}
		if(m == -1 || f == -1) cout << "F" << "\n";
		else if(m + f >= 80) cout << "A" << "\n";
		else if(m + f >= 65) cout << "B" << "\n";
		else if(m + f >= 50) cout << "C" << "\n";
		else if(m + f >= 30 && r >= 50) cout << "C" << "\n";
		else if(m + f >= 30) cout << "D" << "\n";
		else if(m + f < 30) cout << "F" << "\n";
	}

	return 0;
}

Measured memory_bytes: 1124
#include<stdio.h>
#define min(a,b) a<b?a:b

void r(int *p){
    int tmp;
    if(p[0]>p[1]){
        tmp=p[0];
        p[0]=p[1];
        p[1]=tmp;
    }
    if(p[1]>p[2]){
        tmp=p[1];
        p[1]=p[2];
        p[2]=tmp;
    }
    if(p[0]>p[1]){
        tmp=p[0];
        p[0]=p[1];
        p[1]=tmp;
    }
}

int main(){
    int p[3],j[2],ans;

    scanf("%d%d%d%d%d",&p[0],&p[1],&p[2],&j[0],&j[1]);

    r(p);
    ans=min(j[0],j[1]);
    ans+=p[0]-50;
    //ans=min(j[0],j[1])+min(min(p[0],p[1]),p[2])-50;
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 592
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        // Here your code !
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();
        String param[] = input.split(" ");
        int a = Integer.parseInt(param[0]);
        int b = Integer.parseInt(param[1]);
        int c = Integer.parseInt(param[2]);
        if(a > b) {
            int a1 = a;
            int b1 = b;
            a = b1;
            b = a1;
        }
        if (b > c) {
            int b2 = b;
            int c1 = c;
            b = c1;
            c = b2;
        }
        if (a > b) {
            int a2 = a;
            int b2 = b;
            a = b2;
            b = a2;
        }
        System.out.println(a + " " + b + " " + c);
        
    }
}

Measured memory_bytes: 24168
#include <iostream>
using namespace std;
int main() {
	long long a, b, c, k[100005], ans = 0;
	cin >> a >> b >> c;
	for (int i = 0; i < a; ++i) {
		cin >> k[i];
		if (i) {
			if ((k[i] - k[i - 1])*b > c) ans += c;
			else ans += (k[i] - k[i - 1])*b;
		}
	}
	cout << ans << endl;
}

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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REP1(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREP1(i, x) for (int i = ((int)(x)); i > 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define debug(x) cerr << #x << ": " << x << '\n'
const int MOD = (int)1e9 + 7;
const int INF = 1145141919;
using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using l_l = pair<ll, ll>;
using d_d = pair<double, double>;
using vint = vector<int>;
using vll = vector<ll>;

int main() {
    cin.tie(0), ios::sync_with_stdio(false);
    int H, W, D;
    cin >> H >> W >> D;
    vint ax(H * W), ay(H * W);
    REP(y, H) {
        REP(x, W) {
            int a;
            cin >> a;
            a -= 1;
            ax[a] = x;
            ay[a] = y;
        }
    }
    vll cmls(H * W);
    for (int i = D; i < W * H; i++) {
        ll t = abs(ax[i - D] - ax[i]) + abs(ay[i - D] - ay[i]);
        cmls[i] = cmls[i - D] + t;
    }
    int Q;
    cin >> Q;
    int L, R;
    REP(_, Q) {
        cin >> L >> R;
        R -= 1;
        L -= 1;
        cout << cmls[R] - cmls[L] << endl;
    }
}

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

int main() {
  int n, x;
  cin>>n>>x;
  vector<int> s(n);
  for (int i=0;i<n;i++) {
    cin>>s[i];
  }
  int sum = 0;
  int count = 1;
  for (int i=0;i<n;i++) {
    sum += s[i];
    if (sum > x) break;
    count++;
  }
  cout<<count<<endl;
}


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

const int N_MAX = 1000;
const int W_MAX = 1000;
int c[N_MAX+1][W_MAX+1];

int main() {
    int t = 1;
    int w;
    while (cin >> w, w) {
        int n;
        cin >> n;
        vector<int> vs(n+1), ws(n+1);
        for (int i = 1; i <= n; i++) {
            scanf("%d,%d", &vs[i], &ws[i]);
        }
        for (int i = 0; i <= n; i++) {
            fill_n(c[i], w+1, 0);
        }
        int v_max = -1, w_min = 1 << 29;
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= w; j++) {
                if (j - ws[i] >= 0) {
                    c[i][j] = max(c[i-1][j], c[i-1][j - ws[i]] + vs[i]);
                    if (v_max < c[i][j]) {
                        v_max = c[i][j];
                        w_min = j;
                    } else if (v_max == c[i][j]) {
                        w_min = min(w_min, j);
                    }

                } else {
                    c[i][j] = c[i-1][j];
                }
            }
        }
        printf("Case %d:\n%d\n%d\n", t++, v_max, w_min);
    }
}

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

int main(){
    int H1,M1,H2,M2,K;
    cin >> H1 >> M1 >> H2 >> M2 >> K;
    
    int start,end;
    start = H1*60 + M1;
    end = H2*60 + M2;
    
    int ans;
    ans = (end - K) - start;
    if(ans<0) ans=0;
    cout << ans << endl;
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    int a, b, c; cin >> a >> b >> c;
    cout << max({a, b, c}) - min({a, b, c}) << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7740
#include<stdio.h>
int main()
{
    int i,ans;
    char s[3];
    scanf("%s",s);
    ans=700;
    for(i=0;i<3;i++)
    {
        if(s[i]=='o')
            ans+=100;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 128
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	X := float64(nextInt())
	for i := -120; i <= 120; i++ {
		A := float64(i)
		for k := -120; k <= 120; k++ {
			B := float64(k)
			if math.Pow(A, 5)-math.Pow(B, 5) == X {
				fmt.Print(A, B)
				goto FIN
			}
		}
	}
FIN:
}


Measured memory_bytes: 1756
#include <stdio.h>

int main(void)
{
	int s = 0;
	int i;
	char t[4];

	scanf("%c%c%c%c", &t[0], &t[1], &t[2], &t[3]);

	for(i=0; i<4; i++)
	{
		if(t[i] == '+') s += 1;
		else if(t[i] == '-') s -= 1;		
	}
	printf("%d", s);
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
 
int main()
{
int N ;
int K;
cin >> N >> K ;
int A[N+1] ;
for(int i=1; i<=N;i++){
cin >> A[i] ;
}
if((N-1)%(K-1)){
  cout << (N-1)/(K-1)+1 << endl;
}
else{
  cout << (N-1)/(K-1) << endl;
}
    return 0;
}

Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cctype>
#include <climits>
#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>

using namespace std;

#define FOR(i, first, last) for (int i = (first); i < (last); ++i)
#define REP(i, n) FOR(i, 0, n)
#define CLR(a) memset((a), 0, sizeof(a))
#define DUMP(x) std::cerr << #x << " = " << (x) << std::endl;

inline int to_int(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string to_string(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

typedef unsigned long long ull;
typedef unsigned long ul;

int main() {
  int x,y,z;
  cin>>x>>y>>z;

  int n=0;
  int len=0;

  while(len<=x) {
    len += (y+z);
    n++;
  }
  // remove overshoot
  len -= (y+z);
  n--;

  if(x - len < z) n--;

  n = max(n, 0);
  cout << n << endl;

  return 0;
}


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

int main() {
    int A, B, M;
    cin >> A >> B >> M;
    vector<int> a(A);
    vector<int> b(B);
    int minA = 1e6;
    int minB = 1e6;
    int minSum = 1e7;
    rep(i, A) {
        cin >> a[i];
        minA = min(minA, a[i]);
    }
    rep(i, B) {
        cin >> b[i];
        minB = min(minB, b[i]);
    }
    minSum = minA + minB;
    vector<int> x(M);
    vector<int> y(M);
    vector<int> c(M);
    rep(i, M) {
        int x,y,c;
        cin >> x >> y >> c;
        --x;--y;
        minSum = min(minSum,a[x]+b[y]-c);
    }

    cout << minSum << endl;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

ll dp[100001];
// dp[i]:価値iを獲得するのに必要な最小重量

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

  ll max_v = 0;
  rep(i, N)max_v += v[i];
  rep(i, max_v+1)dp[i] = INF;
  dp[0]=0;
  rep(i,N){
    rrep1(j, max_v){
      if(j-v[i]>=0)dp[j] = min( dp[j], dp[j-v[i]]+w[i] );
    }
  }

//  rep(i, max_v+1)cout<<dp[i]<<' ';cout<<endl;
  rrep(i, max_v+1)if(dp[i]<=W){cout<<i<<endl;break;}

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  int t[110], p[110], x[110];
  for(int i=0; i<n; i++){
    cin >> t[i];
  }
  cin >> m;
  for(int i=0; i<m; i++){
    cin >> p[i] >> x[i];
  }
  int sum=0;
  for(int i=0; i<n; i++){
    sum += t[i];
  }
  for(int i=0; i<m; i++){
    int ans = sum - (t[p[i]-1] - x[i]);
    cout << ans << endl;
  }
}

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

typedef long long ll;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

const char nl = '\n';

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
    ll n, m; cin >> n >> m;
    if (n == 1 && m == 1) cout << 1 << nl;
    else if (n == 1 || m == 1) cout << max(n, m) - 2 << nl;
    else {
        cout << (n - 2) * (m - 2) << nl;
    }
}

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

vector<pint> a;
bool cmp(pint a, pint b) { return a.second < b.second; }

int main() {
    int n, m;
    cin >> n >> m;
    a.resize(m);
    rep(i, m) cin >> a[i].first >> a[i].second;
    sort(a.begin(), a.end(), cmp);

    int cnt = 0;
    int x = -1;
    rep(i, m) {
        if(x <= a[i].first) {
            cnt++;
            x = a[i].second;
        }
    }

    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1024
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<i32>();
    let (a, b, c, d)= (line[0], line[1], line[2], line[3]);

    if (a+d-1)/d >=(c+b-1)/b{
        println!("Yes");
    }else{
        println!("No");
    }
}


Measured memory_bytes: 2108
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
//typedef pair<int,int> Pint;
//typedef pair<ll, ll> P;
typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 2147483600;//10^9
ll MOD  = 1000000007;
vector<int> dy = {0,0,1,-1};
vector<int> dx = {1,-1,0,0};
int H,W,N;
int sr,sc;
string S,T;

int main(void){
    cin >> H >> W >> N;
    cin >> sr >> sc;
    cin >> S >> T;
    bool l = 1;
    
    int limitL = 1, limitR = W;
    
    for(int i = N-1; i >= 0; i--){
        
        if(T.at(i) == 'R'){
            limitL--;
            if(limitL < 1){
                limitL++;
            }
        }else if(T.at(i) == 'L'){
            limitR++;
            if(limitR > W){
                limitR--;
            }
        }
        
        if(limitL > limitR) l = 0;
        
        if(S.at(i) == 'R'){
            limitR--;
        }else if(S.at(i) == 'L'){
            limitL++;
        }
        if(limitL > limitR) l = 0;
    }
    if(limitL <= sc && sc <= limitR){
        
    }else{
        l = 0;
        
    }
    
    
    int limitU = 1, limitD = H;
    
    for(int i = N-1; i >= 0; i--){
        if(T.at(i) == 'D'){
            limitU--;
            if(limitU < 1){
                limitU++;
            }
        }else if(T.at(i) == 'U'){
            limitD++;
            if(limitD > H){
                limitD--;
            }
        }
        if(limitU > limitD) l = 0;
        
        if(S.at(i) == 'D'){
            limitD--;
        }else if(S.at(i) == 'U'){
            limitU++;
        }
        if(limitU > limitD) l = 0;
    }
    if(limitU <= sr && sr <= limitD){
        
    }else{
        l = 0;
    }
    
    if(l){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
}


Measured memory_bytes: 776
#include <stdio.h>

int main() {
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	int total = 0;
	for(int i = a; i <= b; i++){
		if(i % c == 0){
			total++;
		}
	}
	printf("%d\n", total);
	return 0;
}

Measured memory_bytes: 1732
#include<iostream>
#define ll long long
using namespace std;
ll a[2010];
ll p=1e9+7;
ll pow(ll y,int z,int p){
    y%=p;ll ans=1;
    for(int i=z;i;i>>=1,y=y*y%p)if(i&1)ans=ans*y%p;
    return ans;
}
ll C(ll n,ll m){
    if(m>n)return 0;
    return ((a[n]*pow(a[m],p-2,p))%p*pow(a[n-m],p-2,p)%p);
}
ll Lucas(ll n,ll m){
    if(!m)return 1;
    return C(n%p,m%p)*Lucas(n/p,m/p)%p;
}
int main(){
    int n,k;
    cin>>n>>k;
    a[0]=1;
    for(int i=1;i<=n;i++)a[i]=(a[i-1]*i)%p;
    for(int i=1;i<=k;i++){
        cout<<Lucas(n-k+1,i)*Lucas(k-1,i-1)%p<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

#define INF ((1LL<<62)-(1LL<<31))
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p) pom(a,p-2,p)

////////////////////////////////////////////////////////////////////////////////////////
int main(){
    ll n; cin >> n;
    ll a[n]; rep(i,0,n) cin >> a[i];

    ll res = 0;
    ll A = 0, keta = 0;
  	rep(i,0,n) A = max(A, a[i]);
    while(A != 0){
        A = A >> 1;
      	//cout << A << ednl;
        keta++;
    }
    keta++;
    keta++;
  	//cout << keta << ednl;
    //vector<vector<ll>> k0(keta), k1(keta);
    ll k0[keta], k1[keta];
    rep(i,0,keta) k0[i] = k1[i] = 0;
    rep(i,0,n){
        ll k = 0;
        while(k < keta){
            if(a[i] & 1){
                k1[k]++;
            }else{
                k0[k]++;
            }
            a[i] = a[i] >> 1;
            k++;
        }
      	//cout << k1[k-1] << " " << k0[k-1] << ednl;
    }
    
    rep(i,0,keta){
        ll tmp = 1;
        tmp = (tmp * (ll)pow(2,i) ) % MOD;
        tmp = (tmp * k0[i]) % MOD;
        tmp = (tmp * k1[i]) % MOD;
        res = (res + tmp) % MOD;
      	//cout << k0[i] << " " << k1[i] << " " << res << ednl;
    }
    cout << res << ednl;
}


Measured memory_bytes: 2560
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   string s,t;
   int ctr = 0;
   cin >> s >> t;
   for(int i = 0; i < 3; i++)
      if(s[i]==t[i])
         ctr++;
   cout << ctr << endl;
   return 0;
}


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

public class Main {
	public static void main(String args[]) throws IOException {
	// 2020/1/30 No.150
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	String str[] = br.readLine().split(" ");
	int n = Integer.parseInt(str[0]);
	int m = Integer.parseInt(str[1]);

	br.close();

	if (500 * n >= m)
		System.out.println("Yes");
	else
		System.out.println("No");
	}
}

Measured memory_bytes: 21204
import           Control.Applicative
import           Control.Monad
import qualified Data.ByteString.Char8 as B
import           Text.Printf

readi :: B.ByteString -> Int
readi b | Just (n, _) <- B.readInt b = n

dot :: (Double, Double) -> (Double, Double) -> Double
(a, b) `dot` (c, d) = a * c + b * d

cross :: (Double, Double) -> (Double, Double) -> Double
(a, b) `cross` (c, d) = a * d - b * c

main :: IO ()
main = do
    n <- readLn
    replicateM_ n $ do
        [a,b,c,d,e,f,g,h] <- fmap (fromIntegral . readi) . B.words <$> B.getLine
        let v1 = (c - a, d - b)
        let v2 = (g - e, h - f)
        case () of
            _ | v1 `dot` v2   == 0 -> putStrLn "1"
              | v1 `cross` v2 == 0 -> putStrLn "2"
              | otherwise          -> putStrLn "0"



Measured memory_bytes: 4104
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1e10;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define P pair<int, int>
#define V vector<int>
//#define S set<int>
#define itn int
bool dbg = false;

int N, W, w[200], v[200];
int dp[101010];

void solve() {
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin >> N >> W;
    FOR(N)
    cin >> w[i] >> v[i];
    FOR(N) {
        for (int bef = W - 1; bef >= 0; bef--) {
            int nxt = bef + w[i];
            if (nxt > W)
                continue;
            chmax(dp[nxt], dp[bef] + v[i]);
        }
    }
    cout << dp[W] << endl;
    solve();
    return 0;
}


Measured memory_bytes: 1024
a1 = []
5.times { a1 << gets.to_i }
a2 = a1.map {|e| e % 10}
a2.delete(0)

res = 0
a1.each do |e|
  if e % 10 == 0
    res += e
  else
    res += (e/10)*10 + 10
  end
end

if a2.empty?
  puts res
else
  puts res + a2.min - 10
end

Measured memory_bytes: 3836
/*
ソートが安定(stable)かどうか確かめる
手続きを入れるより、

ｎがそこまで大きくないので
安定であると周知のソートアルゴリズムを使って
ソートしたのと比較して一致するか見る。
*/

/*
「pivotを中間に、大きいものと小さいものを交換していく」
という感じではなく、
「pivotより小さいものを探して、前の方に詰めていく（添え字iのとこ）」
という感じである。

*/

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

//カード記録用の構造体
//typedef struct CARD_TEMP { //c++は構造体のテンプレートいらない
struct CARD {
	char suit; 
	int num;
	bool operator == (const CARD& right) const { //演算子のオーバーロード
        return suit==right.suit && num==right.num;
    }
};

//<algorithm>のstable_sort()をCARD型配列で使うための、比較用関数
bool CARD_asc( const CARD& left, const CARD& right ) {
    return left.num < right.num;
}


int Partition(vector<CARD> &A, int p, int r){
	int i,j;
	int pivot;

	pivot = A[r].num;
	i=p-1;
	for(j=p; j<r; j++){
		if(A[j].num<=pivot) {
			i++;
			swap(A[i],A[j]);
		}
	}
	swap(A[i+1],A[r]);
	return i+1;
}

void Quicksort(vector<CARD> &A, int p, int r){
	int q;

	if(p<r){
		q=Partition(A, p, r);
		Quicksort(A, p, q-1);
		Quicksort(A, q+1, r);	
	}
}


int main() {
	int i,j;
    int n;
    int p,q,r,pivot;
    vector<CARD> A,B;
    
    cin >> n;
    for(i=0;i<n;i++){
		CARD buf;
		cin >> buf.suit;
		cin >> buf.num;
        A.push_back(buf);
    }

	B=A; //コピー
    stable_sort(B.begin(), B.end(), CARD_asc);

	p=0;
	r=n-1;
	Quicksort(A, p, r);
    
    //出力
	if(A==B) cout << "Stable" << endl;
	else cout << "Not stable" << endl;
    for(i=0;i<n;i++){
		cout << A[i].suit << " " << A[i].num << endl;
    }

	return 0;
}

Measured memory_bytes: 3124
using System;

namespace _049_BloodGroups
{
	class Program
	{
		static void Main ( string[] args )
		{
			const int A = 0;
			const int B = 1;
			const int AB = 2;
			const int O = 3;

			int[] bloodCount = new int[4];

			string inputStr;

			while ((inputStr = Console.ReadLine ()) != null)
			{
				string[] item = inputStr.Split (',');

				switch (item[1])
				{
					case "A":
						bloodCount[A]++;
						break;
					case "B":
						bloodCount[B]++;
						break;
					case "AB":
						bloodCount[AB]++;
						break;
					case "O":
						bloodCount[O]++;
						break;
				}
			}

			foreach (var item in bloodCount)
			{
				Console.WriteLine (item);
			}
		}
	}
}

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

using namespace std;

#define INF 999999999

bool pr[1300000];

void erato(){
	pr[0] = 0;
	pr[1] = 0;
	pr[2] = 1;
	for(int i = 3;i<1300000;i++){
		pr[i]=1;
		for(int j=2;j*j<=i;j++){
			if(i%j==0){
				pr[i] = 0;
				break;
			}
		}
	}
}

int main(){
	int i, j, n;
	int ans;
	erato();
	while(1){
		cin >> n;
		if(!n)break;
		if(pr[n]) cout << "0" << endl;
		else{
			int less = n-1;
			while(!pr[less]){
				less--;
			}
			int more = n+1;
			while(!pr[more]){
				more++;
			}
			cout << more - less << endl;
		}
	}
	return 0;
}

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

void solve(int n){
    int d;
    cin>>d;
    vector<string> name(n);
    for(int i=0;i<n;i++) cin>>name[i];

    auto trans=[&](string s){
        set<string> resp;
        //insert
        for(int i=0;i<=s.size();i++){
            for(int k=0;k<='z'-'a';k++){
                char x='a'+k;
                string tmp=s.substr(0,i)+x+s.substr(i);
                resp.insert(tmp);
            }
        }
        //delete
        for(int i=0;i<s.size();i++){
            string tmp=s.substr(0,i)+s.substr(i+1);
            resp.insert(tmp);
        }
        //replace
        for(int i=0;i<s.size();i++){
            for(int k=0;k<='z'-'a';k++){
                char x='a'+k;
                string tmp=s.substr(0,i)+x+s.substr(i+1);
                resp.insert(tmp);
            }
        }
        //swap
        for(int i=0;i+1<s.size();i++){
            string tmp=s;
            swap(tmp[i],tmp[i+1]);
            resp.insert(tmp);
        }
        return resp;
    };
    vector<set<string>> ss(n);
    for(int i=0;i<n;i++){
        ss[i]=trans(name[i]);
    }
    set<pair<string,string>> res;
    if(d==1){
        for(int i=0;i<n;i++){
            for(int j=0;j<i;j++){
                if(ss[j].count(name[i])){
                    res.insert({min(name[i],name[j]),max(name[i],name[j])});
                }
            }
        }
    }
    else{
        for(int i=0;i<n;i++){
            for(int j=0;j<i;j++){
                for(auto &str:ss[i]){
                    if(ss[j].count(str)){
                        res.insert({min(name[i],name[j]),max(name[i],name[j])});
                        break;
                    }
                }
            }
        }
    }
    for(auto p:res) cout<<p.first<<","<<p.second<<endl;
    cout<<res.size()<<endl;
}
int main(){
    int n;
    while(cin>>n,n){
        solve(n);
    }
    return 0;
}


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

using namespace std;
using ll = long long int;

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

    ll a, b, c, k;
    cin >> a >> b >> c >> k;

    // a[i] = b[i-1] + c[i-1]
    // b[i] = c[i-1] + a[i-1]
    // c[i] = a[i-1] + b[i-1]
    // a[i]-b[i] = b[i-1]-a[i-1]
    cout << (a-b)*(k&1?-1:1) << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 12 20:43:41 2019

@author: Owner
"""

# -*- coding: utf-8 -*-
"""
Created on Sat Dec 29 18:42:51 2018

@author: Owner
"""

import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
"""
N, X = map(int, input().split())

x = [0]*N
x[:] = map(int, input().split())

P = [0]*M
Y = [0]*M
for m in range(M):
    P[m], Y[m] = map(int, input().split())
    
all(nstr.count(c) for c in '753')
"""


N = int(input())
H = int(input())
W = int(input())

num = (N-H+1)*(N-W+1)

print(num)

Measured memory_bytes: 24852
rp = [ele for ele in input().split()]
op = ['+','-','*']
stack = []
for ele in rp:
	if ele not in op:
		# ele is number
		stack.append(eval(ele))
	else:
		# ele is operator
		num_2 = stack.pop()
		num_1 = stack.pop()
		if ele == '+':
			stack.append(num_1 + num_2)
		elif ele == '-':
			stack.append(num_1 - num_2)
		else:
			# ele == '*'
			stack.append(num_1 * num_2)
print(stack[0])

Measured memory_bytes: 7564
#include <bits/stdc++.h>
#define pb push_back
typedef long long ll;
typedef long double la;
using namespace std;

int main(){
    ll n,a,b,t=0,sum=0;
    cin >> n >> a >> b;
    string s;
    cin >> s;
    for(int i=0;i<n;i++){
        if(s[i] == 'a'){
            if(sum < a+b){
                cout << "Yes"<< endl;
                sum++;
            }else{
                cout << "No" << endl;
            }
        }
        if(s[i] == 'b'){
            if(sum < a+b){
                if(t < b){
                    cout << "Yes" << endl;
                    t++;
                    sum++;
                }else{
                    cout << "No" << endl;
                }
            }else{
                cout << "No" << endl;
            }
        }
        if(s[i] == 'c'){
            cout << "No" << endl;
        }
    }
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	int res = a % b;
	int mod = b;
	if (a == 1) {
		cout << "YES" << endl;
		return 0;
	}
	bool elf = false;
	for (int i = 0; i <= b - 1; ++i) {
		if (res * i % mod == c) elf = true;
	}
	if (elf) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

using namespace std;
const int maxn=2e5+5;
int a[maxn],b[maxn];
int main(){
    int n,x,y;
    cin>>n;
    for(int i=1;i<=n;++i){
        scanf("%d%d",&x,&y);
        a[i]=x+y;b[i]=x-y;
    }
    sort(a+1,a+1+n);
    sort(b+1,b+1+n);
    cout<<max(a[n]-a[1],b[n]-b[1])<<endl;
    return 0;
}

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

const int N = (int) 1e5 + 2;
vector<pair<int, int>> adj[N];
int col[N];
int n;
void dfs(int x, int fa) {
	for (auto& e : adj[x]) if (e.first != fa) {
		if (e.second % 2 == 1) {
			col[e.first] = col[x] ^ 1;
		} else {
			col[e.first] = col[x];
		}
		dfs(e.first, x);
	}
}
int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n - 1; ++i) {
		int u, v, w;
		cin >> u >> v >> w, --u, --v;
		adj[u].push_back({v, w});
		adj[v].push_back({u, w});
	}
	col[0] = 0;
	dfs(0, -1);
	for (int i = 0; i < n; ++i) cout << col[i] << "\n";
	return 0;
}


Measured memory_bytes: 8448
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

void overwrite(vs& field,int i,int j,char kind)
{
	int h=field.size(),w=field[0].size();
	if(i<0 || h<=i || j<0 || w<=j || field[i][j]!=kind)
		return;
	field[i][j]=' ';
	overwrite(field,i-1,j,kind);
	overwrite(field,i+1,j,kind);
	overwrite(field,i,j-1,kind);
	overwrite(field,i,j+1,kind);
}

int main()
{
	for(int h,w;cin>>h>>w,h|w;){
		vs field(h);
		rep(i,h)
			cin>>field[i];
		
		int res=0;
		rep(i,h) rep(j,w)
			if(field[i][j]!=' '){
				overwrite(field,i,j,field[i][j]);
				res++;
			}
		cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
N = int(input())

lN = int(str(N)[0])
rN = int(str(N)[-1])
dN = len(str(N))

ans = 0
for a in range(1, N+1):
    la = int(str(a)[0])
    ra = int(str(a)[-1])
    # print(la, ra)
    if la == 0 or ra == 0:
        continue
    #  1桁
    if la == ra:
        ans += 1
        # print(1)
    #  2桁以上
    d = 2
    while d <= dN:
        if d == dN:
            if ra < lN:
                ans += 10**(d-2)
                # print(10**(d-2))
            elif ra == lN:
                if dN == 2:
                    ans += 1
                    # print(1)
                elif dN > 2:
                    midN = int(str(N)[1:-1])
                    if rN >= la:
                        ans += midN + 1
                        # print(midN + 1)
                    else:
                        ans += midN
                        # print(midN)
            else:
                ans += 0
                # print(0)
            break
        ans += 10**(d-2)
        # print(10**(d-2))
        d +=1

print(ans)

Measured memory_bytes: 3064