akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define rep(i, n)      for (int i = 0; i < (n); i++)
#define repr(i, n)     for (int i = (n) - 1; i >= 0; i--)
#define repe(i, l, r)  for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r) - 1; i >= (l); i--)
#define repi(i, l, r)  for (int i = (l); i <= (r); i++)
#define repir(i, l, r) for (int i = (r); i >= (l); i--)
#define range(a) a.begin(), a.end()
void init_io() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(15); }
 
using namespace std;
using ll = long long;

void chmax(int &x, int y) {
  x = max(x, y);
}

int main() { init_io();
  int N, T; cin >> N >> T;
  vector<int> A(N), B(N);
  rep(i, N) cin >> A[i] >> B[i];
  vector<int> ord(N); rep(i, N) ord[i] = i;
  sort(range(ord), [&](int i, int j) { return A[i] < A[j]; });
  vector<int> dp0(6060, -1e9);
  dp0[0] = 0;
  for (int i : ord) {
    vector<int> dp1 = dp0;
    for (int j = 0; j < T; j++) {
      chmax(dp1[j + A[i]], dp0[j] + B[i]);
    }
    dp0 = dp1;
  }
  cout << *max_element(range(dp0)) << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mo = 998244353, X = 1e4 + 7, Y = 1e7 + 7;
const int N = 2.5e5 + 10;
int n;
ll cnt[N], pre[N], X1, cnt2[N], pre2[N], Y1;
char s[N];
ll ksm(ll x, ll y) {
	ll ret = 1; for (; y; y >>= 1) {
		if (y & 1) ret = ret * x % mo;
		x = x * x % mo;
	}
	return ret;
}

map<pair<ll,ll>,int> h;
pair<ll,ll> tj(int x) {
	return make_pair(((pre[n] * cnt[x] % mo + pre[x]) % mo + mo) % mo,
		((pre2[n] * cnt2[x] % mo + pre2[x]) % mo + mo) % mo);
}

int main() {
	cin >> n;
	scanf("%s", s + 1);
	cnt[0] = 1;
	cnt2[0] = 1;
	X1 = ksm(X, mo - 2); Y1 = ksm(Y, mo - 2);
	for(int i = 1; i <= n; i++) {
		cnt[i] = cnt[i - 1];
		pre[i] = pre[i - 1];
		cnt2[i] = cnt2[i - 1];
		pre2[i] = pre2[i - 1];
		if (s[i] == '>') {
			cnt[i] = cnt[i] * X % mo;
			cnt2[i] = cnt2[i] * Y % mo;
		} else if (s[i] == '<') {
			cnt[i] = cnt[i] * X1 % mo;
			cnt2[i] = cnt2[i] * Y1 % mo;
		} else if (s[i] == '+') {
			pre[i] = (pre[i] + cnt[i]) % mo;
			pre2[i] = (pre2[i] + cnt2[i]) % mo;
		} else {
			pre[i] = (pre[i] - cnt[i]) % mo;
			pre2[i] = (pre2[i] - cnt2[i]) % mo;
		}
	}
	ll ans = 0;
	h[tj(0)] = 1;
	for(int i = 1; i <= n; i++) {
		pre[i] = (pre[i] + mo) % mo;
		pre2[i] = (pre2[i] + mo) % mo;
		ans += h[make_pair(pre[i], pre2[i])];
		h[tj(i)] ++;
	}
	cout << ans << endl;
}

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

int main() {
	int N, T;
	cin >> N >> T;
	vector<int>t(N);
	for (int i = 0;i<N;++i) {
		cin >> t[i];
	}
	int ans = 0;
	for (int i = 0;i<N-1;++i) {
		ans += min(T, t[i + 1] - t[i]);
	}
	ans += T;
	cout << ans << endl;
	return 0;
}

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

class UnionFind {
	vector<int>par, sz;
public:
	UnionFind() {}
	UnionFind(int n) {
		par = sz = vector<int>(n);
		for (int i = 0; i < n; i++) {
			par[i] = i;
			sz[i] = 1;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (sz[x] > sz[y]) {
			par[y] = x;
			sz[x] += sz[y];
		}
		else {
			par[x] = y;
			sz[y] += sz[x];
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		return sz[find(x)];
	}
};

int n;ll d;
ll a[300000];
UnionFind uf;
ll mp[300000];

vector<P>loop(bool b){
	vector<P>res(n);
	rep(i,n)res[i]=P(INFL,-1),mp[i]=INFL;
	set<P>se;//コスト、連結成分
	rep(i,n){
		int id=(b?n-i-1:i);
		int p=uf.find(id);
		if(!se.empty()){
			auto it=se.begin();
			while(it!=se.end()&&it->second==p)it++;
			if(it!=se.end()){
				res[p]=min(res[p],P(d*i+it->first+a[i],it->second));
			}
		}
		ll cost=-i*d+a[i];
		if(cost<mp[p]){
			se.erase(P(mp[p],p));
			mp[p]=cost;
			se.insert(P(cost,p));
		}
		while(se.size()>2)se.erase(--se.end());
	}
	return res;
}
int main(){
	cin>>n>>d;
	rep(i,n)scanf("%lld",&a[i]);
	uf=UnionFind(n);
	ll ans=0;
	while(uf.size(0)!=n){
		auto res=loop(0);
		rep(i,n/2)swap(a[i],a[n-i-1]);
		auto res2=loop(1);
		rep(i,n/2)swap(a[i],a[n-i-1]);
		rep(i,n){
			res[i]=min(res[i],res2[i]);
			if(res[i].second==-1)continue;
			if(!uf.same(i,res[i].second)){
				uf.unite(i,res[i].second);
				ans+=res[i].first;
			}
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 11840
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int,int>;
//加算代入演算子は+=！！！！！

int main() {
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);
    //最後の家から最初の家までの距離を出すための仮想家を追加
    a.push_back(a[0] + k); 
    int l = 0; //距離
    // push backで追加してるからn-1ではなくnでよい
    rep(i, n) {
        l = max(l, a[i + 1] - a[i]); //maxで一つずつ比較して最大を探す
    }
    int ans = k - l; //最も長いところ以外の長さの合計が一番移動距離が短い
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
using namespace std;
signed main() {
	int a[7] = { 1,3,5,7,8,10,12 }, b[4] = { 4,6,9,11 };
	int x, y;
	cin >> x >> y;
	if (x == 2 || y == 2)puts("No");
	else {
		for (int i = 0; i < 7; i++) {
			if (a[i] == x)x = 1;
			if (a[i] == y)y = 1;
		}
		for (int i = 0; i < 4; i++) {
			if (b[i] == x)x = 2;
			if (b[i] == y)y = 2;
		}
		if (x == y)puts("Yes");
		else puts("No");
	}
	getchar(); getchar(); return 0;
}

Measured memory_bytes: 256
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
import bisect
As = [0]
for i in range(N):
    As.append(As[-1]+A[i])
Bs = [0]
for i in range(M):
    Bs.append(Bs[-1]+B[i])
ans = 0
for i in range(len(As)):
    v = K-As[i]
    if v ==0: ans = max(ans,i)
    elif v >0:
        idx = bisect.bisect_right(Bs,v)
        if idx==0: ans = max(ans,i)
        else: ans = max(ans,i+idx-1)
print(ans)


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

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		while(true){
			String input = br.readLine();
			if(input.equals("0 0")){
				break;
			}
			String[] numbers = input.split(" ");
			Integer max = Integer.parseInt(numbers[0]);
			Integer target = Integer.parseInt(numbers[1]);
			Integer count = 0;
			String result_size = "";
			for(int i = 1; i <= max; i++){
				for(int j = i + 1; j <= max; j++){
					for(int k = j + 1; k <= max; k++){
						if(i + j + k == target){
							count += 1;
						}
					}
				}
			}
			result_size = result_size + count + "\n" ;
			System.out.print(result_size);
		}
	}
}

Measured memory_bytes: 20224
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
#include <map>
#include <stack>
#include <iomanip>
#include <cstdio>


using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)


/*int binarySearch(vector<int > v, int target){
  int l = 0, r = v.size();
  int mid;
  while (l+1<r){
    mid = (r+l)/2;
    if (v[mid] <= target){
      l = mid;
    }
    else r = mid;
  }
  return l;
}*/


int main(){
  int n, m;
  cin >> n >> m;
  int p[m];
  int y[m];
  vector<int> id[n];
  rep(i,m){
    scanf("%d%d", &p[i], &y[i]), id[p[i]-1].push_back(y[i]);
  }
  rep(i,n){
    sort(id[i].begin(),id[i].end());
  }

  int res;
  rep(i,m){
    res = lower_bound(id[p[i]-1].begin(), id[p[i]-1].end(), y[i])-id[p[i]-1].begin();
    cout<< setfill('0') << setw(6)  << p[i];
    cout << setfill('0') << setw(6)  << res+1 << endl;
  }  
  return 0;
}

Measured memory_bytes: 7808
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

template<int mod>
struct mint {
private:
    long long x;
public:
    mint(long long x = 0) :x(x%mod) {}
    mint(std::string s) {
        long long z = 0;
        REP(i, s.size()) {
            z *= 10;
            z += s[i] - '0';
            z %= mod;
        }
        this->x = z;
    }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    friend std::ostream& operator<<(std::ostream& os, const mint& n) {
        return os << n.x;
    }
    bool operator==(const mint a) const {
        return this->x == a.x;
    }
};

//pow
template<typename T, typename U>
T pow(T k, U n, T unity = 1) {
    while (n > 0) {
        if (n & 1) {
            unity *= k;
        }
        k *= k;
        n >>= 1;
    }
    return unity;
}

int main() {
    const int mod = 998244353;
    mint<mod> ans = 1;
    int n; cin >> n;
    vector<int> v(n,0);
    int m = 0;
    REP(i, n) {
        int a; cin >> a;
        if (i == 0 && a != 0) {
            cout << 0 << endl;
            return 0;
        }
        else if (i != 0 && a == 0) {
            cout << 0 << endl;
            return 0;
        }
        v[a]++;
        m = max(m, a);
    }
    v.push_back(0);
    REP(i, m + 1) {
        ans *= pow(mint<mod>(v[i]),v[i+1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

long P = 10^^9+7;
long[10^^5*2+50] F, RF;

long pow(long x, long n) {
    long y = 1;
    while (n) {
        if (n%2 == 1) y = (y * x) % P;
        x = x^^2 % P;
        n /= 2;
    }
    return y;
}

long inv(long x)
{
    return pow(x, P-2);
}

void init()
{
    F[0] = F[1] = 1;
    foreach (i, ref x; F[2..$]) x = (F[i+1] * (i+2)) % P;

    {
        RF[$-1] = 1;
        auto x = F[$-1];
        auto k = P-2;
        while (k) {
            if (k%2 == 1) RF[$-1] = (RF[$-1] * x) % P;
            x = x^^2 % P;
            k /= 2;
        }
    }
    foreach_reverse(i, ref x; RF[0..$-1]) x = (RF[i+1] * (i+1)) % P;
}

long comb(N)(N n, N k)
{
    if (k > n) return 0;
    auto n_b = F[n];    // n!
    auto nk_b = RF[n-k]; // 1 / (n-k)!
    auto k_b = RF[k];    // 1 / k!

    auto nk_b_k_b = (nk_b * k_b) % P; // 1 / (n-k)!k!

    return (n_b * nk_b_k_b) % P;  // n! / (n-k)!k!
}

void main()
{
    init();
    auto hwab = readln.split.to!(long[]);
    auto H = hwab[0];
    auto W = hwab[1];
    auto A = hwab[2];
    auto B = hwab[3];

    long r;
    foreach (i; 0..H-A) {
        (r += F[B-1+i] * RF[B-1] % P * RF[i] % P * F[W-B-1 + H-i-1] % P * RF[W-B-1] % P * RF[H-i-1] % P) %= P;
    }
    writeln(r);
}

Measured memory_bytes: 5852
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var strs = new Dictionary<string, long>();

            for (var i = 0; i < n; i++)
            {
                var str = new string(Console.ReadLine().OrderBy(c => c).ToArray());
                if (strs.TryGetValue(str, out _)) strs[str]++;
                else strs.Add(str, 1);
            }

            var result = 0L;
            foreach (var cnt in strs.Values)
            {
                result += (cnt * (cnt - 1)) / 2;
            }

            Console.WriteLine(result);
        }
    }
}

Measured memory_bytes: 51380
/*
|| Suyash Yadav | B.Tech (3rd Year CSE) | Tier-3 (NCR,India)
|| suyashky@gmail.com | "suyashky" @linkedIn
||
||		   /\_/\
||		  ( o.o )
|| 	 	   > ^ <
|| From infinity to beyond!
*/

# include <bits/stdc++.h>
using namespace std;
# define INF (long long int)1e28
# define MOD 1000000007
# define endl "\n"
# define all(con) con.begin() , con.end()
# define MAX numeric_limits<int64>::max()
# define MIN numeric_limits<int64>::min()
# define watch1(x) cout<<#x<<": "<<x<<endl
# define watch2(x,y) cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
# define watch3(x,y,z) cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
# define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long int int64;
typedef unsigned long long int uint64;

char t[1005][1005];
int64 dp[1005][1005];

int main()
{
/*
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/

	memset(dp, 0, sizeof(dp));
	int64 n, m;
	cin >> n >> m;

	string s;
	for (int64 i = 1 ; i <= n ; i++)
	{
		cin >> s;
		for (int64 j = 1; j <= m  ; j++)
		{
			t[i][j] = s[j - 1];
		}
	}
	dp[1][1] = 1;
	int64 a, b;
	for (int64 i = 1 ; i <= n ; i++)
	{
		for (int64 j = 1; j <= m  ; j++)
		{
			if (t[i][j] == '.')
			{
				a = (dp[i - 1][j]) % MOD;
				b = (dp[i][j - 1]) % MOD;
				a = (a + b) % MOD;
				dp[i][j] = max(dp[i][j], a);
			}
		}
	}
	cout << dp[n][m] << endl;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define inchar			getchar
#define outchar(x)		putchar(x)
#define ll long long int
#define all(v) v.begin(), v.end()
#define SP outchar(' ')
#define LN outchar('\n')
using namespace std;
const ll MOD  = int(1e9 + 7);

template<typename T> void inpos(T &x){x=0;register T c=inchar();while(((c<48)||(c>57))&&(c!='-'))c=inchar();bool neg=0; if(c=='-')neg=1;for(;c<48||c>57;c=inchar());for(;c>47&&c<58;c=inchar())x=(x<<3)+(x<<1)+(c&15);if(neg)x=-x;}
template<typename T> void outpos(T n){if(n<0){outchar('-');n*=-1;}char snum[65];int i=0;do{snum[i++]=n%10+'0';n/=10;}while(n);i=i-1;while(i>=0)outchar(snum[i--]);}
inline void instr(char *str){register char c=0;register int i=0;while(c<33)c=inchar();while(c!='\n'&&c!=' '&&c!=EOF){str[i]=c;c=inchar();++i;}str[i]='\0';}


int main () {
	int H,W;
	cin >> H >> W;
	vector <string> Graph (H);
	for (int i = 0; i<H;i++) {
		cin >> Graph[i];
	}
	int dp[H+2][W+2] ;
	for (int i = 0 ; i<H+2;i++) {
		for(int j = 0; j<W+2; j++) {
			dp[i][j] = 0;
		}
	}
	dp [1][1] = 1;
	for (int i = 0; i<H ; i++) {
		for (int j = 0 ; j<W;j++) {
			if ( (i ==0) &&( j == 0)) {
				dp[1][1] = 1;
				continue;
			}
			if (Graph[i][j] == '#') {
				dp[i+1][j+1] = 0;
			} else {
				dp[i+1][j+1] = dp[i+1][j] + dp[i][j+1];
				dp[i+1][j+1] %= MOD;  
			} 

		}

	}
	cout << dp[H][W] <<endl;
	

}

Measured memory_bytes: 5248
#pragma region 
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<cstring>
#include<string>
typedef long long ll;
template <typename T>void read(T &x){x=0;char ch=getchar();ll f=1;while(!isdigit(ch)){if(ch=='-')f*=-1;ch=getchar();}while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}x*=f;}
#define IO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
#pragma endregion
const int maxn = 1e5 + 5;
int a[maxn][3];

int main() {
    IO;
    string s;
    cin >> s;
    cout << (s == "ABC" ? "ARC\n" : "ABC\n");
}

Measured memory_bytes: 3656
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 924844033;
const int N = 2335;
const int K = 25;
int t[N][N], a[N], dp[N], b[N], fact[N], s1[N][N], s2[N][N], f[N][N], c[N], ss[N];
void calc(int n, int l, int r){
    for (int i = 0; i <= n; i++){
        for (int j = 0; j <= n; j++){
            t[i][j] = f[i][j] = a[i] = 0;
            s2[i][j] = s1[i][j] = 0;
        }
    }
    for (int j = 0; j <= n; j++){
        if (l) f[0][j] = j + 1; else f[0][j] = 1;
        if (j != 0) s1[0][j] = (s1[0][j - 1] + j * f[0][j] ) % mod; else s1[0][j] = 0;
        if (j != 0) s2[0][j] = (s2[0][j - 1] + f[0][j]) % mod; else s2[0][j] = f[0][j];
    }
    for (int i = 1; i <= n; i++){
        for (int j = 0; j <= n; j++){
            f[i][j] = (f[i - 1][j] - s1[i - 1][j - 1] + (j + 1) * s2[i - 1][j - 1] + mod) % mod;
            if (j != 0) s1[i][j] = (s1[i][j - 1] + j * f[i][j] ) % mod; else s1[i][j] = 0;
            if (j != 0) s2[i][j] = (s2[i][j - 1] + f[i][j]) % mod; else s2[i][j] = f[i][j];
        }
    }
    for (int i = 0; i <= n; i++){
        for (int j = 0; j + i <= n; j++){
            t[i + j][j] = (t[i + j][j] + f[i][j]);
        }
    }
    for (int i = 0; i <= n; i++){
        int c;
        if (r) c = i + 1; else c = 1;
        for (int j = 0; j + i <= n; j++){
            a[i + j] = (a[i + j] + c * t[n - i - 1][j]) % mod;
        }
    }
    if (l == 0 && r == 0) a[n] = 0;
    else if(l == 0 || r == 0) a[n] = 1;
    else a[n] = n + 1;
    a[0] = 1;
}
int coo(int n, int k){
    return fact[n] / fact[k] / fact[n - k];
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n, k;
    cin >> n >> k;
    dp[0] = 1;
    fact[0] = 1;
    int res = 0;
    for (int i = 1; i <= n; i++) fact[i] = fact[i - 1] * i % mod;
    for (int i = 1; i <= k + k; i++){
        int l = 0;
        int rb = 0;
        for (int j = 1; j <= n; j++){
            if (j % (k + k) == i % (k + k)){
                l++;
                rb = j;
            }
        }
        for (int j = 0; j <= n; j++) a[j] = 0;
        int f1, f2;
        if (i > k) f1 = 1; else f1 = 0;
        if (rb + k <= n) f2 = 1; else f2 = 0;
        calc(l, f1, f2);
        for (int j = 0; j <= n; j++) b[j] = 0;
        for (int j = 0; j <= n; j++){
            for (int p = 0; p <= min(l, j); p++){
                b[j] = (b[j] + a[p] * dp[j - p]) % mod;
            }
        }
        for (int j = 0; j <= n; j++) dp[j] = b[j];
    }
    int ans = fact[n];
    for (int i = 0; i <= n; i++) dp[i] = dp[i] * fact[n - i] % mod;
    for (int i = 1; i <= n; i++) if (i % 2) ans = (ans - dp[i] + mod) % mod; else ans = (ans + dp[i]) % mod;
    cout << ans;
}


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

int main(void){
	int x[5];
	for (int i = 0; i < 5; i++) {
		cin >> x[i];
	}
	for (int i = 0; i < 5; i++) {
		if (x[i] == 0) cout << i+1 << endl;
	}
	return 0;
}


Measured memory_bytes: 3620
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;

// ===============================================================

ll gcd(ll a, ll b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}
//最大公約数
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
//最小公倍数
ll box(double a) 
{
	ll b = a;
	return b;
}
//切り捨て
ll fff(double a) 
{
	ll b = a + 0.5;
	return b;
}
//四捨五入
ll sum(ll n) { 
	return (1 + n) * n / 2;
}
//1から整数nまでの合計
bool prime(ll a)//素数判定、primeならtrue,違うならfalse
{
	if (a < 2) return false;
	else if (a == 2) return true;
	else if (a % 2 == 0) return false;
	double sqrtNum = sqrt(a);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (a % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}
//素数判定

// ===============================================================

int main() {
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	bool t = true;
	ll count = 0;
	if (b <= a) {
		for (int i = 0; i < 10; i++) {
			b *= 2;
			count++;
			if (b > a) {
				break;
			}
		}
	}
	if (c <=b) {
		for (int i = 0; i < 10; i++) {
			c *= 2;
			count++;
			if (c > b) {
				break;
			}
		}
	}
	if (count <= k) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

Measured memory_bytes: 3676
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();

    String t = sc.next();

    for(int i = 0; i < t.length(); i++){
      if(t.charAt(i) == 'P' || t.charAt(i) == 'D'){
        sb.append(t.substring(i, i + 1));
      } else {
        sb.append("D");
      }
    }

    System.out.println(sb);
  }
}


Measured memory_bytes: 50688
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

typedef long long ll;
constexpr double PI = 3.141592653589793;
constexpr int INF = 1e9 + 10;
constexpr ll INFL = 1e18 + 10;

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;
}

using namespace std;
//    cout << setprecision(20) << ans << "\n";



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

    ll x, k, d;
    cin >> x >> k >> d;
    bool isNegative = false;
    
    if (x < 0)
    {
        isNegative = true;
    }

    x = abs(x);
    ll prev = INFL;
    if (x / d > k){
        cout << x - k * d << "\n";
        return 0;
    }
    ll mod = x % d;
    ll left = abs(mod - d);
    ll quotient = x / d;
    if ((k - quotient) % 2 == 0){
        cout << mod << "\n";
    }
    else{
        cout << left << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  REP(i, n) { cin >> d[i]; }

  int ans = 0;
  REP(i, n) {
    FOR(j, i + 1, n) { ans += d[i] * d[j]; }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    unused_imports,
    dead_code
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
// use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
    input! {
       N:usize
    }
    // 約数の個数は素因数分解して、各素因数の個数+1をかけたもの。
    // Ex: 12= 2^2*3^1なので、(2+1)*(1+1)=6個。1,2,3,4,6,12
    // 75=(2+1)*(4+1)*(4+1);
    // 100以下の素数は97までの25個。
    // 素数a,b,cについて、a<b<cとする。
    // N < c*2なら、cは N! に高々1個しか含まれないので、不可。
    // 同様に、N < b*4 も成立しない。
    // cの可能性があるのはN/2以下、a,bの可能性があるのはN/4
    let p = getPrimes(N);
    let mut ans = 0;
    //    let ts = getNumbersInN(N);
    let mut ts = vec![0; N + 1];
    for i in 2..=N {
        let mut cur = i;
        for j in 2..=i {
            while cur % j == 0 {
                ts[j] += 1;
                cur = cur / j;
            }
        }
    }
    //println!("{:?}", ts);
    let num = |m| {
        let mut s = 0;
        for &t in ts.iter() {
            if t >= m - 1 {
                s += 1;
            }
        }
        s
    };
    // 2個,4個,4個の場合
    // choose(num5,2) * (num3-num5) + 3*choose(num5,3)
    // = num5*(num5-1)*(num3-num5)/2 + num5*(num5-1)*(num5-2)/2
    // = num5*(num5-1)*(num3 -num5 +num5-2)/2
    // = num5*(num5-1)*(num3-2)/2
    ans += num(5) * (num(5) - 1) * (num(3) - 2) / 2;

    // 14,4の場合
    ans += num(15) * (num(5) - 1);

    // 24,2の場合
    ans += num(25) * (num(3) - 1);
    //print!("{} ", ans);
    // 74の場合
    ans += num(75);
    println!("{}", ans);
}
fn getPrimes(N: usize) -> Vec<usize> {
    let mut p = vec![true; N as usize + 1];
    let mut q = Vec::with_capacity(100);
    p[0] = false;
    p[1] = false;
    for i in 2..=N as usize {
        if p[i as usize] {
            q.push(i);
        }
        let mut j = 2;
        while i * j <= N {
            p[(i * j) as usize] = false;
            j += 1;
        }
    }
    q
}
// 75-1以上=1
// 25-1以上=3
// 15-1以上=4
// 5-1以上=9
// 3-1以上=15
// 1 + 4*48 + 6*23 + 24*23*47/2 = 1+192+138+12972
// 1 + 3*14 + 4*8 + 9*8*13/2 = 1+42+32+468=543

//[0, 97, 48, x32, 24,x18, 16, x13, x12, x11,
//  9,x8, 7,x7,x6,x6, 5,x5, 5, x5,
// x4,x4, 4,x4,x4,x3,x3,x3, 3,x3,
//  3,x3,x3,x2,x2,x2, 2,x2,x2,x2,
//  2,x2, 2,x2,x2,x2, 2,x2,x2,x2,
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
//  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
//  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]


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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

// x の n 乗 x^n を計算する
long long mod_pow(long long x, long long n, int M=1000000007) {
  long long ret = 1;
  while(n) {
    if(n & 1) (ret *= x) %= M;
    (x *= x) %= M;
    n >>= 1;
  }
  return ret;
}

// a の逆元 a^{-1} を計算する
long long inv(long long a, int M=1000000007) {
    long long b = M, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= M;
    if (u < 0) u += M;
    return u;
}

// 二項係数 nCr を計算する
long long com(long long n, long long r, int M=1000000007) {
    long long a = 1, b = 1;
    for (int i = 1; i <= r; ++i) {
        a *= n - (i-1), b *= i;
        a %= M, b %= M;
    }
    return a * inv(b) % M;
}

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

    ll ans = mod_pow(2,n) - 1 - com(n,a) - com(n,b);
    while (ans < 0) ans += MOD;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a,b,s=0,ss,c,i,d;
    cin>>n>>a>>b;

    for( i=a;i<=n;i++)
    {
        c=i;
        ss=0;
        while(c>0)
        {
            d=c%10;
            ss=d+ss;
            c=c/10;
        }
        if(ss>=a&&ss<=b)
            s=s+i;
    }
    cout<<s<<endl;

}


Measured memory_bytes: 256
package main

import(
	"fmt"
	"math"
)

func isPythagorean(s int)bool{
	c:=math.Sqrt(float64(s))
	d:=int(c+0.000000001)
	return d*d==s
}

func main(){
	var(
		n,d,ans int
		x [10][10]int
	)
	fmt.Scanln(&n, &d)
	for i := 0; i < n; i++ {
  	for j := 0; j < d; j++ {
  		fmt.Scan(&x[i][j])
  	}
	}
	ans=0
	for i:=0;i<n;i++{
		for j:=i+1;j<n;j++{
			s:=0
			for k:=0;k<d;k++{
				t:=x[i][k]-x[j][k]
				s+=t*t
			}
			if isPythagorean(s) {
				ans+=1
			}
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
	int n = int.Parse(Console.ReadLine());//int.Parseは文字列を整数に変換。
	long[] numsA = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
  long[] numsB = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
  long[] numsC = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);
  List<long> listA = new List<long>();
  List<long> listB = new List<long>();
  List<long> listC = new List<long>();
    for(int i = 0; i < n; i++)
    {
      listA.Add(numsA[i]);
      listB.Add(numsB[i]);
      listC.Add(numsC[i]);
    }
    listA.Distinct();
    listB.Distinct();
    listC.Distinct();
    listA.Sort((a, b) => a.CompareTo(b));
    listB.Sort((a, b) => a.CompareTo(b));
    listC.Sort((a, b) => a.CompareTo(b));//昇順にソート、重複を削除
    int[] countB = new int[listB.Count()];
    long countC = 0;
    long answer = 0;
    int memoA = 0;
    int memoB = 0;

    for(int i = 0; i < listB.Count(); i++)
    {
    if(i > 0) countB[i] = countB[i-1];
      while(true)
      {
        if(memoA < listA.Count())
        {
          if(listB[i] > listA[memoA])
          {
          memoA++;
          countB[i]++;
          }
          else break;
        }else break;
      }
    }

    for(int i = 0; i < listC.Count(); i++)
    {
    answer += countC;
      while(true)
      {
        if(memoB < listB.Count())
        {
          if(listC[i] > listB[memoB])
          {
          countC += countB[memoB];
          answer += countB[memoB];
          memoB++;
          }
          else break;
        }else break;
      }
    }

	Console.WriteLine(answer);//WriteLineをWriteとすると、改行なしで出力。
	}
}

Measured memory_bytes: 45956
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
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 (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};



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


	int n,m;
	cin >> n >> m;
	vvi Graph(n);
	rep(i,m){
		int a,b;
		cin >> a >> b;
		--a;--b;
		Graph[a].pb(b);
		Graph[b].pb(a);		
	}
	vi com(n);
	rep(i,n){
		com[i] = i;
	}
	/*
	rep(i,n){
		for(auto it:Graph[i]) cout << it << " " ;
		cout   << endl;
	}
	*/
	int cnt = 0;
	do{
		if(com[0]!=0)continue;
		int ck = 0;
    	rep(i,n-1){
			rep(j,Graph[com[i]].size()){
				if(com[i+1]==Graph[com[i]][j]) {ck++;break;}
			}
		}
		if(n-1==ck){cnt++;}
    }while(next_permutation(all(com)));
	cout << cnt << endl;
    return 0;
}


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

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
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; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class B0Or1Swap {
public:
    void solve(istream& cin, ostream& cout) {
      int n; cin >> n;
      int cnt = 0;
      rep(i, n) {
        int a; cin >> a;
        if (a != i+1) cnt++;
      }
      if (cnt==0 || cnt==2) {
        cout << "YES" << endl;
      } else {
        cout << "NO" << endl;
      }

    }
};

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

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#include <cstring>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<ll>> vvll;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define irep(it, stl) for (auto it = stl.begin(); it != stl.end(); it++)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
struct io
{
    io()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
};
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(void)
{
    string n;
    
    cin >> n;
    
    rep (i, 3) {
        if(n.at(i) == '7') {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    
    
}

Measured memory_bytes: 3528
var
  a: array [1..300, 1..300] of boolean;
  b: array [1..300] of boolean;
  ans: array [1..300, 1..300] of longint;
  n, m, k, i, j, cnt, start: longint;
  c: char;
  f: boolean;
begin
  readln(n, m, k);
  for i := 1 to n do
  begin
    for j := 1 to m do
    begin
      read(c);
      if c = '#' then
      begin
        a[i, j] := true;
        b[i] := true;
      end;
    end;
    readln;
  end;
  cnt := 0;
  for i := 1 to n do
    if b[i] then
      break;
  start := i;
  for i := i to n do
    if b[i] then
    begin
      inc(cnt);
      f := false;
      for j := 1 to m + 1 do
      begin
        if j = m + 1 then
          break;
        if a[i, j] then
          if f then
            break
          else
            f := true;
        ans[i, j] := cnt;
      end; 
      for j := j to m do
      begin
        if a[i, j] then
          inc(cnt);
        ans[i, j] := cnt;
      end;
    end
    else
      for j := 1 to m do
        ans[i, j] := ans[i - 1, j];
  for i := 1 to start - 1 do
    for j := 1 to m do
      ans[i, j] := ans[start, j];
  for i := 1 to n do
  begin
    for j := 1 to m do
      write(ans[i, j], ' ');
    writeln;
  end;
end.


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

void dfs(int root, int parent, const vector<vector<int>> &children, vector<long> &count) {
    for (int child : children[root]) {
        if (child == parent)
            continue;
        count[child] += count[root];
        dfs(child, root, children, count);
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, Q;
    cin >> N >> Q;

    vector<vector<int>> children(N);
    int a, b;

    for (int n = 0; n < N - 1; n++) {
        cin >> a >> b;
        a--;
        b--;
        children[a].emplace_back(b);
        children[b].emplace_back(a);
    }

    vector<int> p(Q), x(Q);
    vector<long> count(N);
    for (int q = 0; q < Q; q++) {
        cin >> p[q] >> x[q];
        p[q]--;
        count[p[q]] += x[q];
    }

    dfs(0, -1, children, count);

    for (int n = 0; n < N; n++) {
        cout << count[n] << " ";
    }

    return 0;
}

Measured memory_bytes: 32128
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <iomanip>
#include <cstdlib>
#include <cctype>
#include <map>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;
const int maxn = 1e6+7;

int main() {
	int n;
	cin>>n;
	ll a=-1,b=-1;
	map<ll,ll> m;
	map<ll,ll>::iterator it;
	ll temp;
	for(int i=0; i<n; i++) {
		cin>>temp;
		if(m.find(temp)==m.end()) {
			m[temp]=1;
		} else {
			m[temp]++;
		}
	}
	it=m.begin();
	for(it; it!=m.end(); it++) {
//		cout<<it->first<<" "<<it->second<<endl;
	}
	it=m.end();
	for(it; it!=m.begin(); it--) {
		if(a!=-1&&b!=-1) {
			cout<<a*b<<endl;
			return 0;
		}
		if(it->second>=4) {
			if(a==-1&&b==-1) {
				a=it->first;
				b=it->first;
			} else if(a!=-1&&b==-1) {
				b=it->first;
			}
		} else if(it->second>=2&&it->second<4) {
			if(a!=-1&&b==-1) {
				b=it->first;
//				cout<<"b:"<<b<<endl;
			} else if(a==-1) {
				a=it->first;
//				cout<<"a:"<<a<<endl;
			}
		}
	}
	if(it->second>=4) {
		if(a==-1&&b==-1) {
			a=it->first;
			b=it->first;
		} else if(a!=-1&&b==-1) {
			b=it->first;
		}
	} else if(it->second>=2&&it->second<4) {
		if(a!=-1&&b==-1) {
			b=it->first;
//			cout<<"b:"<<b<<endl;
		} else if(a==-1) {
			a=it->first;
//			cout<<"a:"<<a<<endl;
		}
	}
	if(a!=-1&&b!=-1) {
		cout<<a*b<<endl;
		return 0;
	} else if(a==-1||b==-1) {
		cout<<0<<endl;
	}
	return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long double pi = acos(-1);
void start(){
std::ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
}
int main(){
   start();
    int r;
    cin>>r;
    cout<<r*r<<endl;
    return 0 ;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 10007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //------------------------------
    int n;cin>>n;
    int cnt=1;
    while(n){
        printf("Case %d: %d\n",cnt++,n);
        cin>>n;
    }
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------

































Measured memory_bytes: 3144
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<utility>
#include<array>
#include<set>
#include <numeric>
#include <stdio.h>
#include <map>
#include <iomanip>
#include <sstream>
//#include <boost/math/common_factor_rt.hpp>
#include<fstream>
#define EPS (1e-7)
using namespace std;
#define ll long long



class Employee {
public:
	int id;
	int parent;
	vector<int> children;
	int salary;

	Employee() {
		
	}

	Employee(int num, int nparent) {
		id = num;
		parent = nparent;
		salary = -1;
	}



};



template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}





pair<int, int> count_nonzero_cluster(vector<int>& vs) {

	int number = 0;
	int prev = 0;
	int vmax = -1;
	pair<int, int> re = make_pair(number, vmax);
	for (auto& v:vs)
	{
		if (prev <= 0 && v > 0) {
			re.first += 1;
		}
		if (re.second < v)re.second = v;
		prev = v;
	}


	return re;
}

int main() {
	
	int N , M;
	cin >> N >> M;

	string ans = "IMPOSSIBLE";
	vector<int> from1(N,0), fromn(N,0);
	
	int a, b;
	for (auto i = 0; i < M; i++)
	{
		cin >> a >> b;
		if (a == 1) {
			from1[b]+=1;
			continue;
		}

		if (a == N) {
			fromn[b]+=1;
		}
		else if (b == N) {
			fromn[a]+=1;
		}
	}
	int check;
	for (auto i = 0; i < N; i++)
	{
		if (from1[i] && fromn[i]) {
			ans = "POSSIBLE";
			break;
		}
	}




	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
// B - Ringo's Favorite Numbers
#include <bits/stdc++.h>
using namespace std;

int main(){
	int D,N; cin>>D>>N;
	int s = 1;
	for(int i=0; i<D; ++i) s*=100;
	cout<< s*(N==100? N+1:N) <<endl;
}

Measured memory_bytes: 256
# include<cstdio>
# include<algorithm>
using namespace std;
long long a[300010]; 
int main(){
	int n;
	scanf("%d",&n); 
	for(int i=1;i<=3*n;i++)
		scanf("%lld",&a[i]);
	sort(a+1,a+3*n+1);
	long long sum=0;
	for(int k=1;k<=n;k++){
		sum+=a[3*n-1-2*(k-1)];
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 2560
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

string S;

LL ans = 0;

void solve(){
	if(S=="SSR") ans = 1;
	if(S=="SRS") ans = 1;
	if(S=="RSS") ans = 1;
	if(S=="SRR") ans = 2;
	if(S=="RSR") ans = 1;
	if(S=="RRS") ans = 2;
	if(S=="RRR") ans = 3;
}

int main(){
    cin >> S;

    solve();

    cout << ans << endl;
    return 0;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector< pair<long long, int> > a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a.rbegin(), a.rend());
  vector< vector<long long> > dp(n + 1, vector<long long>(n + 1, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + abs(n - i + j - 1 - a[i].second) * a[i].first);
      dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + abs(a[i].second - j) * a[i].first);
    }
  }
  cout << *max_element(dp[n].begin(), dp[n].end()) << '\n';
  return 0;
}


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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;


signed main(){
    int N;
    cin >> N;
    int odd = 0;
    REP(i, N) if((i + 1) % 2 == 1) odd++;
    PRINT((double)odd / N);
    return 0;
}

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

ll gcd(ll a,ll b){
  if (b == 0){
    return a;
  }
  else {
    return gcd(b,a%b);
  }
}
 
ll lcm(ll x,ll y){
  if (gcd(x,y) == 1){
    return x*y;
  }
  else {
    return (x/gcd(x,y))*y;
  }
}

int main() {
  ll n;cin>>n;
  vector<ll> v(n);
  rep(i,n) cin>>v.at(i);
  if (n == 1){
    cout << v.at(0) << endl;
    return 0;
  }
  sort(v.begin(),v.end());
  reverse(v.begin(),v.end());
  ll ans = 0;
  rep(i,n-1){
    ans = lcm(v.at(i),v.at(i+1));
    v.at(i+1) = ans;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MO = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl
#define MAXE(a,b) a=max(a,b)
#define MINE(a,b) a=min(a,b)

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};


int main(){
    LL N;cin>> N;
    vector<pair<LL,pair<LL,LL>>> vec;
    for(int a = 0;a < N;a++){
        CIN(B);CIN(C);
        vec.push_back({B+C,{B,C}});
    }
    sort(ALL(vec),greater<pair<LL,pair<LL,LL>>>());
    LL T = 0,A = 0;
    for(int a = 0;a < N;a++){
        if(a%2 == 0)T += vec.at(a).second.first;
        else A += vec.at(a).second.second;
    }
    COUT(T-A);
}


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

typedef long long ll;
typedef pair<ll, ll> P;

const int mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 11

int main()
{
    ll n,x; cin >> n >> x;
    ll a[n];
    rep(i,n) cin >> a[i];
    ll ans = 0;
    for(int i = 0;i < n-1; i++){
        if(a[i] > x){
            ans += a[i]-x;
            a[i] = x;
        }
        if(a[i] + a[i+1] > x){
            ans += (a[i+1]+a[i]-x);
            a[i+1] = (x - a[i]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4344