akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h> 
#include <string.h> 
 
int main(void) { 
        int A, B; 
        char S[11], T[11], U[11]; 
 
        scanf("%s %s", S, T); 
        scanf("%d %d", &A, &B); 
        scanf("%s", &U); 
 
        if (strcmp(S, U) == 0) { 
                --A; 
        } else { 
                --B; 
        } 
 
        printf("%d %d\n", A, B); 
         
        return 0; 
}


Measured memory_bytes: 128
X,K,D=map(int,input().split())
ans=10**16
X=abs(X)

if X==0:
    if K%2==1:
        ans=abs(D)
    else:
        ans=0
else:
    p=X//D
    if K>=p:
        X-=D*p
        K-=p
        #print(X,p)
        if K%2==0:
            ans=X
        else:
            X=min(abs(X+D),abs(X-D))
            ans=X
    else:
        X-=D*K
        ans=X

print(ans)

Measured memory_bytes: 9200
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+100;
int a[N];
int main()
{
	int n, m;
	while(cin >> n >> m){
		priority_queue<int> pq;
		for(int i = 1; i <= n; i++){
			int x;
			scanf("%d",&x);
			pq.push(x);
		}
		ll sum = 0;
		while(m){
			int x = pq.top();
			pq.pop();
			pq.push(x / 2);
			m--;
		}
		while(!pq.empty()){
			sum += pq.top();
			pq.pop();
		}
		printf("%lld\n",sum);
	}
	return 0;
}

Measured memory_bytes: 892
// AtCoder-Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#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
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define FORREV(i,N,_cnt) for(auto i=N-1,cnt=_cnt; cnt > 0; --i, --cnt)
#define ALL(x) x.begin(), x.end()

/* 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 */

#define int long long
signed  main() {
#ifdef DEBUG
	ifstream ifs("in.txt");
	cin.rdbuf(ifs.rdbuf());
#endif
	vector<char> changedS;
	string s;
	cin >> s;
	FOR(i, s.size()) {
		auto c = s[i];
		if (i + 1 < s.size() and c == 'B' and s[i + 1] == 'C') {
			changedS.push_back('K');
			i += 1;
		}
		else {
			changedS.push_back(c);
		}
	}
	int ans = 0;
	int nowA = 0;
	int nokoriBC = 0;

	vector<int> BCruiseki(changedS.size(), 0);
	int prev = 0;
	FOR(i, changedS.size()) {
		auto j = changedS.size() - i - 1;
		if (changedS[j] == 'K') {
			prev += 1;
			BCruiseki[j] = prev;
		}
		else if ( (changedS[j] == 'C' or changedS[j] == 'B')) {
			prev = 0;
			BCruiseki[j] = prev;
		}
		else {
			BCruiseki[j] = prev;
		}
	}

	const int M = changedS.size();
	FOR(i, M) {
		auto c = changedS[i];
		if (c == 'A') {
			nowA += 1;
		}
		else if (c == 'K') {
			ans += nowA * BCruiseki[i];
			nowA = 0;
		}
		else {
			nowA = 0;
		}
	}

	cout << ans << endl;




	return 0;
}


Measured memory_bytes: 2304
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, s: "List[int]", c: "List[int]"):
    ans = [0] * N
    if N != 1:
        ans[0] = 1
    check = [10] * N
    for i in range(M):
        d = s[i] - 1
        if (check[d] != 10 and ans[d] != c[i]):
            print(-1)
            return
        if (d == 0 and c[i] == 0 and N != 1):
            print(-1)
            return
        ans[d] = c[i]
        check[d] = c[i]
    if N != 1 and ans[0] == 0:
        print(-1)
        return
    print(''.join([str(i) for i in ans]))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    s = [int()] * (M)  # type: "List[int]"
    c = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        s[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, M, s, c)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include <sstream>
#define pi 3.1416
using namespace std;
/*double Convert(double radian)
{
    return(radian*(180/pi));
}*/
int main()
{
    int count=0;
    string s;
    cin>>s;
    for(int i=0;i<3;i++)
    {
        if(s[i]=='7')
        {
            count++;
        }
    }
    if(count==0)
    {
        cout<<"No";
    }
    else
    {
        cout<<"Yes";
    }


}






Measured memory_bytes: 3624
#include<stdio.h>

int main() {

	int x, y;

	while (1) {
		scanf("%d %d", &x, &y);
		if (x == 0 && y == 0) break;

		if (x <= y)printf("%d %d\n", x, y);
		else printf("%d %d\n", y, x);
	}

	return 0;

}


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

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

const int MOD = 1e9+7;

ll mod(ll a, ll m){
    a %= m;
    if (a<0)return a+m;
    return a;
}

ll inverse(ll a, ll m){
    a = mod(a,m);
    if (a<=1)return a;
    return mod((1 -inverse(m,a) * m)/a, m);
}

//ax + my = 1
//x = 1 - my / a

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    int h, w, n; cin >> h >> w >> n;
    ii walls[n+1];
    walls[n] = ii(h,w);
    FOR(i,0,n-1){
        int y, x; cin >> y >> x;
        walls[i] = ii(y, x);
    }

    sort(walls, walls+n);

    int fac[h+w+1];
    int inv[h+w+1];
    fac[0] = 1;
    inv[0] = inverse(fac[0], MOD);
    FOR(i,1,h+w) {
        fac[i] = (int) (((ll)fac[i-1] * i) % MOD);
        inv[i] = (int) inverse(fac[i], MOD);
    }

    int dp[n+1];
    FOR(i,0,n){
        dp[i] = (int) (((ll)(fac[walls[i].fi-1 + walls[i].sc-1] 
                        * (ll)inv[walls[i].fi-1] % MOD)
                        * (ll)inv[walls[i].sc-1]) % MOD);
        //cout << "ALL " << i << " :: " << dp[i] << endl;

        FOR(j,0,i-1) if (walls[j].sc <= walls[i].sc) {
            int dy = walls[i].fi - walls[j].fi;
            int dx = walls[i].sc - walls[j].sc;

            int paths = (int) (((((ll)fac[dy+dx] 
                                * (ll)inv[dy]) % MOD) 
                                * (ll)inv[dx]) % MOD);
            //cout << "\tSUB " << j << " " << paths << " " << dp[j] << endl;
            //cout << i << ' ' << j << " :: " << dy << ' ' << dx << " :: " << paths << endl;
            dp[i] = (int) mod((ll)dp[i] - ((ll)dp[j] * paths) % MOD, MOD);
        }
    }

    //FOR(i,0,n-1){
    //    cout << i << " :: " << dp[i] << endl;
    //}

    cout << mod(dp[n], MOD) << '\n';
}



Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vvi= vector<vi>;
using vs = vector<string>;
using pl = pair<ll,ll>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  mp(a,b)  make_pair(a,b)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" )
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
ll INF = 1e9+9, LINF = 1e18;

const int M=10000;

int main(int argc,char* argv[])
{
    int a,b,c;
    cin>>a>>b>>c;
    cout<<a*b/2<<endl;

    return 0;
}


Measured memory_bytes: 256
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int n; R(n);
    VPII AA;
    REP(i,n){
        int x,y; R(x,y);
        AA.PB({y,x});
    }
    sort(ALL(AA));
    int now=0;
    REP(i,n){
        now+=AA[i].S;
        if(now>AA[i].F){
            W("No");
            return 0;
        }
    }
    W("Yes");
    return 0;
}


Measured memory_bytes: 2420
#include <iostream>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

vector<string> cand;

void dfs(string &s, string result, int index)
{
	if(index == s.size())
	{
		cand.push_back(result);
		cout << result << endl;
		return;
	}
	if(s[index] == '?')
	{
		string a,b,c;
		a = b = c = result;
		a.push_back('A');
		b.push_back('B');
		c.push_back('C');
		dfs(s, a, index + 1);
		dfs(s, b, index + 1);
		dfs(s, c, index + 1);
	}else{
		result.push_back(s[index]);
		dfs(s, result, index + 1);
	}
	return;
}

void test(string &s)
{
	dfs(s, "", 0);
	int count = 0;
	for(auto e : cand)
	{
	    for(int i = 0; i < s.size(); i++)
        {
            for (int j = i + 1; j < s.size(); ++j) {
                for (int k = j + 1; k < s.size(); ++k) {
                    if(e[i] == 'A' && e[j] == 'B' && e[k] == 'C')
                    {
                        count++;
                    }
                }
            }
        }
	}
	cout << count << endl;
}

int main()
{
	typedef long long int ll;
	string s;
	cin >> s;
	vector<vector<ll>> dp(s.size() + 1, vector<ll>(4, 0));
	dp[s.size()][3] = 1;
	ll mod = 1000000000 + 7;
	string check = "ABC";
    for (int i = s.size() - 1; i >= 0 ; i--) {
        for (int j = 0; j < 4; ++j) {
            if(j == 3)
            {
                if(s[i] == '?')
                {
                    dp[i][j] = 3 * dp[i + 1][j];
                    dp[i][j] %= mod;
                }else{
                    dp[i][j] = dp[i + 1][j];
                }
            }else{
                int m1, m2;
                m1 = s[i] == '?' ? 3 : 1;
                m2 = s[i] == '?' || check[j] == s[i] ? 1 : 0;
                dp[i][j] = m1 * dp[i + 1][j] + m2 * dp[i + 1][j + 1];
                dp[i][j] %= mod;
            }
        }
    }
    cout << dp[0][0] << endl;
	return 0;
}


Measured memory_bytes: 7424
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    int cnt = 0;
    rep(i, s.size()) {
        if(s[i] == 'x') {
            cnt++;
        }
    }

    if(cnt < 8) {
        cout << "YES";
    }
    else {
        cout << "NO";
    }

    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<deque>

using namespace std;
using ll = long long;

int n;
ll a;
deque<ll>Q, D;

int main(){
  cin >> n;
  for(int i = 0; i < n; ++i){
    cin >> a;
    Q.push_back(a);
  }
  ll cnt = n;
  while(!Q.empty()){
    if(cnt % 2 == 1){
      D.push_front(Q.front());
      Q.pop_front();
    }else{
      D.push_back(Q.front());
      Q.pop_front();
    }
    cnt--;
  }
  while(!D.empty()){
    cout << D.front() << " ";
    D.pop_front();
  }
  cout << endl;

}



Measured memory_bytes: 3968
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int p, q, r;
  cin >> p >> q >> r;
  cout << p + q + r - max({p, q, r}) << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include<stdio.h>
       int main()
       {
              int a,b;

              scanf("%d%d",&a,&b);

              if(a>=13)
              {
                printf("%d",b);
              }

                    else if(a>=6&&a<=12)
                    {

                     printf("%d",b/2);

       }
        else if(a<=5)
                     printf("0");




       return 0;
       }


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <queue>
#include <numeric>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)

using namespace std;
using ll = long long;

int getMax(string s, char letter) {
    int result = 0;

    s = letter + s + letter;
    int left = 0;
    for (int right = 1; right < s.size(); right++) {
        if (s[right] == letter) {
            result = max(result, right - left - 1);
            left = right;
        }
    }

    return result;
}

int main() {
    string s;
    cin >> s;
    int ans = 1e6;
    for (char letter = 'a'; letter <= 'z'; letter++) {
        ans = min(ans, getMax(s, letter));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3556
#include <iostream>
#include <vector>
#include <string>
#include <cfenv>
#include <cmath>
#include <string>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using namespace std;

int main(){
  string s;
  cin >> s;
  rep(i,s.size()-1){
    if(s[i] != s[i+1]){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return  0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
  int r,g,b;
  cin >> r >> g >> b;
  int x;
  x = 100 * r + 10 * g + b;
  if(x % 4 == 0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}

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

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

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

Measured memory_bytes: 3868
#include<iostream>
#include<vector>
#include<utility>
#include<queue>
#include<string>
#include<cmath>
#include<tuple>
#include <algorithm>
#define INF 1111111111
using namespace std;
typedef pair<int,int> P;
typedef tuple<int,int,int> tup;
typedef long long ll;
vector<int> vec(100100);
vector<int> passed(100100);
vector<int> dx = {-1,1};
int n,k;

int main() {
  int n;
  cin >> n;
  vector<string> vec(n);
  for(int i=0;i<n;i++)
    cin >> vec.at(i);
  bool flag = true;
  for(int i=0;i<n;i++){
    for(int j=0;j<i;j++){
     if(i != j && vec.at(i) == vec.at(j)) 
      flag = false;
    }
    if(i<n-1){
       string a = vec.at(i);
       string b = vec.at(i+1);
       char aa = a.at(a.size()-1);
       char bb = b.at(0);
       if(aa != bb){
         flag = false;
         break;
       }
     }
  }
    
  if(flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <time.h>
#include <string>

using namespace std;


int main()
{
	int a[5];
	int time = 0;
	int minTime = 10;
	for (int i = 0;i < 5;i++)
	{
		cin >> a[i];
	}
	for (int i = 0;i < 5;i++)
	{
		int num = a[i];
		for (;num > 10;num -= 10)
		{
		}
		if (num < minTime)
		{
			minTime = num;
		}
		time += a[i] + 10 - num;
	}
	time -= 10- minTime;
	cout << time;
		return 0;
}


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

class Main {
	static final int M = 1000000007;

	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long k = sc.nextLong();
		long[][] a = new long[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				a[i][j] = sc.nextLong();
			}
		}
		a = pow(a, k);
		long answer = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				answer = (answer + a[i][j]) % M;
			}
		}

		System.out.println(answer);
	}

	private static long[][] pow(long[][] a, long n) {
		long[][] b = e(a.length);
		while (n > 0) {
			if (n % 2 == 1) b = mul(b, a);
			a = mul(a, a);
			n /= 2;
		}

		return b;
	}

	private static long[][] e(int n) {
		long[][] a = new long[n][n];
		for (int i = 0; i < n; i++) {
			a[i][i] = 1;
		}
		return a;
	}

	private static long[][] mul(long[][] a, long[][] b) {
		long[][] c = new long[b.length][a[0].length];
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < b.length; j++) {
				for (int k = 0; k < a.length; k++) {
					c[i][j] = (c[i][j] + a[i][k] * b[k][j]) % M;
				}
			}
		}
		return c;
	}
}


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

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

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

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

signed main(){
    ll X;
    cin >> X;
    ll a = 0, b = 0;
    while(X >= 500){
        X -= 500; a++;
    }
    while(X >= 5){
        X -= 5; b++;
    }
    PRINT(a * 1000 + b * 5);
    return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	int n;
	cin >> n;

	int a, b;
	cin >> a >> b;

	int p[n];
	rep(i, n) cin >> p[i];

	int t1 = 0;
	int t2 = 0;
	int t3 = 0;
	rep(i, n){
		if(p[i] <= a) t1++;
		if(a < p[i] && p[i] <= b) t2++;
		if(b < p[i]) t3++;
	}

	cout << min({t1, t2, t3}) << endl;
}


Measured memory_bytes: 256
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
ans=sum(b)
for i in range(n-1):
    if a[i] + 1 == a[i+1]:
        ans += c[a[i]-1]
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  ll x, y;
  cin >> x >> y;
  if(x % y == 0) {
    puts("-1");
    return 0;
  }
  cout << x << endl;
}

Measured memory_bytes: 256
//2018-01-07
//LZYeah
//
#include<bits/stdc++.h>
#define ll long long
#define For(i,a,b) for(register int i=a;i<=b;i++)
#define Forr(i,a,b) for(register int i=a;i>=b;i--)
using namespace std;
inline void File()
{
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
}
inline void read(int &x)
{
	int p=1;
	x=0;
	char c=getchar();
	while(!isdigit(c)){if(c=='-')p=-1;c=getchar();}
	while(isdigit(c)){x=(x<<3)+(x<<1)+(c^'0');c=getchar();}
	x*=p;
}
char s[20];
int main()
{
//	File();
	scanf("%s",s+1);
	s[4]='8';
	printf("%s\n",s+1);
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <climits>
#define NDEBUG
#include <cassert>
#define int long long

constexpr auto INF = LLONG_MAX / 10000;

using namespace std;

class network {
  private:
    struct edge;
    int size;
    vector<vector<edge>> graph;
    struct edge {
      int to, capacity, flow, rev;
      vector<vector<edge>>& graph;
      edge& reverse() {
        return graph[to][rev];
      }
      void add_flow(int df) {
        assert(df > 0);
        flow += df;
        assert(flow <= capacity);
        reverse().flow -= df;
      }
    };

  public:
    network(int n): size(n), graph(n) {}

    void add_edge(int from, int to, int cap) {
      graph[from].push_back({to, cap, 0, static_cast<long long>(graph[to].size()), graph});
      graph[to].push_back({from, cap, cap, static_cast<long long>(graph[from].size() - 1), graph});
    }

    int max_flow(int source, int sink) {
      int flow = 0;
      while (true) {
        queue<int> que;
        que.push(source);
        vector<edge*> path(size, nullptr);
        while (!que.empty()) {
          int v = que.front();
          if (v == sink) break;
          que.pop();
          for (auto& e : graph[v]) {
            if (e.to == source || path[e.to] != nullptr || e.flow == e.capacity)
              continue;
            que.push(e.to);
            path[e.to] = &e;
          }
        }
        if (path[sink] == nullptr)
          break;
        int inc = INF;
        for (auto e = path[sink]; e != nullptr; e = path[e->reverse().to])
          inc = min(inc, e->capacity - e->flow);
        for (auto e = path[sink]; e != nullptr; e = path[e->reverse().to])
          e->add_flow(inc);
        assert(inc < INF);
        flow += inc;
      }
      return flow;
    }
};

signed main() {
  int n;
  cin >> n;
  vector<int> a(n);
  int reward = 0;
  network graph(n + 2);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] < 0) {
      graph.add_edge(0, i + 1, -a[i]);
    }
    else {
      reward += a[i];
      graph.add_edge(i + 1, n + 1, a[i]);
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 2 * i; j <= n; j += i)
      graph.add_edge(i, j, INF);
  cout << (reward - graph.max_flow(0, n + 1)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define debug(X) cout << #X << " = " << X << endl

using namespace std;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	#ifdef UTP
	freopen("input.txt", "r", stdin);
	#endif
	int n, m; cin >> n >> m;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a.begin(), a.end());
	vector< pair<int, int> > q(m);
	for (int i = 0; i < m; i++)
        cin >> q[i].second >> q[i].first;
    sort(q.rbegin(), q.rend());
    for (int i = 0, c = 0; i < m && c < n; i++) {
        for (int j = 0; j < q[i].second && c < n; j++) {
            a[c] = max(a[c], q[i].first);
            c++;
        }
    }
    long long ans = accumulate(a.begin(), a.end(), 0LL);
	cout << ans << endl;
	return 0;
}


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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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 coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

//Write From this Line

const int mod = 1e9+7;
int main()
{
	int n , m; 
	cin >> n >> m; 
	vector<pair<int,int>> p(m);
	rep(i,m) {
		cin >> p[i].first >> p[i].second;
		//a[i]とb[i]を行き来できないようにしてほしい
	}

	SORT(p);
	
	map<int,int> disconnect_island;
	//1と縁を切らないと行けない島の最小の島番号を保持するって感じ map 
	rep(i,m) {
		int a = p[i].first , b = p[i].second;
		//mapにp[i].firstをkeyでもつものがなければ追加
		if(!disconnect_island.count(a)) {
			disconnect_island[a] = b ;
		} else {
			disconnect_island[a] = min(disconnect_island[a],b);
		}
	}
	//下準備が終わった
	int ans = 1 ; 
	int a = 0 , b = 1e6; 
	//cout << "a: " << a << " b: " << b << endl;
	for(auto x : disconnect_island) {
		int p1 = x.first , p2 = x.second ;
		//cout <<"p1: " << p1 << " p2: " << p2 << endl;
		//新たにきたp1とp2が納まっている？なら橋はまだ切らずに更新
		//p1がbを超えるかp2がbを超えたらだめ
		if( b <= p1  ) {
			ans ++ ;
			a = p1 , b = p2;
		} else {
			a = p1 ;
			b = min(b,p2) ; 
		}
		//cout << "a: " << a << " b: " << b << endl;
	}
	cout << ans << endl;

}


Measured memory_bytes: 5760
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc *bufio.Scanner

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt()

	aMat := make([][]int, n)
	for i := range aMat {
		aRow := make([]int, n-1)
		for j := range aRow {
			aRow[j] = nextInt() - 1
		}
		aMat[i] = aRow
	}

	days := make([]int, n)
	for {
		matched := false
		for i := range aMat {
			for {
				if len(aMat[i]) == 0 {
					break
				}
				other := aMat[i][0] // len(aMat[other]) > 0
				if i != aMat[other][0] {
					break
				}
				day := maxInt(days[i], days[other]) + 1
				days[i], days[other] = day, day
				aMat[i], aMat[other] = aMat[i][1:], aMat[other][1:]
				matched = true
			}
		}
		if !matched {
			for _, aRow := range aMat {
				if len(aRow) > 0 {
					fmt.Println(-1)
					return
				}
			}
			ans := 0
			for _, d := range days {
				ans = maxInt(ans, d)
			}
			fmt.Println(ans)
			break
		}
	}
}


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

int n,A=-(1<<31),I=(1<<31),d;

int main(){
	cin>>n>>I;
	for(int i=1;i<n;i++){
		cin>>d;
		A=max(A,d-I);
		I=min(I,d);
	}
	cout<<A<<endl;
	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int k, s;
    cin >> k >> s;

    long long ans=0;
    for(int i=0;i<=k;i++)
        for(int j=0;j<=k;j++)
            if( s - i - j >= 0 and s - i -j <= k)
                ans++;
    cout << ans;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include <unordered_map>
#define int long long int
#define double long double
#define endl "\n"
#define PI 3.141592653589793238462643383279502884
#define sum_up(x)  (x*(x+1))/2
#define sp(x)   setprecision(x)
#define ceil(a,b)   (a+(b-1))/b

using namespace std;

void base()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
/*
bool prime[100001];
void sieve(int n)
{
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p)
                prime[i] = false;
        }
    }
}
int power(int x, int y)
{
    int res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = res * x;
        y = y >> 1;
        x = x * x;
    }
    return res;
}

double float_sq(double n)
{
    double x = n;
    double y = 1;
    double e = 0.000001;
    while (x - y > e)
    {
        x = (x + y) / 2;
        y = n / x;
    }
    return x;
}

int int_sq(int x)
{
    if (x == 0 || x == 1)
        return x;
    int start = 1, end = x, ans;
    while (start <= end)
    {
        int mid = (start + end) / 2;
        if (mid*mid == x)
            return mid;
        if (mid*mid < x)
        {
            start = mid + 1;
            ans = mid;
        }
        else
            end = mid-1;
    }
    return ans;
}*/

int32_t main()
{
    base();
    int q;
    cin>>q;
    int arr[q];
    int Sort[q];
    for(int i=0;i<q;i++){
        cin>>arr[i];
        Sort[i]=arr[i];
    }
    sort(Sort,Sort+q);
    for(int i=0;i<q;i++){
        if(arr[i]==Sort[q-1]){
            if(q==1) cout<<arr[i]<<endl;
            else cout<<Sort[q-2]<<endl;
        }
        else cout<<Sort[q-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 4736
n, k = gets.chomp.split(' ').map(&:to_i)
v = gets.chomp.split(' ').map(&:to_i)

pat = []
for j in 0..k
  for i in 0..j
    tmp_v = v.dup
    item = []
    i.times do
      item << tmp_v.shift
    end
  
    (j-i).times do
      item << tmp_v.pop
    end

    item.compact!
    item.sort!
    if item.count > 0
      (k-j).times do
        if item[0] < 0
          item.shift
        end
        break if item.count == 0
      end
    end
    pat << item.inject(:+)
  end
end
pat.compact!
pat << 0
p pat.max



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

using namespace std;
typedef long long int ll;

bool pos(string s, string t, int p){
	int n=s.length(), m=t.size();
	int l=n-p;
	if(l<m) return false;
	for(int i=0; i<m; i++){
		if(s[i+p]!='?' && t[i]!=s[i+p]) return false;
	}
	return true;
}

int main(){
	string s, t;
	cin>>s>>t;
	int n=s.length(), m=t.size();
	vector<string> ps;
	for(int p=0; p<n; p++){
		if(pos(s,t,p)){
			string ts=s;
			for(int i=0; i<p; i++){
				if(ts[i]=='?') ts[i]='a';
			}

			for(int i=0; i<m; i++){
				ts[i+p]=t[i];
			}

			for(int i=p+m; i<n; i++){
				if(ts[i]=='?') ts[i]='a';
			}

			ps.push_back(ts);
		}
	}
	if(ps.size()){
		sort(ps.begin(), ps.end());
		cout<<ps[0]<<endl;		
	}else{
		cout<<"UNRESTORABLE"<<endl;
	}
}

Measured memory_bytes: 256
#include <stdio.h>

typedef long long ll;

int main() {

	ll N,X;

	scanf("%lld %lld",&N,&X);

	ll ans = N;

	N -= X;

	while (N%X != 0) {
		ans += (N / X)*X * 2;
		ll t = X;
		X = N%X;
		N = t;
	}

	ans += X*(((N / X)* 2) - 1);

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

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
    int a,A,B;
    cin>>a;
    if(a==1)
    {
        cout<<"Hello World"<<endl;
    }
    if(a>=2)
    {
        cin>>A>>B;
        cout<<A+B<<endl;
    }
    return 0;
}


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

judge = [1]*N

for r in road:
    h1 = H[r[0]-1]
    h2 = H[r[1]-1]
    if h1 < h2:
        judge[r[0]-1] = 0
    if h1 == h2:
        judge[r[0]-1] = judge[r[1]-1] = 0
    if h1 > h2:
        judge[r[1]-1] = 0

print(sum(judge))

Measured memory_bytes: 31924
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    int a,b,c,x;
    cin>>a>>b>>c;

    if(a>c){
        x=a;
        a=c;
        c=x;
    }

    if(a>b){
        x=b;
        b=a;
        a=x;
    }

    if(b>c){
        x=b;
        b=c;
        c=x;
    }

    cout<<a<<" "<<b<<" "<<c<<endl;

    return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <unordered_set>
#include <set>
#include <cstring>
#include <map>
#include <cmath>
#include <algorithm>
#include <queue>

using namespace std;

using ll = long long;
const ll INF = 1e18 + 1;




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

    ll n;

    cin >> n;
    cout << n + n*n + n*n*n << endl;







}

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

#define maxn 200010
#define INF 1e15
#define ff first
#define ss second
#define endl '\n'
typedef long long ll;

int ans[maxn];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);   
  string str;
  cin >> str;
  int n = str.length();
  int curr = 0;
  for (int i = 0; i < n; ++i) ans[i] = 1;
  for (int i = 1; i < n; ++i) {
    if (str[i] == 'R') curr = i;
    else {
      int dis = i - curr;
      if (dis & 1) {
        if (curr + 1 != i) {
          ans[curr + 1] += ans[i];
          ans[i] = 0;
        }
      }
      else {
        ans[curr] += ans[i];
        ans[i] = 0;
      }
    }
  }
  int curl = n - 1;
  for (int i = n - 2; i >= 0; --i) {
    if (str[i] == 'L') curl = i;
    else {
      int dis = curl - i;
      if (dis & 1) {
        if (curl - 1 != i) {
          ans[curl - 1] += ans[i];
          ans[i] = 0;
        }
      }
      else {
        ans[curl] += ans[i];
        ans[i] = 0;
      }
    }
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  cout << endl;
}


Measured memory_bytes: 1104
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int ans = INF;
	int D, G;
	cin >> D >> G;
	int p[D], c[D];
	REP(i, D) cin >> p[i] >> c[i];

	for (int bit = 0; bit < (1<<D); bit++){
		int score = 0;
		int num = 0;
		int max_index = -1;
		for (int i = 0; i < D; i++){
			if (bit & 1 << i){
				score += 100*(i+1)*p[i]+c[i];
				num += p[i];
			}
			else {
				max_index = i;
			}
		}

		if (score < G){
			int highest_s = 100*(max_index+1);
			int more = (G-score+(highest_s-1)) / highest_s;

			if (more >= p[max_index]) continue;

			num += more;
		}

		ans = min(ans, num);
	}

	cout << ans << endl;
}


Measured memory_bytes: 256
import sys

n = int(input())
L = list(map(int,input().split()))

#print(L)
ans = 0


for i in range(len(L)):
    for j in range(i+1,len(L)):
        for k in range(j+1,len(L)):
            q = []
            q.append(L[i])
            q.append(L[j])
            q.append(L[k])
            q.sort(reverse=True)
            #print(q)
            if q[0]<(q[1]+q[2]) and (q[1]-q[2])*(q[1]-q[0])*(q[0]-q[2])!=0:
                ans += 1
                

print(ans)

Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n; cin >> n;
    vector<int> a(n); for(int i=1; i<n; ++i){cin >> a[i]; a[i]--;}
    vector<int> b(n, 0);
    for(int i=1; i<n; ++i){b[a[i]]++;}
    for(int i=0; i<n; ++i){cout << b[i] << endl;}
    return 0;
}

Measured memory_bytes: 4816
// #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 pb push_back
#define pf push_front
#define fi first
#define se second
#define mk make_pair
#define ve vector
#define lr(n) for (ll i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define be begin
#define sz(a) (ll)(a.size())
#define 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;
// }

void solve(){
	ll x;
	cin>>x;
	ll y=360;
	ll g=gcd(y,x);
	y/=g;
	cout << y << "\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll T=1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;

int main(void){
 int A,B,C,X,Y;
 long long int sum=0;
 cin>>A>>B>>C;
 cin>>X>>Y;
 sum=A*(X-min(X,Y))+B*(Y-min(X,Y))+C*2*min(X,Y);
 if((A+B)<2*C)std::cout<<A*X+B*Y<<std::endl;
 else if(C*2*max(X,Y)<sum)std::cout<<C*2*max(X,Y)<<std::endl; 
 else std::cout<<sum<<std::endl;
}

Measured memory_bytes: 256
"""
author : halo2halo
date : 10, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = map(int,readline().split())

print(1+(B-2)//(A-1))


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  vector<P> p(n);
  rep(i,n) cin >> p[i].first >> p[i].second;
  sort(p.begin(),p.end());

  vector<vector<int>> dp(n+1,vector<int>(t));
  rep(i,n){
    int a = p[i].first, b = p[i].second;
    rep(ti,t){
      if(ti<a){
        dp[i+1][ti] = dp[i][ti];
      }else{
        dp[i+1][ti] = max(dp[i][ti],dp[i][ti-a] + b);
      }
    }
  }
  int ans = 0;
  rep(i,n){
    ans = max(ans,dp[i][t-1]+p[i].second);
  }
  cout << ans << endl;
}

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

int main() {
    string S, T;
    cin >> S >> T;

    int ans = T.size(), diff = 0;

    for (int i = 0; i < S.size(); i++) {
        if (S.at(i) != T.at(i)) {
            diff++;
        }
    }
    ans = min(ans, diff);

    cout << ans << endl;
}

Measured memory_bytes: 3836
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <stack>
#include <queue>

#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define vsort(v) sort(v.begin(),v.end())
#define asort(a,n) sort(a, a + n)
#define vi vector<int>
#define vd vector<double>

using namespace std;

int main(){
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    N = sqrt(N);
    cout << N * N << endl;

    return 0;
}

Measured memory_bytes: 256
def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista

def B_strings(): 
    N = wczytaj_liste()[0]
    wczytaj = input()
    S, T = wczytaj.split()
    odp = []
    for i in range(N): 
        odp.append(S[i])
        odp.append(T[i])
    print(''.join(odp))

B_strings()

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

int main(){
  int n;
  cin >> n;
  int ans=0;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
    if(i%2==0&&a.at(i)%2==1){
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main(){
    int n,m,c,ans=0;
    cin >> n >> m >> c;
    vector<int> b(m);
    vector<vector<int>> a(n,vector<int>(m));
    for(int i=0;i<m;i++){
        cin >> b.at(i);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin >> a.at(i).at(j);
        }
    }
    for(int i=0;i<n;i++){
        int ab=0;
        for(int j=0;j<m;j++){
            ab+=a.at(i).at(j)*b.at(j);
        }
        if(ab+c>0){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI = 3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, (int)vec.size() - 1)std::cout << vec[i] << " ";
	if(!vec.empty())std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int n;
int main() {
	std::cin>>n;
	lint ans=0;
	rep(i,n)ans+=(lint)(i+1)*(n-i);
	rep(i,n-1){
		lint u,v;
		std::cin>>u>>v;
		u--;v--;
		if(u>v)std::swap(u,v);
		ans-=(u+1)*(n-v);
	}
	std::cout<<ans<<std::endl;
	return 0;
}

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

int main(){
	int a,b;
  	cin >> a >> b;
  
  	int judge = 0;
  	if((a + b) % 2 != 0){
    	judge = (a + b + 1) / 2;
    }else{
    	judge = (a + b) / 2;
    }
  	cout << judge << endl;	
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	for i := 1; i <= 5; i++ {
		x := nextInt()
		if x == 0 {
			fmt.Fprintf(out, "%d\n", i)
			break
		}
	}
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
using namespace std;
int main(){
  string s;
  cin >> s;
  vector<string> v({"SUN","MON","TUE","WED","THU","FRI","SAT"});
  int i;
  for(i=0;i<7;i++){
    if(v[i]==s){
      cout << 7-i << "\n";
      return 0;
    }
  }
}

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

int main()
{



int n;
int counter=0;
cin>>n;
for(int i=1;i<=n;i++)
{


    string str=to_string(i);
    if(str.size()%2!=0)counter++;





}
cout<<counter;
}


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

#define ll long long
const int MOD = 1e9 + 7;
#define INF 2e9

#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

#define MATCH(_str, _ptn) regex_match(_str, regex(_ptn))
#define REPLACE(_str, _ptn, _replacement) regex_replace(_str, regex(_ptn), _replacement)

# define pb push_back

# define INIT() cin.tie(0); ios::sync_with_stdio(false)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

double a,b,h,m,ay,ax,bx,by;
string s;
int main() {
    INIT();

    cin >> a>>b>>h>>m;
    
    
    double do_m = m * 360 / 60;
    double radian_m = do_m * M_PI / 180;

    double do_h = h * 360 / 12 + do_m / 12;
    double radian_h = do_h * M_PI / 180;
    
    ax = cos(radian_h) * a;
    bx = cos(radian_m) * b;
    
    ay = sin(radian_h) * a;
    by = sin(radian_m) * b;

    cout << fixed << std::setprecision(20) << sqrt(abs(ax -bx) * abs(ax -bx) + abs(ay - by) * abs(ay - by));
    return 0;
}

Measured memory_bytes: 4180
import java.util.*;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.awt.Point;


public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] s = br.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
        int d = Integer.parseInt(s[1]);
        
        System.out.println(n%(2*d+1)==0?n/(2*d+1):n/(2*d+1)+1);
    }

    
}





Measured memory_bytes: 21332
as = 3.times.map {gets.split.map(&:to_i)}
n = gets.to_i
bs = n.times.map {gets.to_i}

bs.each do |b|
  as.each_with_index do |aa, i|
    aa.each_with_index do |a, j|
      if a == b
        as[i][j] = -1
      end
    end
  end
end

ans = 'No'
as.each do |a|
  if a.count(-1) == 3
    ans = 'Yes'
  end
end

as.transpose.each do |a|
  if a.count(-1) == 3
    ans = 'Yes'
  end
end

if as[0][0] == -1 && as[1][1] == -1 && as[2][2] == -1
  ans = 'Yes'
end

if as[2][0] == -1 && as[1][1] == -1 && as[0][2] == -1
  ans = 'Yes'
end

puts ans

Measured memory_bytes: 1916