akhauriyash/Code-Regression huggingface dataset:
//#define DEB1 //input from input.txt
//#define NDEBUG
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <thread>
#include <mutex>
#include <iomanip>
#include <cassert>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(),(t).end()
#define FILL(a,c) fill(a, a+ sizeof(a)/sizeof(*a),c)
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
#define REP(i,m) for(int i=0;i<(m);++i)
// closed interval, inverse repeat
#define CIREP(i,start,fin) for(int i=(start);i>=(fin);i--)
#define CREP(i,start,fin) for(int i=(start);i<=(fin);i++)
#define RNG(i,start,fin) for(int i=(start);i<(fin);i++)
#define IN(a, x, b) (a<=x && x<b)
#define PB push_back
#define SZ(x) (int)(x).size()

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL,LL>;
using VI = vector<int>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VVI = vector<VI>;
const LL LINF = 1001002003004005006ll;
/* 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,SZ(v))i>>v[j];return i;}

template<typename T>string join(const vector<T>&v)
{stringstream s;REP(i,SZ(v))s<<' '<<v[i];return s.str().substr(1);}

template<typename T>inline ostream& operator<<(ostream&o,const vector<T>&v)
{if(SZ(v))o<<join(v);return o;}
*/

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




/*
constant values
*/

//const int dx[] = {1,0,-1,0};
//const int dy[] = {0,1,0,-1};
//const int MX = 31001;

//const ll INF= 1LL<<60 ;//INF = 1001001001001; //1e9


// Main program
void solve(){
    float a, b, n;
    cin >> a >> b >> n;
    chmax(a,b);
    cerr << n/a << endl;
    cout << int(ceil(n/a)) << endl;

    return;
}



// ----------------------------------------------
int main(){

#ifdef DEB1
    cout << "DEBUG MODE"  << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf()); //for debug
#endif

    int T=1; 

    for (int i = 0; i < T; ++i) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
uv = [sorted(map(int, input().split())) for _ in range(n - 1)]

# 解説AC
ans = sum(i * (n + 1 - i) for i in range(n + 1))
for u, v in uv:
    ans -= u * (n - v + 1)
print(ans)


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T &t, const U &u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T &t, const U &u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

class unionfind {
    vector<int> par, rank;

   public:
    void init(int n) {
        par.resize(n);
        rank.resize(n);

        for (int i = 0; i < n; i++) {
            par[i] = i;
            rank[i] = 0;
        }
    }

    int find(int x) {
        if (par[x] == x)
            return x;
        else
            return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;

        if (rank[x] < rank[y])
            par[x] = y;
        else {
            par[y] = x;
            if (rank[x] == rank[y]) ++rank[x];
        }
    }

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

int main() {
    int N, M;
    cin >> N >> M;
    V<int> p(N);
    rep(i, N) cin >> p[i], --p[i];
    unionfind uf;
    uf.init(N);
    rep(i, M) {
        int x, y;
        cin >> x >> y;
        --x, --y;
        uf.unite(x, y);
    }
    int ans = 0;
    rep(i, N) if (uf.same(i, p[i])) ans++;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#include<vector>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define rep(i,N) for(int i=0;i<N;i++)

using namespace std;

int main(void){
    int A,B;
    cin>>A>>B;
    if((A+B)%2==0){
        cout<<int((A+B)/2)<<endl;
    }
    else{
        cout<<"IMPOSSIBLE"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <assert.h>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(){
  ll l,r,d;
  cin>>l>>r>>d;
  ll ans = 0;
  rep(i,l,r+1){
    if(i%d==0)ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <functional>
#include <initializer_list>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#define REP(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define REPC(i, a, n) for (int i = (a); i <= (int)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}

int main() {
  string o, e;
  cin >> o >> e;
  REP(i, 0,  o.length()+e.length()) {
    if (i % 2 == 0)
      cout << o[i / 2];
    else
      cout << e[i / 2];
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        string S = Console.ReadLine();

        int a = int.Parse(new string(S.Take(2).ToArray())),
            b = int.Parse(new string(S.Skip(2).ToArray()));

        if (1 <= a && a <= 12)
        {
            if (1 <= b && b <= 12)
                Console.WriteLine("AMBIGUOUS");
            else
                Console.WriteLine("MMYY");
        }
        else
        {
            if (1 <= b && b <= 12)
                Console.WriteLine("YYMM");
            else
                Console.WriteLine("NA");
        }
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;


int main() {
	int n, m;
	cin >> n >> m;
	ll ans=0;
	ans = (ll)(n - 2)*(m - 2);
	if (ans < 0) {
		ans *= -1;
	}
	
	cout << ans << endl;

	
}



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

using namespace std;

int solve(std::string& s) {
  int ret = s.size();
  int sCount = 0;
  int tCount = 0;
  for (auto const c : s) {
    if (c == 'S') {
      if (tCount) {
        ret -= tCount * 2;
        sCount -= tCount;
        tCount = 0;
      }
      sCount++;
      continue;
    }

    tCount = std::min(tCount + 1, sCount);
  }
  if (tCount) {
    ret -= tCount * 2;
  }
  return ret;
}

int main() {
  std::string s;
  std::cin >> s;
  std::cout << solve(s) << std::endl;
  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#define sz(x) (int)(x).size()

const int N = 510;
const int M = 200010;
int f[N][N], g[N][N], n, m, q;
int lf[M], rt[M];

void process() {
  memset(f, 0, sizeof f);
  for (int i = 0; i < m; i++) f[lf[i]][rt[i]]++;
  for (int i = 1; i <= n; i++) g[i][i] = f[i][i];

  for (int s = 2; s <= n; s++) {
    for (int i = 1; i + s - 1 <= n; i++) {
      int j = i + s - 1;
      g[i][j] = f[i][j] + g[i + 1][j] + g[i][j - 1] - g[i + 1][j - 1];
    }
  }
  assert(g[1][n] == m);
}

int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 0; i < m; i++) scanf("%d%d", &lf[i], &rt[i]);
  process();
  int a, b;
  for (int i = 0; i < q; i++) {
    scanf("%d%d", &a, &b);
    printf("%d\n", g[a][b]);
  }
}



Measured memory_bytes: 4480
import java.io.*;
import java.util.*;
public class Main {
    
    public static void main(String args[]) {
        int n = 0, w = 0;
        int[][] arr = null;
        int sumValues = 0;
        try (Scanner scanner = new Scanner(System.in)) {
            n = scanner.nextInt();
            w = scanner.nextInt();
            
            arr = new int[n][2];
            for (int i=0; i < n; i++) {
                for(int j = 0; j < 2 ; j++) {
                    arr[i][j] = scanner.nextInt();
                    if(j == 1)
                        sumValues += arr[i][j];
                }
            }
        }
        long[] dp = new long[sumValues + 1];
        Arrays.fill(dp, Long.MAX_VALUE);
        dp[0] = 0;
        for(int i = 0; i < n; i++) {
            int curW = arr[i][0];
            int curV = arr[i][1];
            for(int j = sumValues; j >= 0 ; j--) {
                if(dp[j] == Long.MAX_VALUE)
                    continue;
                long combinedW = dp[j] + curW;
                int combinedV = j + curV;
                if(dp[combinedV] > combinedW)
                    dp[combinedV] = combinedW;
            }
        }
        
        // System.out.println(Arrays.toString(dp));
        for(int j = sumValues; j >= 0 ; j--) {
            if(dp[j] <= w){
                System.out.println(j);
                return;
            }
        }
        
        System.out.println(-1);
        
    }
}

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

int main() {
    int N;
    cin >> N;
    vector<int>v(N);
    for (int i = 0; i < N; ++i) {
      cin >> v[i];
    }
    sort(v.begin(), v.end());
    double ans = v[0];
    for (int i = 1; i < N; ++i) {
        ans += v[i];
        ans /= 2;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

int main(void) {
    int N;
    cin >> N;
    map<string,int> mp;
    while(N--) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        mp[s]++;
    }

    int64_t ans = 0;
    for(auto itr=mp.begin(); itr!=mp.end(); itr++) {
        int64_t val = itr->second;
        ans += val*(val-1)/2;
    }

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


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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    priority_queue<pair<int,int>> c;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        pair<int,int> p;
        p.second = a;
        p.first = b;
        c.push(p);
    }
    sort(a.begin(),a.end());

    // rep(k,n){
    //     cout << a.at(k) << " ";
    // }
    // cout << endl;

    int bl = 0;
    while(c.size() && bl < n){
        auto p = c.top(); c.pop();
        // int l = bl,r = n;
        // while(l+1 < r){
        //     int x = (l+r)/2;
        //     if(a.at(x) < p.first) l = x;
        //     else r = x;
        // }
        // for(int j=bl+1;j<=l && j<bl+1+p.second;j++){
        //     a.at(j) = p.first;
        // }
        // bl = min(l, bl+1+p.second);
        
        for(int j=0;j<p.second && bl<n;j++){
            if(a.at(bl) < p.first){
                a.at(bl) = p.first;
                bl++;
            }
            else {
                break;
            }
        }

        // rep(k,n){
        //     cout << a.at(k) << " ";
        // }
        // cout << endl;
    }
    ll tot = 0;
    rep(i,n){
        tot += a.at(i);
    }
    cout << tot << endl;
    return 0;
}

Measured memory_bytes: 1784
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<cmath>
#include<iomanip>
using namespace std;

int main(void){
	int a[6],ue,sita,hokan;
	char huku;

	cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6];
while(cin>>huku){
	if(huku=='N'){
		hokan=a[1];
		a[1]=a[2];
		a[2]=a[6];
		a[6]=a[5];
		a[5]=hokan;
	}
	if(huku=='E'){
		hokan=a[1];
		a[1]=a[4];
		a[4]=a[6];
		a[6]=a[3];
		a[3]=hokan;
	}
	if(huku=='S'){
		hokan=a[1];
		a[1]=a[5];
		a[5]=a[6];
		a[6]=a[2];
		a[2]=hokan;
	}
	if(huku=='W'){
		hokan=a[1];
		a[1]=a[3];
		a[3]=a[6];
		a[6]=a[4];
		a[4]=hokan;
	}
	}
cout<<a[1]<<endl;
	return 0;
}



Measured memory_bytes: 3100
#include <set>
#include <map>
#include <cmath>
#include <ctime>
#include <bitset>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define PR pair
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define REP(i, x, y)   for(int i = (int)(x); i <= (int)(y); i++)
#define FOR(i, x, y)   for(int i = (int)(x); i <  (int)(y); i++)
#define PER(i ,x, y)  for(int i = (int)(x); i >= (int)(y); i--)
#define CH	         ch = getchar()
#define Exit(...)    printf(__VA_ARGS__), exit(0)
#define dln()        fprintf(stderr,"\n")
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef double	  db;
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI > VII;
typedef PR<int,int> PII;
typedef vector<PII> VPI;
const	int inf=2e9;
const	LL Inf=1e10;
const	int P=1e9+7;
const	int N=200005;

inline LL IN(){
	LL x = 0;
	int ch = 0, f = 0;
	for (CH; ch != -1 && (ch < 48 || ch > 57); CH) f = (ch == '-');
	for (; ch >= 48 && ch <= 57; CH) x = (x << 1) + (x << 3) + ch - '0';
	return f ? (-x) : x;
}
template<typename T> inline int chkmin(T &a, const T &b){if(b < a) return a = b, 1; return 0;}
template<typename T> inline int chkmax(T &a, const T &b){if(b > a) return a = b, 1; return 0;}

void renew(int &x, const int &y){
	x += y;
	if(x >= P) x -= P;
	if(x <  0) x += P;
}

int Pow(int x, int y, int p){
	int a = 1;
	for (; y; y >>= 1, x = (LL)x * x %p) if(y & 1) a=(LL)a * x%p;
	return a;
}

int X[N], Y[N], n;
int V[4005][4005], ans, inv[8005], fac[8005];

int C(int x, int y){
	return (LL)fac[x + y] * inv[x] % P * inv[y] % P;
}

int main(){
	scanf("%d", &n);
	REP(i, 0, 8002) inv[i] = Pow(i, P - 2, P);
	inv[0] = 1;
	REP(i, 1, 8002) inv[i] = (LL)inv[i - 1] * inv[i] % P;
	REP(i, 0, 8002) fac[i] = Pow(inv[i], P - 2, P);
	REP(i, 1, n) scanf("%d%d", X + i, Y + i);
	REP(i, 1, n) renew(V[2001 - X[i]][2001 - Y[i]], 1);
	REP(i, 0, 4002)
	REP(j, 0, 4002){
		renew(V[i][j + 1], V[i][j]);
		renew(V[i + 1][j], V[i][j]);
	}
	REP(i, 1, n) renew(ans, V[X[i] + 2001][Y[i] + 2001]);
	REP(i, 1, n) renew(ans, -C(X[i] + X[i], Y[i] + Y[i]));
	printf("%d\n", (LL)ans * Pow(2, P - 2, P) % P);
	return 0;
}

Measured memory_bytes: 64512
n,y=map(int,input().split())
ans=0
for i in range(n+1):
    for j in range(n+1):
        if 10000*i+5000*j+1000*(n-i-j)==y and n-i-j>=0:
            ans+=1
            print(i,j,n-i-j)
            break
    else:
        continue
    break
if ans==0:
    print('-1 -1 -1')

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll a[5050];

int main(){
    int n, k;
    cin >> n >> k;
    rep(i, n) cin >> a[i];
    sort(a, a + n);

    ll t = 0, cnt = 0, ans = n;
    
    rrep(i, n){
        if (t + a[i] < k) t += a[i];
        else ans = i;
    }

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


Measured memory_bytes: 3676
#include <iostream>
using namespace std;
int main() {
	long long n;
	cin >> n;
	long long int *a = new long long[n];
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i];
	}
	int count = 0;
	for (int i = 0; i < n; ++i)
	{
		int loc = a[i];
		if (a[loc-1] == i+1)
		{
			count++;
		}
	}
	cout << count / 2;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N, H;
	cin >> N >> H;
	vector<ll > a(N), b(N);
	REP(i, N) cin >> a[i] >> b[i]; 

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	ll res = 0;
	REP(i, N){
		ll ind = N-1-i;
		if(b[ind]<=a[N-1]) break;
		H -= b[ind];
		res++;
		if(H<=0){
			cout << res << endl;
			return 0;
		}
	}
	res += (H/a[N-1]+(H%a[N-1]!=0));
	cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
#define int long long int

signed main(){
    int a, b, n;
    cin >> a;
    cin >> b;
    cin >> n;
    int wa = max(a,b);
    for(int i=0;true;i++){
        if(wa*i >= n){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;



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



	return 0;
}

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

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // vector<int> n;
  int a, b, c;
  cin >> a >> b >> c;
  cout << min(a + b, min(b + c, c + a)) << endl;
      return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <stdio.h>
#include <algorithm>
#include <map>
#include <queue>
#include <unordered_map>
#define ll long long
#define pii pair <int, int>
#define pll pair <long long, long long>
#define plxy pair <long long, pll>
#define INT_MAX 1e18
using namespace std;
using namespace std;
const int mod=1e9+7;
const int N=2e5+5;
int main()
{
    int n;
    cin>>n;
    cout<<(n+1)/2<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	ll N,K;
	scanf("%lld %lld",&N,&K);

	if(K%2 == 0){

		ll num = 0;
		ll num2 = 0;
		ll half_K = K/2;

		for(ll i = 1; i <= N; i++){

			if(i%K == 0){

				num++;
			}else if(i%(half_K) == 0){

				num2++;
			}
		}

		printf("%lld\n",num*num*num+num2*num2*num2);

	}else{

		ll num = 0;

		for(ll i = 1; i <= N; i++){

			if(i%K == 0)num++;
		}

		printf("%lld\n",num*num*num);
	}

	return 0;
}


Measured memory_bytes: 3772
#define _USE_MATH_DEFINES
#include <stdio.h>
#include<math.h>

int main(void)
{
  float  num, dnum;
  int a;
  scanf("%d", &a);
  
  dnum = a * M_PI * 2;
    
  printf("%f", dnum);
  
  return 0;
}

Measured memory_bytes: 1716
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())
a = list( map(int, input().split()))
a.sort()

from itertools import accumulate
acc = [0]+a
acc = list(accumulate(acc))

mi = 0
for i in reversed(range(1,n)):
    if acc[i]*2 < a[i]:
        mi = i
        break

print(n-mi)

Measured memory_bytes: 14252
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n = int(input())
    aa = LI()
    cnt = [0] * 100005
    for a in aa:
        cnt[a] += 1

    ans = s = sum(cnt[:3])
    for x in range(100000):
        s += cnt[x + 3] - cnt[x]
        if s > ans: ans = s

    print(ans)

main()


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

#define int long long
#define ll long long
#define f1(i,a,b) for(i=a;i<b;i++)
#define f2(i,a,b) for(i=a;i>=b;i--)
#define endl '\n'
#define pb push_back
#define gp " "
#define ff first
#define ss second
#define mp make_pair

const int mod=1000000007;
int i,j;
ll temp;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b,c;
    cin>>a>>b>>c;
    cout<<(a*b)/2;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
using namespace std;
int n,a[101],ans=0;
bool ced[101];
int main()
{
	cin>>n;
	for(register int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	for(register int i=2;i<=n;i++)
	{
		if(a[i]==a[i-1]&&ced[i-1]==0)
		{
			ced[i]=1;
			ans++;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
import math
def f(x,y,z):
    # x,y,z = A,x,B
    return math.floor(x*y/z) - x*math.floor(y/z)
a,b,n = map(int,input().split())
if n<b:
    print(math.floor(a*n/b))
else:
    print(f(a, b-1, b))

Measured memory_bytes: 9052
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
//cout << fixed << setprecision(10);

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

struct Edge { int to, id;};
vector<vector<Edge>> g;
vi ans;

void dfs(int v, int c=-1, int p=-1) {
  int k = 1;
  rep(i,g[v].size()) {
    int u = g[v][i].to, ei = g[v][i].id;
    if (u == p) continue;
    if (k == c) ++k;
    ans[ei] = k++;
    dfs(u,ans[ei],v);
  }
}

int main () {
  int n;
  cin >> n;
  g.resize(n);
  ans = vi(n-1);
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back((Edge){b,i});
    g[b].push_back((Edge){a,i});
  }
  dfs(0);
  int mx = 0;
  rep(i,n) mx = max(mx, (int)g[i].size());
  cout << mx << endl;
  rep(i,n-1) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 8320
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0); 
  int n, m;
  while (cin >> n) {
    cin >> m;
    if (n == 0) return 0;
    vector<int> a(n), b(m);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a.begin(), a.end());
    for (int i = 0; i < m; i++) {
      cin >> b[i];
    }
    sort(b.begin(), b.end());
    int s = 0, t = 0;
    int ans = 0;
    while (s < n || t < m) {
      if (s < n && t < m) {
        if (a[s] < b[t]) {
          ans += a[s];
          s++;
        } else if (a[s] > b[t]) {
          ans += b[t];
          t++;
        } else {
          ans += a[s];
          s++;
          t++;
        }
      } else if (s < n) {
        ans += a[s];
        s++;
      } else {
        ans += b[t];
        t++;
      }
      //cerr << s << " " << t << " " << ans << endl;
    }
    cout << ans << '\n';
  }
  return 0;
}


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

int main() {
  string A, B, C;
  int a, b;
  cin >> A >> B >> C;
  a=A.size();
  b=B.size();
  if (A.at(a-1)==B.at(0) && B.at(b-1)==C.at(0)) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 3492
#include<iostream>
using namespace std;
int main(){
  string s;
  while(getline(cin,s)){
    for(int i=0; i<26; i++){
      for(int j=0; j<s.size(); j++){
	if(s[j]<'z' && s[j]>='a') s[j]++;
	else if(s[j] == 'z') s[j] = 'a';
      }
      if(s.find("the") != string::npos){cout <<s<<endl;break;}
      if(s.find("that") != string::npos){cout <<s<<endl;break;}
      if(s.find("this") != string::npos){cout <<s<<endl;break;}
    }
  }
  return 0;
}

Measured memory_bytes: 1172
N=int(input())
S=input()
R=[0 for i in range(N)]
L=[0 for i in range(N)]
LL=0
RR=0
for i in range(N):
  if S[i]=='(':
    LL+=1
  else:
    RR+=1
  L[i]=LL
  R[i]=RR
s=0
for i in range(N):
  s=max(s,R[i]-L[i])
t=s+L[N-1]-R[N-1]
print('('*s+S+')'*t)

Measured memory_bytes: 62028
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;

int main(){

	int year,month,day;
	while(~scanf("%d %d %d",&year,&month,&day)){
		char buf[64];
		sprintf(buf,"%04d%02d%02d",year,month,day);
		string str = buf;

		if("18680908" <= str && str <= "19120729"){
			printf("meiji %d %d %d\n",year-1868+1,month,day);
		}
		else if("19120730" <= str && str <= "19261224"){
			printf("taisho %d %d %d\n",year-1912+1,month,day);
		}
		else if("19261225" <= str && str <= "19890107"){
			printf("showa %d %d %d\n",year-1926+1,month,day);
		}
		else if("19890108" <= str){
			printf("heisei %d %d %d\n",year-1989+1,month,day);
		}
		else{
			printf("pre-meiji\n");
		}
	}
}

Measured memory_bytes: 0
n = int(input())
XY = []
for i in range(n):
    a = int(input())
    xy = []
    for j in range(a):
        x, y = map(int, input().split())
        xy.append([x, y])
    XY.append(xy)
ans = 0
for i in range(2 ** n):
    s = [0] * n
    cnt = 0
    case = 0
    for j in range(n):
        if (i >> j) & 1:
            s[n - 1 - j] = 1
            cnt += 1
    for k in range(n):
        if s[k] == 1:
            for l in range(len(XY[k])):
                if s[XY[k][l][0] - 1] != XY[k][l][1]:
                    case = 1
    if case == 0:
        ans = max(ans, cnt)
print(ans)

Measured memory_bytes: 9200
// 全然わかんねぇ数学できねぇ俺らは感覚でコードを書いている
// 参考 -> #6056988
import java.util.Scanner;

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

        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long d = sc.nextLong();

        long ans = f(b, c, d) - f(a-1, c, d);

        System.out.println(ans);
    }

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static long f(long n, long c, long d) {
        long x = n;
        x -= n / c;
        x -= n / d;
        long tmp = c / gcd(c, d) * d;
        x += n / tmp;
        return x;
    }
}

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

void solve()
{ 
  int N,D;
  cin>>N>>D;
  int a;
    int b;
  
  
int minn=INT_MAX;
  int count=0;
  for(int i=0;i<N;i++)
  {
    
    cin>>a;
    cin>>b;
    if( sqrt(pow(a,2)+pow(b,2))<=D )
      count++;
    
  
  }
  cout<<count<<endl;
  

}
int main()
{

solve();
}

Measured memory_bytes: 3680
import itertools
import math


n = int(input())
l = []
for i in range(n):
    l.append([int(_) for _ in input().split()])
ans = 0
for i in list(itertools.permutations(range(n))):
    for j in range(n-1):
        ans += math.sqrt((l[i[j]][0] - l[i[j+1]][0])**2 + (l[i[j]][1] - l[i[j+1]][1])**2)
print(ans/math.factorial(n))

Measured memory_bytes: 45808
#include <iostream>
#include <vector>
#include <memory.h>

using namespace std;
const long long MOD = 1e9+7 ;
vector <vector <long long  > > v ;
long long dp [100010][5] , n , prnt [1000000];
long long solve ( long long idx , int color )// 0 white 1 black 
{

	if(v[idx].size()==1 && v[idx][0]==prnt[idx])
		return dp[idx][color]=1  ;
		

	if (dp[idx][color]!=-1)return dp[idx][color];
	
	long long a=0,b=0 ,c , help=1    ;
	for (int j=0 ; j<v[idx].size();j++)
	{
		if (v[idx][j]==prnt[idx])
		continue ; 
	
		prnt [v[idx][j]]=idx ;
		
		a =  (solve (v[idx][j],0) %MOD)%MOD ; 
		if(color == 0) b = (solve(v[idx][j],1) %MOD)%MOD ; 
		c= (a%MOD+b%MOD)%MOD ;
		
		help=(help%MOD*c%MOD)%MOD  ;
	}
	


	return dp[idx][color] = help  ;
}
int main() {
	cin >> n ; 
	v.resize(n+1); 
	
	memset (dp , -1, sizeof dp ); 
	long long   x , y ; 
	for (int i=0 ;i<n-1 ; i++)
	{
		cin >> x >> y ;
		v[x].push_back(y); 
		v[y].push_back(x); 
	}
	
	if (n==1 ) 
	{
		cout << 2 ;
		return 0 ; 
	}
	
	long long one = solve(1,0)%MOD ;
	long long two = solve(1,1)%MOD ; 
	
	long long ans = (one%MOD+two%MOD)%MOD ;
	cout << ans<<endl  ;
	

	return 0;
}

Measured memory_bytes: 20480
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

#define F first
#define S second
#define PB push_back
#define MP make_pair

#define REP(i,start,end) for (int (i) = (start); (i) < (end); (i)++)
#define SORTV(v) sort(v.begin(), v.end())
#define SORTA(a, n) sort(a, a+n)

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

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

    int n, l;
    cin >> n >> l;
    vector<string> s;
    REP(i, 0, n) {
        string s_; cin >> s_;
        s.PB(s_);
    }
    SORTV(s);
    REP(i, 0, n) cout << s[i];

    return 0;
}

Measured memory_bytes: 892
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;


int main(){
  string s; cin>>s;
  int length=0;
  int index=0;
  rep(i,s.size()){
    if(s[i]!='A'&&s[i]!='T'&&s[i]!='G'&&s[i]!='C')
    continue;
    int end=0;
    for(int j=i;j<s.size();j++){
      if(s[j]!='A'&&s[j]!='T'&&s[j]!='G'&&s[j]!='C')
      break;
      end=j;
    }
      // cout<<i<<" "<<end<<endl;
    if(length<end-i+1){
      length=end-i+1;
      index=i;
    }
  }
  // if(s.size()==1&&(s[0]=='A'||s[0]=='T'||s[0]=='G'||s[0]=='C'))
  // length=1;
  cout<<length<<endl;
  return 0;
}


Measured memory_bytes: 256
s=list(str(input()))

if int(s[0])+int(s[1])+int(s[2])+int(s[3])==7:
    ans=s[0]+'+'+s[1]+'+'+s[2]+'+'+s[3]+'=7'
    print(ans)
    exit()

elif int(s[0])+int(s[1])+int(s[2])-int(s[3])==7:
    ans=s[0]+'+'+s[1]+'+'+s[2]+'-'+s[3]+'=7'
    print(ans)
    exit()

elif int(s[0])+int(s[1])-int(s[2])+int(s[3])==7:
    ans=s[0]+'+'+s[1]+'-'+s[2]+'+'+s[3]+'=7'
    print(ans)
    exit()

elif int(s[0])+int(s[1])-int(s[2])-int(s[3])==7:
    ans=s[0]+'+'+s[1]+'-'+s[2]+'-'+s[3]+'=7'
    print(ans)
    exit()

elif int(s[0])-int(s[1])+int(s[2])+int(s[3])==7:
    ans=s[0]+'-'+s[1]+'+'+s[2]+'+'+s[3]+'=7'
    print(ans)
    exit()

elif int(s[0])-int(s[1])+int(s[2])-int(s[3])==7:
    ans=s[0]+'-'+s[1]+'+'+s[2]+'-'+s[3]+'=7'
    print(ans)
    exit()

elif int(s[0])-int(s[1])-int(s[2])+int(s[3])==7:
    ans=s[0]+'-'+s[1]+'-'+s[2]+'+'+s[3]+'=7'
    print(ans)
    exit()

elif int(s[0])-int(s[1])-int(s[2])-int(s[3])==7:
    ans=s[0]+'-'+s[1]+'-'+s[2]+'-'+s[3]+'=7'
    print(ans)
    exit()


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

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

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n;
string s;
i64 a,b,c;
void solve(){
	cin >> n >> s;
	
	i64 ans = 0;
	for(int i = 0; i < n; i++){
		if(s[i] == 'R') a++;
		if(s[i] == 'G') b++;
		if(s[i] == 'B') c++;
	}
	ans = a*b*c;
	for(int i = 1; i < n; i++){
		for(int j = 0; j < n; j++){
			if(j+i+i >= n) break;
			if(s[j] != s[j+i] && s[j] != s[j+i+i] && s[j+i] != s[j+i+i]){
				ans--;
			}
		}
	}
	cout << ans << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 3692
def main():
    r, g, b, n = map(int, input().split())

    cnt = 0
    for i in range(n+1):
        for j in range(n+1):
            b_num = n - r*i - g*j
            if b_num >= 0 and b_num % b == 0:
                cnt += 1
    print(cnt)

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#include <iostream>
#define PUT(ch) cout << ch;
#define NL cout << endl;
#define PUTS(ch,cnt) for (int i = 0; i < cnt; i++) { PUT(ch) }
using namespace std;

int main() {
	int h, w;
	while (true) {
		cin >> h >> w;
		if (0 == (h | w)) {
			break;
		}
		PUTS('#', w)
		NL
		for (int j = 2; j < h; j++) {
			PUT('#')
			PUTS('.', w - 2)
			PUT('#')
			NL
		}
		PUTS('#', w)
		NL
		NL
	}
	return 0;
}

Measured memory_bytes: 1152
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int Y = sc.nextInt();
        for (int i = 0; i <= N ; i++) {
            for (int j = 0; j <= N - i; j++) {  
                int total = 10000 * i + 5000 * j + 1000 * (N - i - j);
                if (total == Y) {
                    System.out.println(" " + i + " " + j + " " + (N - i - j));
                    return;
                }
            }
        }
        System.out.println(" " + -1 + " " + -1 + " " + -1);
        return;
    }
}

Measured memory_bytes: 21844
#include<stdio.h>
#define INF 1000000005

int cnt;

int merge(int A[],int l,int m,int r){
  int R[250010],L[250010];
  int i,j,k;
  int n1,n2;
  n1 = m - l;
  n2 = r - m;

  for(i=0;i<n1;i++){
    L[i] = A[l+i];
  }
  for(i=0;i<n2;i++){
    R[i] = A[m+i];
  }
  L[n1] = INF;
  R[n2] = INF;
  i = 0;
  j = 0;

  for(k=l;k<r;k++){
    cnt++;
    if(L[i] <= R[j]){
       A[k] = L[i];
       i += 1;
    }else{
      A[k] = R[j];
      j += 1;
    }
  }
}

void  mergesort(int A[],int l,int r){
  int m;
  if(l + 1 < r){
    m = (l+r)/2;
    mergesort(A,l,m);
    mergesort(A,m,r);
    merge(A,l,m,r);
  }
}


int main(){
  int n;
  int S[500005];
  int i;
  cnt = 0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
    mergesort(S,0,i);

    for(i=0;i<n;i++){
      printf("%d",S[i]);
      if(i<n-1){
        printf(" ");
      }
    }
    puts("");
    printf("%d\n",cnt);
    return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}

int main() {
  int A, B, K; cin >> A >> B >> K;
  vector<int> C;
  int i = 1;
  while(i <= min(A, B)) {
    if(A % i == 0 && B % i == 0) {
      C.push_back(i);
    }
    i++;
  }
  cout << C[C.size() - K] << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<vector<int> >  vec2int;
typedef vector<ll >     vecll;
typedef vector<string > vecstr;
typedef vector<bool > vecbool;
typedef vector<bool > vecbool;
////////////////////////////////////////////////
int main()
{
  long x, y; cin >> x >> y;
  // long k = log2(y/x); 
  // cout << k + 1 << endl;
  long ans =0;
  while(x <= y){
    x*=2;
    ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		int n = sc.nextInt();
		int x = sc.nextInt();

		while(!(n == 0&&x==0)){
		int count = 0;
		for (int i = 1; i <= n-2; i++) {
			for (int j = i + 1; j <= n-1; j++) {
				for (int k = j + 1; k <= n; k++) {
					if ((i + j + k) == x) {
						count++;
						break;
					}

				}
			}
		}
		System.out.println(count);

		n = sc.nextInt();
		x = sc.nextInt();
		}
	}
}


Measured memory_bytes: 26776
#include <iostream>
using namespace std;
int main(void){
	long long int a,b,c,d;
  	
	std::cin >> a;
  	std::cin >> b;
  	std::cin >> c;
 
 	d=c-a-b;
 	if(d<=0
      	|| (d>0 && 4*a*b>=d*d)) std::cout << "No" << endl;
    else std::cout << "Yes";
  
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    // Your code here!
    int n, x, t;
    int remain_n=0;
    int tako_time=0;
    
    scanf("%d %d %d", &n, &x, &t);
    if((n<1) || (n>1000)){
        printf("incorrect number:N\n");
        return -1;
    }
    if((x<1) || (x>1000)){
        printf("incorrect number:X\n");
        return -1;
    }
    if((t<1) || (t>1000)){
        printf("incorrect number:T\n");
        return -1;
    }
    
    remain_n = n;
    while(remain_n > x){
        tako_time+=t;
        remain_n-=x;
    }
    tako_time+=t;
    
    printf("%d", tako_time);
    
    return 0;
    
}


Measured memory_bytes: 1708
import sys
input = lambda: sys.stdin.readline().rstrip()
s=input()
q=int(input())
sign=1
F,B="",""
for i in range(q):
  Q=[str(i) for i in input().split()]
  if Q[0]=="1":
    sign*=-1
  else:
    f,c=Q[1:]
    if f=="1" and sign==1:
      F=c+F
    elif f=="2" and sign==-1:
      F=c+F
    else:
      B=B+c
ans=F+s+B
print(ans if sign==1 else ans[::-1])


Measured memory_bytes: 4568
#include<stdio.h>
#define MAX 500000
#define INFTY 2000000000

int Left[MAX/2+2],Right[MAX/2+2];
int cnt,A[MAX];

void merge(int A[],int l,int m , int r)
{
  int i,j,n1,n2,k;
   n1 = m - l;
   n2 = r - m;
   for(i=0;i < n1;i++)
     {
       Left[i]=A[l+i];
     }
 
   for(i=0;i < n2;i++)
     {
       Right[i]=A[m+i];
     }
   Left[n1]=INFTY;
   Right[n2]=INFTY;
   i=0;
   j=0;
   for(k=l;k < r;k++)
     {
       cnt++;
       if(Left[i]<=Right[j])
	 {
	   A[k] = Left[i];
	   i++;
	 }
       else 
	 {
	 A[k] = Right[j];
	 j++;
	 }
     }
}

void mergeSort(int A[],int l, int r)
{
  int mid=0;
  if(l+1 < r)
    {
      mid = (l+r)/2;
      mergeSort(A,l,mid);
      mergeSort(A,mid,r);
      merge(A,l,mid,r);
    }
}

int main()
{
  int n,i;
  cnt = 0;
  scanf("%d",&n);
  for (i=0;i < n;i++)
    {
      scanf("%d",&A[i]);
    }

  mergeSort(A,0,n);

  for(i = 0; i < n-1;i++)
    {
      printf("%d ",A[i]);
    }
  printf("%d\n",A[i]);
  printf("%d\n",cnt);
  return 0;
}

Measured memory_bytes: 4504
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


class Seg():
    def __init__(self, na, default, func):
        if isinstance(na, list):
            n = len(na)
        else:
            n = na
        i = 1
        while 2**i <= n:
            i += 1
        self.D = default
        self.H = i
        self.N = 2**i
        if isinstance(na, list):
            self.A = [default] * (self.N) + na + [default] * (self.N-n)
            for i in range(self.N-1,0,-1):
                self.A[i] = func(self.A[i*2], self.A[i*2+1])
        else:
            self.A = [default] * (self.N*2)
        self.F = func

    def find(self, i):
        return self.A[i + self.N]

    def update(self, i, x):
        i += self.N
        self.A[i] = x
        while i > 1:
            i = i // 2
            self.A[i] = self.merge(self.A[i*2], self.A[i*2+1])

    def merge(self, a, b):
        return self.F(a, b)

    def total(self):
        return self.A[1]

    def query(self, a, b):
        A = self.A
        l = a + self.N
        r = b + self.N
        res = self.D
        while l < r:
            if l % 2 == 1:
                res = self.merge(res, A[l])
                l += 1
            if r % 2 == 1:
                r -= 1
                res = self.merge(res, A[r])
            l >>= 1
            r >>= 1

        return res

def main():
    n = I()
    s = S()
    q = I()
    qa = [LS() for _ in range(q)]
    aa = [[0]*26]
    oa = ord('a')
    for c in s:
        t = [0] * 26
        t[ord(c) - oa] = 1
        aa.append(t)

    def f(a,b):
        return [a[i]+b[i] for i in range(26)]

    seg = Seg(aa,[0]*26,f)
    r = []
    for t,a,b in qa:
        if t == '1':
            u = [0] * 26
            u[ord(b) - oa] = 1
            seg.update(int(a),u)
        else:
            c = seg.query(0,int(a))
            d = seg.query(0,int(b)+1)
            r.append(len([1 for i in range(26) if c[i] != d[i]]))

    return JA(r, '\n')


print(main())





Measured memory_bytes: 445480
package main

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

func main() {
	var n string
	var sc = bufio.NewScanner(os.Stdin)

	if sc.Scan() {
		n = sc.Text()
	}

	if (n[0] == n[1] && n[1] == n[2]) || (n[1] == n[2] && n[2] == n[3]) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
	
}

Measured memory_bytes: 640
import java.util.*;

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

		int a = scan.nextInt();
		int b = scan.nextInt();

		int diff = Math.abs(a - b);

		int snowHeight = 0;

		int tower = 0;

		for(int i = 1; i <= diff; i++){
			tower += i;
		}

		snowHeight = tower - b;
		System.out.println(snowHeight);
	}
}


Measured memory_bytes: 21840
// Date: 2020-01-27

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef pair<int, int> pii;
#define FIO ios::sync_with_stdio(false);cin.tie(0)
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
#define per(i, b, a) for(int i = int(b); i >= int(a); --i)
#define mem(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(),(x).end()
#define mk make_pair
#define pb push_back
#define fi first
#define se second
const LL INF = 1e18;
const LL mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int N = 1e5 + 10;
LL qpow(LL x, LL y, LL MOD) {LL a=1; while(y){ if(y&1) a=a*x%MOD; x=x*x%MOD; y>>=1; } return a;}

int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	LL ans = 0;
	for(int a = 1; a <= n; a++) {
		if(2 * a % k == 0) {
			LL x = (n+a)/k-(a+k)/k+1;
			if(x > 0) ans += x*x;
		}
	}
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;

public class Main {
    static List<List<Long>> cnts = new ArrayList<>();
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        List<Long> k1 = Arrays.asList(1L,2L,3L,4L,5L,6L,7L,8L,9L);
        cnts.add(k1);
        gen(10);
        System.out.println(cnts.stream().flatMap(p->p.stream()).limit(K).collect(Collectors.toList()).get(K-1));
    }

    private static void gen(int keta){
        if(cnts.size() < keta){
            gen(keta-1);
        }
        List<Long> ket = cnts.get(keta-1).stream().flatMap(p -> {
            List<Long> ret = new ArrayList<>();
            long last = p % 10;
            if(last > 0){
                ret.add(p*10+last-1);
            }
            ret.add(p*10+last);
            if(last < 9){
                ret.add(p*10+last+1);
            }
            return ret.stream();
        }).collect(Collectors.toList());
        cnts.add(ket);
    }
}


Measured memory_bytes: 67340
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <utility>
#include <algorithm>

using namespace std;

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

int main(){
    ll N,K;
    cin>>N>>K;
    if(K==0){
        cout<<N*N<<endl;
        return 0;
    }
    ll a;
    ll hoge;
    ll ans=0;
    rep(i,N-K){
        a=K+i+1;
        hoge=(N-K)/a;
        ans+=hoge*(a-K);
        if(N%a<K) ans+=a-K;
        else ans+=N%a-K+1;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256