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

int power(int x, int y){
  int n = 1;
  for(int i = 0; i < y; i++)
    n *= x;
  return n;
}
int digit(int x, int y){
  return x%power(10,y+1)/power(10,y);
}

int main() {
  int n;
  cin >> n;
  vector<int64_t> luca(87);
  luca.at(0) = 2ll;
  luca.at(1) = 1ll;
  for(int i = 2; i < 87; i++){
    luca.at(i) = luca.at(i-1)+luca.at(i-2);
  }
  cout << luca.at(n) << endl;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int s = in.nextInt();
		int c = in.nextInt(); in.nextLine();
		
		int[] studentsX = new int[s];
		int[] studentsY = new int[s];
		int[] checkpointsX = new int[c];
		int[] checkpointsY = new int[c];
		
		for ( int i = 0; i < s; i++ ) {
			studentsX[i] = in.nextInt();
			studentsY[i] = in.nextInt();
			in.nextLine();
		}
		
		for ( int i = 0; i < c; i++ ) {
			checkpointsX[i] = in.nextInt();
			checkpointsY[i] = in.nextInt();
		}
		
		// System.out.println(Arrays.toString(studentsX));
		// System.out.println(Arrays.toString(studentsY));
		// System.out.println(Arrays.toString(checkpointsX));
		// System.out.println(Arrays.toString(checkpointsY));
		
		int minim = 1000000000;
		int dist = -1;
		int minimPoint = 51;
		for ( int i = 0; i < s; i++ ) {
			for ( int j = 0; j < c; j++ ) {
				dist = Math.abs(studentsX[i]-checkpointsX[j])+Math.abs(studentsY[i]-checkpointsY[j]);
				if ( dist == minim ) {
					minimPoint = Math.min(minimPoint, j+1);
				} else if ( dist < minim ) {
					minim = Math.min(minim, dist);
					minimPoint = j+1;
				}
				// System.out.println("dist: "+dist);
				// System.out.println("minimpt: "+minimPoint);
			}
			System.out.println(minimPoint);
			minim = 1000000000;
			dist = -1;
			minimPoint = 51;
		}
	}
}

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

int main()
{
  int A,B,C,D;
  int Left, Right;

  cin >>A>>B>>C>>D;

  Left = A+B;
  Right = C+D;

  if(Left < Right) cout << "Right" << endl;
  if(Left > Right) cout << "Left" << endl;
  if(Left == Right) cout << "Balanced" << endl;

  return 0;

}


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

int main() {
	long long r, d, x;
	
	cin >> r >> d >> x;

	for (int i = 1; i <= 10; i++) {
		x = r * x - d;
		cout << x << endl;
	}
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

// ll get_b(ll rest) {
//   if (k1 % 2 == 0) {
//     cout << -1 << endl;
//     return -1;
//   }

//   ll b;
//   switch (k1) {
//     case 1:
//       b = 7;
//       break;
//     case 3:
//       b = 9;
//       break;
//     case 7:
//       b = 1;
//       break;
//     case 9:
//       break;
//   }
//   return b;
// }

// fill < 10
ll calc(ll fill, ll n1) {
  ll b = -1;

  for (ll i = 0; i < 10; i++) {
    if (n1 * i % 10 == fill) {
      b = i;
      break;
    }
  }

  return b;
}

int main() {
  ll N;
  scanf("%lld", &N);

  ll n1 = N % 10;

  bool ok = false;
  bool error = false;

  ll ans = 0;
  ll current = N;
  for (ll i = 0;; i++) {
    // cout << "current:" << current << endl;
    ll c1 = current % 10;

    ll fill = 7 - c1;
    if (fill < 0) {
      fill += 10;
    }

    ll b = calc(fill, n1);

    if (b == -1) {
      error = true;
      break;
    }

    current += N * b;
    current /= 10;
    ans++;

    for (;;) {
      if (current == 0) {
        ok = true;
        break;
      }
      ll c1 = current % 10;
      if (c1 == 7) {
        current /= 10;
        ans++;
      } else {
        break;
      }
    }
    if (ok) {
      break;
    }
  }

  if (error) {
    cout << -1 << endl;
    return 0;
  }

  cout << ans << endl;
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/













int A, B, C;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> A >> B >> C;

    int ans = min(B / A, C);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, k, s = 0, a[32800] = {};
    ll d[102][32800] = {}, e[102][32800] = {};
    cin >> n >> k;
    for (int i = 1; i <= 32000; i++) if (i * i <= n) s = i;
    int b = 0, t = n - s;
    for (int i = 1; i <= s; i++) a[i] = n / i - n / (i + 1);
    for (int i = 1; i <= s; i++) {
        b += a[i];
        if (b > t) {
            a[i] -= b - t;
        }
    }
    for (int i = 1; i <= s; i++) d[1][i] = d[1][i - 1] + 1, e[1][i] = a[i];
    for (int i = s; i; i--) e[1][i] += e[1][i + 1];
    for (int i = 2; i <= k; i++) {
        for (int j = 1; j <= s; j++) {
            d[i][j] = (d[i - 1][s] + e[i - 1][j]) % mod;
            e[i][j] = d[i - 1][j] * a[j] % mod;
        }
        for (int j = 1; j <= s; j++) {
            d[i][j] += d[i][j - 1];
            if (d[i][j] >= mod) d[i][j] -= mod;
        }
        for (int j = s; j; j--) {
            e[i][j] += e[i][j + 1];
            if (e[i][j] >= mod) e[i][j] -= mod;
        }
    }
    cout << (d[k][s] + e[k][1]) % mod;
}


Measured memory_bytes: 52608
import sys

s = input()
l = list(s)
for i in range(2):
    c = s.count(l[0])
    s = s.replace(l[0], "")
    h = l[0]
    while h in l:
        l.remove(h)
    if c!=2: 
        print("No")
        sys.exit()
if s != "":
    print("No")
else:
    print("Yes")

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] inputLine = line.split(" ");

		int totalDice = Integer.parseInt(inputLine[0]);
		int selectDice = Integer.parseInt(inputLine[1]);


		//与えられたダイスの配列を期待値配列に変換する
		line = sc.nextLine();
		inputLine = line.split(" ");
		double[] inputDiceArray = new double[totalDice];
		for(int i =0; i < totalDice; i++) {
			inputDiceArray[i]= Integer.parseInt(inputLine[i]);
		}
		double[] kitaichiArray = new double[totalDice];
		for(int i=0; i<totalDice; i++) {
			kitaichiArray[i]= (inputDiceArray[i]+1)/2;
		}

		//期待値配列を用いて、累積和で、期待値が最大となる隣接するK個の組み合わせを求める
		double maxKitaichi = 0;
		for(int i = 0; i < selectDice; i++) {
			maxKitaichi+=kitaichiArray[i];
		}
		double comp=maxKitaichi;
		for(int i=1; i<=totalDice-selectDice;i++) {
			comp=comp-kitaichiArray[i-1]+kitaichiArray[i+selectDice-1];
			maxKitaichi=Math.max(comp, maxKitaichi);
		}

		//最大組み合わせを標準出力
		System.out.println(maxKitaichi);
	}

}

Measured memory_bytes: 48720
from sys import stdin

def main():
    input = stdin.readline
    h, w = map(int, input().split())
    n = int(input())
    a = list(map(int, input().split()))
    m = [[0] * w for _ in range(h)]
    x, y, LR, v = 0, 0, 1, 0
    for n in a:
        v += 1
        for _ in range(n):
            m[y][x] = str(v)
            x += LR
            if x == w:
                y += 1
                x = w - 1
                LR = -1
            elif x < 0:
                y += 1
                x = 0
                LR = 1
    for i in range(h):
        print(" ".join(m[i]))
main()

Measured memory_bytes: 3828
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cmath>
#include <numeric>
#include <utility>
#include <iomanip>

using namespace std;
using int64 = long long;

struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i=0; i<n; i++) cin >> a[i];
    sort(a.rbegin(), a.rend());

    int64 ans = 0;
    int index = 0;
    for (int i=1; i<n; i++) {
        ans += a[index];
        if (i%2) index++;
    }

    cout << ans << endl;
}


Measured memory_bytes: 3700
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
using namespace std;
///////////////////library zone!!!!!!!!!!!!!!!!!!!!!!!!!!!!
typedef long long ll;
typedef long double ld;
#define all(a) (a).begin(),(a).end()
#define EPS (1e-5)
#define bit(n,k) ((n>>k)&1)
const ll Mod = 1000000007;
const ll mod = 998244353;
struct H {
	ll x, y;
	bool operator<(const H &b) const {
		if (x != b.x) return x < b.x;
		return y < b.y;
	}
	bool operator>(const H &b) const {
		if (x != b.x) return x > b.x;
		return y > b.y;
	}
	bool operator==(const H &b) const { return x == b.x&&y == b.y; }
	bool operator!=(const H &b) const { return (*this) != b; }
};
struct P {
	ll pos, cost;
	bool operator<(const P &b) const { return cost < b.cost; }
	bool operator>(const P &b) const { return cost > b.cost; }
};
struct B {
	ll to, cost;
};
struct E {
	ll from, to, cost;
	bool operator<(const E &b) const { return cost < b.cost; }
	bool operator>(const E &b) const { return cost > b.cost; }
};
template<typename T, typename U>
void chmin(T &a, U b) {
	if (a > b) a = b;
}
template<typename T, typename U>
void chmax(T &a, U b) {
	if (a < b) a = b;
}
template<typename T>
T max_0(T a) {
	if (a < 0) return 0;
	return a;
}
template<typename T>
T min_0(T a) {
	if (a > 0) return 0;
	return a;
}
ll read() {
	ll u;
	ll k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j%i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}//x^n%p
const ll Inf = 3023372036854775807;
const int inf = 1500000000;
#define int long long
//----------------------------------------------------
string s;
int k;
vector<string>a;
signed main() {
	cin >> s >> k;
	for (int i = 0; i < s.size(); i++) {
		string h = "";
		for (int j = 0; i + j < s.size() && j < 8; j++) {
			h += s[i + j];
			a.push_back(h);
		}
	}
	sort(all(a));
	a.erase(unique(all(a)), a.end());
	cout << a[k - 1] << endl;
}

Measured memory_bytes: 2424
#include <stdio.h>

int main(){
	int a, b;
	
	while(scanf("%d %d", &a, &b) != EOF){
		int c, i;
	
		c = a + b;
	
		for(i = 0; c != 0; i++) c = c / 10;
	
		printf("%d\n", i);
	}
	
	return 0;
}

Measured memory_bytes: 600
import heapq
n,m = map(int, input().split())
job_list = []
for i in range(n):
    a,b = map(int, input().split())
    job_list.append((a,b))
job_list.sort(key=lambda x:x[0])
# print(job_list)

hq = []
max_income = 0
j = 0
for i in range(1,m+1):
    while j < n and job_list[j][0] <= i:
        heapq.heappush(hq, (-job_list[j][1],job_list[j][0]))
        j += 1
    if len(hq) < 1:
        continue
    b_i, a_i = heapq.heappop(hq)
    max_income += -b_i

print(max_income)

Measured memory_bytes: 26708
import java.util.*;

public class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int x = sc.nextInt();
	int t = sc.nextInt();
	if (n%x == 0) System.out.print((n/x) * t);
	else { System.out.print((n/x + 1) * t); }
    }
}


Measured memory_bytes: 35680
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> A(n);
  for(int i=0;i<n;i++){
    cin >> A.at(i) ;
  }
  sort(A.begin(),A.end(),greater<int>());
  int a=0,b=0;
  for(int i=0;i<n;i++){
    if(i%2==0){
      a += A.at(i);
    }else{
      b += A.at(i);
    }
  }
  cout << a-b <<endl;
}
    
    

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main{

	
	public static void main(String[] args){
	
		Scanner stdIn = new Scanner(System.in);
		int N = stdIn.nextInt();
		long ans = 0;

		if(N > 1){
			for(int i = 1;i < N;i++){
				ans += i;
			}
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
#include <iostream>
using namespace std;
typedef long long ll;

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

int main () {
	int K;
	cin >> K;
	ll ans = 0;
	for (int a=1; a<=K; a++) {
		for (int b=1; b<=a; b++) {
			ll tmp1 = gcd (a,b);
			for (int c=1; c<=b; c++) {
				ll tmp = gcd (tmp1, c);
				if (a==b && b==c)
					ans += tmp;
				else if (a==b || b==c)
					ans += tmp * 3;
				else
					ans += tmp * 6;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

int dp[2][110]={};
int ary[110];
int main(){
	int N,A,B,C;
	cin>>N>>A>>B>>C;
	for(int i=1;i<=N;i++){
		cin>>ary[i];
	}
	int in=0,ou=1;
	for(int i=1;i<=N;i++){
		for(int j=1;j<=N;j++){
			dp[ou][j]=max(dp[in][j],dp[in][j-1]+ary[i]);
		}
		swap(in,ou);
	}
	int res=0;
	for(int i=1;i<=N;i++){
		res=max(res,(dp[in][i]+C)/(A+i*B));
	}
	cout<<res<<endl;
}

Measured memory_bytes: 3104
#include <iostream>
#include <set>
#include <vector>
#include <string>
#include <map>

using namespace std;
int main() {
	int N;
	cin >> N;
	std::map<std::string, int> word;
	std::string S;
	for(int i = 0;i<N;i++){
		cin >> S;
		word[S]++;
	}
	
cout << word.size() << endl;
	return 0;
}


Measured memory_bytes: 19108
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
ll gcd(ll x,ll y){
   if(x==0||y==0)return max(x,y);
   return gcd(y,x%y);
}
int num(ll x){
   if(x%2!=0){return 0;}
   return num(x/2)+1;
}
int main()
{
   int N;
   ll M;
   cin >> N >> M;
   vector<ll>a(N);
   int div2=0;
   rep(i,N){
      cin >> a[i];
      a[i]/=2;
      if(i==0)div2=num(a[i]);
      else{
         if(div2!=num(a[i])){
            cout << 0 << endl;
            return 0;
         }
      }
   }
   ll lcm=1;
   rep(i,N){
      ll g=gcd(lcm,a[i]);
      lcm=lcm/g*a[i];
      if(lcm>M){
         cout << 0 << endl;
         return 0;
      }
   }
   //cout << lcm << endl;
   cout << (M/lcm)-(M/(2*lcm)) << endl;


   return 0;
}

Measured memory_bytes: 1024
#ifndef _WIN32
#include<iostream>
#endif // !_WIN32

#include<string>
#include<iomanip>
#include<vector>
#include<string>
#include<stack>
#include<tuple>
#include<algorithm>
using namespace std;

#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()


const int dr[] = {0,1,0,-1};
const int dc1[] = {1,0,-1,0 };
const int dc2[] = { -1,0,1,0 };
typedef long long LL;
typedef vector<int> V;
typedef vector<V> VV;
typedef tuple<int, int, int, int> T;
VV g;
int a[1123];
int b[1123];
LL d[1123];
LL dp[1123][1123][2];
void dfs(int v, int p,int rev) {
	if (dp[v][p][rev] != -1)return;
	LL &ret = dp[v][p][rev];
	ret = 0;
	if (rev == 1) {
		for (auto &e : g[v]) {
			int u = v^a[e] ^ b[e];
			if (u == p)continue;
			if (g[u].size() == 1)ret += d[e];
			else {
				ret += 3 * d[e];
				dfs(u, v, 1);
				ret += dp[u][v][1];
			}
		}
	}
	else {
		LL sum = 0;
		vector<LL> x,y;
		for (auto &e : g[v]) {
			int u = v^a[e] ^ b[e];
			if (u == p)continue;
			if (g[u].size() == 1) {
				x.push_back(d[e]);
				y.push_back(d[e]);
				sum += d[e];
			}
			else {
				dfs(u, v, 0);
				dfs(u, v, 1);
				x.push_back(3 * d[e] + dp[u][v][1]);
				sum += 3 * d[e] + dp[u][v][1];
				y.push_back(2 * d[e] + dp[u][v][0]);
			}
		}
		ret = sum;
		int n = x.size();
		REP(i, n)ret = min(ret, sum - x[i] + y[i]);
	}
	return;
}
int main() {
	int n;
	while (cin >> n, n) {
		LL res = 1e18;
		g.assign(n+1,V());
		REP(i, n + 10)REP(j ,n+ 10)REP(k,2)dp[i][j][k] = -1;
		FOR(i, 0, n -1) {
			int q = i + 2;
			int p; cin >> p;
			a[i] = q;
			b[i] = p;
			g[p].push_back(i);
			g[q].push_back(i);
		}
		FOR(i, 0, n - 1) {
			cin >> d[i];
		}
		FOR(i, 1, n + 1) {
			dfs(i, 0, 0);
			res = min(res,dp[i][0][0]);
		}
		cout << res<< endl;
	}


	return 0;
}

Measured memory_bytes: 16884
#include <iostream>
#include <queue>

#define INF 10000
#define N_MAX 50
#define M_MAX 50

using namespace std;

typedef pair<int,int> P;
typedef pair<P,P> PP;

short int d[N_MAX][M_MAX][N_MAX][M_MAX];

int X,Y;
int tx,ty,kx,ky;
int ans;

int map[N_MAX][M_MAX];

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

bool bfs();

int main () {
	
	while (1) {
		cin>>X>>Y;
		if (X==0&&Y==0) {
			break;
		}
		cin>>tx>>ty>>kx>>ky;
		tx--;ty--;kx--;ky--;
		for (int i=0; i<Y; i++) {
			for (int j=0; j<X; j++) {
				cin>>map[i][j];
				for (int k=0; k<Y; k++) {
					for (int l=0; l<X; l++) {
						d[i][j][k][l]=INF;
					}
				}
			}
		}
		
		if (bfs()) {
			cout << ans << endl;
		}
		else{
			cout << "NA" << endl;
		}
	}
}

bool bfs(){
	queue<PP> que;
	que.push(PP(P(ty,tx),P(ky,kx)));
	d[ty][tx][ky][kx]=0;

	while(que.size()){
		PP p;
		p = que.front();
		que.pop();
		if (d[p.first.first][p.first.second][p.second.first][p.second.second]>=100) {
			return false;
		}
		if(p.first.first==p.second.first&&p.first.second==p.second.second){
			ans = d[p.first.first][p.first.second][p.second.first][p.second.second];
			return true;
		}
		for (int i=0; i<4; i++) {
			int ntx=p.first.second+dx[i],nty=p.first.first+dy[i];
			int nkx=p.second.second-dx[i],nky=p.second.first-dy[i];
			
			int flag=2;
			if (!(0<=ntx&&ntx<X&&0<=nty&&nty<Y&&map[nty][ntx]!=1)) {
				ntx-=dx[i];nty-=dy[i];
				flag--;
			}
			if (!(0<=nkx&&nkx<X&&0<=nky&&nky<Y&&map[nky][nkx]!=1)) {
				nkx+=dx[i];nky+=dy[i];
				flag--;
			}
			
			if (flag!=0&&d[nty][ntx][nky][nkx]==INF) {
				que.push(PP(P(nty,ntx),P(nky,nkx)));
				d[nty][ntx][nky][nkx] = d[p.first.first][p.first.second][p.second.first][p.second.second]+1;
			}
			
		}
	}
	
	return false;
}

Measured memory_bytes: 13000
#include <iostream>
#include <algorithm>
using namespace std;
long long int n,i,j,k;
long long int f[100001],a[100001];
int main()
{
    cin >>n>>k;
    for (i=1;i<=n;i++) cin >>a[i];
    f[1]=0;
    for (i=2;i<=k;i++){
        for (j=1;j<i;j++)
            f[i]=f[i-j]+abs(a[i]-a[i-j]);
    }
    for (i=k+1;i<=n;i++)
    {
        for (j=1;j<=k;j++){
            if (j==1) f[i]=f[i-1]+abs(a[i]-a[i-1]);
            else f[i]=min(f[i],f[i-j]+abs(a[i]-a[i-j]));
    }
    }
    //cout <<f[2];
    cout <<f[n];
    return 0;
}


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

using namespace std;

#define INF 210000000
#define int long long

int gcd(int a, int b) {
  int amari = a % b;
  int c = b;
  if (amari == 0) {
    return b;
  } else {
    return gcd(b, amari);
  }
}

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

signed main() {
  int a;
  cin >> a;
  cout << 3 * a * a;
}



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

int main()
{
    char a,b; cin>>a>>b;
    if(a=='H'&&b=='H' || a=='D'&&b=='D') cout<<'H'<<endl;
    else cout<<'D'<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int x[10], y[10];

double dist(int i, int j){
  int dx = x[i] - x[j];
  int dy = y[i] - y[j];
  return pow(dx*dx + dy*dy, 0.5);
}

int main(){
  int N;cin >> N;
  vector<int> v(N);
  for(int i = 0; i < N; i++){
    cin >> x[i] >> y[i];
    v[i] = i;
  }
  double sum = 0;
  int ave = 1;
  for(int i = 1; i <= N; i++){
    ave *= i;
  }
  do{
    for(int i = 0; i < N - 1; i++){
      sum += dist(v[i], v[i + 1])/ave;
    }
  }
  while(next_permutation(v.begin(), v.end()));
  cout << fixed << setprecision(10) << sum << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>

#define MOD (1e9 + 7);
#define PI (3.14159265358979323846)

using ll = int64_t;
using ull = uint64_t;

using namespace std;

[[maybe_unused]] static auto __x = [](){ios_base::sync_with_stdio(0); cin.tie(0);};

int main() {
    char c;
    cin >> c;

    cout << (char)(c + 1);

    return 0;
}


Measured memory_bytes: 256
N = int(input())
 
Tmp = []
Tmp = input().rstrip().split(' ')
 
nAns = [ 0 for i in range(4)]
Flag = 0
for i in range(N):
  S = Tmp[i]
  if S=='Y':
    Flag = 1

if Flag==1:
  print('Four')
else:
  print('Three')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
const int DIM = 1e2 + 5;
 
int arr[DIM];
 
int main( void ) {
    
    int n;
    cin >> n;
    
    for( int i = 1; i <= n; i ++ )
        cin >> arr[i];
    
    int ans = INT_MAX;
    for( int k = -DIM; k <= +DIM; k ++ ) {
        int cst = 0;
        
        for( int i = 1; i <= n; i ++ )
            cst += (arr[i] - k) * (arr[i] - k);
        
        ans = min( ans, cst );
    }
    
    cout << ans << endl;
    return 0;
}

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

int main(){
    int N, A[250], cnt=0;
    cin >> N;

    for (int i = 0; i < N; i++) cin >> A[i];

    int flag=0;
    while (flag==0) {
        for (int i = 0; i < N; i++) {
            if (A[i]%2 != 0) {
                flag = 1;
                break;
            }
            A[i] = A[i]/2;

            if (i == N-1) cnt++;


        }
    }

    cout << cnt << endl;

    return 0;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 500005
#define M 500005
using namespace std;
inline int read(){
    int ans=0;
    char ch=getchar();
    while(!isdigit(ch))ch=getchar();
    while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
    return ans;
}
int n,m,first[N],cnt=0,d[N];
bool vis[N];
struct edge{int v,next,c;}e[M<<1];
inline void add(int u,int v,int c){e[++cnt].v=v,e[cnt].next=first[u],e[cnt].c=c,first[u]=cnt;}
struct heap{int u,v;};
inline bool operator<(heap a,heap b){return a.v==b.v?a.u<b.u:a.v<b.v;}
priority_queue<heap>q;
set<int>col[N];
inline void dijkstra(){
    for(int i=2;i<=n;++i)d[i]=0x3f3f3f3f,vis[i]=false;
    q.push((heap){1,d[1]});
    while(!q.empty()){
        heap x=q.top();
        q.pop();
        if(vis[x.u])continue;
        vis[x.u]=1;
        for(int i=first[x.u];i;i=e[i].next){
            int v=e[i].v,w=col[x.u].count(e[i].c)?0:1;
            if(d[v]>d[x.u]+w)d[v]=d[x.u]+w,q.push((heap){v,-d[v]}),col[v].clear(),col[v].insert(e[i].c);
            else if(d[v]==d[x.u]+w)col[v].insert(e[i].c);
        }
    }
}
int main(){
    n=read(),m=read();
    for(int i=1;i<=m;++i){
        int u=read(),v=read(),c=read();
        add(u,v,c),add(v,u,c);
    }
    dijkstra();
    printf("%d",d[n]==0x3f3f3f3f?-1:d[n]);
    return 0;
}

Measured memory_bytes: 42744
#include<stdio.h>
int main()
{
	int a,b;
	
	scanf("%d%d",&a,&b);
	
	if(a%3==0){
		puts("Possible");
	}else if(b%3==0){
		puts("Possible");
	}else if((a+b)%3==0){
		puts("Possible");
	}else{
		puts("Impossible");
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
int main(void)
{
    int a, b;
    scanf("%d",&a);
    scanf("%d",&b);
    if(a < b){
        printf("a < b\n");
    }
    else if(a > b){
        printf("a > b\n");
    }
    else {
        printf("a == b\n");
    }
    return 0;
}



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

int main(){
    int N; cin >> N;
    double ans = 0;
    double A;
    for(int i=0;i<N;i++){
        cin >> A;
        ans += 1/A;
    }
    ans = 1/ans;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
const int INF = 0x7fffffff;
using lll = long long;
using ull = unsigned long long;
using namespace std;
const int MOD = 1000000007;

long long modpow(long long a,long long n,long long mod){
  long long res = 1;
  while(n > 0){
    if(n & 1){
      res = res * a % mod;
      a = a * a % mod;
      n >>= 1;
    }
  }
  return res;
}

int main(){
  lll ii,jj,kk;
  vector<int> ret;
  lll k;

  cin >> k;

  
  if(k % 2 == 0 || k % 5 == 0){
    cout << "-1" << endl;
    return 0;
  }
  
  int mod = 0;
  int cnt = 1;
  
  while(true){
    mod = (mod * 10 + 7) % k;
    if(mod == 0){
      break;
    }
    else{
      cnt++;
    }
  }

  cout << cnt << endl;
  
  return 0;
}


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

int main(){
  int a,tmp=0;
  rep(i,3){
  	cin>>a;
  	tmp+=a;
  }
  if(tmp>21) puts("bust");
  else puts("win");
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static final String str = "AC";

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int Q = scanner.nextInt();
		String S = scanner.next();
		int[] l = new int[Q];
		int[] r = new int[Q];
		for (int i = 0; i < Q; i++) {
			l[i] = scanner.nextInt();
			r[i] = scanner.nextInt();
		}
//		for (int i = 0; i < Q; i++) {
//			String s2 = new String(S.substring(l[i] - 1, r[i]));
//			int ans = judgeAndChange(s2);
//			System.out.println(ans);

//		}
		scanner.close();
		int[] ans = new int[N + 1];
		for (int i = 1; i < N; i++) {
//			System.out.println(ans[i]);
			if (S.charAt(i) == 'C' && S.charAt(i - 1) == 'A') {
				ans[i + 1] = ans[i] + 1;
			} else {
				ans[i + 1] = ans[i];
			}
		}
//		for (int i : ans) {
//			System.out.print(i);
//		}
//		System.out.println();
		for (int i = 0; i < Q; i++) {
//			System.out.println("ans[" + r[i] + "]-ans[" + l[i] + "]");
			System.out.println(ans[r[i]] - ans[l[i]]);
		}
	}

//	public static int judgeAndChange(String s) {
//		int ans = 0;
//		while (s.contains(str)) {
//			s = s.replaceFirst(str, "XX");
//			ans++;
//		}
//		return ans;
//	}
}


Measured memory_bytes: 83832
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 25;
const int MOD = 1e9+7;
 
int main() {
	int d,t,s;
	cin >>d>>t>>s;
	if (d <= t*s) cout << "Yes" << endl;
	else cout << "No" << endl;
 	return 0;
}

Measured memory_bytes: 3632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

class Main {
    public static void main(String[] args) throws IOException {
        int i, j;

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tok = new StringTokenizer(br.readLine());
        final int h = Integer.parseInt(tok.nextToken());
        final int w = Integer.parseInt(tok.nextToken());

        char[][] mat = new char[h][w];
        boolean[] row = new boolean[h];
        boolean[] col = new boolean[w];

        String str;
        char c;
        for (i = 0; i < h; i++) {
            str = br.readLine();
            for (j = 0; j < w; j++) {
                c = str.charAt(j);
                mat[i][j] = c;
                if (c == '#') {
                    row[i] = true;
                    col[j] = true;
                }
            }
        }

        for (i = 0; i < h; i++) {
            if (!row[i]) continue;
            for (j = 0; j < w; j++)
                if (col[j])
                    System.out.print(mat[i][j]);
            System.out.print("\n");
        }
    }
}


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

#define LL long long
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    LL N;
    cin >> N;
    vector<LL> v(N);
    REP(i, N) {
        cin >> v[i];
    }
    sort(ALL(v), greater<LL>());
    vector<LL> s(2, 0);
    for(int i = 0, j = 0;j < 2 && i < N - 1;i++) {
        if(v[i] == v[i + 1]) {
            s[j] = v[i];
            i++;
            j++;
        }
    }
    LL res = s[0]*s[1];
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 1024
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
const ll MAX = 300000;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n,ll k){
    if (n == 1) return 1;
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
    COMinit();
    ll n,k;cin >> n >> k;
    if(k>=n)k=n-1;
    ll ans=0;
    //cout << n << " " << k << endl;
    REP(i,k+1){
        ans+=(COM(n,i)*COM(n-1,n-i-1));
        ans%=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 7296
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=1;i<=(n);++i)
#define ALL(v) v.begin(), v.end()
#define DUMP(x) cout<<#x<<"="<<(x)<<endl;
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long lint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;

class CCitySavers {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N;
	    lint ans = 0;
	    in>>N;
	    vector<int> A(N+1), B(N);
	    REP(i, N+1)in>>A[i];
	    REP(i, N)in>>B[i];
	    REP(i, N){
	        lint cur = min(A[i], B[i]);
	        ans += cur;
	        B[i] -= cur;
	        lint cur2 = min(A[i+1], B[i]);
	        ans += cur2;
	        A[i+1] -= cur2;
	    }
	    out<<ans<<endl;
	}
};


int main() {
	CCitySavers solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main()
{
    string s ;
    cin>>s;
    string s1 = "ABC";
    string s2 = "ARC";
    if(s==s1)
    {
        cout<<s2;
    }
    else
{
    cout<<s1;
}
}


Measured memory_bytes: 3624
class RMaxQ:
    
    __slots__ = ["n", "data"]
    
    def __init__(self, li):
        self.n = len(li)
        self.data = li*2
        for i in range(self.n - 1, 0, -1):
            self.data[i] = max(self.data[2*i], self.data[2*i+1])
    
    def update(self, i, a):
        i += self.n
        self.data[i] = a
        while i > 1:
            i //= 2
            self.data[i] = max(self.data[2*i], self.data[2*i+1])
    
    def add(self, i, a):
        i += self.n
        self.data[i] += a
        while i > 1:
            i //= 2
            self.data[i] = max(self.data[2*i], self.data[2*i+1])
    
    def fold(self, l, r):
        l += self.n
        r += self.n
        res = 0
        while l < r:
            if l % 2:
                res = max(self.data[l], res)
                l += 1
            if r % 2:
                r -= 1
                res = max(res, self.data[r])
            l //= 2
            r //= 2
        return res

n, q = map(int, input().split())
A = list(map(int, input().split()))
seg = RMaxQ(A)
for _ in range(q):
    t, x, v = map(int, input().split())
    x -= 1
    if t == 1:
        seg.update(x, v)
    elif t == 2:
        print(seg.fold(x, v))
    else:
        ng = x
        ok = n+1
        while ok - ng > 1:
            mid = (ok+ng)//2
            if seg.fold(x, mid) >= v:
                ok = mid
            else:
                ng = mid
        print(ok)

Measured memory_bytes: 96036
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
	typedef long long int lli;
	const int MaxN=200005;
	#define fst first
	#define snd second
	int mcd(int a,int b){	
		if(a==0)return b;
		return mcd(b%a,a);
	}	;
int main(){
	lli N,K,i,j,p;
	cin>>N>>K;
	if(N<=K){
		cout<<min(N,K-N);
	}
	else {
		p=N/K;
		N=N-(p*K);
		cout<<min(N,K-N);
	}
	
}

Measured memory_bytes: 888
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>

int main() {
	int n; std::cin >> n;
	std::vector<int> heights(n); for (auto& h : heights) std::cin >> h;
	std::vector<long long int> memo(n, LLONG_MAX);
	memo[0] = 0;
	for (auto i = 0; i + 1 < n; ++i) {
		memo[i + 1] = std::min(memo[i + 1], memo[i] + std::abs(heights[i] - heights[i + 1]));
		if (i + 2 < n) memo[i + 2] = std::min(memo[i + 2], memo[i] + std::abs(heights[i] - heights[i + 2]));
	}
	std::cout << memo.back() << std::endl;
}

Measured memory_bytes: 1408
#include<iostream>
using std:: cout ;
using std:: cin ;
using std:: endl ;
int main()
{
	int i , j ;
	int x ;
	int N ;
	int max = 0 ;
	int sum = 0;

	cin >> N ;
	
	while ( cin >> x ){
		if ( max < x ) 
			max = x ;
		sum += x ;
	}
	
	sum = sum - max ;
	
	if( max < sum )
		cout << "Yes" ;
	else
		cout << "No" ;
	
	return 0 ;
	
 } 

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int N,M,x,y,X,Y;
        N=sc.nextInt();
        M=sc.nextInt();
        X=sc.nextInt();
        Y=sc.nextInt();
        int maxX=sc.nextInt();
        for(int i=0;i<N-1;i++){
            x=sc.nextInt();
            if(maxX<x)maxX=x;
        }
        int minY=sc.nextInt();
        for(int i=0;i<M-1;i++){
            y=sc.nextInt();
            if(minY>y)minY=y;
        }
        if(maxX<minY&&maxX<Y&&minY>X){
            System.out.println("No War");
        }else{
            System.out.println("War");
        }
    }
}


Measured memory_bytes: 22612
h,w=map(int,input().split())
field=[[int(i) for i in input().split()] for i in range(10)]
wall=[[int(i) for i in input().split()] for i in range(h)]


def warshall_floyd(d,n):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d
    
d=warshall_floyd(field,10)

ans=0
for i in wall:
    for j in i:
        if j!=-1 and j!=1:
            ans+=d[j][1]
print(ans)

Measured memory_bytes: 3316
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
  while(1) {
    int n;
    std::cin >> n;
    if(n == 0)
      break;
    std::vector<int> v(n);
    for(int i = 0; i < n; i++) {
      std::cin >> v[i];
    }
    std::sort(v.begin(), v.end());
    int s = 0;
    for(int i = 1; i < n - 1; i++) {
      s += v[i];
    }
    std::cout << (s / (n - 2)) << "\n";
  }
  return 0;
}

Measured memory_bytes: 3060
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
#define int long long int

void solve() {
  // int x;
  // cout << endl;
}

signed main() {
  int x;
  cin >> x;

  cout << x / 3 << endl;
  return 0;
}


Measured memory_bytes: 256
import numpy as np
H,W=map(int,input().split(" "))

def white(a):
    ans=0
    for i in range(len(a)):
        if a[i]=="#":
            ans=1
    return ans

A=[]
for i in range(H):
    gyo=list(input())
    if white(gyo)==1:
        A.append(gyo)

Anum=np.array(A)
ash=Anum.shape[1]
for i in range(ash):
    j=ash-i-1
    if white(Anum[:,j])==0:
        Anum=np.delete(Anum,j,1)

for i in range(Anum.shape[0]):
    moji=""
    for j in range(Anum.shape[1]):
        moji+=Anum[i,j]        
    print(moji)


Measured memory_bytes: 21504
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define int ll
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	string s; cin>>s;
	int a=(s[0]-'0')*10+s[1]-'0';
	int b=(s[2]-'0')*10+s[3]-'0';
	if(a>0 && a<13 && b>0 && b<13) cout<<"AMBIGUOUS\n";
	else if(a>0 && a<13) cout<<"MMYY\n";
	else if(b>0 && b<13) cout<<"YYMM\n";
	else cout<<"NA\n";
	return 0;
}















Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = readInts >>= print . ( `div` 2 ) . uncurry (+) . ( ( * 3 ) *** id ) . mp

Measured memory_bytes: 380
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int humanNum = sc.nextInt();
		int count = 0;

		for(int num = 1; num <= humanNum; num++) {
			count += num;
		}

		System.out.println(count);
	}
}

Measured memory_bytes: 35656
import std.stdio, std.algorithm, std.range;

int N, W;
int[] ws, vs;

void main(){
	init;
	writefln("%.5f", solve);
}

void init(){
	scanf("%d%d", &N, &W);
	foreach(i; 0..N){
		int w, v;
		scanf("%d%d", &w, &v);
		ws ~= w;
		vs ~= v;
	}
}

double solve(){
	int[] nws, nvs;
	double V = 0;
	foreach(w, v; zip(ws, vs)){
		if(w <= 0 && v >= 0){
			W -= w;
			V += v;
		}
		else if(w > 0 && v > 0){
			nws ~= w;
			nvs ~= v;
		}
		else if(w < 0 && v < 0){
			W -= w;
			V += v;
			nws ~= -w;
			nvs ~= -v;
		}
	}
	sort!"a[0]*b[1] > a[1]*b[0]"(zip(nvs, nws));

	foreach(w, v; zip(nws, nvs)){
		if(W >= w){
			W -= w;
			V += v;
		}
		else{
			V += cast(double)W / w * v;
			break;
		}
	}

	return V;
}

Measured memory_bytes: 1308
#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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    int A,B,m;
    cin >> A >> B >> m;
    int a[A],b[B];
    int mna=mod;
    int mnb=mod;
    int mnm=mod;
    rep(i,A){
        cin >> a[i];
        chmin(mna,a[i]);
    }
    rep(i,B){
        cin >> b[i];
        chmin(mnb,b[i]);
    }
    mnm=mna+mnb;
    rep(i,m){
        int x,y,c;
        cin >> x >> y >> c;
        x--;
        y--;
        int p=a[x]+b[y]-c;
        chmin(mnm,p);
    }
    cout << mnm;



    
}

Measured memory_bytes: 1024
import java.util.*
import java.math.*
import java.lang.Math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readLong: ()->Long = { readLine()!!.toLong() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }
private val readListLong: ()->List<Long> = { readLine()!!.split(' ').map(String::toLong) }
private val errPrintln: (String)->Unit = { msg -> System.err.println(msg) }
private val MOD = 1e9.toLong()+7
private val INF = Int.MAX_VALUE/2
private val LINF = Long.MAX_VALUE/2


fun solveD(H: Int, W: Int, G: List<String>): Int {
    val que = LinkedList<Pair<Int, Int>>()
    que.addLast(Pair(0,0))
    val dx = intArrayOf(0,1,0,-1)
    val dy = intArrayOf(1,0,-1,0)
    val step = Array(H){Array<Int>(W){INF}}
    step[0][0] = 0
    while(que.isNotEmpty()) {
        val (x, y) = que.removeFirst()

        for (i in dx.indices) {
            val nx = x + dx[i]; val ny = y + dy[i]
            if (nx<0 || H<=nx || ny<0 || W<=ny) {
                continue
            }
            if (G[nx][ny] == '#') {
                continue
            }

            assert(G[nx][ny] == '.'){"(nx,ny) is white"}

            if (step[nx][ny] == INF) {
                que.addLast(Pair(nx,ny))
            }
            if (step[x][y] + 1 < step[nx][ny]) {
                step[nx][ny] = step[x][y] + 1
            }
        }
    }

    if (step[H-1][W-1] == INF) {
        return -1
    }

    var white = 0
    for(i in 0 until H) {
        for (j in 0 until W) {
            if (G[i][j] == '.') white++
        }
    }

    val path = step[H-1][W-1] + 1

    return white - path
}


fun main(args: Array<String>) {
    val (H, W) = readListInt()

    val S = Array<String>(H){""}
    for (i in 0 until H) {
        S[i] = readString()
    }

    val ans = solveD(H, W, S.toList())

    println(ans)
}


Measured memory_bytes: 38172
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int masu[100001];
int main(){
    int m,n;
    cin>>n>>m;
    
    char a[n][n];
    char b[m][m];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }
    }
    
    for(int i=0;i<m;i++){
        for(int j=0;j<m;j++){
            cin>>b[i][j];
        }
    }
    
    for(int i=0;i<n-m+1;i++){
        for(int j=0;j<n-m+1;j++){
            
            bool flag=0;
            for(int k=i;k<i+m;k++){
                for(int l=j;l<j+m;l++){
                    if(a[k][l]!=b[k-i][l-j]){
                        flag=1;}
                }
            }
            if(flag==0){
                cout<<"Yes"<<endl;return 0;}
    }
    }
    
    cout<<"No"<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }



void solve() {
    int n,m;
    cin >> n >> m;
    VI h(n);
    REP(i,0,n) cin >> h[i];
    VVI es(n);
    int a,b;
    REP(i,0,m) {
        cin >> a >> b;
        --a; --b;
        es[a].push_back(b);
        es[b].push_back(a);
    }
    int cnt = 0;
    REP(i,0,n) {
        bool b = true;
        for (int dst: es[i]) {
            if (h[i] <= h[dst]) {
                b = false;
                break;
            }
        }
        if (b) ++cnt;
    }
    cout << cnt << endl;
}

signed main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 8804
import java.util.Scanner;
import java.io.PrintWriter;

// A - Dividing a String
class Main {
    static int divideStr(String str) {
        int count = 0;
        int pre = '\0';
        char cur;
        for (int i = 0; i < str.length(); i ++) {
            cur = str.charAt(i);
            if (pre == cur && i != str.length() - 1) {
                count ++;
                i ++;
                pre = '\0';
            } else if (pre != cur) {
                count ++;
                pre = cur;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String str = sc.nextLine();

        out.println(divideStr(str));
        out.flush();
    }
}


Measured memory_bytes: 26552