akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
int main() {
  int x, y;
  cin >> x >> y;
  if(x < y) {
    if(abs(y) >= abs(x)) {
      if(x < 0) cout << 1 + y - (-x) << endl;
      else cout << y - x << endl;
    }
    else {
      if(y <= 0) cout << y - x << endl;
      else cout << (-y) - x + 1 << endl;
    }
  }
  else {
    if(abs(y) >= abs(x)) {
      if(x < 0) cout << abs(y) - abs(x) + 2 << endl;
      else cout << abs(y) - abs(x) + 1 << endl;
    }
    else {
      if(y <= 0) cout << 1 + y - (-x) << endl;
      else cout << 1 + (-y) - (-x) + 1 << endl;
    }
  }
}

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

long long gcd(long long smaller, long long bigger) {
    // cout << "smaller" << smaller << " bigger" << bigger << endl;
    assert(smaller <= bigger);
    // cout << bigger % smaller << endl;
    if ((bigger % smaller) == 0) return smaller;
    // if ((bigger % smaller) == 0) cout << "zero" << endl;
    else return(gcd((bigger % smaller), smaller));
    // return bigger;
}

long long lcm(long long a, long long b){
    long long mul = a * b;
    // cout << mul << endl;
    if (a <= b) return mul / gcd(a, b);
    else return mul / gcd(b, a);
    return gcd(a,b);
}

int main(){
    long long a,b;
    cin >> a >> b;
    cout << lcm(a, b) << endl;
}

Measured memory_bytes: 3596
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define lu unsigned long long int
#define pi pair<ll, ll>
#define pll pair<ll, ll>
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mk make_pair
#define ve vector
#define vll ve<ll>
#define vpl ve<pll>
#define lr(n) for(ll i = 0; i < n; i++)
#define ltr(i, l, r) for (ll i = l; i <= r; i++)
#define rtl(i, l, r) for (ll i = r; i >= l; i--)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define be begin
#define sz(a) (ll)(a.size())
#define con continue
#define ret return
#define endl "\n"
const ll INF = 1e18;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

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

ll mod = 1e9+7;

ll mult(ll x, ll y){
    ll rem=1;
    while(y){
        if(y&1){
            rem=(rem*x)%mod;
        }
        x=(x*x)%mod;
        y>>=1;
    }
    return rem;
}


ll dp[2001];

void solve(ll T){
	ll n;
	cin>>n;
	dp[0] = 1;
	for(ll i=1;i<=n;i++){
		dp[i] = 0;
		for(ll j=3;j<=i;j++){
			dp[i] += dp[i-j];
		}
		dp[i] %= mod;
	}
	cout << dp[n] << "\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	// std::cout << std::unitbuf;
	ll T=1;
	// cin>>T;
	for(ll t=1;t<=T;t++){
		solve(t);
	}
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    ll x;
    cin >> x;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 0;
    while(1) {
        //cout << x << endl;
        if (x < a[ans] || ans == n) break;
        if (ans == n-1 && x != a[ans]) break;
        x -= a[ans];
        //cout << "test" << endl;
        ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
s=input()
k=int(input())
l=len(s)
def find_substring_from_a(a):
    a_s=[]
    for i in range(l):
        if s[i]==a:
            for j in range(1,min(6,l-i+1 )):
                a_s.append(s[i:i+j])
    return sorted(set(a_s) )
moji_list = sorted(set(s))
length = 0
for a in moji_list:
    a_s=find_substring_from_a(a)
    lenas = len(a_s)
    if length+lenas >=k:
        break
    else:
        length+=lenas
print(a_s[k-length-1])

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

#define rep(i, N) for (ll i = 0; i < N; i++)

#define MOD 1000000007


using ll = long long;
using namespace std;

typedef vector<ll> vl;


ll mlpow(ll x, ll p) { //x^p(long long)%MOD
    ll tmp = 1;
    if(p == 0) return 1;
    while(p != 0) {
        if(p & 1) tmp = tmp*x % MOD;
        x = x*x % MOD;
        p = p >> 1;
    }
    return tmp;
}


int main() {
    int N;
    cin >> N;
    vl A(N);
    rep(i,N) cin >> A[i];

    ll ans = 0;
    int cnt = 0;
    bool flag = true;
    while(flag) {
        flag = false;
        ll num1 = 0, num0 = 0;
        rep(i,N){
            if(A[i]&1 == 1)num1++;
            else num0++;
            A[i] >>= 1;
            if(A[i] != 0) flag = true;
        }
        ll tmp = (mlpow(2,cnt)*((num0*num1)%MOD))%MOD;
        ans += tmp;
        ans %= MOD;
        cnt++;
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ull unsigned long long
# define ll long long
# define mod 1000000007LL 
using namespace std;
int main()
{
     ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll arr[n];
    ll fre[100005]={0};
    ll sum=0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        fre[arr[i]]++;
        sum=sum+arr[i];
    }
    ll count,a,b;
    cin>>count;
    while(count--)
    {
        cin>>a>>b;
        sum=sum-fre[a]*a+fre[a]*b;
        fre[b]=fre[b]+fre[a];
        fre[a]=0;
        cout<<sum<<"\n";
    }


    
    return 0;
}

Measured memory_bytes: 5148
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>

signed main()
{
int x=0,y=0,z=0,w=0,n=0,m=2001,a=0,b=0;
string s;
std::cin >> s;
if(s=="Sunny")std::cout << "Cloudy" << '\n';
else if(s=="Cloudy")std::cout << "Rainy" << '\n';
else if(s=="Rainy")std::cout << "Sunny" << '\n';
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
const int MAXN = 100010;
struct node{
    int x,y,t;
}plan[MAXN];

int main(){
    int n;
    int i;
    scanf("%d",&n);
    plan[0].t = 0;
    plan[0].x = 0;
    plan[0].y = 0;
    for(i = 1; i <= n; i++){
        scanf("%d%d%d",&plan[i].t,&plan[i].x,&plan[i].y);
    }
    for(i = 1; i <= n; i++){
        int mint = abs(plan[i].x-plan[i-1].x)+abs(plan[i].y-plan[i-1].y);
        int realt = plan[i].t-plan[i-1].t;
        if(mint % 2 != realt % 2 || realt<mint)
            break;
    }
    if(i > n)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;
}


Measured memory_bytes: 1408
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF =1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define trep(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
    int n;
    int a,b;
    cin >> n >> a >> b;
    int cc = b - a;
    if (cc%2==0){
        cout << "Alice" << endl;
    }else{
        cout<<"Borys"<<endl;
    }
        return 0;
}

Measured memory_bytes: 256
/******************************************************/
/******************************************************/
/**                                                  **/
/**            BISMILLAHIR RAHMANIR RAHIM            **/
/**         REAZ AHAMMED CHOWDHURY - reaziii         **/
/**  Department of Computer Science and Engineering  **/
/*         INSTITUTE OF SCIENCE AND TECHNOLOGY       **/
/**                                                  **/
/******************************************************/
/******************************************************/



#include<bits/stdc++.h>
#define sc(x)        scanf("%lld",&x)
#define pcase(x)     printf("Case %d: ",x++)
#define pn           printf("\n")
#define fri(f)       for(int i=0;i<f;i++)
#define frj(f)       for(int j=0;j<f;j++)
#define reset(x,e)   memset(x,e,sizeof(x))
#define all(x)       x.begin(),x.end()
#define input        freopen("input.txt","r",stdin);
#define output       freopen("output.txt","w",stdout)
#define infi         INT_MAX
#define m_v          3000000
#define pii          pair<int,int>
#define pch          pair<char,char>
#define pll          pair<ll,ll>
#define mgraph       map<int,vector<int> >
#define mp           make_pair
#define pb           push_back
#define clr(x)       memset(x,0,sizeof(x))
#define frx(x,y)     for(int x=0;x<y;x++)
#define ff           first
#define ss           second
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
bool checkbitt(ll num, int pos);
ll setbitt(ll num, ll pos);
ll resetbitt(ll num, int pos);
void read(int *aa, int sz) {fri(sz) scanf("%d", (aa + i));}
void read(ll *aa, int sz) {fri(sz) scanf("%lld", (aa + i));}
void read(ll *aa, int s, int e) {for (int i = s; i < s + e; i++)scanf("%lld", (aa + i));}
void read(int *aa, int s, int e) {for (int i = s; i < s + e; i++)scanf("%d", (aa + i));}
const ll mod =       1e9 + 7;
const ll N =     1e6 + 10;

//.................___Start from here___.................//
//.................._____________________................//
int n, k;
int arr[N + 10];
int dp[N + 100];

int transition(int x) {
	int ret = infi;
	for (int i = 1; i <= k; i++) {
		if (x + i > n) continue;

		ret = min(ret, abs(arr[x] - arr[x + i]) + dp[x + i]);
	}

	return ret;


}




int solve() {
	cin >> n >> k;
	read(arr, 1, n);

	clr(dp);

	for (int i = n - 1; i >= 1; i--) {
		dp[i] = transition(i);
	}

	cout << dp[1] << endl;


	return 0;
}
int main() {
// #ifndef ONLINE_JUDGE
// 	input;
// 	output;
// #endif
// #ifdef ONLINE_JUDGE
// 	ios_base::sync_with_stdio(false);
// 	cin.tie(0);
// #endif
	int cs = 1;
	int cn = 1;
	//cin>>cs;
	while (cs--) {
		solve();

	}
}


bool checkbitt(ll num, int pos) {return (num >> pos) & 1;}
ll setbitt(ll num, ll pos) {return (1 << pos) | num;}
ll resetbitt(ll num, int pos) {if (!checkbitt(num, pos)) return num; else return (1 << pos)^num;}


Measured memory_bytes: 8016
#include <stdio.h>

int main(void) {
	int a[10000];
	int n, i, min, max;
	long sum;

	scanf("%d", &n);

	scanf("%d", &a[0]);
	min = max = sum = a[0];
	for (i = 1; i < n; i++) {
		scanf("%d", &a[i]);
		if(min > a[i]) min = a[i];
		if(max < a[i]) max = a[i];
		sum += a[i];
	}
	printf("%d %d %ld\n", min, max, sum);
}


Measured memory_bytes: 2112
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<ctime>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<bitset>
#define ll long long 
#define ull unsigned long long 
#define mem(a) memset(a,0,sizeof(a))
#define rint register int 
#define rll register long long 
#define rull register unsigned long long 
#define rchar register char
#define rstring register string 
#define rfloat register float
#define rdouble register double 
#define fio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define For(i,a,b) for(int i=a;i<b;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define cFor(i,a,b) for(int i=a;i>b;i--)
#define cFOR(i,a,b) for(int i=a;i>=b;i--)
#define lFor(i,a,b) for(ll i=a;i<b;i++)
#define lFOR(i,a,b) for(ll i=a;i<=b;i++)
#define lcFor(i,a,b) for(ll i=a;i>b;i--)
#define lcFOR(i,a,b) for(ll i=a;i>=b;i--)
#define watch(a) cout<<#a<<"="<<a<<endl
using namespace std;
int main(){
	int h,n;
	ll sum=0;
	cin>>h>>n;
	while(n--){
		int x;
		cin>>x;
		sum+=x;
	}
	if(sum>=h)
		cout<<"Yes\n";
	else
		cout<<"No\n";	
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define IOS; ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define MX  3001
#define FF freopen("input.in","r",stdin); freopen("output.txt","w",stdout);
ll dp[MX][MX][2];
int n;
int a[MX];
ll f(int i,int j,bool turn)
{
    if(i>j)return 0;
    if(dp[i][j][turn]!=-1)return dp[i][j][turn];
    ll x=0;
    if(turn)
    {
        return dp[i][j][turn]=x=max(f(i+1,j,!turn)+a[i],f(i,j-1,!turn)+a[j]);
    }
    else
        return dp[i][j][turn]=x=min(f(i+1,j,!turn)-a[i],f(i,j-1,!turn)-a[j]);
    return x;
}
int main()
{
    //FF;
    IOS;
    int k;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i];
    memset(dp,-1,sizeof dp);
    cout<<f(0,n-1,1);
}



Measured memory_bytes: 141184
#include<stdio.h>

int main(){
    int N, M, T_ex=0, P[100], X[100], T[100], T_sum=0;//Nに格納,t_exはドーピング後に解く時間
    scanf("%d", &N); 
    for(int i=0; i<N; i++){
        scanf("%d", &T[i]);//Tに格納
         T_sum = T[i] + T_sum;//Tの和
    }
    scanf("%d", &M);//Mに格納
    for(int i=0; i<M; i++){
        scanf("%d%d", &P[i], &X[i]);  
        
    }
    
     for(int i=0; i<M; i++){
          T_ex = T_sum - T[P[i]-1] + X[i];
        printf("%d\n", T_ex);
        T_ex = 0;
     }
    return 0;
}

Measured memory_bytes: 1732
#include "bits/stdc++.h"

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s; cin>>s;
    string month = s.substr(5,2);
    int m = stoi(month);
    if(m<5) print("Heisei");
    else print("TBD");
    return 0;
}

Measured memory_bytes: 256
from math import atan2,pi
N=int(input())
points=[[int(i) for i in input().split()] for i in range(N)]
p=[0]*N

for i in range(N):
  angle_p=[]
  angle_n=[]
  for j in range(N):
    if i!=j:
      c=atan2(points[i][1]-points[j][1],points[i][0]-points[j][0])
      if c>=0:
        angle_p.append(c)
      else:
        angle_n.append(c)
 
  if len(angle_n)==0:
    d=max(angle_p)-min(angle_p)
  elif len(angle_p)==0:
    d=max(angle_n)-min(angle_n)
  elif max(angle_p)-min(angle_n)<pi:
    d=max(angle_p)-min(angle_n)
  elif pi-min(angle_p)+max(angle_n)<0:
    d=2*pi-min(angle_p)+max(angle_n)
  else:
    d=pi
  p[i]=(pi-d)/(2*pi)
    
for i in range(N):
  print(p[i])
    

    
      

Measured memory_bytes: 39664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    string s, t;
    cin >> s >> t;
    int ans = 0;
    rep(i, s.size()){
        if (s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3912
#include <bits/stdc++.h>
using LL = long long;
using namespace std;
int main() {
	int n, p; cin >> n >> p;
	string s; cin >> s;
	LL ans = 0;
	if (p == 2 or p == 5) {
		for (int i = 0; i < n; i++) 
			if ((s[i] - '0') % p == 0) ans += i + 1;
	} else {
		map<int, int> mp;
		mp[0] = 1;
		LL sum = 0, power = 1;
		for (int i = n - 1; i >= 0; i--) {
			sum = (sum + (s[i] - '0') * power) % p;
			ans += mp[sum % p]++;
			power = power * 10 % p;
		}
	}
	cout << ans;	
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

template <typename T>
std::tuple<T, T, T> extgcd(T a, T b){
    T s1 = 1, t1 = 0, s2 = 0, t2 = 1;
    while(b != 0){
        std::tie(s1, t1, s2, t2) = std::make_tuple(s2, t2, s1 - (a / b) * s2, t1 - (a / b) * t2);
        std::tie(a, b) = std::make_tuple(b, a % b);
    }
    return std::make_tuple(s1, t1, a);
}

// 注意: a と mod が互いに素である必要がある
template <typename T>
T mod_inverse(T a, T mod){
    T b;
    std::tie(b, std::ignore, std::ignore) = extgcd(a, mod);
    if(b < 0){b += mod;}
    return b;
}

template <typename T>
struct Combinatorics{
    T modulo;
    std::vector<T> fact, inv_fact;

    Combinatorics(T max, T modulo) : modulo(modulo), fact(max + 1), inv_fact(max + 1) {
        fact[0] = 1;
        for(T i=1;i<=max;++i){
            fact[i] = i * fact[i - 1] % modulo;
        }

        inv_fact[max] = mod_inverse(fact[max], modulo);
        for(T i=max;i>0;--i){
            inv_fact[i - 1] = i * inv_fact[i] % modulo;
        }
    }

    T nPk(T n, T k){
        if(n < k){return 0;}
        return fact[n] * inv_fact[n - k] % modulo;
    }

    T nCk(T n, T k){
        if(n < k){return 0;}
        return fact[n] * inv_fact[k] % modulo * inv_fact[n - k] % modulo;
    }

    T nHk(T n, T k){
        if(n == 0 && k == 0){return 1;}
        return nCk(n + k - 1, k);
    }
};

constexpr ll MOD = 1'000'000'007;
int N, M;
Combinatorics<ll> comb(200100, MOD);

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

    std::cin >> N >> M;

    ll cnt = 1;

    for(int i=2;i*i<=M;++i){
        int t = 0;

        while(M % i == 0){
            M /= i;
            t += 1;
        }

        cnt = cnt * comb.nHk(N, t) % MOD;
    }

    if(M > 1){
        cnt = cnt * N % MOD;
    }

    std::cout << cnt << std::endl;
}


Measured memory_bytes: 3328
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM_ID.

DATA DIVISION.
WORKING-STORAGE SECTION.
01 LN             PIC X(7).
01 N              PIC 9(3).
01 M              PIC 9(3).
01 ans            PIC X(3).

PROCEDURE DIVISION.
  ACCEPT LN.
  UNSTRING LN DELIMITED BY SPACE INTO N M.
  IF N = M
      DISPLAY "Yes"
  ELSE
      DISPLAY "No"
  END-IF.
  STOP RUN.


Measured memory_bytes: 764
import collections
n,elems = int(raw_input()), map(int, raw_input().split(' '))

def f(elems):
	for e in elems:
		if e % 2 == 0:
			if not((e % 3 == 0) or (e % 5 == 0)):
				return False
	return True

print 'Approved'.upper() if f(elems) else 'Denied'.upper()

Measured memory_bytes: 64904
n=int(input())
a=list(map(int,input().split()))
a.sort()
a.reverse()
x=a[0]
diff=10**9
for i in range(1,n):
  if abs(x-2*a[i])<diff:
    y=a[i]
    diff=abs(x-2*y)
print(x)
print(y)

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

using namespace std;
using ll = long long;

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

int main() {
  int n;
  cin >> n;
  int a[n], b[n];
  rep(i, n) {
    cin >> a[i];
    b[i] = a[i];
  }

  sort(b, b + n);
  int mx = b[n - 1], mx2 = b[n - 2];

  rep(i, n) {
    if (a[i] == mx)
      cout << mx2 << endl;
    else
      cout << mx << endl;
  }
  return 0;
}


Measured memory_bytes: 5084
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  cout<<(n*800)-((n/15)*200)<<"\n";
  
    return 0;
}

Measured memory_bytes: 3592
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;class Program
{
	static void Main(string[] args)
	{
		const int mod = 998244353;
        //var exStdIn = new System.IO.StreamReader( "stdin.txt" );System.Console.SetIn( exStdIn );
		
		string s = Console.ReadLine();
		int cnt = 0;
		for (int i = 0; i < 3; i++)
		{
			if (s[i]=='R')
			{
				cnt++;
			}
		}
		if(cnt==2&&s[1]=='S')cnt = 1;
		Console.WriteLine(cnt);
	}
}


Measured memory_bytes: 25868
x=require('fs').readFileSync('/dev/stdin','utf8').trim().split(/\s/);
yobi=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
for(i=0;i<x.length-1;){
    if(x[i]==0)break;
    console.log(yobi[new Date('2004/0'+x[i++]+'/0'+x[i++]).getDay()]);
}

Measured memory_bytes: 15472
import java.util.Scanner;

public class Main {
	Scanner scan = new Scanner(System.in);
	void run() {
		int n = scan.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}

		for(int i = n - 1; i > 0; i--) {
			System.out.print(a[i] + " ");
		}
		System.out.println(a[0]);
	}
	public static void main(String[] args) {
		//TODO Auto-generated method stub
		new Main().run();
	}

}

Measured memory_bytes: 26444
#include<stdio.h>

int main(){
    int x,y,result,i;
    scanf("%d %d",&x,&y);
    result=x+y+2;
    for(i=0;i<=x;i++){
        if((y*i)%x==0){
            result-=1;
        }
    }
    printf("%d\n",result);
    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

vector<vector<pair<int, int>>> graph;
vector<int> ans;

void dfs(int node, int par, int col) {
	ans[node] = col;
	for (auto e : graph[node]) {
		if (e.first == par) continue;
		dfs(e.first, node, (e.second + col) % 2);
	}
}

int main () {
	int N; cin >> N;
	graph.resize(N);
	rep(i, N - 1) {
		int u, v, w;
		cin >> u >> v >> w;
		u--, v--, w %= 2;
		graph[u].push_back(make_pair(v, w));
		graph[v].push_back(make_pair(u, w));
	}

	ans.resize(N);
	dfs(0, -1, 0);
	rep(i, N) cout << ans[i] << endl;
}


Measured memory_bytes: 8192
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    if (S[0] == 'S') cout << "Cloudy";
    else if (S[0] == 'C') cout << "Rainy";
    else cout << "Sunny";
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
long long p = 1000000000;
long long l, r, m, t, k;
long long n, x, y, z, w;
long long a[200000];
int main() {
	l = p * p * (-1);
	r = p * p + 1;
	scanf("%lld%lld", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%lld", a + i);
		if (a[i] < 0)x++;
		if (a[i] == 0)y++;
		if (a[i] > 0)z++;
	}
	std::sort(a, a + n);
	while (r - l > 1) {
		m = (r + l) / 2;
		t = 0;
		if (m == 0) {
			t = x * z;
		}
		if (m > 0) {
			t = x * z + (x + z) * y + y * (y - 1) / 2;
			w = n - 1;
			for (long long i = x + y; i < n; i++) {
				while (a[w] * a[i] >= m)w--;
				if (w > i)t += w - i;
				else break;
			}
			w = 0;
			for (long long i = x - 1; i >= 0; i--) {
				while (a[w] * a[i] >= m)w++;
				if (w < i)t += i - w;
				else break;
			}
		}
		if (m < 0) {
			w = x - 1;
			for (long long i = n - 1; i >= x + y; i--) {
				while (w >= 0 && a[w] * a[i] >= m)w--;
				if (w >= 0)t += w + 1;
			}
		}
		if (t < k)l = m;
		else r = m;
	}
	printf("%lld\n", l);
}


Measured memory_bytes: 3272
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
constexpr long long INF = 1LL << 62;

// Dinic O(|E||V|^2)
struct Edge { int dst; long long cap; int rev; };
using Edges = vector<Edge>;
using Graph = vector<Edges>;

struct Dinic {
    int n, s, t;
    vector<int> level, iter;
    Graph g;

    Dinic(int n) : g(n), n(n) {}
    void add_edge(int src, int dst, long long cap) {
        g[src].push_back((Edge){ dst, cap, (int)g[dst].size()  });
        g[dst].push_back((Edge){ src, 0  , (int)g[src].size()-1});
    }

    void bfs(int s) {
        level.assign(n, -1);
        queue<int> que;
        level[s] = 0;
        que.push(s);
        while(!que.empty()){
            int v = que.front(); que.pop();
            for(Edge e : g[v]) {
                if(e.cap > 0 && level[e.dst] < 0){
                    level[e.dst] = level[v] + 1;
                    que.push(e.dst);
                }
            }
        }
    }

    long long dfs(int v,int t,long long f){
        if(v==t) return f;
        for(int &i = iter[v]; i < (int)g[v].size(); ++i){
            Edge &e = g[v][i];
            if(e.cap > 0 && level[v] < level[e.dst]){
                long long d = dfs(e.dst, t, min(f, e.cap));
                if(d > 0){
                    e.cap -= d;
                    g[e.dst][e.rev].cap += d;
                    return d;
                }
            }
        }
        return 0;
    }

    long long max_flow(int s,int t) {
        long long flow = 0;
        while(true){
            bfs(s);
            if(level[t] < 0) return flow;
            iter.assign(n,0);
            long long f = 0;
            while((f = dfs(s, t, INF)) > 0){
                flow += f;
            }
        }
    }
};

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int n; cin >> n;
    int a[100];
    long long sum = 0;
    for(int i=0; i < n; ++i) {
        cin >> a[i];
        if(a[i] > 0) sum += a[i];
    }

    Dinic dn(n + 2);
    int S = n, T = n + 1;
    // S : break, T : not break
    // classify each a[i] into two classes, and minimize losses
    for(int i=0; i < n; ++i) {
        if(a[i] <= 0) dn.add_edge(S, i, -a[i]); // when classify this i to T(not break), lose a[i]
        else dn.add_edge(i, T, a[i]);
    }
    // penalty of classifying (j = 2*i,3*i,...) to same class is INF
    for(int i=0; i < n; ++i) {
        for(int j=0; j < n; ++j) {
            if((j+1)%(i+1)==0) {
                dn.add_edge(i, j, INF);
            }
        }
    }

    cout << sum - dn.max_flow(S, T) << '\n';
    return 0;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int N;
bool isone(string s)
{
	int N=s.size()-1;
	int p2=0,ret=0;
	for(int i=0;i<=N;i++)
	{
		int si=s[N-i]-'0';
		if(i>0)
		{
			int x=i;
			while(x%2==0)x/=2,p2--;
			x=N-i+1;
			while(x%2==0)x/=2,p2++;
		}
		if(p2==0)ret=(ret+si)%2;
	}
	return ret%2;
}
main()
{
	string s;
	cin>>N>>s;
	for(int i=0;i<N;i++)s[i]--;
	if(isone(s))cout<<1<<endl;
	else
	{
		string t=s;
		bool flag=true;
		for(int i=0;i<N;i++)
		{
			if(t[i]=='2')t[i]='1';
			else if(t[i]=='1')flag=false;
		}
		if(flag&&isone(t))cout<<2<<endl;
		else cout<<0<<endl;
	}
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

int N;
vector<int> C(501, 0);
vector<int> S(501, 0);
vector<int> F(501, 0);

int main(void){
    
    scanf("%d", &N);
    for(int i = 0; i < N - 1; ++i) scanf("%d %d %d", &C[i], &S[i], &F[i]);
   
    for(int i = 0; i < N - 1; ++i){
        int sum = C[i] + S[i];
        for(int j = i + 1; j < N - 1; ++j){
            int a;
            if(sum <= S[j]) a = S[j] - sum;
            else a = (sum % F[j]) ? F[j] - sum % F[j] : 0;
            sum += C[j] + a;
        }
        printf("%d\n", sum);
    }
    printf("0\n");
	
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

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

class modInt{
    ll value;
    static const ll mod = 998244353;

public:
    modInt(ll x=0): value{x % mod}{}

    inline modInt& operator+=(modInt x){
        value = (value + x.value) % mod;
        return *this;
    }

    inline modInt& operator-=(modInt x){
        value = (value + mod - x.value) % mod;
        return *this;
    }

    inline modInt& operator*=(modInt x){
        value = (value * x.value) % mod;
        return *this;
    }


    inline modInt operator/=(modInt x){
        *this *= x.inv();
        return *this;
    }

    inline modInt pow(modInt x, int n){
        modInt res = modInt(1LL);
        while(n > 0){
            if(n & 1)   res *= x;
            x *= x;
            n >>= 1;
        }
        return res;
    }

    inline modInt inv(){
        modInt res = pow(value, mod-2);
        return res;
    }

    inline ll get(){
        return value;
    }
};

modInt operator+(modInt x, modInt y){
    return x += y;
}

modInt operator-(modInt x, modInt y){
    return x -= y;
}

modInt operator*(modInt x, modInt y){
    return x *= y;
}

modInt operator/(modInt x, modInt y){
    return x /= y;
}

ostream& operator<<(ostream& os, modInt x){
    return os << x.get();
}


class modIntCombinations{
    vector<modInt> factArray;

    void make_fact(ll x){
        for(auto i = factArray.size(); i <= x+1; i++){
            modInt y = factArray[i-1] * i;
            factArray.push_back(y);
        }
    }

public:
    modIntCombinations(){
        factArray.emplace_back(1);
    }

    modInt fact(ll x){
        if(factArray.size() < x+1){
            make_fact(x);
        }
        return factArray[x];
    }

    modInt comb(ll n, ll k){
        if(n < k){
            return modInt{0};
        }
        else{
            return fact(n) / fact(k) / fact(n - k);
        }
    }

    modInt perm(ll n, ll k){
        if(n < k){
            return modInt{0};
        }
        else{
            return fact(n) / fact(k);
        }
    }
};


int main(){
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k <= a){
        cout << k << endl;
    }
    else if(k <= a + b){
        cout << a << endl;
    }
    else{
        cout << a - (k - a - b) << endl;
    }


    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
using namespace std;
int main() {
	int a;
	int b;
	int c;
	int d;
	int e;
	std::cin >> a >> b >> c;
	if ((a*100+b*10+c*1) % 4 == 0) {
		cout << "YES" << "\n";
	}
	else {
		cout << "NO" << "\n";
	}
	
	std::cin >> e;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, i;
  cin >> n >> i;
  cout << n + 1 - i << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC177A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] DTS = Console.ReadLine().Split(' ');
            int D = int.Parse(DTS[0]);
            int T = int.Parse(DTS[1]);
            int S = int.Parse(DTS[2]);
            if (S * T >= D)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 27452
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

using P = pair<int, int>;

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

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int H, W;
  while (cin >> H >> W) {
    vector<string> grid(H);
    for (auto& line : grid) cin >> line;
    vec<int, 2> dist = make_v(H, W, -1);
    queue<P> q;
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        if (grid[i][j] == '#') {
          q.push(P(i, j));
          dist[i][j] = 0;
        }
      }
    }
    while (!q.empty()) {
      auto p = q.front();
      q.pop();
      int y = p.fst, x = p.snd;
      for (int k = 0; k < 4; k++) {
        int ny = y + dy[k];
        int nx = x + dx[k];
        if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
        if (dist[ny][nx] == -1) {
          dist[ny][nx] = dist[y][x] + 1;
          q.push(P(ny, nx));
        }
      }
    }
    int res = 0;
    for (int y = 0; y < H; y++) {
      for (int x = 0; x < W; x++) {
        chmax(res, dist[y][x]);
      }
    }
    cout << res << endl;
  }
  return 0;
}


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 58) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}


int main() {
  auto A = make_v< int >(3, 3);
  cin >> A;
  int N;
  cin >> N;
  for(int i = 0; i < N; i++) {
    int x;
    cin >> x;
    for(int j = 0; j < 3; j++) {
      for(int k = 0; k < 3; k++) {
        if(A[j][k] == x) A[j][k] = -1;
      }
    }
  }
  for(int k = 0; k < 3; k++) {
    if(A[k][0] == -1 && A[k][1] == -1 && A[k][2] == -1) {
      cout << "Yes\n";
      return 0;
    }
    if(A[0][k] == -1 && A[1][k] == -1 && A[2][k] == -1) {
      cout << "Yes\n";
      return 0;
    }
  }
  if(A[0][0] == -1 && A[1][1] == -1 && A[2][2] == -1) {
    cout << "Yes\n";
    return 0;
  }
  if(A[0][2] == -1 && A[1][1] == -1 && A[2][0] == -1) {
    cout << "Yes\n";
    return 0;

  }

  cout << "No\n";

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n;
bool p[5001][5001];
bool c(int a){
    return 0<=a&&a<=5000;
}
int main(){
    while(cin>>n&&n){
        int x[5000],y[5001],an=0;
        for(int i=0;i<n;i++)cin>>x[i]>>y[i],p[x[i]][y[i]]=1;
        for(int i=0;i<n;i++)
            for(int j=i;j<n;j++){
                int dx=x[i]-x[j],dy=y[i]-y[j];
                int x1=x[i]-dy,y1=y[i]+dx,x2=x[j]-dy,y2=y[j]+dx;
                int x3=x[i]-dy,y3=y[i]+dx,x4=x[j]+dy,y4=y[j]-dx;
                if(c(x1)&&c(y1)&&p[x1][y1]&&c(x2)&&c(y2)&&p[x2][y2])
                    an=max(an,dx*dx+dy*dy);
                if(c(x3)&&c(y3)&&p[x3][y3]&&c(x4)&&c(y4)&&p[x4][y4])
                    an=max(an,dx*dx+dy*dy);
            }
        cout<<an<<endl;
    }
    return 0;
}

Measured memory_bytes: 22624
#include<bits/stdc++.h>
using namespace std;
#define Mod(n) n % 1000000007
int main()
{
    set<string> s;
    int N;
    cin >> N;
    string t;
    for(int i = 0; i < N;i++)
    {
        cin >> t;
        s.insert(t);
    }
    cout << (s.size() == 3 ? "Three\n" : "Four\n");
}


Measured memory_bytes: 256
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define Rep(i, n) for(ll i = 1; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b) {
  return b ? GCD(b,a%b) : a;
}


ll LCM(ll a,ll b){
  return a/GCD(a,b)*b;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

void runlength(string s,vector<pair<char,ll>> &p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
}




ll COM(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;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}

vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll p=2;p<=sqrt(n);p++){
    if(n%p!=0) continue;
    ll cnt=0;
    while(n%p==0){
      n/=p;
      cnt++;
    }
    ans.push_back(make_pair(p,cnt));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {

  ll n,w;cin>>n>>w;
  vector<ll> weight(n),value(n);
  rep(i,n) cin>>weight[i]>>value[i];
  ll dp[n+1][Svec(value)+1];
  rep(i,Svec(value)+1) dp[0][i]=1e11;
  dp[0][0]=0;
  ll sum=Svec(value);
  rep(i,n){
    rep(j,sum+1){
      if(j>=value[i]) dp[i+1][j]=min(dp[i][j],dp[i][j-value[i]]+weight[i]);
      else dp[i+1][j]=dp[i][j];
    }
  }
  for(ll i=sum;i>=0;i--){
    if(dp[n][i]<=w){
      cout<<i<<endl;
      return 0;
    }
  }
}

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

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; }
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using pint = pair<int, int>; 
using pll  = pair<ll, ll>;
using vint = vector<int>; 
using vll  = vector<ll>;
using vstr = vector<string>;

//　定数, 変数 *********************************************
const ll MOD=1e9+7;
const ll INF=1ll<<60;

int N;

// *********************************************************
int main(){

    cin >> N ;

    int D[N][2];

    bool ans=false;
    int zoro=0;
    rep(i, N){
        cin >> D[i][0];
        cin >> D[i][1];
        if(!ans){
            if(D[i][0]==D[i][1]){
                ++zoro;
                if(zoro==3) ans=true;
            }else{
                zoro=0;
            }
            
        }
    }
    if(ans){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}



    return 0;
}

Measured memory_bytes: 3620
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<math.h>
#include<algorithm>
using namespace std;
int main(){
	long long n,a[100000],x=-100,y=-100;
	cin>>n;
	long long i,j;
	for (i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+n+1);
	i=n;
	for (i=n;i>=1;i--)
		if (a[i]==a[i-1]){
			x=a[i];
			j=i;
	for (j-=2;j>=1;j--)
		if (a[j]==a[j-1]){
			y=a[j];
			break;
		}
			break;
		}

	if (x==-100||y==-100)
		cout<<'0';
	else
		cout<<x*y;
    return 0;
}

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

using namespace std;

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

  size_t N; cin>>N;
  vector<size_t> A(N); for (auto& a : A) cin>>a;
  size_t ans = 0;
  constexpr size_t MOD = 1e9+7;
  for (size_t i = 0; i < 60; i++) {
    size_t cnt1 = 0;
    for (auto a : A) {
      if (a & (1ul << i))
        cnt1++;
    }
    size_t sum = cnt1 * (N - cnt1) % MOD;
    ans += (sum * ((1ul << i)%MOD)) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

struct Dice
{
  map<char,int> mp;
  Dice()
  {
    mp['t']=0;
    mp['b']=5;
    mp['n']=4;
    mp['s']=1;
    mp['w']=3;
    mp['e']=2;
  }

  void roll(char c)
  {
    map<char,int> next;
    switch (c)
    {
      case 'S':{
        next['b']=mp['s'];
        next['t']=mp['n'];
        next['w']=mp['w'];
        next['e']=mp['e'];
        next['n']=mp['b'];
        next['s']=mp['t'];
        break;
      }
      case 'N':{
        next['b']=mp['n'];
        next['t']=mp['s'];
        next['w']=mp['w'];
        next['e']=mp['e'];
        next['n']=mp['t'];
        next['s']=mp['b'];
        break;
      }
      case 'W':{
        next['b']=mp['w'];
        next['t']=mp['e'];
        next['w']=mp['t'];
        next['e']=mp['b'];
        next['n']=mp['n'];
        next['s']=mp['s'];
        break;
      }
      case 'E':{
        next['b']=mp['e'];
        next['t']=mp['w'];
        next['w']=mp['b'];
        next['e']=mp['t'];
        next['n']=mp['n'];
        next['s']=mp['s'];
        break;
      }
      default :{
        break;
      }
    }
    mp=next;
  }
};

int main()
{
  Dice dice;
  vector<int> point(6);
  for(auto&& e: point) 
  {
    cin>>e;
  }
  string s;
  cin>>s;
  for (int i = 0; i < s.size(); ++i)
  {
    dice.roll(s[i]);
  }
  cout<<point[dice.mp['t']]<<endl;
}


Measured memory_bytes: 3224
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    char S[101];
    size_t len;
    intmax_t ans = 0;

    gets(S);
    len = strlen(S);


    for (size_t i = 0; i < (len / 2); i++) {
        if (S[i] != S[len - i - 1])
            ans++;
    }

    printf("%jd\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 1000000000000000007LL
#define ll long long
using namespace std;
int cans[114514],aans[114514];
signed main(){
	int x,y,z;
	cin>>x>>y>>z;
	vector<int> a,b,c;
	for(int i=0;i<x+y+z;i++){
		int ta,tb,tc;
		cin>>ta>>tb>>tc;
		a.pb(ta);b.pb(tb);c.pb(tc);
	}
	vector< pair<int,int> > id;
	for(int i=0;i<x+y+z;i++){
		id.pb( mp( a[i]-c[i], i ) );
	}
	sort( id.begin(), id.end() );
	priority_queue< int, vector<int> , greater<int> > cs,as;
	//////////////////////// kokokara c
	int tmp = 0;
	for(int i=0;i<z;i++){
		int cur = id[i].second;
		cs.push( c[cur]-b[cur] );
		tmp += c[cur];
	}
	cans[z-1] = tmp;
	for(int i=z;i<z+y;i++){
		int cur = id[i].second;
		cs.push( c[cur]-b[cur] );
		tmp += c[cur];
		tmp -= cs.top();
		cans[i] = tmp;
		cs.pop();
	}
	//////////////////////// kokokara a
	tmp = 0;
	for(int i=x+y+z-1;i>=y+z;i--){
		int cur = id[i].second;
		as.push( a[cur] - b[cur] );
		tmp += a[cur];
	}
	aans[y+z] = tmp;
	for(int i=y+z-1;i>=z;i--){
		int cur = id[i].second;
		as.push( a[cur] - b[cur] );
		tmp += a[cur];
		tmp -= as.top();
		aans[i] = tmp;
		as.pop();
	}
	//////////////////////// gassan
	int ans = -1;
	for(int i=z-1;i<=y+z-1;i++){
		int su = cans[i] + aans[i+1];
		if( su > ans ) ans = su;
	}
	cout<< ans << endl;
	return 0;
}

Measured memory_bytes: 6108
import sys

class UnionFindVerSize():
    def __init__(self, N):
        """ N個のノードのUnion-Find木を作成する """
        # 親の番号を格納する。自分が親だった場合は、自分の番号になり、それがそのグループの番号になる
        self._parent = [n for n in range(0, N)]
        # グループのサイズ（個数）
        self._size = [1] * N

    def find_root(self, x):
        """ xの木の根(xがどのグループか)を求める """
        if self._parent[x] == x: return x
        self._parent[x] = self.find_root(self._parent[x]) # 縮約
        return self._parent[x]

    def unite(self, x, y):
        """ xとyの属するグループを併合する """
        gx = self.find_root(x)
        gy = self.find_root(y)
        if gx == gy: return

        # 小さい方を大きい方に併合させる（木の偏りが減るので）
        if self._size[gx] < self._size[gy]:
            self._parent[gx] = gy
            self._size[gy] += self._size[gx]
        else:
            self._parent[gy] = gx
            self._size[gx] += self._size[gy]

    def get_size(self, x):
        """ xが属するグループのサイズ（個数）を返す """
        return self._size[self.find_root(x)]

    def is_same_group(self, x, y):
        """ xとyが同じ集合に属するか否か """
        return self.find_root(x) == self.find_root(y)

    def calc_group_num(self):
        """ グループ数を計算して返す """
        N = len(self._parent)
        ans = 0
        for i in range(N):
            if self.find_root(i) == i:
                ans += 1
        return ans

input=sys.stdin.readline

N,M,K=map(int,input().split())
A=[0 for i in range(0,M)]
B=[0 for i in range(0,M)]
for i in range(0,M):
    A[i],B[i]=map(int,input().split())
C=[0 for i in range(0,K)]
D=[0 for i in range(0,K)]
for i in range(0,K):
    C[i],D[i]=map(int,input().split())

friend=[0 for i in range(0,N)]
for i in range(0,M):
    friend[A[i]-1]+=1
    friend[B[i]-1]+=1

uf=UnionFindVerSize(N)
for i in range(0,M):
    uf.unite(A[i]-1,B[i]-1)

block=[0 for i in range(0,N)]
for i in range(0,K):
    if uf.is_same_group(C[i]-1,D[i]-1):
        block[C[i]-1]+=1
        block[D[i]-1]+=1

ans=[0 for i in range(0,N)]
for i in range(0,N):
    ans[i]=uf.get_size(i)-friend[i]-block[i]-1
print(*ans)

Measured memory_bytes: 89492