akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>
 
typedef struct {
  int par, sib, lch, rch, depth, height;
} node;
 
#define MAX_N 25
 
int n;
node T[MAX_N];
 
int max(int a, int b) {
  return a > b ? a : b;
}
 
int dfs(int u, int depth) {
  int hl = 0, hr = 0;
  T[u].depth = depth;
  if(T[u].lch != -1){
    hl = dfs(T[u].lch, depth+1) + 1;
  }
  if(T[u].rch != -1) {
    hr = dfs(T[u].rch, depth+1) + 1;
  }
  return T[u].height = max(hl, hr);
}
 
int main() {
  int root = -1;
  int i;
  for(i = 0; i < MAX_N; i++) {
    T[i] = (node){-1, -1, -1, -1, -1, -1};
  }
  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    int id, lch, rch;
    scanf("%d %d %d", &id, &lch, &rch);
    T[id].lch = lch;
    T[id].rch = rch;
    if(lch != -1) {
      T[lch].sib = rch;
      T[lch].par = id;
    }
    if(rch != -1) {
      T[rch].sib = lch;
      T[rch].par = id;
    }
  }
  for(i = 0; i < n; i++) {
    if(T[i].par == -1) root = i;
  }
  dfs(root, 0);
  for(i = 0; i < n; i++) {
    char type[256];
    int deg = 0;
    if(T[i].par == -1){
      strcpy(type, "root");
    }
    else if(T[i].lch == -1 && T[i].rch == -1){
      strcpy(type, "leaf");
    }
    else{
      strcpy(type, "internal node");
    }
    if(T[i].lch != -1){
      deg++;
    }
    if(T[i].rch != -1){
      deg++;
    }
    printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,T[i].par,T[i].sib,deg,T[i].depth,T[i].height);
    puts(type);
  }
  return 0;
}

Measured memory_bytes: 612
# -*- coding: utf-8 -*-

# AtCoder Beginner Contest
# Problem B

if __name__ == '__main__':
    from bisect import bisect_left

    n, m, x = list(map(int, input().split()))
    a = list(map(int, input().split()))
    low = bisect_left(a, x)
    print(min(len(a[:low]), len(a[low:])))


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

int main() {
  int N;
  cin >> N;
  
  int c = 0, d = 0, e = 0, f = 0;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    
    if (s == "AC") c++;
    else if (s == "WA") d++;
    else if (s == "TLE") e++;
    else f++;
  }
  
  cout << "AC x " << c << endl;
  cout << "WA x " << d << endl;
  cout << "TLE x " << e << endl;
  cout << "RE x " << f << endl;
  
}


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

#define ll long long
#define eb emplace_back
#define nl '\n'
#define deb(x) cerr << #x" = " << x << nl
#define in() ( { int a ; scanf("%d", &a); a; } )

const int N = 1e6 + 9;
const int mod = 1e9 + 7;


string s;
int n,dp[N][2];
int yo(int i,int k)
{
    if(i==n) return k;
    int &ret=dp[i][k];
    if(ret!=-1) return ret;
    ret=(s[i]-'0')+k+yo(i+1,0);///+10^i
    ret=min(ret,10-k-(s[i]-'0')+yo(i+1,1));///-10^i
    return ret;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin>>s;
    reverse(s.begin(), s.end());
    n = s.size();
    memset(dp, -1, sizeof dp);
    cout<<yo(0,0)<<nl;
    return 0;
}


Measured memory_bytes: 56092
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

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

  string S;
  cin >> S;
  int64_t n = S.size();
  vector<int64_t> sol(n, 0);

  int64_t mv = 0;
  vector<int64_t> mvs(n, 0);
  for (int64_t i = n - 1; i > -1; i--) {
    if (S.at(i) == 'R') {
      mv++;
      mvs.at(i) = mv;
    } else {
      mv = 0;
    }
  }

  mv = 0;
  for (int64_t i = 0; i < n; i++) {
    if (S.at(i) == 'L') {
      mv--;
      mvs.at(i) = mv;
    } else {
      mv = 0;
    }
  }

  for (int64_t i = 0; i < n; i++) {
    sol.at(i + mvs.at(i) - (abs(mvs.at(i)) / mvs.at(i)) * (abs(mvs.at(i)) % 2))++;
  }

  for (int64_t i = 0; i < n; i++) {
    cout << sol.at(i) << " ";
  }

  return 0;
}


Measured memory_bytes: 4976
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
//#include <unistd.h>
//#include <stdio.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const ld pi = 3.14159265358;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}

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

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

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logN)
ll modpow(ll n,ll m,ll MOD){
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}

//printf("%.10f\n", N);
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/

//    cout << fixed << setprecision(15);

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    ll s = S.size();
    ll a = 0,b = 0,c = 0;
    rep(i,s){
        if(S[i] == 'a')a++;
        if(S[i] == 'b')b++;
        if(S[i] == 'c')c++;
    }
    vector<ll> num = {a,b,c};sort(all(num));
    if(num[2] - num[0] <= 1)
    cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 3736
let N: Int = Int(readLine()!)!
let A: [Int] = [0] + readLine()!.characters.split(" ").map{Int(String($0))!} + [0]
func cost(i: Int, _ j: Int) -> Int {
  return abs(A[i] - A[j])
}
let sum: Int = (0...N).reduce(0){$0 + cost($1, $1+1)}
for i in 1...N {
  let ans: Int = sum + cost(i-1, i+1) - cost(i-1, i) - cost(i, i+1)
  print(ans)
}

Measured memory_bytes: 9324
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define sz(x)  (long long)(x).size()
#define sqr(x) (x)*(x)
#define sof sizeof
#define resz resize
#define ins insert
#define lowerB lower_bound
#define upperB upper_bound
#define mkp make_pair
#define mkt make_tuple
#define act(a,v) (get<(long long)a>(v))
#define mod 1000000007
#define mod1 998244353
#define N 400003  //N idhar hai
#define inf 1e10
#define minf -1e18
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define sumall(v) accumulate(all(v),(ll)0)
#define suma accumulate
#define FastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PRECISION(n) std::cout.unsetf ( std::ios::floatfield );std::cout.precision((ll)n)
#define PI M_PI
#define fi first
#define se second
#define here cout<<"RSSB"<<endl
#define showzero cout<<std::showpoint
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) ((a*b)/gcd(a,b))
#define bitcount( x ) __builtin_popcountll( x )
#define br "\n"
#define sp " "
using namespace  std ;
typedef double db;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
typedef vector<bool>vbool ;
void READ(vll &v, ll n){ll a ;for(ll i=0 ; i<n ; i=i+1){cin>>a ;v.pb(a);}}
void PRINT(vll &v , ll a = 0){for(ll i=a ; i<v.size() ; i=i+1){/*v[i] = max((ll)0,v[i]);*/cout<<v[i]<<" " ;}cout<<"\n" ;}
double logy(ll n , ll b){if(b==0){return(-1);}if(n==1){return(0);}return((db)log10(n)/log10(b));}
long long power(long long k , long long n , long long m=mod){long long res = 1;while(n){if(n%2!=0){res = (res*k)%m ;}k = (k*k)%m ;n = n/2 ;}return(res) ;}
double power(double k , long long n ){double res = 1;while(n){if(n%2!=0){res = (res*k) ;}k = (k*k) ;n = n/2 ;}return(res) ;}
double distance(pll a , pll b){return((db)(sqrt( sqr(a.fi-b.fi) + sqr(a.se-b.se))));}
const ll dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const ll dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
vpll dr;
void call(){dr.pb(mkp(1,0));dr.pb(mkp(-1,0));dr.pb(mkp(0,1));dr.pb(mkp(0,-1));}
ll n,m,k,h;
bool ok = false;
int main()
{
    FastIO ;
    PRECISION(10) ;
    ll a,b,c,d,i,j,t,x,y,z;//,x1,y1,z1,e,f;
    db p,q,r,u,w ;
    char ch,chr ;
    string str,st,str1,str2,str3,str4;
    //ll a1=0,a2=0,b1=0,b2=0,c1=0 ;
    //cin>>str>>str1;
    //Stay Motivated!!
    //Never use i for two or more nested loops!!
    //Range Query + Constructive + DSU  +  Graph Theory + Math + DP + Bitmasks + Geometry + Brute Force + Greedy + Implementation + Binary Search
    cin>>str;
    if(count(all(str),'A') && count(all(str),'B'))
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	// Code for E - Sequence Sum
	var N, X, M int
	fmt.Scan(&N, &X, &M)

	var A, B int
	A = X
	var S int
	S += A

	var numB, numA, C int
	test := make(map[int]int, M+1)

	var SB, SA int
	var flag int = 0
	for i := 2; i <= N; i++ {
		B = (A * A) % M
		A = B
		S += A
		test[B]++

		if flag == 1 && B == C {
			numA = i
			SA = S
			break
		}

		if test[B] > 2 && flag == 0 {
			numB = i
			C = B
			SB = S
			flag++
		}
	}

	if flag == 0 {
		fmt.Println(S)
	} else {
		//fmt.Println(((N - numA) / (numB - numA)))
		ans := SB + (SA-SB)*((N-numB)/(numA-numB))
		D := C
		for i := 1; i <= (N-numB)%(numA-numB); i++ {
			E := (D * D) % M
			ans += E
			D = E
		}
		fmt.Println(ans)
	}

}


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

#define endl "\n"
#define f first
#define s second
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long, long long>
#define ll long long
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const ll M = 998244353;
const int N = 5*1e5+5;
const ll INF = 1e18;

ll a[N],n;
string s;

int main() {
	cin>>s;
	for (int i = s.size()-1; i>=0; i--) {
		if (s[i] == '>') {
			a[i] = max(a[i+1]+1,a[i]);
		}
	}
	for (int i = 0; i<s.size(); i++) {
		if (s[i] == '<') {
			a[i+1] = max(a[i+1],a[i]+1);
		}
	}
	ll ans = 0;
	for (int i = 0; i<=s.size(); i++) {
		ans+=a[i];
		//cout<<a[i]<<' ';
	}
	cout<<ans;

    return 0;
}


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

int main()
{
    char s[5];
    cin >> s;
    if ( s [0]== s [1]&& s [1]== s [2]) puts (" Yes ");
    else if ( s [1]== s [2]&& s [2]== s [3]) puts (" Yes ");
    else puts (" No ");
}

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

void main()
{
    auto N = readln.chomp.to!int;
    int sum_p, max_p;
    foreach (_; 0..N) {
        auto p = readln.chomp.to!int;
        sum_p += p;
        max_p = max(max_p, p);
    }
    writeln(sum_p - max_p / 2);
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
void me()
{
std::ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
}
typedef long long ll;
#define bay_bay return 0;
#define forn for(int i=0;i<n;++i)
#define forsz for(int i=0;i<s.size();++i)
#define all(v) ((v).begin()), ((v).end())
#define sz(v) v.size()
void stop() {
#ifndef ONLINE_JUDGE
system("pause");
#endif
}
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
string arr[100009];
int main()
{
me();
ll a,b;
cin>>a>>b;
ll n=a;
int c=0;
while(a--)
{
    cin>>arr[c];
    c++;
}
sort(arr,arr+n);
forn
cout<<arr[i];
}


Measured memory_bytes: 1024
n,k=map(int,input().split())
lr=[list(map(int,input().split())) for _ in range(k)]
mod=998244353
dp=[0]*n
dp[0]=1
for i in range(n):
  if i>1:
    dp[i]+=dp[i-1]
    dp[i]%=mod
  for l,r in lr:
    if i+l<n:
      dp[i+l]+=dp[i]
      dp[i+l]%=mod
    if i+r+1<n:
      dp[i+r+1]-=dp[i]
      dp[i+r+1]%=mod
print(dp[-1]%mod)


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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  int ans = 0;
  for (int i = 1; i < N+1; ++i) {
    int num = i;
    int sum = 0;
    while(num){
      sum += num % 10;
      num /= 10;
    }
    if ((sum >= A) && (sum <= B)) {
      ans += i;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 345;
double dp[MAXN][MAXN][MAXN];
bool visit[MAXN][MAXN][MAXN];

double dfs(int c1, int c2, int c3, int N) {
    if (visit[c1][c2][c3]) return dp[c1][c2][c3];
    visit[c1][c2][c3] = 1;
    if (!c1 && !c2 && !c3) return 0.0;
    int c0 = N - c1 - c2 - c3;
    double res = (double)c0 / N;
    if (c1) res += (dfs(c1 - 1, c2, c3, N) + 1) * ((double)c1 / N);
    if (c2) res += (dfs(c1 + 1, c2 - 1, c3, N) + 1) * ((double)c2 / N);
    if (c3) res += (dfs(c1, c2 + 1, c3 - 1, N) + 1) * ((double)c3 / N);
    return dp[c1][c2][c3] = ((double)N / (N - c0) * res);
}

int main() {
    int N;
    scanf("%d", &N);
    vector<int> cnt(4, 0);
    for (int i = 0; i < N; i++) {
        int a;
        scanf("%d", &a);
        cnt[a]++;
    }
    printf("%.10lf\n", dfs(cnt[1], cnt[2], cnt[3], N));
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
by Benq;
*/


Measured memory_bytes: 143132
#include <iostream>

using namespace std;

int main(){
  int n,t;
  int m;
  char v;
  bool ie;
  while(cin >> n,n){
    m=n;
    int a[35]={0};
    int first=30;int second=30;
    ie=false;
    while(n--){
      //cout << n << endl;
      cin >> v;
      t=v-'A';
      a[t]++;
      //cout << n << " " << v << endl;
      if(t!=first&&a[t]>=a[first]){
        second=first;
        first=t;
      }
      else if(t!=first&&t!=second&&a[t]>a[second]){
        second=t;
      }
      if(a[first]>a[second]+n&&ie==false){
        cout << char(first+'A') << " " << m-n << endl;
        ie=true;
      }
      //cout << char(first+'A')<< " " << char(second+'A') << " " << endl;
    }
    if(a[first]==a[second])cout << "TIE" << endl;
    else if(!ie)cout << char(first+'A') << " " << m << endl;
  }
}

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


int main(){
    int N, M;
    cin >> N >> M;
    cout << ((N==M)? "Yes":"No") << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;


ll rec(ll b, ll n) {
  if (n < b) return n;
  else return rec(b, n/b) + n%b;
}


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

  ll b;
  for (b = 2; b*b <= n; ++b) {
    if (s == rec(b, n)) {
      cout << b << "\n";
      return 0;
    }
  }
  for (ll k = b-1; k > 0; --k) {
    b = (n+k-s) / k;
    if (b < 2) continue;
    if (s == rec(b, n)) {
      cout << b << "\n";
      return 0;
    }
  }

  if (s == n) cout << n+1 << "\n";
  else cout << -1 << "\n";

  return 0;
}


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


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,ma,mb;cin>>n>>ma>>mb;
    vector<ll> a(n),b(n),c(n);
    rep(i,n)cin>>a[i]>>b[i]>>c[i];
    ll n1 = n/2, n2 = n-n1;
    vector<P> cost1;
    rep(i,1<<n1){
        ll amb_minus_bma = 0;
        ll cost = 0;
        rep(j,n1){
            if((i>>j)&1){
                amb_minus_bma += a[j]*mb - b[j]*ma;
                cost += c[j];
            }
        }
        cost1.push_back(P(amb_minus_bma,cost));
    }
    sort(cost1.begin(),cost1.end());
    ll ans = INF;
    rep(i,1<<n2){
        ll amb_minus_bma = 0;
        ll cost = 0;
        rep(j,n2){
            if((i>>j)&1){
                amb_minus_bma += a[n1+j]*mb - b[n1+j]*ma;
                cost += c[n1+j];
            }
        }
        auto itr = lower_bound(cost1.begin(),cost1.end(),P(-amb_minus_bma,cost==0?1:0));
        
        if(itr!=cost1.end()&&(*itr).first==-amb_minus_bma){
            cost = cost+(*itr).second;
            if(cost!=0)ans=min(ans,cost);
        }
    }
    if(ans==INF)cout<<-1;
    else cout<<ans;


    return 0;
}

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

int main() {
	bool prime[100000];
	fill(prime, prime + 100000, 1);
	prime[0] = prime[1] = false;
	for (int i = 2; i * i < 100000; i++) {
		for (int j = 2; i * j < 100000; j++) {
			if (!prime[i * j]) continue;
			prime[i * j] = false;
		}
	}

	int n;
	while (cin >> n) {
		int i = 0;
		for (int i = n - 1; i >= 0; i--) {
			if (prime[i]) {
				cout << i << " ";
				break;
			}
		}
		for (int i = n + 1; i < 100000; i++) {
			if (prime[i]) {
				cout << i << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3152
n=int(input())
if n==1:
    print(0)
    exit()
def sosuu(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
if sosuu(n):
    print(1)
    exit()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

 


ff=factorization(n) 
d=[]
ans=0
for i,j in ff:
    tmp=0
    while j>0:
        tmp+=1
        j-=tmp

        if j<0:
            break
        ans+=1
print(ans)


Measured memory_bytes: 63708
// AtCoder Grand Contest 019
// C - Fountain Walk

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;


const int MAX_N = 200000;
const int INF = (int)1e9;
const long double PI_L = acos(-1.0L);

int X1, Y1, X2, Y2;
int N, K;
int inv_x, inv_y;
vector<pii> a;
int dp[MAX_N];

int main() {

    int x, y;
    long double ans;
    int cnt, arcs;

    cin >> X1 >> Y1 >> X2 >> Y2;
    cin >> N;
    inv_x = X1 > X2 ? -1 : 1;
    inv_y = Y1 > Y2 ? -1 : 1;
    X1 *= inv_x; X2 *= inv_x;
    Y1 *= inv_y; Y2 *= inv_y;

    for (int i = 0; i < N; i++) {
        cin >> x >> y;
        x *= inv_x; y *= inv_y;
        if (X1 <= x && x <= X2 && Y1 <= y && y <= Y2) {
            a.push_back(pii(x, y));
        }
    }
    sort(a.begin(), a.end());
    K = a.size();

    fill(dp, dp + K, INF);
    for (int j = 0; j < K; j++) {
        *lower_bound(dp, dp + K, a[j].second) = a[j].second;
    }
    cnt = lower_bound(dp, dp + K, INF) - dp;
    arcs = (cnt == min(X2 - X1, Y2 - Y1) + 1) ? cnt + 1 : cnt;

    ans = 100.0L * ((X2 - X1) + (Y2 - Y1)) - 20.0L * cnt + 5.0L * arcs * PI_L;

    cout << fixed << setprecision(20) << ans << endl;

    return 0;

}



Measured memory_bytes: 2672
from operator import itemgetter

n = int(input())
XLs = [list(map(int, input().split())) for i in range(n)]

for i in range(n):
    x = XLs[i][0]
    l = XLs[i][1]
    XLs[i].append(x+l)

#右手の端の位置でソート
XLs.sort(key=itemgetter(2))

choice = -10**10
cnt = 0
for i in range(n):
    x = XLs[i][0]
    l = XLs[i][1]

    if choice <= x-l:
        choice = x+l
        cnt += 1

print(cnt)

Measured memory_bytes: 32292
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

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

const ll mod=1000000007;

ll countBits(ll in){
  int res=0;
  for(;in>0;in>>=1){
    if((in&0x01)!=0){
      res++;
    }
  }
  return res;
}

template<typename T>
void show2dVector(vector<vector<T>>& v){
  for(int i=0;i<v.size();i++){
    int m=v[i].size();
    cout<<i<<" : ";
    for(int j=0;i<m;i++){
      cout<<v[i][j]<<" ";
    }
    cout<<endl;
  }
}

void bfs(const vector<vector<int>>&g, int v, vector<bool>& seen){
  seen[v]=true;
  cout<<v<<" ";
  for(auto next: g[v]){
    if(seen[next]){
      continue;
    }
    bfs(g,next,seen);
  }
}

bool dfs(vector<vector<int>> &g,int start,int goal,vector<bool>&seen){
  bool res=false;
  seen[start]=true;
  if(start==goal){
    return true;
  }
  for(auto next: g[start]){
    if(seen[next]){
      continue;
    }
    res=dfs(g,next,goal,seen);
    if(res){
      break;
    }
  }
  return res;
}

ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}

ll powm(ll a,ll n, ll m){
  ll ret=1;
  while(n>0){
    if(n%2==1){
      ret=(ret*a)%m;
    }
    n>>=1;
    a=(a*a)%m;
  }
  return ret;
}

const string yesno(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  string s;cin>>s;
  for(int i=0;i<s.size();i+=2){
    cout<<s[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define EPS (1e-7)
#define INF (1e9)
#define N 105
using namespace std;
typedef pair<double,int> P1;
typedef complex<double> P;
typedef pair<P,P> L;
vector<vector<P> > Stars;
int n,m,l,x,y,a,r;
double d[N];

P Rot_P(P p,int sita){
  return P(p.real()*cos(sita*M_PI/180.0)-p.imag()*sin(sita*M_PI/180.0),
	   p.real()*sin(sita*M_PI/180.0)+p.imag()*cos(sita*M_PI/180.0));
}

void Make_Star(){
  P p=P(0,r);
  p=Rot_P(p,a);
  vector<P> Star;
  for(int i=0;i<5;i++){
    Star.push_back(P(p.real()+x,p.imag()+y));
    p=Rot_P(p,216);
  }
  Stars.push_back(Star);
}

double dot(P a, P b){ return real(conj(a)*b); }

double cross(P a, P b){ return imag(conj(a)*b); }

double getDistanceSP(L s, P p){
  if(dot(s.second - s.first, p - s.first) < -EPS) return abs(p - s.first);
  if(dot(s.first - s.second, p - s.second) < -EPS) return abs(p - s.second);
  return abs(cross(s.second - s.first, p - s.first) / abs(s.second - s.first));
}

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b,c) > EPS) return 1;
  if(cross(b,c) < -EPS) return -1;
  if(dot(b,c) < -EPS) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}

bool isIntersect(L s1, L s2){
  return ( ccw(s1.first,s1.second,s2.first) * ccw(s1.first,s1.second,s2.second) <= 0 &&
           ccw(s2.first,s2.second,s1.first) * ccw(s2.first,s2.second,s1.second) <= 0 );
}

double getDistanceSS(L s1, L s2){
  if(isIntersect(s1,s2)) return 0.0;
  return min( min(getDistanceSP(s1, s2.first), getDistanceSP(s1, s2.second)),
              min(getDistanceSP(s2, s1.first), getDistanceSP(s2, s1.second)));
}

double get_d(int A,int B){
  double res=INF;
  for(int i=0;i<5;i++){
    L l1=L(Stars[A][i],Stars[A][(i+1)%5]);
    for(int j=0;j<5;j++){
      L l2=L(Stars[B][j],Stars[B][(j+1)%5]);
      res=min(res,getDistanceSS(l1,l2));
    }
  }
  return res;
}

double dijkstra(){
  priority_queue<P1,vector<P1>,greater<P1> > q;
  for(int i=0;i<n;i++)d[i]=INF;
  q.push(P1(0,m));
  d[m]=0;
  while(!q.empty()){
    P1 t=q.top(); q.pop();
    double cost=t.first;
    int node=t.second;
    if(d[node]+EPS<cost)continue;
    if(node==l)return cost;
    for(int i=0;i<n;i++){
      if(node==i)continue;
      double ncost=cost+get_d(node,i);
      if(d[i]>ncost+EPS){
	d[i]=ncost;
	q.push(P1(ncost,i));
      }
    }
  }
  return INF;
}

int main(){
  while(1){
    cin>>n>>m>>l;
    if(!n&&!m&&!l)break;
    m--; l--;
    for(int i=0;i<n;i++){
      cin>>x>>y>>a>>r;
      Make_Star();
    }
    printf("%.20f\n",dijkstra());
    for(int i=0;i<n;i++)Stars.clear();
  }
  return 0;
}

Measured memory_bytes: 3488
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

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

    int q;
    cin >> q;
    bitset<64> b;
    while (q--) {
        int com, i;
        cin >> com;
        switch (com) {
        case 0:
            cin >> i;
            cout << b.test(i) << endl;
            break;
        case 1:
            cin >> i;
            b.set(i);
            break;
        case 2:
            cin >> i;
            b.reset(i);
            break;
        case 3:
            cin >> i;
            b.flip(i);
            break;
        case 4:
            cout << b.all() << endl;
            break;
        case 5:
            cout << b.any() << endl;
            break;
        case 6:
            cout << !b.any() << endl;
            break;
        case 7:
            cout << b.count() << endl;
            break;
        case 8:
            cout << b.to_ullong() << endl;
            break;
        }
    }
}



Measured memory_bytes: 3144
N = int(input())
A = list(map(int, input().split()))

limit = 10 ** 18
res = A[0]

if 0 in A:
    print(0)
    exit(0)
else:
    for i in range(1, N):
        res *= A[i]
        if res > limit:
            print(-1)
            exit(0)

print(res)

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

ll dp[3010][3010][4];
ll item[3010][3010];

int main(){
  int R,C;ll K;
  cin>>R>>C>>K;
  rep(i,K){
    int r,c;cin>>r>>c;r--,c--;
    int v;cin>>v;
    item[r][c]=v;
  }
  rep(i,3010)rep(j,3010)rep(k,4)dp[i][j][k]=0;
  dp[0][0][1] = item[0][0];
  rep(i,R){
    rep(j,C){
      rep(k,4){
        if(i+1<R){
          dp[i+1][j][0] = max(dp[i+1][j][0],dp[i][j][k]);
          dp[i+1][j][1] = max(dp[i+1][j][1],dp[i][j][k]+item[i+1][j]);
        }
        if(j+1<C){
          dp[i][j+1][k] = max(dp[i][j+1][k],dp[i][j][k]);
          if(k+1<=3) dp[i][j+1][k+1] = max(dp[i][j+1][k+1], dp[i][j][k] + item[i][j+1]);
        }
      }
    }
  }
  cout << *max_element(dp[R-1][C-1], dp[R-1][C-1]+4) << endl;
  return 0;
}

Measured memory_bytes: 357208
import sys
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def solve():
    ans = 0
    for i in range(n):
        a = l[i]
        for j in range(i+1,n):
            b = l[j]
            for k in range(j+1,n):
                c = l[k]
                if a!=b and a!=c and b!=c:
                    if a+b>c and b+c>a and c+a>b:
                        ans += 1
    print(ans)
    return

if __name__=='__main__':
    n = I()
    l = list(IL())
    solve()

Measured memory_bytes: 9208
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int b[26] = {};
    string a;
    cin >> a;
    for ( int i = 0 ; i < a.length() ; i++ ) {
        b[a[i] - 'a']++;
        if( b[a[i] - 'a'] >= 2 ) {
            cout << "no";
            return 0;
        }
    }
    cout << "yes";
}


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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define fi first
#define se second
#define setpre(x) cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ cout << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 100005;

/* ...o(^-^)o... */
struct edge{
    int from, to, id;
};

int n;
vector<edge> G[50];
lint path[20];

lint bfs(int u, int v){
    bool seen[50]; edge rev[50];
    fill(seen, seen+n, false);
    queue<int> q; q.push(u);
    while(!q.empty()){
        int w = q.front(); q.pop();
        if(w == v) break;
        seen[w] = true;
        for(edge& e : G[w]){
            if(seen[e.to]) continue;
            q.push(e.to);
            rev[e.to] = e;
        }
    }
    lint ans = 0;
    while(1){
        ans |= (1LL << (rev[v].id));
        v = rev[v].from;
        if(v == u) break;
    }
    return ans;
}

int main(){
    cin >> n;
    rep(i, n - 1){
        ii2(a, b); a--; b--;
        G[a].push_back(edge{a, b, i});
        G[b].push_back(edge{b, a, i});
    }
    ii(m);
    rep(i, m){
        ii2(u, v); u--; v--;
        path[i] = bfs(u, v);
    }
    lint M = (1 << m); lint ans = 0;
    rep(i, M){
        lint bit = 0;
        rep(j, m){
            if(i & (1 << j)) bit = bit | path[j];
        }
        ans += (1LL << (n-1-bit_c(bit))) * ((bit_c(i)%2==0)?1:-1);
    }
    out(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,sum;
  cin>>n;
  sum=0;
  for(int i=n;i>0;i=i/10){
    int f;
    f=i%10;
    sum=sum+f;
  }
  if(n%sum==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

struct edge{int to;ll cost;};
vector<edge> G[200200];
ll D[200200];
void dijkstra(int N,int S){
  priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> que;
  rep(i,N) D[i]=1001001001001001001;
  D[S]=0;
  que.push(mp(0,S));
  while(!que.empty()){
    PII P=que.top();
    que.pop();
    int X=P.second;
    if(D[X]<P.first) continue;
    rep(i,G[X].size()){
      edge E=G[X][i];
      if(D[E.to]>D[X]+E.cost){
        D[E.to]=D[X]+E.cost;
        que.push(mp(D[E.to],E.to));
      }
    }
  }
}

int main(){
  int N,M,S;
  cin>>N>>M>>S;
  VI U(M),V(M),A(M),B(M);
  rep(i,M) cin>>U[i]>>V[i]>>A[i]>>B[i];
  VI C(N),F(N);
  rep(i,N) cin>>C[i]>>F[i];
  map<PII,int> E;
  int cnt=0;
  rep(i,N) rep(j,2501) E[mp(i,j)]=cnt++;
  rep(i,N) rep(j,2500) G[E[mp(i,j+1)]].pb(edge{E[mp(i,j)],0});
  rep(i,N) rep(j,2501) G[E[mp(i,j)]].pb(edge{E[mp(i,min(j+C[i],2500ll))],F[i]});
  rep(i,M) rep(j,2501) if(j-A[i]>=0) G[E[mp(U[i]-1,j)]].pb(edge{E[mp(V[i]-1,j-A[i])],B[i]});
  rep(i,M) rep(j,2501) if(j-A[i]>=0) G[E[mp(V[i]-1,j)]].pb(edge{E[mp(U[i]-1,j-A[i])],B[i]});
  dijkstra(N*2501,E[mp(0,min(S,2500))]);
  rep(i,N-1){
    ll tmp=LLONG_MAX;
    rep(j,2501) if(tmp>D[E[mp(i+1,j)]]) tmp=D[E[mp(i+1,j)]];
    cout<<tmp<<endl;
  }
}

Measured memory_bytes: 34844
n = int(input())
A = list(map(int,input().split(" ")))
A.sort()
sieve = [True for i in range(A[-1] + 1)]
done = set()
ans = 0

for i, a in enumerate(A):
    if sieve[a] == True:
        num = 1
        while a*num <= A[-1]:
            sieve[num*a] = False
            num += 1
        if i ==len(A)-1:
            ans +=1
        elif (i < len(A) -1) and (A[i] != A[i+1]):
            ans +=1
        

print(ans)
            


Measured memory_bytes: 32228
#include <cstdio>
#include <vector>
#include <queue>
#include <algorithm>

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  std::vector<std::vector<int>> edges(n);
  std::vector<int> deg(n);
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x, --y;
    edges[x].push_back(y);
    deg[y]++;
  }
  std::vector<int> dp(n);
  std::queue<int> queue;
  for (int i = 0; i < n; ++i) {
    if (deg[i] == 0) queue.push(i);
  }
  while (!queue.empty()) {
    int u = queue.front();
    queue.pop();
    for (auto &&v: edges[u]) {
      dp[v] = std::max(dp[v], dp[u] + 1);
      if (--deg[v] == 0) queue.push(v);
    }
  }
  printf("%d\n", *std::max_element(dp.begin(), dp.end()));
  return 0;
}


Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
using namespace std;
int main(){
    //Seiranchan!
    int N;
    cin >>N;

    set<char> s;
    REP(i,N){
        char c;
        cin >>c;
        s.insert(c);
    }
    
    if(s.size()==3){
        cout <<"Three" << endl;
    }else{
        cout << "Four" << endl;
    }

}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CSnack solver = new CSnack();
        solver.solve(1, in, out);
        out.close();
    }

    static class CSnack {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long a = in.nextInt(), b = in.nextInt();

            long answer = a * b / NumberTheory.gcd(a, b);
            out.println(answer);
        }

    }

    static class NumberTheory {
        public static long gcd(long a, long b) {
            long c;
            while (a != 0) {
                c = a;
                a = b % a;
                b = c;
            }
            return b;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



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

int main()
{
	int five = 0, seven = 0, temp;
	for(int i = 1; i <= 3; ++i)
	{
		cin >> temp;
		if(temp == 5)
			five++;
		if(temp == 7)
			seven++;
	}
	if(five == 2 && seven == 1)
		cout << "YES" << endl;
	else 
		cout << "NO" << endl;
}

Measured memory_bytes: 256
N,L,*A=map(int,open(0).read().split())
k=-1
for i in range(N-1):
	if A[i]+A[i+1]>=L:
		k=i
if k>=0:
	print('Possible')
	for i in range(k+1,N-1)[::-1]:
		print(i+1)
	for i in range(k+1):
		print(i+1)
else:
	print('Impossible')


Measured memory_bytes: 14092
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)       (((a) > (b)) ? (a) : (b))               /* ２個の値の最大値 */
#define min(a, b)       (((a) < (b)) ? (a) : (b))               /* ２個の値の最小値 */
#define ENTER           printf("\n")                                    /* 改行プリント */
int DBG = 1;                                                                            /* デバッグプリント 提出時は0
 */
/* main *************************************************************/
int main()
{
        int             a,b,c,i,j,k,n,m,x,y,ans = 0;
        char    str[256];

        scanf("%d", &a);
        printf("%d\n",(a-30)/2);


        return 0;
}



Measured memory_bytes: 2140
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  string s;
  cin >> s;
  if(s[2] == s [3] && s[4] == s[5]){
    cout << "Yes";
  }
  else{
    cout << "No";
  }
}




Measured memory_bytes: 256
fn main() {
    let n: i32 = read();
    let mut i = 1;
    while i*i <= n {
        i += 1;
    }
    i -= 1;
    let ans = i * i;
    println!("{}", ans);
}

// 以下関数

use std::io::*;
use std::str::FromStr;
pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub const MOD: u64 = 10e9 as u64 + 7;

pub fn is_prime(n: i32) -> bool {
    if n < 2 {
        return false;
    } else if n == 2 {
        return true;
    }
    let mut i = 2;
    while i * i < n {
        if n % i == 0 {
            return false;
        } else {
            i += 1;
            continue;
        }
    }
    true
}

pub fn lcm(mut n: i32, mut m: i32) -> i32 {
    n = if n > m { m } else { n };
    m = if n > m { n } else { m };
    let mut i = n;
    while i % m != 0 {
        i += n;
    }
    i
}

pub fn abs(n: i32) -> i32 {
    if n >= 0 {
        n
    } else {
        -n
    }
}

pub fn max(n: i32, m: i32) -> i32 {
    if n >= m {
        n
    } else {
        m
    }
}

pub fn min(n: i32, m: i32) -> i32 {
    if n <= m {
        n
    } else {
        m
    }
}

Measured memory_bytes: 4352
N,M = map(int,input().split())
res = []
for i in range(N):
    res.append(list(map(int,input().split())))

if N == 1:
    print(res[0][0])
    exit()

s = [0 for i in range(M)]
for i in res:
    for j in i[1:]:
        #print(j)
        s[j-1] += 1

#print(s)

count = 0
for i in range(M):
    if s[i] == N:
        count += 1

print(count)

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

bool ub(string s, int a, int b){
  vector<char> chr(1,s.at(a-1));
  vector<int> cnt(1,1);
  for(int i = a; i < b; i++){
    for(int j = 0; j < chr.size(); j++){
      if(s.at(i) == chr.at(j)){
        cnt.at(j) ++;
      }
      else if(j = chr.size()-1)
        chr.push_back(s.at(i));
    }
  }
  sort(cnt.begin(), cnt.end());
  if(2*cnt.at(cnt.size()-1) > b-a+1)
    return true;
  else
    return false;
}

int main(){
  string s;
  cin >> s;
  int n = s.size();
  int a = -1;
  int b = -1;
  bool bk = false;
  for(int i = 1; i < 4; i++){
    for(int j = 1; j+i <= n; j++){
      if(ub(s,j,j+i)){
        a = j;
        b = j+i;
        bk = true;
        break;
      }
    }
    if(bk)
      break;
  }
  cout << a << " " << b << endl;
}

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a = 0;
  int b = 0;
  int c = 0;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    if (tmp == 1) {
      a++;
    } else if (tmp == 2) {
      b++;
    } else {
      c++;
    }
  }
  vector<vector<vector<double>>> dp(n + 1, vector<vector<double>>(b + c + 1, vector<double>(c + 1, 0)));
  for (int k = 0; k <= c; k++) {
    for (int j = 0; j + k <= b + c; j++) {
      for (int i = 0; i + j + k <= n; i++) {
        if (i == 0 && j == 0 && k == 0) {
          dp[0][0][0] = 0;
          continue;
        }
        double sum = (double) i + j + k;
        double tmp = (double) n / sum;
        if (i > 0) {
          tmp += (double) i / sum * dp[i - 1][j][k];
        }
        if (j > 0) {
          tmp += (double) j / sum * dp[i + 1][j - 1][k];
        }
        if (k > 0) {
          tmp += (double) k / sum * dp[i][j + 1][k - 1];
        }
        dp[i][j][k] = tmp;
      }
    }
  }
  cout << setprecision(12) << dp[a][b][c] << '\n';
  return 0;
}

Measured memory_bytes: 216832
import math
d,g=map(int,input().split())
l=[list(map(int,input().split())) for i in range(d)]
#p,c
cnt=float('inf')
score=0
for i in range(2**d):
    temp_cnt=0
    temp_score=0
    max_point = d - 1
    for j in range(d):
        if (i>>j)&1:
            temp_score+=100*l[d-1-j][0]*(d-j)+l[d-1-j][1]
            temp_cnt+=l[d-1-j][0]
            if d-j-1==max_point:
                #解いてない問題の中で最も配点の高い問題
                max_point+=-1

    left=g-temp_score

    if left>0 and left<l[max_point][0]*100*(max_point+1):
        temp_cnt+=math.ceil(left/(100*(max_point+1)))
        temp_score+=math.ceil(left/(100*(max_point+1)))*100*(max_point+1)
    if temp_cnt<cnt and temp_score>=g:
        cnt=temp_cnt


print(cnt)

Measured memory_bytes: 3064
import sys
import math
sys.setrecursionlimit(10**6)
def MAP(): return [int(s) for s in input().split()]

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline

N = int(input())

price = math.ceil(N/1.08)
#print(price)
print(price if math.floor(price * 1.08) == N else ':(')

Measured memory_bytes: 3060
import sys
S = input()
if "R" in S:
    if S.count("R") == 1:
        print("1")
        sys.exit()
    elif S.count("R") == 3:
        print("3")
        sys.exit()
    elif S.count("R") == 2:
        if S[1] == "S":
            print("1")
        else:
            print("2")
else:
    print("0")
    sys.exit()
    

Measured memory_bytes: 9056
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<ll,ll> p;
typedef unsigned long long int ull;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const ll INF=2e18;
ll MOD=1e9+7;

ll power(ll a,ll x){
    ll res=1;
    while(x>0){
        if(x&1) res=res*a%13;
        a=a*a%13;
        x>>=1;
    }
    return res;
}

vector<vector<int> > G(50,vector<int>(50,0));
vector<int> cl(50,0);
int n,m;
void dfs(int x,int c){
    cl[x]=c;
    for(int y=0;y<n;y++)if(G[x][y]==1){
        if(cl[y]==0) dfs(y,c);
    }
}
int main(){
    cin>>n>>m;
    vector<int> a(m),b(m);
    for(int i=0;i<m;i++){
        cin>>a[i]>>b[i];
        a[i]--;b[i]--;
        G[a[i]][b[i]]=G[b[i]][a[i]]=1;
    }
    int ans=0;
    for(int i=0;i<m;i++){
        int cnt=0;
        G[a[i]][b[i]]=G[b[i]][a[i]]=0;
        fill(cl.begin(),cl.end(),0);
        for(int i=0;i<n;i++)if(cl[i]==0){
            cnt++;
            dfs(i,cnt);
        }
        if(cnt>1) ans++;
        G[a[i]][b[i]]=G[b[i]][a[i]]=1; 
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
//#include "testlib.h"
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define int long long
#define ll long long
#define M 1000000007
#define MM 998244353
#define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
#define GCD(m,n) __gcd(m,n)
#define LCM(m,n) m*(n/GCD(m,n))
#define mii  map<ll ,ll >
#define sz(a) (int)a.size()
#define msi  map<string,ll >
#define rep(a,b)    for(ll i=a;i<b;i++)
#define rep0(n)    for(ll i=0;i<n;i++)
#define repi(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define vi vector<ll>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define r0 return 0;
#define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
#define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define Set(a, s) (a, s, sizeof (a))
#define FOR repi
#define vii vector<pii>
#define pii pair<int,int>
#define REVERSE(v) reverse(all(v))
#define trav(a, x) for(auto& a : x)
#define display(x) trav(a,x) cout<<a<<" ";cout<<endl
#define debug cerr<<"bhau"<<endl
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
template<typename T, typename U> static inline void amin(T &x, U y) 
{ 
    if (y < x) 
        x = y; 
}
template<typename T, typename U> static inline void amax(T &x, U y) 
{ 
    if (x < y) 
        x = y; 
}
 
ll max(ll a, ll b) { return (a > b)? a : b;}
int min(int a, int b) { return (a < b)? a : b;} 


int solve(){

    int k;cin>>k;
    int ans=0;
    rep(1,k+1){
        repi(j,1,k+1){
            repi(l,1,k+1){
                ans+=__gcd(__gcd(i,j),l);
            }
        }
    }
    cout<<ans;


    return 0;
}
signed main(){
    asdf
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3648