akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#pragma GCC optimize("02")
#define ll long long
#define _inline __inline__ __attribute__((always_inline))
using namespace std;
struct ios{
    inline char gc(){
        static const int IN_LEN=1<<18|1;
        static char buf[IN_LEN],*s,*t;
        return (s==t)&&(t=(s=buf)+fread(buf,1,IN_LEN,stdin)),s==t?-1:*s++;
    }
    template <typename _Tp> _inline ios & operator >> (_Tp &x){
        static char ch,sgn; ch=gc(),sgn=0;
        for(;!isdigit(ch);ch=gc()){if(ch==-1)return *this;sgn|=ch=='-';}
        for(x=0;isdigit(ch);ch=gc())x=x*10+(ch^'0');
        sgn&&(x=-x); return *this;
    }
}inc;
int n;
int main(){
	inc>>n;
	return printf("%d\n",800*n-200*(n/15)),0;
}

Measured memory_bytes: 256
from itertools import combinations
from math import sqrt, floor, ceil


def is_square_of_int(n):
    f = sqrt(n)
    return floor(f) ** 2 == n or ceil(f) ** 2 == n


def square_distance(p1, p2):
    return sum((x1 - x2) ** 2 for x1, x2 in zip(p1, p2))


N, D = map(int, input().split())
X = []

for _ in range(N):
    X.append([int(x) for x in input().split()])

answer = sum(
    1 for p1, p2 in combinations(X, 2) if is_square_of_int(square_distance(p1, p2))
)
print(answer)


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

set<int> s;

int main()
{
    int n,k;
    cin >> n >> k;
    for(int i=0;i<k;i++){
        int d;
        cin >> d;
        for(int j=0;j<d;j++){
            int a;
            cin >> a;
            s.insert(a);
        }
    }
    cout << n-s.size() << "\n";
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    ll n = s.size();

    ll k;
    cin >> k;

    for (int i = 0; i < min(n, k); i++) {
        if (s[i] != '1') {
            cout << s[i] << endl;
            return 0;
        }
    }

    cout << 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <functional>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <vector>
#include <array>
#include <memory>
#include <set>
#include <map>

using namespace std;

#define Get(ty,...) ty __VA_ARGS__;cins(__VA_ARGS__);
#define GetArray(ty,v,n) vector<ty> v(n);cin_arr(v,n);
#define ci cin
#define co cout
#define en endl;
#define Arr(f, arr,pred) f(arr.begin(),arr.end(),pred)
#define Arr2(f, arr) f(arr.begin(),arr.end())
#define ArrExpr(f, arr,expr) f(arr.begin(),arr.end(),[](auto x){return expr;})
#define Acc(init,arr,pred) accumulate(arr.begin(),arr.end(),init,pred)

void cins(){}

template<class Head,class... Tail>
void cins(Head& head,Tail&... tail) {
	cin >> head;
	cins(tail...);
}

template<class Arr>
void cin_arr(Arr& v,int n) {
	for (int i = 0; i < n; i++)
		cin >> v[i];
}

int main() {
	Get(int, n, x);
	GetArray(int, v, n);
	int count = 1;
	int nowX = 0;

	for (int y:v) {
		nowX += y;
		if (nowX <= x) {
			count++;
		}else{
			break;
		}
	}

	co << count << en;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,count,count2;
  cin >> n;
  vector<int> a(n);
  count = 0;
  count2 = 0;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
    for(int i=0;i<n;i++){
      if(a[i]%2==0){
        count++;
        if(a[i]%3==0 || a[i]%5==0){
 			 count2++;
        }
      }
  }
  if(count2 == count) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
}

Measured memory_bytes: 256
def d_robot_arms(N, Pos):
    # 参考: http://drken1215.hatenablog.com/entry/2018/09/30/002900
    ans = []

    pos = []
    # すべての座標でパリティが一定でなければ、条件を満たす腕を作りようがない
    parity = (abs(Pos[0][0]) + abs(Pos[0][1])) % 2
    for x, y in Pos:
        parity_current = (abs(x) + abs(y)) % 2
        if parity != parity_current:
            return -1
        pos.append([x - y, x + y])
        # u=x-y, v=x+y とすると、 点(u, v)は
        # 原点周りに45度回転させる座標変換によって点(x, y)から移される点

    d = []
    # log2(10**9)=29.90 なので、2**30以下の2の冪乗の足し引きで10**9までの奇数を生成できる
    for i in range(30, -1, -1):
        d.append(1 << i)
    if parity % 2 == 0:
        d.append(1)
    ans.append(str(len(d)))
    ans.append(' '.join(list(map(str, d))))

    for i in range(N):
        # u, v座標はそれぞれ独立に見て構わない
        udir, vdir = 0, 0
        usum, vsum = 0, 0
        tmp = []
        for j in range(len(d)):
            if usum <= pos[i][0]:
                udir = 1
                usum += d[j]
            else:
                udir = -1
                usum -= d[j]

            if vsum <= pos[i][1]:
                vdir = 1
                vsum += d[j]
            else:
                vdir = -1
                vsum -= d[j]

            # uv平面で軸と平行に(正の向き:1, 負の向き:-1)移動することと
            # xy平面での移動モード(UDLR)との対応
            if udir == 1 and vdir == 1:
                tmp.append('R')
            elif udir == 1 and vdir == -1:
                tmp.append('D')
            elif udir == -1 and vdir == -1:
                tmp.append('L')
            else:
                tmp.append('U')
        ans.append(''.join(tmp))
    ans = '\n'.join(ans)
    return ans

N = int(input())
Pos = [[int(i) for i in input().split()] for j in range(N)]
print(d_robot_arms(N, Pos))

Measured memory_bytes: 3440
#include<iostream>
using namespace std;
int main() {

	//B
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '?') {
			cout << 'D';
		}
		else {
			cout << s[i];
		}
	}
	cout << endl;
	return 0;

	//A
	/*int h1, m1, h2, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;
	int m = (h2 - h1) * 60 + m2 - m1;
	cout << m - k << endl;
	return 0;
	*/


}

Measured memory_bytes: 3748
import copy
s=input()
a=0
n=len(s)
x=[0]*13
if s[-1]=='?':
  x = [int(i<=9) for i in range(13)]
else:
  x[int(s[-1])%13]=1
p=1
for i in range(1,n):
  p=10*p%13
  y=[0]*13
  if s[n-1-i]=='?':
    for j in range(13):
      for k in range(10):
        y[(k*p+j)%13]+=x[j]
  else:
    t=int(s[n-1-i])
    for j in range(13):
      y[(t*p+j)%13]+=x[j]
  x=copy.deepcopy(y)
  x = [z%(10**9+7) for z in x]
print(x[5])

Measured memory_bytes: 53976
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int n;
    scanf("%d",&n);
    char a[101];
   scanf("%s",a);
    int i,j,k,l,max=0;
 
    for(i=0; i<=strlen(a)-2; i++)
    {
        int cont[10000]={0};
        for(j=0; j<=i; j++)
        {
 
            for(k=i+1; k<=strlen(a)-1; k++)
            {
                if(a[j]==a[k])
                {
                    int x=(int)a[j];
                    cont[x]++;
 
                }
            }
 
 
 
        }
        int sum=0;
            for(l=0; l<10000; l++)
            {
                if(cont[l]!=0)
                    sum=sum+1;
            }
            if(max<sum)
                max=sum;
 
    }
 
 printf("%d\n",max);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
#define all(t) (t).begin(),(t).end()
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}



int main(){
	string s;
	cin >> s;
	bool ans=1;
	FOR(i,s.size()){
		if((i+1)%2==1){
			if(s[i]=='L')ans=0;
		}else{
			if(s[i]=='R')ans=0;
		}

	}
	if(ans){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()


int main(){
    ll a, b;
    cin >> a >> b;
    if(a + b == 15){
        cout << '+' << endl;
    }else if(a * b == 15){
        cout << '*' << endl;
    }else{
        cout << 'x' << endl;
    }
    return 0;
}


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

using namespace std;
using i64 = int64_t;

int main()
{
    int n, m, p;
    cin >> n >> m >> p;
    vector<tuple<i64,i64,i64>> edges;
    for(int i = 0; i < m; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        edges.emplace_back(--a, --b, c - p);
    }
    vector<i64> dp(n, -1e18);
    dp[0] = 0;
    i64 tmp;
    for(int i = 0; i < 5500; ++i){
        for(auto& ed : edges){
            i64 a, b, c;
            tie(a, b, c) = ed;
            if(dp[b] < dp[a] + c)
                dp[b] = dp[a] + c;
        }
        if(i == n - 2)
            tmp = dp.back();
    }
    if(tmp != dp.back())
        cout << -1 << endl;
    else
        cout << max(0L, dp.back()) << endl;
    return 0;
}




Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    int n;
    cin >> n;
    if (n == 1) {
        cout << 0 << endl;
        return 0;
    }
    using ii = pair<int, i64>;
    using vii = vector<ii>;
    vector<vii> adj(n);
    for (int i = 0; i < n - 1; i++) {
        int s, t, w;
        cin >> s >> t >> w;
        adj[s].push_back(ii(t, w));
        adj[t].push_back(ii(s, w));
    }

    vi dist(n);
    function<void(int, int)> dfs1 = [&](int v, int par) {
        for (ii& s: adj[v]) {
            if (s.first != par) {
                dfs1(s.first, v);
                dist[v] = max(dist[v], dist[s.first] + s.second);
            }
        }
    };

    dfs1(0, -1);

    i64 ans = 0;
    function<void(int, i64, int)> dfs2 = [&](int v, i64 d_par, int par) {
        vii tmp = {ii(0, 0)};
        for (ii& s: adj[v]) {
            if (s.first == par) {
                tmp.push_back(ii(s.first, d_par + s.second));
            } else {
                tmp.push_back(ii(s.first, dist[s.first] + s.second));
            }
        }
        sort(tmp.begin(), tmp.end(), [](ii a, ii b) {
            return a.second > b.second;
        });
        ans = max(ans, tmp[0].second + tmp[1].second);
        for (ii& s: adj[v]) {
            if (s.first != par) {
                if (s.first == tmp[0].first){
                    dfs2(s.first, tmp[1].second, v);
                } else {
                    dfs2(s.first, tmp[0].second, v);
                }
            }
        }
    };

    dfs2(0, 0, -1);
    cout << ans << endl;
}


Measured memory_bytes: 33832
#include <iostream>

using namespace std;

int main() {
    int n, cnt, k = 0, ans = 0;
    int primes[100], exp[100] = {0};

    cin >> n;

    for (int i = 2; i <= n; i++) {
        bool flag = true;
        for (int j = 2; j <= i; j++) {
            if (i % j == 0 && i != j) {
                flag = false;
                break;
            }
        }
        if (flag) {
            cnt++;
            primes[k++] = i;
        }
    }

    for (int i = 2; i <= n; i++) {
        k = i;
        for (int j = 0; j < cnt; j++) {
            while (k % primes[j] == 0) {
                exp[j]++;
                k /= primes[j];
            }
        }
    }

    // p^74
    for (int i = 0; i < cnt; i++) {
        if (exp[i] >= 74) {
            ans++;
        }
    }

    // p^2 * q^24
    for (int i = 0; i < cnt; i++) {
        for (int j = 0; j < cnt; j++) {
            if (i == j) { continue; }
            if (exp[i] >= 2 && exp[j] >= 24) {
                ans++;
            }
        }
    }

    // p^4 * q^14
    for (int i = 0; i < cnt; i++) {
        for (int j = 0; j < cnt; j++) {
            if (i == j) { continue; }
            if (exp[i] >= 4 && exp[j] >= 14) {
                ans++;
            }
        }
    }

    // p^2 * q^4 * r^4
    for (int i = 0; i < cnt; i++) {
        for (int j = 0; j < cnt; j++) {
            for (int k = j+1; k < cnt; k++) {
                if (i == j || i == k || j == k) { continue; }
                if (exp[i] >= 2 && exp[j] >= 4 && exp[k] >= 4) {
                     ans++;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
#define Fordown(i,a,b) for(register sign i=(sign)(a);i>=(sign)(b);--i)
template<typename T>bool cmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool cmin(T &a,T b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
	T ans=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
	return ans*f;
}
template<typename T>void write(T x,char y)
{
	if(x==0)
	{
		putchar('0'),putchar(y);
		return;
	}
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	static char wr[20];
	int top=0;
	for(;x;x/=10)wr[++top]=x%10+'0';
	while(top)putchar(wr[top--]);
	putchar(y);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("F.in","r",stdin);
	freopen("F.out","w",stdout);
#endif
}
const int N=3e3+5;
int n,X;
void input()
{
	n=read<int>(),X=read<int>();
}
const int mo=998244353;
int dp[N][N<<1];
int mc[N],inv[N];
int power(int x,int y)
{
	int res=1;
	for(;y;x=1ll*x*x%mo,y>>=1)if(y&1)res=1ll*res*x%mo;
	return res;
}
void init()
{
	mc[0]=inv[0]=1;
	For(i,1,n)mc[i]=1ll*mc[i-1]*i%mo;
	inv[n]=power(mc[n],mo-2);
	Fordown(i,n,1)inv[i-1]=1ll*inv[i]*i%mo;
}
int C(int n,int m)
{
	if(n<0||m<0||n<m)return 0;	
	return 1ll*mc[n]*inv[m]%mo*inv[n-m]%mo;
}
void work()
{
	if(X==1){write(power(2,n),'\n');return;}
	dp[0][0]=1;
	For(i,1,n)For(j,1,2)
	{
		For(k,j,X)dp[i][k]=(dp[i][k]+dp[i-1][k-j])%mo;
	}
	int ans=0;
	For(i,0,n)For(j,0,X-1)ans=(ans+1ll*dp[i][j]*C(n,i))%mo;
	//cout<<ans<<endl;
	For(i,0,n)
	{
		if((i+1)*2>X-1)break;
		For(j,0,n)
		{
			if((i+1)*2+j>n)break;
			
			if(X-1>=(i+1)*2)ans=(ans+1ll*dp[j][X-1-(i+1)*2]*C(n,(i+1)*2+j))%mo;
/*			if(dp[j][X-1-i*2]&&C(n,i*2+1+j))
			{
				cout<<i<<' '<<j<<' '<<dp[j][X-1-i*2]<<' '<<C(n,i*2+1+j)<<endl;
			}*/
		}
	}
	
	if(X&1)
	{
		For(i,(X-1)/2,n)
		{
			if((X+1)/2+i>n)break;
			ans=(ans+C(n,(X+1)/2+i))%mo;
		}

	}
	write(ans,'\n');
}
int main()
{

	input();
	init();
	work();
	return 0;
}



Measured memory_bytes: 70656
#include<stdio.h>

#define MAX 100
#define NIL -1

struct node{
  int parent;
  int left;
  int right;
};

struct node T[MAX];
int n;

void PreOrder(int);
void InOrder(int);
void PostOrder(int);

int main(){
  int id, l, r;
  int root;
  int i;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    T[i].parent = T[i].left = T[i].right = NIL;
  }

  for(i=0; i<n; i++){
    scanf("%d%d%d", &id, &l, &r);

    T[id].left = l;
    T[id].right = r;
    
    T[l].parent = id;
    T[r].parent = id;
  }

  for(i=0; i<n; i++){
    if(T[i].parent == NIL){
      root = i;
      break;
    }
  }

  printf("Preorder\n");
  PreOrder(root);
  printf("\n");

  printf("Inorder\n");
  InOrder(root);
  printf("\n");

  printf("Postorder\n");
  PostOrder(root);
  printf("\n");
  
  return 0;
}

void PreOrder(int u){
  if(u == NIL)
    return;

  printf(" %d",u);
  PreOrder(T[u].left);
  PreOrder(T[u].right);
}

void InOrder(int u){
  if(u == NIL)
    return;
  
  InOrder(T[u].left);
  printf(" %d",u);
  InOrder(T[u].right);
}

void PostOrder(int u){
  if(u == NIL)
    return;
  
  PostOrder(T[u].left);
  PostOrder(T[u].right);
  printf(" %d",u);
}



Measured memory_bytes: 2104
N, A, B = gets.chomp.split(" ").map &:to_i
X = gets.chomp.split(" ").map &:to_i
pos = X[0]
dx = B/A
v = 0
(1...N).each do |i|
  _dx = X[i] - pos
  v += _dx <= dx ? _dx * A : B
  pos = X[i]
end
puts v


Measured memory_bytes: 9476
#include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;
struct Ant {
    int pos, idx;
    char dir;
};

int main(void){
    for(int n, l; cin >> n >> l, n;){
        vector<Ant> ant(n);
        for(auto & e : ant) cin >> e.dir >> e.pos;
        rep(i, n) ant[i].idx = i + 1;

        int rest = 0, resi;
        set<int> s;
        rep(i, n) s.insert(i + 1);
        while(s.size() != 0){
            rep(i, n){
                rep(j, n){
                    if(ant[j].pos - ant[i].pos == 2 and
                            ant[i].dir == 'R' and
                            ant[j].dir == 'L'){
                        swap(ant[i].idx, ant[j].idx);
                    }
                }
            }

            bool left = false;
            rep(i, n){
                int dx = ant[i].dir == 'R' ? 1:-1;
                ant[i].pos += dx;
                if(ant[i].pos == 0 or ant[i].pos == l){
                    if(not left or ant[i].pos == 0){
                        resi = ant[i].idx;
                        left = true;
                    }
                    s.erase(ant[i].idx);
                }
            }

            rest++;
        }

        cout << rest << " " << resi << endl;
    }

	return 0;
}

Measured memory_bytes: 3104
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            int N = Integer.parseInt(reader.readLine());
            args = reader.readLine().split(" ");
            int[] L = new int[N];
            for (int i = 0; i < N; i++) {
                L[i] = Integer.parseInt(args[i]);
            }

            Arrays.sort(L);

            int count = 0;

            for (int i = 0; i < N; i++) {
                for (int j = i + 1; j < N; j++) {
                    for (int k = j + 1; k < N; k++) {
                        if (L[k] >= L[i] + L[j]) {
                            break;
                        }

                        count++;
                    }
                }
            }

            System.out.println(count);
        }
    }

}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 100000
i64 parent[MAX_N];
i64 rank__[MAX_N];

void init(i64 n) {
    REP(i, n) {
        parent[i] = i;
        rank__[i] = 0;
    }
}

i64 find(i64 x) {
    if (parent[x] == x) {
        return x;
    } else {
        return parent[x] = find(parent[x]);
    }
}

void unite(i64 x, i64 y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rank__[x] < rank__[y]) {
        parent[x] = y;
    } else {
        parent[y] = x;
        if (rank__[x] == rank__[y]) {
            rank__[x]++;
        }
    }
}

bool same(i64 x, i64 y) {
    return find(x) == find(y);
}

i64 N, M;

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

    i64 x, y, z;
    REP(i, M) {
        cin >> x >> y >> z;
        unite(x-1, y-1);  // 1-origin to 0-origin
    }

    set<i64> unique_parent;
    REP(i, N) {
        unique_parent.insert(find(i));
    }

    cout << SIZE(unique_parent) << endl;

    return 0;
}

Measured memory_bytes: 6528
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 0;
    
    for(int i = 1; i*i <= n; ++i){
      int num = (int)Math.pow(i,2);
      if(num <= n){
        ans = (int)num;
      }else{
        break;
      }
      
    }
    
    System.out.print(ans);
    
  }
}

Measured memory_bytes: 35732
#include <iostream>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <vector>
#include <algorithm>

#define PI acos(-1)
#define INF 0x3f3f3f3f
#define SCD(a) scanf("%d",&a)
#define SCL(a) scanf("%lld", &a)
#define SCLL(a,b) scanf("%lld%lld", &a, &b)
#define SCDD(a,b) scanf("%d%d",&a,&b)
#define SCF(a) scanf("%lf",&a)
#define PTD(a) printf("%d", a)
#define PTL(a) printf("%lld", a)
#define PTLE(a) printf("%lld\n", a)
#define PTDE(a) printf("%d\n",a)
#define MST(a,b) memset(a, b, sizeof(a))
#define FOR(a,b,c) for(int a=b; a<c; a++)
#define pb push_back
#define ll long long

using namespace std;
const int D = 20;
const int L = 1e5 + D;
int n, m, T;
int ans;
int a[L];
vector<int> v;

void solve()
{
    int i,  t;
    for(i=0; i<n; i++){
        SCD(t);
        v.push_back(t);
    }
    sort(v.begin(), v.end());
    ans = 0;
    for(i=1; i<v.size(); i++)
        a[i] = v[i] - v[i-1] - 1 ;
    for(i=2; i<v.size(); i++){
        ans += max(a[i], a[i]);

    }

    PTDE(ans);
}


int main()
{
    int i ,j ,t;
    char a, b;
    cin>>a;
    getchar();
    cin>>b;
    if(a < b)
        cout<<'<'<<endl;
    else if(a > b)
        cout<<'>'<<endl;
    else
        cout<<'='<<endl;
    //cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0;
}

/*


*/


Measured memory_bytes: 384
use std::io;

fn main() {
    loop {
        let (x, y) = input();
        if x == 0 && y == 0 {
            break;
        }

        if x <= y {
            println!("{} {}", x, y);
        } else {
            println!("{} {}", y, x);
        }
    }
}

fn input() -> (i32, i32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");

    let mut iter = s.trim().split_whitespace();

    let a: i32 = iter.next().unwrap().parse().unwrap();
    let b: i32 = iter.next().unwrap().parse().unwrap();

    (a, b)
}



Measured memory_bytes: 5028
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}


/*
int N;
Graph G;

int main() {
  cin >>N;
  rep(i, N-1){
    int a,b; cin >>a >>b; a--; b--;
    G[a].push_back(b); G[b].push_back(a);
  }
}
*/

int main() {
  int n,a,b; cin >>n >>a >>b;
  cout <<min(a,b) <<" " <<max(0, a+b-n) <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>

int main(){
    
    //人数
    //インデックス
    vector<pair<int,int>> p;

    int n;
    cin >> n;
    int cnt = 1;
    for(int i=0;i < n;i++) {
        int a;
        cin >> a;
        p.push_back(make_pair(a,cnt++));
    }
    //firstが小さい順
    sort(p.begin(),p.end());

    for(int i=0;i < p.size();i++){
        cout << p[i].second << " ";

    }


    return 0;
}

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

using namespace std;

int main(){

    int a,b,k;

    cin >> a >> b >> k;
    int i=0;
    while(true){
        if(i == k){break;}
        i++;
        if(a%2 == 1){
            a -= 1;
        }
        b += a/2;
        a /= 2;

        if(i == k){break;}
        i++;
        if(b%2 == 1){
            b -= 1;
        }
        a += b/2;
        b /= 2;
    }
    cout << a << " " << b << endl;
}


Measured memory_bytes: 256
# AOJ 1166 - 迷図と命ず

import sys
from collections import deque

while True:
    W, H = map(int, sys.stdin.readline().strip().split())

    if (W == 0) and (H == 0):
        break

    Ph = []  # Partition horizontal  H * (W -1)  横移動を遮る仕切り
    Pv = []  # Partition vertical  (H - 1) * W  縦移動を遮る仕切り

    for h in range(2 * H - 1):
        p = list(map(int, sys.stdin.readline().strip().split()))
        if h % 2 == 0:
            Ph.append(p)
        else:
            Pv.append(p)

    # ----------------------------------------------------
    fp = [[True] * W for _ in range(H)]  # FootPrint  探索済みか判断する

    q = deque()
    counter = 1
    q.append((0, 0, counter))
    fp[0][0] = False

    ans_counter = 0
    while q:
        flag = False
        ux, uy, counter = q.popleft()
        # print(f'ux: {ux}, uy: {uy}, counter: {counter}')

        if (ux == W - 1) and (uy == H -1):
            ans_counter = counter
            break

        for i in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
            vx = ux + i[0]
            vy = uy + i[1]
            # print(f'vx: {vx} vy: {vy}')

            if (vx < 0) or (vx >= W):
                continue
            if (vy < 0) or (vy >= H):
                continue
            if fp[vy][vx] is False:
                continue
            # print(f'vx: {vx}, vy: {vy}')

            if (i[1] == 1) and (Pv[uy][ux] == 0):  # 縦方向の移動　下
                q.append((vx, vy, counter + 1))
                fp[vy][vx] = False
            elif (i[1] == -1) and (Pv[vy][ux] == 0):  # 縦方向の移動　上
                q.append((vx, vy, counter + 1))
                fp[vy][vx] = False
            elif (i[0] == 1) and (Ph[uy][ux] == 0):  # 横方向の移動　右
                q.append((vx, vy, counter + 1))
                fp[vy][vx] = False
            elif (i[0] == -1) and (Ph[uy][vx] == 0):  # 横方向の移動　左
                q.append((vx, vy, counter + 1))
                fp[vy][vx] = False

    print(ans_counter)



Measured memory_bytes: 6040
n = int(input())
a,x = [],[]
for i in range(n):
    a.append(int(input()))
    xy=[list(map(int,input().split())) for _ in range(a[i])]
    x.append(xy)
ans = 0
for i in range(2**n):
    cnt = 0
    for j in range(n):
        if i&(1<<j):
            for k,l in x[j]:
                if (i>>(k-1))&1!=l:
                    cnt=1
                    break
    if cnt==0:
        ans = max(ans,bin(i).count("1"))

print(ans)

Measured memory_bytes: 3064
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b' ');
    let k: i32 = read(&mut stdin_lock, &mut buf, b'\n');
    let mut hv = vec![0i32; n];
    for i in 0..n - 1 {
        hv[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    hv[n - 1] = read(&mut stdin_lock, &mut buf, b'\n');

    let mut ans = 0;
    for i in 0..n {
        if hv[i] >= k {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
import sys
import itertools


def resolve(in_):
    h, w, k = map(int, next(in_).split())
    c = [row.strip() for row in in_]
    # for i in range(h):
    #     print(c[i].decode())

    ans = 0
    black_char = ord(b'#')
    red_mask = itertools.product(
        itertools.product((True, False), repeat=h),
        itertools.product((True, False), repeat=w),
    )
    for not_red_row, not_red_col in red_mask:
        black_n = 0
        # print(not_red_row, not_red_col)
        for i, j in itertools.product(range(h), range(w)):
            # print(f'  {i=} {j=}')
            if c[i][j] == black_char and not_red_row[i] and not_red_col[j]:
                black_n += 1
                if black_n > k:
                    break
        else:
            if black_n == k:
                ans += 1

    return ans


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9144
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;
int n;
int w[600][600];
int tag[600];

void dfs(int now, int tag_num)
{
    for (int i=now+1; i<=n; ++i)
    {
        if (w[now][i] == 0 && (tag[i]==0 || (tag[i] != tag[now])))
        {
            w[now][i] = w[i][now] = tag_num;
            if (tag[now] == 1)
                tag[i] = 2;
            else tag[i] = 1;
            dfs(i, tag_num);
        }
    }
}

int main()
{
    cin >> n;
    for (int i=1; i<=n; ++i)
    {
        memset(tag, 0, sizeof(tag));
        for (int j=1; j<=n; ++j)
        {
            if (tag[j] == 0)
            {
                tag[j] = 1;
                dfs(j, i);
            }
        }
    }
    for (int i=1; i<=n; ++i)
    {
        for (int j=i+1; j<=n; ++j)
            cout<<w[i][j]<<' ';
        cout<<endl;
    }


    return 0;
}



Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define rrep(i, a, b) for (int i = (a); i < (b); ++i)
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, k;
    cin>>n>>k;
    vl to(n); cin>>to;
    rep(i, n) to[i]--;
    vl dist(n, LINF);
    queue<LP> q;
    q.emplace(0, 0);
    ll ans = 0;
    while (!q.empty()) {
        LP p = q.front(); q.pop();
        ll v = p.fi;
        ll d = p.se;
        if (dist[v] != LINF) {
            if (k <= dist[v]) break;
            ll cycle = d - dist[v];
            k -= dist[v];
            k %= cycle;
            k += dist[v];
            break;
        }
        dist[v] = d;
        q.emplace(to[v], d + 1);
    }
    rep(i, n) if (dist[i] == k) ans = i + 1;
    cout<<ans<<endl;
}

Measured memory_bytes: 6372
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	string s,tem;
    int n;
    cin>>n;
    cin>>s;
    if(s.size()<=n)
    {
        cout<<s<<endl;
    }
    else
    {
        tem = s.substr(0,n);
        tem = tem+"...";
        cout<<tem<<endl;
    }
    return 0;
}


Measured memory_bytes: 3596
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    ll a, b;
    cin >> a >> b;
    if (a >= 13) {
        cout << b << endl;
    } else if (a >= 6) {
        cout << b/2 << endl;
    } else {
        cout << 0 << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i,n) for(int i = 1; i < n+1 ;i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define SZ(x) ((int)(x).size())
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using namespace std;
typedef long long ll;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
const int MAX = 510000;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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;
    }
}

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

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    //COMinit();
    string s;
    cin>>s;
    if((s.at(2)==s.at(3))and (s.at(4)==s.at(5))){
        cout <<"Yes"<< endl;
    }
    else cout <<"No" << endl;
}


Measured memory_bytes: 256
rl = input()

b = 0
f = True
k = [0 for i in range(len(rl))]
for i in range(len(rl) ):

    if  (rl[i] == "R" and not f) or i == len(rl) -1:

        i +=  1 if i == len(rl) -1 else 0
        tmp= int((i - b + 1) /2 )
        k[b - 1]  += (i - b ) - tmp
        k[b] += tmp
        b = i
        f = True

    if i == len(rl) :
        break

    if rl[i] == "R" and rl[i+1] =="L" and f:
        k[i] += int((i - b + 2) /2 )
        k[i + 1] += (i - b + 1) - k[i]
        b = i + 1
        f = False

print(" ".join([str(s) for s in k]))


Measured memory_bytes: 10612
s = input()
t = input()

ds = dict()
dt = dict()
tr = dict()
tr2 = dict()
res = True
for i in range(len(s)):
    ds[s[i]] = True
    dt[s[i]] = True
    if s[i] not in tr:
        tr[s[i]] = t[i]
    else:
        if tr[s[i]] != t[i]:
            res = False

    if t[i] not in tr2:
        tr2[t[i]] = s[i]
    else:
        if tr2[t[i]] != s[i]:
            res = False

if (len(ds) == 26 or len(dt) == 26) and ds != dt:
    res = False

print("Yes" if res else "No")

Measured memory_bytes: 42828
import numpy as np
N, M, C= map(int, input().split())
B = []
B.append(list(map(int, input().split())))
arrB = np.array(B)
#A = np.array()
#for i in range(N):
#    A[i] = input()


#a = list()
#for i in range(M):
#    a.append(map(int, input().split()))

#a = list(a)

A = []
for i in range(N):
    A.append(list(map(int, input().split())))

arrA = np.array(A)

D = np.empty((0,M), int)
for i in range(N):
    D = np.append(D, arrB*arrA[i], axis=0)
#    C.append(arrB*arrA[i])


F = np.empty((0,N), int)
for i in range(N):
    F = np.append(F, np.sum(D[i]))

E = F + C
t=0
for i in range(N):
    if E[i]>0:
        t = t+1
    else:
        t =t



#print(arrB)
#print(arrA)
#print(D)
#print(E)
#print(F)
print(t)


Measured memory_bytes: 12512
#include<stdio.h>
#define M 10010

int main(void){
  int i;
  char ch[M];
  int jcount,icount;

  for(;scanf("%s",ch)==1;){
    jcount=0;
    icount=0;
    for(i=0;ch[i];i++){
      if(ch[i]=='J'){
        if(ch[i+1]=='O' &&
            ch[i+2]=='I'){
          jcount++;
        }
      }
      else if(ch[i]=='I'){
        if(ch[i+1]=='O' &&
            ch[i+2]=='I'){
          icount++;
        }
      }
    }
    printf("%d\n%d\n",jcount,icount);
  }
  return 0;
}

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

const int MAXN = 200005;

char str[MAXN];

int main()
{
	scanf("%s", str+1);
	int n = strlen(str+1);
	int ans = n, cnt = 0;
        for (int j = 1; j <= n; j++) {
		if (str[j] == 'S') cnt++;
		else if (str[j] == 'T') {
			if (cnt) cnt--, ans -= 2;
		} else throw;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 384
//vectorを使ったコード
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        a[i]--;
    }
    vector<int> b(n);
    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    vector<int> c(n - 1);
    for(int i = 0; i < n; i++){
        cin >> c[i];
    }

    int result = 0;
    for(int i = 0; i < n; i++){
        result += b[a[i]];
        if(i > 0 && a[i] == a[i - 1] + 1){
            result += c[a[i - 1]];
        }
    }
    cout << result << endl;
}

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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << "\n";

ll answers[100005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N, K, Q;

  CIN(N >> K >> Q);

  ll minPass = Q - K + 1;

  ll A;
  for (ll i = 0; i < Q; i++) {
    CIN(A);
    answers[A - 1]++;
  }

  for (ll i = 0; i < N; i++) {
    if (minPass <= answers[i]) {
      COUT("Yes");
    } else {
      COUT("No");
    }
  }

  return 0;
}


Measured memory_bytes: 1408
l ,r = map(int, input().split())
t = []
if r-l >= 2019:
  print(0)
  exit()
elif r-l < 2019:
  if 2019 <= l:
    for i in range(l, r):
      for j in range(i+1, r+1):
        ii = i % 2019
        jj = j % 2019
        s = (ii*jj) % 2019
        t.append(s)
    ans = min(t)
    print(ans)
  elif l < 2019 < r:
    for i in range(l, r):
      for j in range(i+1, r+1):
        ii = i % 2019
        jj = j % 2019
        s = (ii*jj) % 2019
        t.append(s)
    ans = min(t)
    print(ans)
  elif r <= 2019:
    for i in range(l, r):
      for j in range(i+1, r+1):
        s = (i*j) % 2019
        t.append(s)
    ans = min(t)
    print(ans)
    

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

int main(){
  int n; cin>>n;
  vector<int > menu(n),satis(n),bonus(n-1);
  for(int i=0;i<n;i++){
    cin>>menu[i];
    menu[i]--;
  }for(int i=0;i<n;i++){
    cin>>satis[i];
  }for(int i=0;i<n-1;i++){
    cin>>bonus[i];
  }long long ans=0;
  for(int i=0;i<n;i++){
    if(i==0){
      ans+=satis[menu[i]];
    }else{
      ans+=satis[menu[i]];
      if(menu[i-1]+1==menu[i]){
        ans+=bonus[menu[i-1]];
      }
    }
  }
  cout<<ans<<endl;
}


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

int main(){
    int one, ten, hundred;

    char x;
    string xs;

    cin >> xs;

    one = 10 - (xs[2] - '0');
    ten = 10 - (xs[1] - '0');
    hundred = 10 - (xs[0] - '0');

    cout << hundred * 100 + ten * 10 + one << endl;

    return 0;
}


Measured memory_bytes: 256
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""

def readInts():
  return list(map(int,input().split()))

def main():
  n,m = readInts()
  a = readInts()
  s = sum(a)
  cnt = 0
  for i in range(n):
    if a[i]*4*m >= s:
      cnt+=1
  if cnt >= m:print("Yes")
  else:print("No")
if __name__ == '__main__':
  main()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

int N, K;
int a[5010];
int dp[5010][5010];

bool solve(int idx){
    // dp: a[idx] を含まずに構成可能なaの和j
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;
    REP(i, N){
        REP(j, K){
            chmax(dp[i+1][j], dp[i][j]);
            if(i != idx && j+a[i] < K) chmax(dp[i+1][j+a[i]], dp[i][j]);
        }
    }

    FOR(i, max((int)0, K-a[idx]), K){
        if(dp[N][i]) return true;
    }

    return false;
}

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

    cin >> N >> K;
    REP(i, N) cin >> a[i];
    
    sort(a, a+N);

    int ok = N;
    int ng = -1;
    while(abs(ok-ng) > 1){
        int mid = (ok+ng)/2;
        if(solve(mid)){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    cout << ok << "\n";

    return 0;
}

Measured memory_bytes: 196352
def check(a, b):
  if b < a:
    a, b = b, a
  if b - a <= 1:
    return 2 * a - 2
  d = a * b
  c, ng = a, b
  while ng - c > 1:
    mid = (ng + c) // 2
    if mid ** 2 < d:
      c = mid
    else:
      ng = mid
  return 2 * c - 1 - (c * (c + 1) >= a * b)

for _ in range(int(input())):
  print(check(*list(map(int, input().split()))))


Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#define N 55
using namespace std;

int n, m, Q, mx, a[N], b[N], c[N], d[N], x[15];

void dfs(int p, int q) {
	int i, s=0;
	if(p==n+1) {
		for(i=1; i<=Q; i++) if(x[b[i]] - x[a[i]] == c[i]) s += d[i];
		mx = max(mx, s);
		return;
	}
	for(i=q; i<=m; i++) {
		x[p] = i;
		dfs(p+1, i);
	}
}

int main() {
	cin >> n >> m >> Q;
	for(int i=1; i<=Q; i++) cin >> a[i] >> b[i] >> c[i] >> d[i];
	dfs(1, 1);
	cout << mx;
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std; 
int main() {
  int N; 
  cin >> N; 
  int arr[N];  
  int inpt; 
  int total = 0; 
  for (int i = 0; i < N - 1; i++){ 
    cin >> inpt;
    arr[i] = inpt;
  }
  total += arr[0]; 
  for (int i = 1; i < N - 1; i++){ 
    total += min(arr[i-1],arr[i]); 
  }
  total += arr[N-2]; 
  cout << total; 
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;
typedef unsigned long long ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
typedef pair<ll, pair<ll, ll > > iip;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;

int main(){

    ll N, K; cin >> N >> K ;

    map<ll, ll> mp;
    
    for(ll i = 0; i < N; i++){
        ll t = 0; cin >> t;
        mp[t]++;
    }

    if(mp.size() <= K){
        cout << 0 << endl;
        return 0;
    }

    priority_queue<ll , vector<ll > , greater<ll > > que;

    auto begin = mp.begin(), end = mp.end();
    for (auto iter = begin; iter != end; iter++) {
        que.push(iter->second);
    }   

    ll ans = 0;

    while(que.size() > K){
        ans += que.top(); que.pop();
    }

    cout << ans << endl;

}

Measured memory_bytes: 14964
#include <stdio.h>
#define ll long long
ll n, m;
ll arr[3] = {};
double val[301][301][301];
double solve(ll a, ll b, ll c)
{
    if (a < 0 || b < 0 || c < 0 || a + b + c == 0)
    {
        return 0;
    }
    else if (val[a][b][c] > 0)
    {
        return val[a][b][c];
    }
    else
    {
        val[a][b][c] = (n + solve(a - 1, b, c) * a + solve(a + 1, b - 1, c) * b + solve(a, b + 1, c - 1) * c) / (a + b + c);
        return val[a][b][c];
    }
}
int main()
{
    scanf("%lld", &n);
    if (n)
    {
        for (ll i = 0; i < n; i++)
        {
            scanf("%lld", &m);
            arr[m - 1]++;
        }
        printf("%.12lf", solve(arr[0], arr[1], arr[2]));
    }
    else
    {
        printf("0");
    }
    return 0;
}

Measured memory_bytes: 213248
#include <stdio.h>
#include <inttypes.h>

int main(void) {
	int N;
	int i;
	uint64_t wa = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 1; i <= N; i++) {
		if (i % 3 != 0 && i % 5 != 0) wa += i;
	}
	printf("%" PRIu64 "\n", wa);
	return 0;
}


Measured memory_bytes: 1720