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

using namespace std;

using LL = long long;


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

	int n;
	cin >> n;

	vector<LL> a(n);
	vector<LL> f(n);

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

	LL total = 0;

	for(int i = 0; i < n; ++i) 
		if (f[i] > 0) total += ( (f[i] * (f[i] - 1)) / 2 );
	
	for(int i = 0; i < n; ++i) {
		LL k = a[i];

		total -= ( (f[k] * (f[k] - 1)) / 2 );
		--f[k];
		
		cout << ( total + ( (f[k] * (f[k] - 1)) / 2 ) ) << '\n';
		
		++f[k];
		total += ( (f[k] * (f[k] - 1)) / 2 ) ;
	
	}

	return 0;	
}

Measured memory_bytes: 5760
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll a,b,c,x,y;
    cin>>a>>b>>c>>x>>y;
    ll ans=INF;
    if(x>=y){
        ans=min(ans,x*c*2);
        ans=min(ans,y*c*2+(x-y)*a);
    }else{
        ans=min(ans,y*c*2);
        ans=min(ans,x*c*2+(y-x)*b);
    }
    ans=min(ans,x*a+y*b);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=998244353;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

const int d=60;
const int MAX_N=200005;
int to[d][MAX_N]; //to[i][j] jから2^i先の頂点

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  ll n,k;
  cin >> n >> k;
  vector<int>a(n);
  rep(i,n){
    cin >> to[0][i];
    to[0][i]--;
  }
  rep(i,d-1){
    rep(j,n){
      to[i+1][j]=to[i][to[i][j]];
    }
  }
  int v=0;
  for(int i=d-1;i>=0;i--){
    ll l=1ll<<i;
    if(l<=k){
      v=to[i][v];
      k-=l;
    }
  }
  cout << v+1 << endl;
  return 0;     
}


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

#define EQ(a,b) (abs((a)-(b)) < EPS)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()

using namespace std;
typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;

const D EPS = 1e-8;
const D PI = acos(-1);
//for vector
inline D dot(P x, P y){return real(conj(x)*y);}
inline D cross(P x, P y){return imag(conj(x)*y);}

//rotate a point counter-clockwise on the origin
inline P rotate(P v, D s){
  return P(real(v)*cos(s) - imag(v)*sin(s), real(v)*sin(s) + imag(v)*cos(s) );
}

inline int ccw(P a,P b,P c){
  b -= a;c -= a;
  if (cross(b,c)>EPS) return 1;   //counter clockwise
  if (cross(b,c)<-EPS) return -1; //clockwise
  if (dot(b, c)<-EPS) return 2;   //c--a--b on line
  if (abs(b)+EPS<abs(c)) return -2;   //a--b--c on line
  return 0;                       //on segment
}

inline bool is_cp(L a,L b){
  if(ccw(a.fs,a.sc,b.fs)*ccw(a.fs,a.sc,b.sc)<=0)
    if(ccw(b.fs,b.sc,a.fs)*ccw(b.fs,b.sc,a.sc)<=0)return true;
  return false;
}

inline D seg_p_dis(L a,P x){
  if(dot(a.sc-a.fs,x-a.fs)<EPS)return abs(x-a.fs);
  if(dot(a.fs-a.sc,x-a.sc)<EPS)return abs(x-a.sc);
  return abs(cross(a.sc-a.fs,x-a.fs))/abs(a.sc-a.fs);
}

inline D seg_seg_dis(L a,L b){
  D res = 1e10;
  res = min(res,seg_p_dis(a,b.fs));
  res = min(res,seg_p_dis(a,b.sc));
  res = min(res,seg_p_dis(b,a.fs));
  res = min(res,seg_p_dis(b,a.sc));
  return res;
}

D g[111][111];

int main(){
  int n,m,l;
  while(scanf("%d%d%d",&n,&m,&l), n){
    vector< vector<L> > stars(n);
    for(int i=0;i<n;i++){
      int x,y,a,r;
      scanf("%d%d%d%d",&x,&y,&a,&r);
      P c = P(x,y);

      vector<P> v(5);
      P p = P(0,r);
      for(int j=0;j<5;j++){
	v[j] = c+rotate(p,PI*(a+j*72)/180);
      }
      
      vector<L> l(5);
      for(int j=0;j<5;j++){
	l[j] = L(v[j],v[(j+2)%5]);
      }
      stars[i] = l;
    }

    for(int i=0;i<n;i++){
      for(int j=i+1;j<n;j++){
	D dis = 1e9;
	for(L a : stars[i]){
	  for(L b : stars[j]){
	    if(is_cp(a,b)){
	      dis = 0;
	      break;
	    }else dis = min(dis, seg_seg_dis(a,b));
	  }
	}
	g[i][j] = g[j][i] = dis;
      }
      g[i][i] = 0;
    }

    for(int k=0;k<n;k++){
      for(int i=0;i<n;i++){
	for(int j=0;j<n;j++){
	  g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
	}
      }
    }

    printf("%.9lf\n",g[m-1][l-1]);
  }
}	

Measured memory_bytes: 1336
#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, n) for(int i = n-1; i >= 0; i--)
#define rep4(i, x, n) for(int i = x; i > n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = 1e15;

int cha(char a){
    if(a == 'L') return 0;
    elif(a == 'U') return 1;
    elif(a == 'R') return 2;
    else return 3;
}

int main(){
    int H, W, N, x, y;
    cin >> H >> W >> N >> x >> y;
    string S, T;
    cin >> S >> T;
    int wide[4];
    fill_n(wide, 4, 0);
    rep3(i, N){
        int j = cha(T[i]);
        j += 2;
        j %= 4;
        if(wide[j] > 0) wide[j]--;
        int k = cha(S[i]);
        wide[k]++;
        if(wide[0] + wide[2] >= W || wide[1] + wide[3] >= H){
            cout << "NO" << endl;
            exit(0);
        }
    }
    if(y>wide[0] && x>wide[1] && y<=W-wide[2] && x<=H-wide[3]) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

#define all(v) v.begin(), v.end()
typedef long long ll;
const int INT_INF = 1e9;
const ll INF = 1LL << 30;

int main() {
    ll n, a, b; cin >> n >> a >> b;
    ll c = a + b;
    ll d = n / c;
    ll e = n % c;
    if(a < e) e = a;
    cout << d * a + e << endl;

}



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

class Program
{
    static void Main(string[] args)
    {
        var HW = ReadLine().Split(" ").Select(s => int.Parse(s)).ToArray();
        var (H, W) = (HW[0], HW[1]);
        var hw = ReadLine().Split(" ").Select(s => int.Parse(s)).ToArray();
        var (h, w) = (hw[0], hw[1]);
        var ans = (H-h) * (W-w);
        WriteLine(ans);
    }
}


Measured memory_bytes: 28204
n , x = map(int, input().split())
a = list(map(int,input().split()))
a2 =[0]*n
for i in range(n):
    if a[i]>x:
        a2[i]=x
    else:
        a2[i] = a[i]
s = 0
for i in range(n-1):
    if a2[i]+a2[i+1]>x:
        a2[i+1]=x-a2[i]
for i in range(n):
    s+=a[i]-a2[i]
print(s)


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

int main() {
	int N, K, ans = 0;
	cin >> N >> K;
	vector<int> l(N);
	for (int& i : l) cin >> i;
	sort(l.begin(), l.end(), greater<int>());
	for (int i = 0; i < K; ++i) ans += l[i];
	cout << ans;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		final int N = n;

		int s = 0;
		for (;n>0;n/=10){
			s += n%10;
		}

		if (N%s==0){
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <stack>
using namespace std;

int main()
{
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
    if(abs(a-b)>k||abs(a-c)>k||abs(a-d)>k||abs(a-e)>k
       ||abs(b-c)>k||abs(b-d)>k||abs(b-e)>k
       ||abs(c-d)>k||abs(c-e)>k
       ||abs(d-e)>k)
        cout << ":(";
    else
        cout << "Yay!";
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;


int main() {
	int N,M;cin>>N>>M;
	vector<vector<pair<int,int>>>edges(N);
	vector<int>memo(N-1,1e9+1e7);
	memo[0]=0;

	for (int i = 0; i < M; ++i) {
		int a,b,c;cin>>a>>b>>c;
		a--;b--;
		edges[a].push_back(make_pair(b,c));
	}

	priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>que;
	que.push(make_pair(0,0));
	while (!que.empty()) {
		auto atop(que.top());
		que.pop();
		const int now=atop.second;
		const int now_time=atop.first;
		if(memo[now]<now_time)continue;
		for (auto e : edges[now]) {
			if(e.first==N-1)continue;
			if (e.second >= now_time) {
				if (memo[e.first] > e.second) {
					que.push(make_pair(e.second,e.first));
					memo[e.first]=e.second;
				}
			}
		}
	}

	int ans=-1;
	for (int i = 0; i < N - 1; ++i) {
		for (auto e : edges[i]) {
			if (e.first==N-1&&memo[i] <= e.second) {
				ans=max(ans,e.second);
			}
		}
	}
	{
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 8704
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

#[derive(PartialEq, PartialOrd, Copy, Clone)]
pub struct Total<T>(pub T);

impl<T: PartialEq> Eq for Total<T> {}

impl<T: PartialOrd> Ord for Total<T> {
    fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering {
        self.0.partial_cmp(&other.0).unwrap()
    }
}

fn argsort<T: std::cmp::Ord + std::marker::Copy>(v: &Vec<T>) -> Vec<usize> {
    let mut sort_v = Vec::new();
    for i in 0..v.len() {
        sort_v.push((v[i], i));
    }
    sort_v.sort();
    sort_v.iter().map(|x| x.1).collect::<Vec<usize>>()
}

fn main() {
    let mut n = read::<i64>();
    let v = read_vec::<i64>();
    let (ga, sa, ba) = (v[0], v[1], v[2]);
    let v = read_vec::<i64>();
    let (gb, sb, bb) = (v[0], v[1], v[2]);
    let mut ans = 0;
    for gi in 0..n + 1 {
        if gi * ga > n {
            break;
        }
        for si in 0..n + 1 {
            if gi * ga + si * sa > n {
                break;
            }
            let mut residual = n - (gi * ga + si * sa);
            if bb > ba {
                residual = (residual / ba) * bb + (residual - (residual / ba) * ba);
            }
            ans = max(ans, gb * gi + sb * si + residual);
        }
    }

    n = ans;

    let order = argsort(&vec![ga / gb, sa / sb, ba / bb]);
    let rates = vec![(gb, ga), (sb, sa), (bb, ba)];

    if rates[order[2]].0 >= rates[order[2]].1 {
        println!("{:?}", n);
        return;
    }
    let (gb, ga) = rates[order[2]];
    let (sb, sa) = rates[order[1]];
    let (bb, ba) = rates[order[0]];

    let max_enable = (n / gb) as i64;

    let mut ans = n;
    if n <= 5000 {
        for gi in 0..max_enable + 1 {
            for si in 0..n {
                if gi * gb + si * sb > n {
                    break;
                }
                let mut residual = n - (gi * gb + si * sb);
                if ba > bb {
                    residual = (residual / bb) * ba + (residual - (residual / bb) * bb);
                }
                ans = max(ans, residual + gi * ga + si * sa);
            }
        }
    } else {
        for gi in 0..max_enable + 1 {
            let si = (n - gi * gb) / sb;
            let residual = n - (gi * gb + si * sb);
            ans = max(ans, residual + gi * ga + si * sa);
        }
    }
    println!("{:?}", ans);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

int main(void)
{
	int N;
	char str[1025];
	int n, len;
	int i, p;
	char *table[] = {"",    ".,!? ", "abc",  "def", "ghi",
	                 "jkl", "mno",   "pqrs", "tuv", "wxyz"};
					 
	scanf("%d", &N);
	for (i = 0; i < N; i++){
		scanf("%s", str);
		p = 0;
		n = 0;
		len = 0;
		while (str[p] != '\0'){
			if (n == 0){
				if (str[p] != '0'){
					n = str[p] - '0';
					len++;
				}
			}
			else {
				if (str[p] == '0'){
					printf("%c", table[n][(len - 1) % strlen(table[n])]);
					n = 0;
					len = 0;
				}
				else {
					len++;
				}
			}
			p++;
		}
		printf("\n");
	}
	return (0);
}

Measured memory_bytes: 580
#include <stdio.h>

int main(void)
{
	int i,x;
	i=1;
	scanf("%d",&x);
	while(x!=0){
		printf("Case %d: %d\n",i,x);
		i++;
		scanf("%d",&x);
	}
	
	
	
	
	return 0;
}


Measured memory_bytes: 2052
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<char>> a(n, vector<char>(n)), b(m, vector<char>(m));
    rep(i, n)rep(j, n)cin >> a[i][j];
    rep(i, m)rep(j, m)cin >> b[i][j];
    bool ans = false;
    rep(si, n-m+1){
        rep(sj, n-m+1){
            bool now = true;
            rep(i, m){
                rep(j, m)if(a[si+i][sj+j] != b[i][j])now = false;
            }
            if(now)ans = true;
        }
    }
    if(ans) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
m,n=map(int,input().split())
mod=1000000007
ans=1
if m==1:
    print(1)
elif n<10000:
    for i in range(n):
        ans=ans*m%mod
    print(ans)
else:
    subm=(m**10000)%mod
    for i in range(n//10000):
        ans=ans*subm%mod
    for i in range(n%10000):
        ans=ans*m%mod
    print(ans)


Measured memory_bytes: 5616
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10001

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

  scanf("%d",&n);

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

  for(i=0;i<VMAX;i++){
    C[i]=0;
  }
  for(i=0;i<n;i++){
    scanf("%d",&A[i+1]);
    C[A[i+1]]++;
  }
  for(i=1;i<VMAX;i++){
    C[i]=C[i]+C[i-1];
  }
  for(j=1;j<=n;j++){
    B[C[A[j]]]=A[j];
    C[A[j]]--;
  }

  for(i=1;i<=n;i++){
    if(i>1){
      printf(" ");
    }
    printf("%d",B[i]);
  }
  printf("\n");

  return 0;
}
    



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

int main(){
    int i, j, m, n, c, s, a, num = 0;
    cin >> n >> m >> c;
    int b[m];
    for(i=0; i<m; i++){
        cin >> b[i];
    }
    for(i=0; i<n; i++){
        s = 0;
        for(j=0; j<m; j++){
            cin >> a;
            s += a*b[j];
        }
        if(s+c > 0){
            num++;
        }
    }
    cout << num;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
main()
{
	char s[4];
	cin>>s;
	if(!strcmp(s,"SAT"))
	cout<<1<<endl;
	else if(!strcmp(s,"FRI"))
	cout<<2<<endl;
	else if(!strcmp(s,"THU"))
	cout<<3<<endl;
	else if(!strcmp(s,"WED"))
	cout<<4<<endl;
	else if(!strcmp(s,"TUE"))
	cout<<5<<endl;
	else if(!strcmp(s,"MON"))
	cout<<6<<endl;
	else cout<<7<<endl;
	
	
}

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

int sum_digit(int n){
  if( n == 0 ) return 0;
  else return n%10 + sum_digit(n/10);
}

int main()
{
  int i,N; cin >> N;
  vector<int> a(N);
  for(i = 0; i < N; i++){
  	cin >> a.at(i);
  }
  
  int temp , Alice = 0 , Bob = 0;
  int count = 0;
  while(count < N){
    int localmax = 0;
    for(int i = 0; i < N; i++){
  	  if( localmax < a.at(i) ){
      	localmax = a.at(i);
        temp = i;
      }
    }
    if(count % 2 == 0) Alice += localmax;
    else Bob += localmax;
    a.at(temp) = 0;
    count++;
  }
  
  int ans = Alice - Bob;
  cout << ans <<  endl;
}

Measured memory_bytes: 256
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_ON			1										// 汎用フラグ - ON
#define D_OFF			0										// 汎用フラグ - OFF
#define D_VTX_MAX		1000									// 最大頂点数
#define D_EDGE_MAX		2000									// 最大辺数

// 内部構造体 - 頂点情報
typedef struct Vtx {
	long long mlScore;											// スコア
	int miInf;													// 無限フラグ
} Vtx;

// 内部構造体 - 辺情報
typedef struct Edge {
	int miVFNo;													// 頂点 - 元 1～
	int miVTNo;													// 頂点 - 先 1～
	int miScore;												// スコア
} Edge;

// 内部変数
static Vtx sz1Vtx[D_VTX_MAX + 5];								// 頂点
static int siVCnt;												// 頂点数
static Edge sz1Edge[D_EDGE_MAX];								// 辺
static int siECnt;												// 辺数

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpT, *szpFpA;
#endif

// 頂点更新 - スコア・無限フラグ
int
fUpVtx(
	int piInf					// <I> 無限フラグの更新 [1]あり [0]なし
)
{
	int i, j;

	// 頂点のスコア - 更新(最大でも頂点数のループで更新が終了 - 頂点が１直線)
	for (i = 0; i < siVCnt; i++) {
		for (j = 0; j < siECnt; j++) {

			// 頂点(元)
			Vtx *lzpVtxF = &sz1Vtx[sz1Edge[j].miVFNo];

			// 接続有無
			if (lzpVtxF->mlScore == LLONG_MIN) {
				continue;
			}

			// スコア
			long long llSocre = lzpVtxF->mlScore + (long long)sz1Edge[j].miScore;

			// 頂点(先)
			Vtx *lzpVtxT = &sz1Vtx[sz1Edge[j].miVTNo];
			if (lzpVtxT->mlScore < llSocre) {
				lzpVtxT->mlScore = llSocre;

				if (piInf == D_ON) {
					lzpVtxT->miInf = D_ON;
				}
			}
		}
	}

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	char lc1Buf[1024], lc1Out[1024];

	// データ初期化
	memset(sz1Vtx, 0, sizeof(sz1Vtx));							// 頂点

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", piTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#endif

	// 頂点数・辺数取得
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%d%d", &siVCnt, &siECnt);

	// 辺取得
	for (i = 0; i < siECnt; i++) {
#ifdef D_TEST
		fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
		fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
		sscanf(lc1Buf, "%d%d%d", &sz1Edge[i].miVFNo, &sz1Edge[i].miVTNo, &sz1Edge[i].miScore);
	}

	// 頂点のスコア - 初期化
	sz1Vtx[1].mlScore = 0;
	for (i = 2; i <= siVCnt; i++) {
		sz1Vtx[i].mlScore = LLONG_MIN;
	}

	// 頂点のスコア - 更新
	fUpVtx(D_OFF);

	// まだ更新できるかチェック(ループの有無チェック)
	fUpVtx(D_ON);

	// 結果セット
	if (sz1Vtx[siVCnt].miInf == D_ON) {
		sprintf(lc1Out, "inf\n");
	}
	else {
		sprintf(lc1Out, "%lld\n", sz1Vtx[siVCnt].mlScore);
	}

	// 結果表示
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, lc1Out)) {
		siRes = -1;
	}
#else
	printf("%s", lc1Out);
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", piTNo);
	}
	else {
		printf("NG %d\n", piTNo);
	}
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 256
using System;

namespace ABC099B
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int[] inputs = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int a = inputs[0];
            int b = inputs[1];

            int temp = b - a;
            int sum = temp * (temp + 1) / 2;
            Console.WriteLine(sum -b );
        }
    }
}

Measured memory_bytes: 11092
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        string[] b = Console.ReadLine().Split(' ');

        int[] ans = new int[b.Length + 1];
        for (int i = 0; i < (n - 1); i++)
        {
            if (i == 0)
            {
                ans[i] = int.Parse(b[i]);
                ans[i + 1] = ans[i];
            }
            else
            {
                if (ans[i] < int.Parse(b[i]))
                {
                    ans[i + 1] = int.Parse(b[i]);
                }
                else
                {
                    if (ans[i] >= int.Parse(b[i]))
                    {
                        ans[i] = int.Parse(b[i]);
                        ans[i + 1] = int.Parse(b[i]);
                    }
                    else
                    {
                        ans[i + 1] = ans[i];
                    }
                }
            }
        }
        Console.WriteLine(ans.Sum());
    }
}


Measured memory_bytes: 13268
#include<stdio.h>
int main(void)
{
	int i,j,n,m,x,a[201];
	scanf("%d",&n);
	for(i=1;i<=n*2;i++){
		scanf("%d",&a[i]);
	}
	for(i=1;i<=n*2;i++){
		for(j=i+1;j<=n*2;j++){
			if(a[i]<a[j]){
				m=a[i];
				a[i]=a[j];
				a[j]=m;
			}
		}
	}
	for(i=1;i<=n;i++){
		x+=a[i*2];
	}
	printf("%d\n",x);
	return 0;
}

Measured memory_bytes: 128
list1=[]
list2=[]
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
list1.append(a)
list1.append(b)
list1.append(c)
list1.append(d)
list1.sort()
list1.reverse()
list2.append(e)
list2.append(f)
list2.sort()
list2.reverse()
print(list1[0]+list1[1]+list1[2]++list2[0])



Measured memory_bytes: 5596
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

using namespace std;

int main() {

	SINT32 N = 0;
	SINT32 X = 0;
	SINT32 ANS = 0;

	cin >> N;
	cin >> X;

	vector<SINT32> DATA(N+1);
	vector<SINT32> SA(N);

	DATA[0] = X;
	
	for (SINT32 i = 0; i < N; i++) {
		cin >> DATA[i+1];
	}
	sort(DATA.begin(),DATA.end());


	for (SINT32 i = 1; i < N+1; i++) {
		SA[i-1] = DATA[i] - DATA[i-1];
	}

	if (N == 1) {
		ANS = SA[0];
	} else {

		ANS = __gcd(SA[0],SA[1]);
		for (SINT32 i = 2; i < N; i++) {
			ANS = __gcd(ANS,SA[i]);
		}
	}


	cout << ANS << endl;
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();

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

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

    long n;
    cin >> n;

    long x[n];
    long x_copy[n];

    for (long i = 0; i < n; i++) {
        cin >> x[i];
        x_copy[i] = x[i];
    }
    sort(x_copy, x_copy + n);
    long small_mean = x_copy[n / 2 - 1];
    long large_mean = x_copy[n / 2 ];

    for (long i = 0; i < n; i ++) {
        if (x[i] <= small_mean) {
            cout << large_mean << "\n";
        } else {
            cout << small_mean << "\n";
        }
    }

    return 0;
}


Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T&a,T&b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T&a,T&b){if(a>b){a=b;return true;}return false;}
const ll INF = 1LL<<60;
const ll M = 1000000007;
/**/

int main(){
    ll n;cin>>n;
    ll big=pow(10,18);
    ll ans=1;
    ll hoge;
    for(ll i=0;i<n;i++){
        cin>>hoge;
        if(hoge==0){
            ans=0;
        }
        if(ans==0 || ans==-1)continue;
        if(hoge<=big/ans)ans=ans*hoge;
        else ans=-1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3572
use strict;
use utf8;
use warnings;

my $x = <STDIN>;
chomp($x);
my $t= int($x % 11);
my $ans = int($x / 11);
my $d = $x - $ans*11;
$ans *= 2;
if ($d <= 6) {
    $ans += 1;
}elsif ($d < 11){
    $ans += 2;
}
if ($t == 0){
    $ans -= 1;
}

print "$ans\n";

Measured memory_bytes: 768
def task(n, a):
    mxs = []
    current = 1

    for i in range(0, n + 1):
        mxs.append(current)
        current = (current - a[i]) * 2

        if current < 0:
            print(-1)
            return

    # print(mxs)

    v = 0
    nodes = 0
    for i in reversed(range(0, n + 1)):
        nodes = min(nodes + a[i], mxs[i])
        v += nodes

    print(v)


n = int(input())
a = list(map(int, input().split()))
task(n, a)


Measured memory_bytes: 702196
mod = 10**9 + 7
def combination(n,k,mod):
    bunsi = 1
    bunbo = 1
    for i in range(k):
        bunsi *= (n-i)
        bunsi %= mod
        bunbo *= i+1
        bunbo %= mod
    bunbo = pow(bunbo, mod-2, mod)
    return bunsi * bunbo % mod
n, a, b = map(int, input().split())
ans = (pow(2, n, mod) - 1 - combination(n, a, mod) - combination(n, b, mod)) % mod
if ans < 0:
    ans += mod
print(ans)

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

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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int MN = 1e5 + 5, LN = 17, INF = 0x3f3f3f3f, MOD = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    int n; cin >> n;
    cout << n * (n + 1) / 2 << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
  int unused __attribute__((unused));
  long long a,b,c,d,i,ans=-1000000000000000000;
  long long arr[4];
  unused = scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

  arr[0] = a*c;
  arr[1] = a*d;
  arr[2] = b*c;
  arr[3] = b*d;
  for(i=0; i<4; i++){
    if(ans < arr[i]) ans = arr[i];
  }
  printf("%lld", ans);
  return 0;
}

Measured memory_bytes: 1736
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;

class Main{
    public static void main(String[] args){
        
        Scanner sc = new Scanner(System.in);
        
        int H = sc.nextInt();
        int W = sc.nextInt();
        int[][] a = new int[H][W];
        ArrayList<Integer> list = new ArrayList<Integer>();
        ArrayList<Integer> listh = new ArrayList<Integer>();
        ArrayList<Integer> listw = new ArrayList<Integer>();
        if(H==1 && W==1){
            System.out.println(0);
            return;
        }

        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                a[i][j] = sc.nextInt();
            }
            if(i%2==0){
                for(int j=0; j<W; j++){
                    list.add(a[i][j]);
                    listh.add(i);
                    listw.add(j);
                }
            }
            else{
                for(int j=W-1; j>=0; j--){
                    list.add(a[i][j]);
                    listh.add(i);
                    listw.add(j);
                }
            }
        }
        int[] x = new int[H * W];
        int[] A = new int[H * W];
        int y = 0;
        if(list.get(0)%2==1){
            x[y] = 0;
            A[0] = list.get(0) - 1;
            A[1] = 1;
            y++;
        }
        for(int i=1; i<list.size(); i++){
            A[i] += list.get(i);
            if(i==list.size()-1){
                break;
            }
            if(A[i]%2==1){
                A[i] -= 1;
                A[i + 1] = 1;
                x[y] = i;
                y++;
            }
        }
        System.out.println(y);
        for(int i=0; i<y; i++){
            int b1 = listh.get(x[i]) + 1;
            int b2 = listw.get(x[i]) + 1;
            int b3 = listh.get(x[i] + 1) + 1;
            int b4 = listw.get(x[i] + 1) + 1;
            System.out.println(b1 + " " + b2 + " " + b3 + " " + b4);
        }
    }
}

Measured memory_bytes: 113972
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
#dt = {k:v for k,v in sorted(x.items(), key=lambda i: i[1])}
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]
mp = lambda :map(int,input().split())

p = 100
x = inp()
n = 0
while p < x:
    p += int(p*0.01)
    #print(p)
    n += 1
print(n)

Measured memory_bytes: 63768
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <map>
#include <list>
#include <queue>
#include <set>
#include <iostream>
#include <fstream>

using namespace std;

const int DIV = 1000000007;

void solve(int test, istream &in) {
    int n, m;
    in >> n >> m;
    vector<int> a(m), b(m);
    vector<vector<int>> g(n);
    for (int i = 0; i < m; i++) {
        in >> a[i] >> b[i];
        a[i]--;
        b[i]--;
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }
    
    int from = 0;
    vector<int> d(n, INT32_MAX), p(n, -1);
    d[from] = 0;
    priority_queue<pair<int, int>> q;
    q.emplace(0, from);
    while (!q.empty()) {
        int v = q.top().second;
        int curD = -q.top().first;
        q.pop();
        if (curD > d[v])
            continue;
        for (int i = 0; i < g[v].size(); i++) {
            int to = g[v][i];
            int len = 1;
            if (d[v] + len < d[to]) {
                d[to] = d[v] + len;
                p[to] = v;
                q.emplace(-d[to], to);
            }
        }
    }
    bool yes = true;
    for (int i = 1; i < n; i++) {
        if (d[i] == INT32_MAX)
            yes = false;
    }
    if (yes) {
        printf("Yes\n");
        for (int i = 1; i < n; i++) {
            printf("%d\n", p[i] + 1);
        }
    }
    else {
        printf("No\n");
    }
}

int main(int argc, char* argv[])
{
#ifdef VLAD_LOCAL
    ifstream f("in.txt");
#else
    istream &f = cin;
#endif
    int tests = 1;
    //f >> tests;
    for (int test = 0; test < tests; test++) {
        solve(test, f);
    }

    return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<int>a(n);
  int kotae=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    kotae+=a[i];
  }
  sort(a.begin(),a.end());
  int x=kotae;
  bool hantei=false;
  if(x%10==0){
    hantei=true;
    for(int i=0;i<n;i++){
      if(a[i]%10!=0)x-=a[i];
      if(x%10!=0)break;
    }
  }
  if(hantei){
    if(kotae==x){
      cout<<0<<endl;
    }else{
      cout<<x<<endl;
    }
  }else{
    cout<<kotae<<endl;
  }
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
#include <stack>
#include <iomanip>
#include <limits>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;

#define INF 1e+9
#define MAX_V 300

struct edge {
    int to;
    int cost;
};
using P = pair<ll, ll>;
ll gcd(ll x, ll y)
{
  if(x<y)
  {
    swap(x,y);
  }
  while(y>0)
  {
    ll r=x%y;
    x=y;
    y=r;
  }
  return x;
}
int main(){
  int x,y;cin>>x>>y;
  map<int,int> d;
  d[1]=1;
  d[3]=1;
  d[5]=1;
  d[7]=1;
  d[8]=1;
  d[10]=1;
  d[12]=1;
  d[4]=2;
  d[6]=2;
  d[9]=2;
  d[11]=2;
  d[2]=3;
  if(d[x]==d[y]){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}

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

int char_to_int(char c){
	return c - '0';
}

int main(){
    string S;
    cin >> S;
    int a = char_to_int(S[0]);
    int b = char_to_int(S[1]);
    int c = char_to_int(S[2]);
    int d = char_to_int(S[3]);
    
    char op1, op2, op3;
    
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 2; j++){
            for(int k = 0; k < 2; k++){
                int res = a;
                if(i == 0)res += b;
                else res -= b;
                if(j == 0)res += c;
                else res -=c;
                if(k == 0)res += d;
                else res -= d;
                if(res == 7){
                    if(i == 0)op1 = '+';
                    else op1 = '-';
                    if(j == 0)op2 = '+';
                    else op2 = '-';
                    if(k == 0)op3 = '+';
                    else op3 = '-';
                    cout << a << op1 << b << op2 << c << op3 << d << "=7" << endl;
                    return 0;
                }
            }
        }
    }
}

Measured memory_bytes: 256
include Math
a, b, c = gets.chomp.split(" ").map(&:to_f)
data = []
radian = (c / 180 * PI)
h = b * sin(radian)
s = a * h * 0.5
l = a + b + sqrt(a**2 + b**2 - 2 * a * b * cos(radian))
puts s.round(5), l.round(5), h.round(5)

Measured memory_bytes: 8928
#include <bits/stdc++.h>
using namespace std;
double l;
double a,b,c;
bool cmp(string c)
{
    string p;
    p=c;
    reverse(c.begin(),c.end());
    if(p==c) return true;
    else return false;
}
int main()
{
    cin>>l;
    a=l/3.0;
    b=a;
    c=a;
    double ans=a*b*c;
    printf("%.12lf",ans);
    return 0;
}

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

int main(){	
	int r, c;
	cin >> r >> c;
	vector<vector<int> > t(r + 1, vector<int>(c + 1, 0));
	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			cin >> t[i][j];
			t[r][j] += t[i][j];
			t[i][c] += t[i][j];
			t[r][c] += t[i][j];
		}
	}

	for (int i = 0; i <= r; i++) {
		for (int j = 0; j < c; j++) {
			cout << t[i][j] << " ";
		}
		cout << t[i][c] << endl;
	}
	return 0;
}



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

int main() {
    int N, K;
    bool treat[110];
    cin >> N >> K;
    for (int i = 0; i < N; ++i){
        treat[i] = true;
    }

    for (int i = 0; i < K; ++i){
        int d;
        cin >> d;
        for (int j = 0; j < d; ++j){
            int a;
            cin >> a;
            treat[a-1] = false;
        }
    }

    int res = 0;
    for (int i = 0; i < N; ++i){
        if (treat[i] == true) res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3636
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-04-12 20:34:19
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  int64 n; cin >> n;

  int64 n3 = n / 3, n5 = n / 5, n15 = n / 15;

  debug(n3, n5, n15);

  int64 ans = n * (n + 1LL) / 2;

  ans -= n3 * (n3 + 1LL) / 2 * 3;
  ans -= n5 * (n5 + 1LL) / 2 * 5;
  ans += n15 * (n15 + 1LL) / 2 * 15;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3612
n = int(input())
a = list(map(int, input().split()))

cnt = {}
for ai in a:
    if ai in cnt:
        cnt[ai] += 1
    else:
        cnt[ai] = 1

ls = []
for k, v in cnt.items():
    if 4 <= v:
        ls.append(k)
    if 2 <= v:
        ls.append(k)
if len(ls) <= 1:
    print(0)
else:
    ls = list(reversed(sorted(ls)))
    print(ls[0] * ls[1])

Measured memory_bytes: 67608
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <string>
using namespace std;

int main()
{
	int dirs[4][3] = {
		{1, 0, 1}, {0, 1, 1}, {-1, 0, 1}, {0, -1, 1}};

	int W, H, N;
	cin >> H >> W >> N;
	int sr, sc;
	cin >> sr >> sc;
	string S, T;
	cin >> S;
	cin >> T;
	int wl,wr,hd,hu;
	wl = wr = sc;
	hd= hu =sr;

	for (int i = 0; i <S.size(); i++)
	{
		
		if (S[i] == 'L'){
			wl--;
		}
		if (S[i] == 'R'){
			wr++;
		}
		if (S[i] == 'U')
			hu--;
		if (S[i] == 'D')
			hd++;
		if (wl <=0 || wr>W || hu<=0 || hd>H){
			cout<<"NO"<<endl;
			return 0;
		} 

		if (T[i] == 'L')
			wr = max(1,wr-1);
		if (T[i] == 'R')
			wl = min(W,wl+1);
		if (T[i] == 'U')
			hd = max(1,hd-1);
		if (T[i] == 'D')
			hu = min(H,hu+1);

	}
	cout << "YES" << endl;
	return 0;
}

Measured memory_bytes: 776
import math
def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:

            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
 
n=nCast(input())+1
h=nCast(input())
w=nCast(input())

print((n-h)*(n-w))


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
// #include <bits/stdc++.h>

using namespace std;

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

//vector//
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

typedef pair<int,int> P;  //q(p.first,p.second)

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

    ll int sum = 0;

    for(int i=1;i<=n;i++){
        if(i%15 != 0 && i%3 != 0 && i%5 != 0){
            sum += i;
        }
    }
    cout << sum;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define sz size
#define se second
#define fe first
#define mper make_pair
#define all(x) x.begin(), x.end()
#define mal ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
using namespace std;


int n, k, dis[2010][2010], mx;
vector < int > g[2010];

bool used[2010][2010];

vector < pair <int, int> > pos_ans;

void dfs(int orig, int v, int ct = 0) {

    used[orig][v] = 1;

    for(auto to : g[v]) {

        if(!used[orig][to]) {

            dis[orig][to] = ct + 1;

            mx = max(mx, ct + 1);

            if(ct + 1 == k) {pos_ans.pb(mper(orig, to));}


            dfs(orig, to, ct + 1);

        }

    }

}

int main(){

cin >> n >> k;

for(int i = 1, l, r; i < n; ++i) {

    cin >> l >> r;

    g[l].pb(r);
    g[r].pb(l);

}

for(int i = 1; i <= n; ++i) {
    dfs(i, i);
}


if(mx <= k) {cout << 0;return 0;}


int ans = (int)1e8;

for(auto to : pos_ans) {

    int a = to.fe;
    int b = to.se;
    int ct = 0;



    for(int i = 1; i <= n; ++i) {

        if(dis[a][i] > k) {ct++;}
        else if(dis[b][i] > k) {ct++;}

    }

    ans = min(ans, ct);

}

cout << ans;

return 0;
}


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

console.log(main());
function main(){
  var a = o.a();
  var b = o.a();
  var c = o.a();
  return Math.min(b/a|0,c);
}

Measured memory_bytes: 21956
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;

signed main(){
    string S;cin>>S;
    cout<<S.substr(0,5)<<" "<<S.substr(6,7)<<" "<<S.substr(14,5)<<endl;
}

Measured memory_bytes: 256
def ifif(s):
  if s:
    print("Yes")
  else:
    print("No")

###senkei

def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(map(str, input().split()))
def pl(a): print(" ".join(list(map(str, a))))
def ma():return map(int,input().split())
from itertools import accumulate as acc
import operator as op
import copy as cp
import math; import numpy
from bisect import bisect_left as bisl
from bisect import bisect_right as bisr
###
n=input()
s=0
if n[0]=='7':
    s=1
if n[1]=='7':
    s=1
if n[2]=='7':
    s=1
ifif(s)


Measured memory_bytes: 27116
package main

import (
	"bufio"
	"fmt"
	"os"
	"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()
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 100100)

	s := []byte(getString())
	K := getInt()

	for i := 0; i < len(s); i++ {
		if s[i] == 'a' {
			continue
		}
		v := s[i]
		d := int(1 + 'z' - v)
		//out(d)
		if K >= d {
			K -= d
			s[i] = 'a'
		}
	}
	//out(K)
	K %= 26
	l := len(s) - 1
	s[l] += byte(K)
	if s[l] > 'z' {
		s[l] = 'a'
	}
	out(string(s))

}


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

int main(){
    int n, x, cnt=1;
    int L[101], D[10001];
    cin >> n >> x;
    for(int i=1; i<=n; i++)
        cin >> L[i];

    D[1]=0;
    for(int i=2; i<=n+1; i++){
        D[i] = D[i-1] + L[i-1];
        if (D[i]<=x)
            cnt++;
    }

    cout<<cnt;
    return 0;
}

Measured memory_bytes: 256
const fi='abc065_a.inp';
        fo='abc065_b.out';
var x,a,b:longint;
function conan:string;
        begin
                if b<=a then exit('delicious');
                if b<=a+x then exit('safe');
                exit('dangerous');
        end;
begin

        readln(x,a,b);
        writeln(conan);

end.


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();

        if(a % 10 == 2 || a % 10 == 4 || a % 10 == 5 || a % 10 == 7 || a % 10 == 9) {
        	System.out.println("hon");
        } else if (a % 10 == 0 || a % 10 == 1 || a % 10 == 6 || a % 10 == 8){
        	System.out.println("pon");
        } else {
        	System.out.println("bon");
        }



        scan.close();
    }


}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int X;	cin>>X;
	while(1){
		bool ans=IsPrime(X);
		if(ans)	break;
		X++;
	}
	
	cout<<X<<endl;

    return 0;
}



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

int main() {
  int a, b;
  cin >> a >> b;
  
  int ans = max(a / 0.08, b / 0.1) + 0.9;
  if (ans < (int)min((a+1) / 0.08, (b+1) / 0.1))
    cout << ans << endl;
  else
    cout << -1 << endl;
  
  return 0;
}

Measured memory_bytes: 256
lines = []
colums = []

while True:
 H,W = map(int,input().split())
 if H == 0 and W == 0:
   break
 lines.append(H)
 colums.append(W)

for H,W in zip(lines,colums):
 for i in range(H):
   for j in range(W):
     print("#",end="")
   print("\n",end="")
 print("\n",end="")


Measured memory_bytes: 7024
#include<iostream>
#include<vector>
#include<utility>
#include<map>
#include<algorithm>
#include<numeric>
#include<string>
#include<deque>

using namespace std;
using ll = long long int;


ll ret = 0;
int n;
vector<vector<int>> tree;
vector<int> value;
deque<int>c;

deque<int> q, qpv;
void bfs(int node, int pv) {
	if (!c.empty() && value[node] == 0) {
		value[node] = c.front();
		c.pop_front();
		ret += min(pv, value[node]);
	}
	for (int i = 0; i < tree[node].size(); i++) {
		if (value[tree[node][i]] == 0) {
			q.push_back(tree[node][i]);
			qpv.push_back(value[node]);
		}
	}
	if (!q.empty()) {
		int tmp1 = q.front();
		int tmp2 = qpv.front();
		q.pop_front();
		qpv.pop_front();
		bfs(tmp1, tmp2);
	}
}

int main(void) {
	cin >> n;
	tree = vector<vector<int>>(n + 1);
	value = vector<int>(n + 1, 0);
	for (int i = 0; i < n - 1; i++) {
		int a, b;
		cin >> a >> b;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}
	for (int i = 0; i < n; i++) {
		int ci;
		cin >> ci;
		c.push_back(ci);
	}
	sort(c.begin(), c.end(), greater<int>());

	int root_node = 0;
	int root_size = tree[root_node].size();
	for (int i = 0; i < n; i++) {
		if (tree[i].size() > root_size) {
			root_node = i;
			root_size = tree[i].size();
		}
	}

	bfs(root_node, 0);
	cout << ret << endl;
	for (int i = 0; i < n; i++)
		cout << value[i+1] << ' ';
	cout << endl;
	return 0;

}


Measured memory_bytes: 1536
#include <algorithm>
#include <bitset>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define MOD (1000000007l)
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)

using namespace std;

void solve() {
  ll N;
  string S;
  cin >> N >> S;

  for (ll i = 0; i < S.size(); i++) {
    char tmp = S[i];
    tmp -= 'A';
    tmp += N;
    tmp %= 26;
    tmp += 'A';
    S[i] = tmp;
  }

  cout << S << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256