akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;
#define  ll long long
#define ld long double
#define f first
#define s second
const int N = 1e5+5;

ll n , pw[15];

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

    cin >> n;
    pw[0]=1;
    for(int i=1; i<=12; i++)
    {
        pw[i] = 26*pw[i-1];
    }

    ll idx=-1;
    pw[0]=0;
    for(int i=1; i<13; i++)
    {
        pw[i] += pw[i-1];
        if (n <= pw[i])
        {
            idx=i; //len
            n -= pw[i-1];
            break;
        }
    }


    n--;
    string s="";
    for(int i=1; i<=idx; i++)
    {
        s += char('a'+(n%26));
        n /= 26;
    }

    reverse(s.begin() , s.end());
    cout << s;


    return 0;
}

Measured memory_bytes: 3648
import sys, collections, bisect, itertools, heapq, math, copy, string
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()

    ans = ''
    radix = 26
    while N > 0:
        ans += string.ascii_lowercase[N%radix-1]
        N = (N - 1) // radix

    print(ans[::-1])

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10104
N,M=map(int,input().split())
L,R=[],[]

for i in range(M):
  l,r=map(int,input().split())
  L.append(l)
  R.append(r)
L.sort(reverse=True)
R.sort()

if R[0]>=L[0]:
  print(R[0]-L[0]+1)
else:
  print(0)

Measured memory_bytes: 11420
n, m, x = map(int, input().split())
P = [list(map(int, input().split())) for i in range(n)]

INF = 10 ** 9
ans = INF
for bit in range(1 << n):
    now = 0

    Q = [0]*m
    for i in range(n):
        if bit >> i & 1:
            now += P[i][0]
            for j in range(m):
                Q[j] += P[i][j+1]

    ok = 1
    for j in range(m):
        if Q[j] < x:
            ok = 0

    if ok == 1:
        ans = min(ans, now)

if ans == INF:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 9212
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
ans = 0

m = 1
j = 0
for i in range(n-1):
    ans += a[j]
    m += 1
    if m == 2:
        m = 0
        j += 1
    
print(ans)

Measured memory_bytes: 31512
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R;

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

	L = MOD * MOD;
	R = -MOD * MOD;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> M;
		L = min(L, M);
		R = max(R, M);
	}
	cout << R - L << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
struct _job {
    int t, d;
};
_job job[200000];
bool cmp(_job &a, _job &b) {
    if (a.d != b.d) {
        return a.d < b.d;
    }
    return a.t <= b.t;
}
int main() {
    int n;
    while (cin >> n) {
        for (int i = 0; i < n; ++i) {
            cin >> job[i].t >> job[i].d;
        }
        sort(job, job + n, cmp);
        int current = 0;
        bool flag = true;
        for (int i = 0; i < n; ++i) {
            current += job[i].t;
            if (current > job[i].d) {
                flag = false;
                break;
            }
        }
        if (flag) {
            printf("Yes\n");
        }
        else {
            printf("No\n");
        }
    }
    return 0;
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast,inline,unroll-loops,fast-math")
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <utility>
#define N 1020
using namespace std;

bool k[N][N];
vector<int> e[N];
bool u[N];
int p[N], x[N];
vector<int> s, b, r;
vector<pair<int, int> > t, d;

void DFS(int x, int k)
{
    int i;

    if(u[x] && x == k)
        throw 0;
    if(u[x])
        return;
    u[x] = true;

    s.push_back(x);
    for(i = 0; i < (signed)e[x].size(); i ++)
        DFS(e[x].at(i), k);
    s.pop_back();

    return;
}

int main(void)
{
    int n, m, u, v;
    int i, j;

    scanf("%d %d", &n, &m);
    while(m --)
    {
        scanf("%d %d", &u, &v);
        e[u].push_back(v);
        k[u][v] = true;
    }

    for(i = 1; i <= n; i ++)
        try
        {
            memset(::u, false, sizeof(::u));
            DFS(i, i);
        }
        catch(...)
        {
            break;
        }
    if(i > n)
        printf("-1\n");
    else
    {
        // printf("found circ %d\n", i);
        // for(int xx: s)cout<<xx<<' ';cout<<endl;
        memset(p, -1, sizeof(p));
        for(i = 0; i < (signed)s.size(); i ++)
        {
            p[s.at(i)] = i;
            x[s.at(i)] = s.at((i + 1) % (signed)s.size());
        }
        for(i = 0; i < (signed)s.size(); i ++)
            for(j = 0; j < (signed)e[s.at(i)].size(); j ++)
                if(p[e[s.at(i)].at(j)] != -1 && p[e[s.at(i)].at(j)] != (i + 1) % (signed)s.size())
                    t.push_back(make_pair(i, p[e[s.at(i)].at(j)]));
        while(!t.empty())
        {
            b.clear();
            // printf("found %d-%d\n",s[t.front().first],s[t.front().second]);
            for(u = s.at(t.front().second); u != s.at(t.front().first); u = x[u])
                b.push_back(u);
            b.push_back(s.at(t.front().first));
            r = s;
            s = b;
            // for(int xx: s)cout<<xx<<' ';cout<<endl;

            memset(p, -1, sizeof(p));
            for(i = 0; i < (signed)s.size(); i ++)
            {
                p[s.at(i)] = i;
                x[s.at(i)] = s.at((i + 1) % (signed)s.size());
            }

            d.clear();
            for(i = 0; i < (signed)t.size(); i ++)
                if(p[r.at(t.at(i).first)] != -1 && p[r.at(t.at(i).second)] != -1 && p[r.at(t.at(i).second)] != (p[r.at(t.at(i).first)] + 1) % (signed)s.size())
                    d.push_back(make_pair(p[r.at(t.at(i).first)], p[r.at(t.at(i).second)]));
            t = d;
        }

        printf("%d\n", (signed)s.size());
        for(i = 0; i < (signed)s.size(); i ++)
            printf("%d\n", s.at(i));
    }

    return 0;
}


Measured memory_bytes: 1408
// K - Stones  https://atcoder.jp/contests/dp/tasks/dp_k
/* 入力例
2 4
2 3
// →出力 First
// dp(n)=-1 ｎ個石があるときに手が回ってきたら負ける
// dp(n)=1  ｎ個石があるときに手が回ってきたら勝つ
// -1をかけることにより勝ち負けの入れ替えを実装している
*/
#include <bits/stdc++.h>
using namespace std;

int N, K;
int a[100], mina;
int memdp[100001];
int dp(int n) {
    if(memdp[n] > -10) {
        return memdp[n];
    } else if(n < mina) {
        memdp[n] = -1;
        return memdp[n];
    } else {
        int maxdp = -10;
        for(int i = 0; i < N; i++) {
            int target = n - a[i];
            if(target >= 0) {
                if(maxdp < (dp(target) * (-1))) {
                    maxdp = dp(target) * (-1);
                }
            }
        }
        memdp[n] = maxdp;
        return memdp[n];
    }
}

int main(void) {
    cin >> N >> K;
    mina = INT_MAX;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        if(a[i] < mina)
            mina = a[i];
    }
    for(int i = 0; i <= 100000; i++) {
        memdp[i] = -10;
    }
    if(dp(K) == 1)
        cout << "First" << endl;
    else
        cout << "Second" << endl;
    return 0;
}


Measured memory_bytes: 5376
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
size_t N;



int main(int argc, char const *argv[])
{
    cin>>N;
    map<int,int> d_independ;
    int temp,ans;
    ans=0;
    for(size_t i=0;i<N;i++){
        cin>>temp;
        d_independ[temp]++;
        if(d_independ[temp]==1){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
from collections import deque
N,Q=map(int,input().split())
nondirtree=[[] for _ in range(N)]
dirtree=[[] for _ in range(N)]
for i in range(N-1):
    a,b=map(int,input().split())
    nondirtree[a-1].append(b-1)
    nondirtree[b - 1].append(a - 1)
#points=[tuple(map(int,input().split())) for _ in range(Q)]
score=[0]*N
for i in range(Q):
    point,sc=map(int,input().split())
    score[point-1]=score[point-1]+sc
#print(points)
v=0
d=deque()
d.append(v)
seen=[0]*N
seen[0]=1
ans=[0]*N
while len(d)!=0:
    v=d.popleft()
    for j in nondirtree[v]:
        if seen[j]==0:
            dirtree[v].append(j)
            seen[j]=1
            d.append(j)
    #print(d,seen,dirtree)
    #input(
v=0
d=deque()
d.append(v)
#print(dirtree)
ans[0]=score[0]
while len(d)!=0:
    v=d.popleft()
    for j in dirtree[v]:
        ans[j]=ans[v]+score[j]
        d.append(j)
    #input()
    #print(ans)
print(*ans,sep=" ")


Measured memory_bytes: 123084
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  ll n;
  R n;
  ll a[n];
  rep(i,n) R a[i];
  ll ans=1;
  rep(k,2) {
    vector<ll> v;
    for(int i=1; i*i<=a[k]; i++) {
      if(a[k]%i==0) {
        v.pb(i);
        if(i*i!=a[k]) v.pb(a[k]/i);
      }
    }
    rep(j,v.size()) {
      ll d=v[j];
      int c=0;
      rep(i,n) {
        if(__gcd(d,a[i])!=d) c++;
      }
      if(c<=1) ans=max(ans,d);
    }
  }
  pr(ans);
}

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


Measured memory_bytes: 1024
import math
n = int(input())
num  = [str(n)+":"]
i = 2
while i <= math.sqrt(n):
    while n % i == 0:
        num.append(str(i))
        n//=i
    i+=1
if n != 1:
    num.append(str(n))
print(num[0]+" "+str(n) if len(num) == 1 else " ".join(num))


Measured memory_bytes: 5668
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int m= Integer.parseInt(sc.next());
		int d = Integer.parseInt(sc.next());
		int count = 0;
		
			for(int i = 4; i <= m; i++) {
				for(int j = 2; j <= d/10; j++) {
				for(int k = 2; k <=9; k++) {
					if(j == d/10 && k > d%10) {
						break;
					}
					if(i==j*k) {
						//System.out.println(j*k);
						count++;
					}
				}
				}
			}
				System.out.println(count);
			}
	
}

Measured memory_bytes: 35572
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#define int long long
#define oku7 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
using namespace std;
std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0,-1 }; // x軸方向への変位
int dy[4] = { 1, 0,-1, 0 }; // y軸方向への変位


signed main() {
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	if (K % 2 == 0) cout << A - B << "\n";
	else cout << B - A << "\n";

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int  a  = sc.nextInt();
            char op = sc.next().charAt(0);
            int  b  = sc.nextInt();
            if (op == '?')
                break;
            switch (op) {
                case '+':
                    System.out.println(a + b);
                    break;
                case '-':
                    System.out.println(a - b);
                    break;
                case '*':
                    System.out.println(a * b);
                    break;
                case '/':
                    System.out.println(a / b);
                    break;
            }
        }
    }
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  double sum = 0;

  for (int i = 0; i < N; i++) {
    cin >> A[i];
    sum += pow(A[i], -1);
  }

  cout << pow(sum, -1) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1000000007
//S.size()

using namespace std;


typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;



int main(void){
  int A,B;cin>>A>>B;
  int cnt = 0;
  for(int i = A;i <= B;i++){
    if(i % 10 == i / 10000 && (i / 10) % 10 == (i / 1000) % 10)cnt++ ;
  }
  cout<<cnt;
}


Measured memory_bytes: 256
main :: IO ()
main = do
    [a, b, c] <- (map read . words) <$> getLine
    putStrLn $ if solve (a, b, c) then "YES" else "NO"

-- |
--
-- >>> solve (7, 5, 1)
-- True
--
-- >>> solve (2, 2, 1)
-- False
solve :: (Int, Int, Int) -> Bool
solve (a, b, c) = any f [1 .. b]
  where f n = (n * a) `mod` b == c


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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;



void solve()
{
	int x;
	cin >> x;
	cout << 1 - x << endl;



}

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

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





















Measured memory_bytes: 3636
//
//  main.cpp
//  temp
//
//  Created by tolemy on 2019/08/04.
//  Copyright © 2019 tolemy. All rights reserved.
//

#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
    
    int n;
    cin >> n;
    
    int *h = new int[n];
    for(int i=0;i<n;i++)
    {
        cin >> h[i];
    }
    
    int max_count = 0;
    for(int i=0;i<n;i++)
    {
        int present = i;
        int count = 0;
        for(int j=i+1;j<n && h[j] <= h[present];j++)
        {
            present = j;
            count++;
        }
        
        if(count > max_count) max_count = count;
        i = present;
    }
    
    
    cout << max_count << endl;
    
    return 0;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr(n, r) memset(n,r,sizeof(n));

void fast() {
    cin.tie(0);
    cin.sync_with_stdio(0);
}

double cotan(double i) {
    return  1.0/ tan(acos(-1)/180.0*i);
}

int main() {
    fast();
    int n;cin>>n;
    string s;cin>>s;
    if(s.size()<=n)cout<<s;
    else cout<<s.substr(0,n)<<"...";

}

Measured memory_bytes: 3676
from itertools import permutations as perm


def euclidean_distance(list1, list2):
    x_norm = (list1[0] - list2[0]) ** 2
    y_norm = (list1[1] - list2[1]) ** 2
    return (x_norm + y_norm) ** 0.5


def main():
    n = int(input())
    xys = [list(map(int, input().split())) for _ in range(n)]

    orders = list(perm([xys[i] for i in range(n)], n))
    order_num = len(orders)
    ans = 0
    for order in orders:
        for i in range(n-1):
            ans += euclidean_distance(order[i], order[i+1])

    print(ans/order_num)


if __name__ == "__main__":
    main()


Measured memory_bytes: 8052
# frozen_string_literal: true

s = gets.to_i
i = 1
list = Hash.new(0)
list[s] += 1

loop do
  i += 1
  s = s.even? ? s / 2 : 3 * s + 1
  list[s] += 1

  break if list[s] > 1
end

puts i

Measured memory_bytes: 1788
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var k = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var ans = getAns(a, n , k);
        Console.WriteLine(ans);
    }
    static long getAns (int[] a, int n , int k)
    {
        var dp = new long[n];
        dp[1] = Abs(a[1] - a[0]);
        for (int i = 2; i < n; i++)
        {
            var nw = long.MaxValue;
            for (int j = 1; j <= k; j++)
              if (i -j >= 0)
                {
                    var w = dp[i - j] + Abs(a[i - j] - a[i]);
                    nw = Min(nw, w);
                }
            dp[i] = nw;
        }
        return dp[n - 1];
    }
}

Measured memory_bytes: 19296
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;

int main() {
    int x, a, b; cin >> x >> a >> b;
    x -= a;
    while(true){
        if(x - b >= 0) x -= b;
        else break;
    }
    cout << x << endl;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n,cnt=0,cntt=0,cnttt=0,cntttt=0,ans=0,a,b,c,cmp[100000],data,m,h,w,x,y,xcmp,ycmp,sum=0;

string s;

vector<int> z;

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

       cin >> n;
       rep(i,n){
           cin >> s;
           if(s[0]=='P'){
               cmp[0]++;
           }
           else if(s[0]=='W'){
               cmp[1]++;
           }
           else if(s[0]=='G'){
               cmp[2]++;
           }
           else {
               cmp[3]++;
           }
       }
       
       rep(i,4){
           if(cmp[i]!=0){
               ans++;
           }
       }
       if(ans==3){
           Cout("Three");
       }
       else{
           Cout("Four");
       }
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define senor_SR ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
typedef long long ll;
typedef long double ld;
typedef int32_t i32;
 
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define pf push_front
 
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>=b;i--)
#define FILL(a,b,c) for(ll i=0;i<c;i++) a[i]=b;
 
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
 
#define endl "\n"
#define setpri(x) setprecision(x)
#define vp(x) cout<<#x<<" : "<< (x)<<" | "
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define farr(a,n) for(long long i=0;i<n;i++) cin>>a[i];
#define fvec(vec,n) for(long long i=0;i<n;i++) {ll tmp;cin>>tmp;vec.pb(tmp);}
#define parr(a,n) for(long long i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define prvec(v) for(long long i=v.size()-1;i>=0;i--) cout<<v[i]<<" "; cout<<endl;
#define pvecpair(v) for(long long i=0;i<v.size();i++) cout<<v[i].first<<" "<<v[i].second<<endl;
 
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
#define MAX_INT 100000
#define MOD 1000000007

const int N=1e6+2;
vector<int> adj[N+1];
ll vis[N+1]={0};
double tot=0,dis=0,leaf=0;
map<pair<int,int>,vector<int>> mv;

int col[N]={0},len;

ll dfs(ll cur)
{
    if(vis[cur]==1) return 0;
    vis[cur]=1;
    ll ans=1;
    for(auto x:adj[cur])
    {
        if(vis[x]==0)
        {
            ans+=dfs(x);                    
        }
    }
    return ans;
}

long long moduloExpo(long long X,long long N,long long M=1000000007)
{
    if(X==0) return 0;
    long long RES=1;
    while(N>0) { if(N%2==1) RES=(RES*X)%M;X=(X*X)%M;N=N/2;}
    return RES;
}

void solve()
{
    ll n;cin>>n;
    //ll m;cin>>m;
    
    cout<<1000*(n/500)+5*((n%500)/5);
}
    
int main()
{
    senor_SR;
    
    //ll t;cin>>t;while(t--)
        solve();
 
    return 0;
}

Measured memory_bytes: 27264
#include<bits/stdc++.h>
using namespace std;
main(){
int i,j,k,l,m,n,p;

while(cin>>p){
int x[p];
for(i=0;i<p;i++)cin>>x[i];
sort(x,x+p);
j=0;k=0;
for(i=0;i<p;i++){
    if(i%2==0)j+=x[i];
    else k+=x[i];
}
cout<<abs(j-k)<<endl;
} return 0;
}


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

#define abs(N) ((N>0)?N:-1*N)
#define min(A,B) ((A>B)?B:A)
#define max(A,B) ((A<B)?B:A)
#define print(S) (cout << S)
#define println(S) (cout << S << endl)

int main() {
	double r;
	double PI = 3.14159265358979;
	cin >> r;

	printf("%f %f\n",r*r*PI,2*r*PI);

	return 0;
}



Measured memory_bytes: 3176
// わからなかった.2項係数(nCk mod. p)の求め方
// http://drken1215.hatenablog.com/entry/2018/06/08/210000
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

const int MAX = 1001001;
const int MOD = 1000000007;
// const int MOD = 1e9 + 7;

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

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
    int X, Y;
    cin >> X >> Y;

    COMinit();

    if ((X + Y) % 3 != 0) {
        cout << 0 << endl;
        return 0;
    }

    int n = (2 * Y - X) / 3;
    int m = (2 * X - Y) / 3;

    cout << COM(n + m, m) << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;

const int N=2e5+10;
const int mod=1e9+7;
int n,k,m;
int a[N];
int b[N];
int ans[N];
string s;
int vis[N];
map<int,int> mp;
int D[N][2];
int cmp(int a, int b){
    return a>b;
}
int main()
{
    memset(a,0,sizeof(a));
    cin>>n;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=2;j++){
            cin>>D[i][j];
        }
        if(D[i][1]==D[i][2]) a[i]=1;
    }
    int flag=0;
    int ans=0;
    int cou=0;
    for(int i=1;i<=n;i++){
        if(flag==0){
            if(a[i]==1){
                flag=1;
                cou=1;
            }
        }
        else{
            if(a[i]==1){
                cou++;
            }
            else{
                flag=0;
                cou=0;
            }
        }
        if(cou==3){
            ans=1;
            break;
        }
    }
    if(ans) cout<<"Yes";
    else cout<<"No";

}



Measured memory_bytes: 4424
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>










int a, b, k;




void solve()
{
	cin >> k >> a >> b;
	for(int i = a; i <= b; i++)
	{
		if(i%k == 0)
		{
			cout << "OK\n";
			return;
		}
	}
	cout << "NG\n";
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 3632
use proconio::{input, fastout};
use proconio::marker::Chars;
use std::cmp::min;

#[fastout]
fn main() {
    input! {
        s: Chars,
        t: Chars,
    }
    let mut ans = t.len();

    for si in 0..s.len() {
        if si + t.len() > s.len() {
            break;
        }
        let mut cnt = 0;
        for i in 0..t.len() {
            if s[si + i] != t[i] {
                cnt += 1;
            }
        }
        ans = min(ans, cnt);
    }
    println!("{}", ans);
}

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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

//↓0-originか1-originでn回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   //0-origin昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) //1-origin昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  //0-origin降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   //1-origin降順
//rep2 -> 第二引数 m から n 回繰り返し ex) m=5 n=3 なら i=5,i=6,i=7 まで
#define rep2(i,m,n) for(int i = ((int)(m)); i < ((int)(n))+((int)(m)); i++)
#define SIZE(x) ((int)((x).size()))
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<int,int> PII;
template<class T,class U> inline bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U> inline bool chmin(T &a, const U &b){if(a>b){a=b;return 1;}return 0;}

/* 円周率は M_PI を使おうね */
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;

/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    //cout << fixed << setprecision(10);

    double r0,w,c,r;
    while(cin >> r0>>w>>c>>r) {
        if(r0==0&&w==0&&c==0&&r==0) break;

        for(int i = 0;; ++i) {
            if((r0+r*i)/c >= w) {
                cout << i << '\n';
                break;
            } 
        }
    }
}


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

using namespace std;

#define pb push_back
#define prr pair<int,int> 
#define int long long
#define fir first
#define sec second
#define double long double
#define ll long long



int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s,t;
    cin>>s>>t;
    if(t.length()<=1){
        cout<<"No";
        return 0;
    }
    t.pop_back();
    if(s==t && s.length()>=1 && s.length()<=10){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    


    // if(s.length()>=1 && s.length()<=10){
    //     if(t.length()==s.length()+1){
    //         cout<<"Yes";
    //     }else{
    //         cout<<"No";
    //     }

    // }else{
    //     cout<<"No";
    // }
}



Measured memory_bytes: 3672
from math import factorial

def Comb(n, k):
	return factorial(n)//(factorial(n-k) * factorial(k))

T = 10**9 + 7


N, K = [int(x) for x in input().split()]

A = N-K+1;

for i in range(1, K+1):
	if A < i:
		print(0)
	else:
		print(int((Comb(A, i)*Comb(K-1, i-1))%T))



Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF = 1e9;
const int MOD = 1000000007;

int main(){
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[4][13] = {};
    int x,y;
    char c[] = "SHCD";
    char b;
    for(int i=0;i<n;i++){
        cin >> b >> y;
        for(int j=0;j<4;j++) if(b==c[j]) x = j;
        a[x][y-1] = 1;
    }
    for(int i=0;i<4;i++){
        for(int j=0;j<13;j++) if(a[i][j]==0) cout << c[i] << " " << j+1 << endl;
    }
}

Measured memory_bytes: 3068
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const [N, D] = lines[0].split(" ").map(v=>v-0);
    let ans = 0;
    for(let i=1;i<=N;i++){
        const [a,b] = lines[i].split(" ").map(v=>v-0);
        const d = Math.sqrt(a*a+b*b);
        if(D>=d) ans++;
    }
    console.log(ans);
});


Measured memory_bytes: 79404
###template###
import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())
###template###

N = int(input())

nset = set()

for _ in range(N):
  i = int(input())
  if i in nset: nset.remove(i)
  else: nset.add(i)

print(len(nset))




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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

typedef double D;
typedef complex<D>Point;
typedef vector<Point>Polygon;

const D EPS=1e-5;

const int COUNTER_CLOCKWISE=1;
const int CLOCKWISE=-1;
const int ONLINE_FRONT=2;
const int ONLINE_BACK=-2;
const int ON_SEGMENT=0;

struct Segment{
    Point p1,p2;
    Segment(const Point &p1=Point(),const Point &p2=Point()):p1(p1),p2(p2){}
};

istream& operator>>(istream &is,Point &a){
    D x,y;
    is>>x>>y;
    a=Point(x,y);
    return is;
}

D dot(const Point &a,const Point &b){
    return real(a)*real(b)+imag(a)*imag(b);
}
D cross(const Point &a,const Point &b){
    return real(a)*imag(b)-real(b)*imag(a);
}

Point projection(const Point &a,const Point &b){
    return a*real(b/a);
}

Point projection(const Segment &s,const Point &a){
    return s.p1+projection(s.p2-s.p1,a-s.p1);
}

Point reflection(const Segment &s,const Point &a){
    Point p=projection(s,a);
    return 2.0*p-a;
}

int ccw(Point a,Point b,Point c){
    b-=a;c-=a;
    if(cross(b,c)>EPS)return COUNTER_CLOCKWISE;
    if(cross(b,c)<-EPS)return CLOCKWISE;
    if(dot(b,c)<-EPS)return ONLINE_BACK;
    if(norm(b)+EPS<norm(c))return ONLINE_FRONT;
    return ON_SEGMENT;
}

bool intersect(const Point &a1,const Point a2,const Point &b1,const Point &b2){
    return ccw(a1,a2,b1)*ccw(a1,a2,b2)<=0&&
    ccw(b1,b2,a1)*ccw(b1,b2,a2)<=0;
}

signed main(){
    Point A,B;
    cin>>A>>B;

    int N;cin>>N;
    Polygon G(N);
    rep(i,N)cin>>G[i];

    double ans=1e18;

        rep(i,N){
            if(ccw(G[i],G[(i+1)%N],A)==CLOCKWISE&&ccw(G[i],G[(i+1)%N],B)==CLOCKWISE){
                Point p=reflection(Segment(G[i],G[(i+1)%N]),B);
                if(intersect(G[i],G[(i+1)%N],A,p))chmin(ans,abs(p-A));
            }
        }

        vint okA(N),okB(N);
        rep(i,N){
            if(ccw(G[(i-1+N)%N],G[i],A)!=COUNTER_CLOCKWISE||ccw(G[i],G[(i+1)%N],A)!=COUNTER_CLOCKWISE)okA[i]=true;
            if(ccw(G[(i-1+N)%N],G[i],B)!=COUNTER_CLOCKWISE||ccw(G[i],G[(i+1)%N],B)!=COUNTER_CLOCKWISE)okB[i]=true;
        }

        rep(i,N){
            if(!okA[i])continue;
            rep(j,N){
                if(!okB[j])continue;
                double tmp=abs(G[i]-A)+abs(G[j]-B);
                int v=i;
                while(v!=j){
                    tmp+=abs(G[v]-G[(v+1)%N]);
                    v=(v+1)%N;
                }
                chmin(ans,tmp);


                tmp=abs(G[i]-A)+abs(G[j]-B);
                v=i;
                while(v!=j){
                    tmp+=abs(G[v]-G[(v-1+N)%N]);
                    v=(v-1+N)%N;
                }
                chmin(ans,tmp);
            }
        }



    printf("%.20f\n",ans);
    return 0;
}

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

void b_sort(long long int* a , int n){
	for(int i=0 ; i < n ; ++i){
		for(int j=i+1 ; j < n ; ++j){
			if(a[i]>a[j]){
				a[i]^=a[j];
				a[j]^=a[i];
				a[i]^=a[j];
			}
		}
	}
}

int main(){
	int n;
	long long int sum=0;
	cin >> n;
	long long int a[100000]={0};
	for(int i=0 ; i<n ; ++i){
		cin >> a[i];
	}
	b_sort(a , n);
	
	for(int i=0 ; i<n ; ++i){
		sum+=a[i];
	}
	cout << a[0] << " " << a[n-1] << " " << sum << endl;
	return 0;
}

Measured memory_bytes: 1956
import java.util.Scanner;

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

		long a = stdIn.nextLong();
		long b = stdIn.nextLong();
		long n = stdIn.nextLong();

		Func func = new Func(a,b);

		long maxMod = getMaxMod(a,b,n);
		long max = func.getValue(maxMod);

		System.out.println(max);
		for(int i = 1; i <= 1000000; i++) {
			maxMod = maxMod + b;
			if(maxMod < n) {
				break;
			}
		}

		stdIn.close();
	}

	public static long getMaxMod(long a,long b,long n) {
		if(b-1 > n) {
			return n;
		}
		return b-1;
	}
}

class Func {
	long a;
	long b;


	public Func(long a, long b) {
		super();
		this.a = a;
		this.b = b;
	}


	public long getValue(long x) {
		return (long)Math.floor((((double)a/(double)b))*(double)x) - a * (long)Math.floor((double)x/(double)b);
	}
}

Measured memory_bytes: 35864
#include<stdio.h>
 
int main(void){
    int m[20][20],i,l,n,x,y;
     
    while(scanf("%d",&n)!=0){
        if(n==0)break;
        for(i=0;i<20;i++){
            for(l=0;l<20;l++){
                m[i][l]=0;
            }
        }
         
        x=(n-1)/2;
        y=x+1;
         
        m[x][y]=1;
         
        for(i=2;i<=n*n;i++){
            x+=1;
            y+=1;
            while(1){
                if(x>=n){
                    x=0;
                    continue;
                }
                if(x<0){
                    x=n-1;
                    continue;
                }
                if(y>=n){
                    y=0;
                    continue;
                }
                if(y<0){
                    y=n-1;
                    continue;
                }
                if(m[x][y]>0){
                    x-=1;
                    y+=1;
                    continue;
                }
                break;
            }
            m[x][y]=i;
        }
         
        for(i=0;i<n;i++){
            for(l=0;l<n;l++){
                printf("%4d",m[l][i]);
            }
            printf("\n");
        }
    }
    return 0;
}

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

int main(){
    string s;
    cin >> s;
    string ans="Good";
    for(int i=1; i<s.size(); i++){
        if(s[i]==s[i-1]){
            ans = "Bad";
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
///cREATED bY BERNARB.01
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef priority_queue<int,vector<int>,greater<int>> pqil;
typedef priority_queue<int> pqig;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef priority_queue<pii> pqiig;
typedef vector<pii> vii;
typedef vector<piii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int, int> mii;
#define mid ((l+r)/2)
#define PB push_back
#define PP pop_back
#define PF push_front
#define DF pop_front
#define F first
#define S second
#define MP make_pair
#define C continue
#define B break
#define R return
#define sz(v) (int)(v).size()
#define len(s) (int)(s).length()
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(arr, x) memset((arr), (x), sizeof (arr))
#define loop(n) for(int i=0; i<(n); i++)
#define jloop(n) for(int j=0; j<(n); j++)
#define rloop(n) for(ll i=(n)-1; i>=0; i--)
const ll N = 2e5+9;
const ll INF = 2e17+423;
const ll mod = 1e9+7; //998244353;
const ld pi = acos(-1.0);
const ld cmpf = 1e-9;
//__int128_t
#define endl '\n'
ll po(ll,ll);














int main() {
  /*#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  #endif // ONLINE_JUDGE*/
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  int aa = a, bb= b, ans1 = b, ans2=a;
  while(aa){
    ans1*=10;
    ans1+=b;
    --aa;
  }
  ans1/=10;
  while(bb){
    ans2*=10;
    ans2+=a;
    --bb;
  }
  ans2/=10;
  cout << max(ans1, ans2) << endl;
  R 0;
}
/*

*/



































ll po(ll x, ll n){
  if(n==0) R 1;
  ll y = po(x, n/2);
  y = ((y)*(y));
  if(n%2) y = (y*(x));
  R y;
}


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

using namespace std;

using ll = long long;

constexpr char newl = '\n';

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

    string s;
    cin >> s;

    if (s == "RRR") cout << 3 << newl;
    else if (s == "SSS") cout << 0 << newl;
    else if (s == "RRS" || s == "SRR") cout << 2 << newl;
    else cout << 1 << newl;

    return 0;
}

Measured memory_bytes: 3640
import numpy as np
#import math
a,b,x=map(int, input().split())
x/=a
if a*b/2 == x:
    ang = np.arctan2(b, a)
    ang_deg = np.rad2deg(ang)
    print(ang_deg)
elif a*b/2 < x:
    emp=a*b-x
    emp_b=2*emp/a
    ang = np.arctan2(emp_b, a)
    ang_deg = np.rad2deg(ang)
    #ang=math.atan(a/emp_b)
    #ang_deg=math.degrees(ang)
    print(ang_deg)
else:
    full_a=2*x/b
    ang = np.arctan2(b, full_a)
    ang_deg = np.rad2deg(ang)
    #ang=math.atan(full_a/b)
    #ang_deg=math.degrees(ang)
    print(ang_deg)

Measured memory_bytes: 14428
#include<iostream>
#include<algorithm>
using namespace std;
long M=1e9+7;
long f(long a)
{
	long ans=1;
	for(long i=2;i<=a;i++)ans=ans*i%M;
	return ans;
}
long p(long n,long m)
{
	long ans=1;
	for(long i=0;i<m;i++)ans=ans*(n-i)%M;
	return ans;
}
main()
{
	long n,m;cin>>n>>m;
	if(n-m>1||m-n>1)cout<<0<<endl;
	else
	{
		if(n==m)cout<<f(n)*f(m)%M*2%M<<endl;
		else cout<<f(n)*f(m)%M<<endl;
	}
}


Measured memory_bytes: 256
k = gets.to_i
ls = [1,2,3,4,5,6,7,8,9]
opr = [-1,0,1]
ans = []
(k+1).times do
	t = ls.shift
	ans << t
	d = t.to_s[-1].to_i
	opr.each do |o|
		if d + o >= 0 && d + o < 10
			ls << (t.to_s + (d + o).to_s).to_i
		end
	end
end

puts ans[k-1]

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

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

	vector<int> cartas;
	vector<int> papu;
	vector<int> popa;	
	
	int aux = 0;
	for (int i = 0; i < N; i++) {
		cin >> aux;
		cartas.push_back(aux);
	}

	for (int i = 0; i < N; i++) {
		int maximo = *max_element(cartas.begin(), cartas.end());
		for (int j = 0; j < cartas.size(); j++) {
			if (cartas[j] == maximo) {
				cartas.erase(cartas.begin() + j);
				if (i%2==0) popa.push_back(maximo);
				else if (i%2!=0) papu.push_back(maximo);
				break;
			} 
		}
	}
	
	int sumapopa = 0;
	int sumapapu = 0;
	for (int i = 0; i < popa.size(); i++) sumapopa+=popa[i];
	for (int i = 0; i < papu.size(); i++) sumapapu+=papu[i];
	
	cout << sumapopa - sumapapu ;
	
   
   return 0;
}

Measured memory_bytes: 3564
r,c = list(map(int, input().split()))

t = [[0 for j in range(c + 1)] for i in range(r + 1)]

for i in range(r):
    rd = list(map(int, input().split()))
    for j in range(c):
        t[i][j] = rd[j]
        t[i][c] += rd[j]
        t[r][j] += rd[j]
        t[r][c] += rd[j]

for i in t:
    print(*i)


Measured memory_bytes: 6216
#include <iostream>
#include <string>
using namespace std;
 
int main() {
    string s;
    cin >> s;
    int check = 700;
    if (s[0] == 'o') check += 100;
    if (s[1] == 'o') check += 100;
    if (s[2] == 'o') check += 100;
    cout << check << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define Accel ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define Re(a,b) memset(a,b,sizeof a)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define ALL(X) (X).begin(), (X).end()
#define FOR(I, A, B) for (int I = (A); I <= (B); I++)
#define REP(I, N) for (int I = 0; I < (N); I++)
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define SZ(a) ((int)a.size())
//#pragma GCC optimize(2)
using namespace std;
const int N=1e6+1;
const int M=1e9+7;
const double eps=1e-6;
typedef complex<double>C;
const double PI(acos(-1.0));
//size() use int
//__gcd, atan2(y,x)=y/x , __int128
//c(n,k)=c(n-1,k-1)+c(n-1,k)
//c(i,r),i for r to n =c(n+1,r+1)
//void add(int x){while(x<N)BIT[x]++,x+=x&-x;}
//int sum(int x){return x?BIT[x]+sum(x-(x&-x)):0;}
//int find(int x){return x==p[x]?x:p[x]=find(p[x]);}
//LL pw(LL a, LL b,LL M) { return b ? b & 1 ? a*pw(a, b - 1,M) % M : pw(a*a%M, b>>1,M) : 1; }
//log() = ln() , log(x)/log(y)=log(y)-base-x
//watch out LL
//INT_MAX 127,INT_MIN 128
using namespace std;
int a[2][101],s[2][101],n;
int main(){
	cin>>n;
	FOR(i,1,2)
		FOR(j,1,n){
			cin>>a[i][j];
			s[i][j]=s[i][j-1]+a[i][j];
		}
	int ans=0;
	FOR(j,1,n)
		ans=max(ans,s[1][j]+s[2][n]-s[2][j-1]);
	cout<<ans<<endl;
		
}

Measured memory_bytes: 768
def selectionSort():
    N = int(input())
    A = list(map(int, input().split()))
    C = 0
    
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        
        A[i], A[minj] = A[minj], A[i]
        if not(minj == i):
            C += 1
    
    print(*A)
    print(C)
    
selectionSort()

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

#define int long long
#define ff first
#define ss second
#define loop(i,k,n) for(int i=k;i<n;++i)
#define rloop(i,n,k) for(int i=n;i>=k;i--)
#define vi vector<int>
#define vvi vector<vector<int> >
#define vpii vector<pair<int,int> >
#define all(v) v.begin(),v.end()
#define mset(a,i) memset(a,i,sizeof(a))
#define mii map<int,int>
#define mci map<char,int>  
#define pii pair<int,int>
#define pdd pair<double,double>
#define deb(x) cout<<#x<<" "<<x<<endl;
#define mp make_pair
#define pb push_back
#define mod 1000000007  
#define endl "\n"
#define inf 1e18
#define sp(x,y) fixed<<setprecision(y)<<x

void get_it_done(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int gcd(int a, int b){ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
void swap(int &a,int &b){
    a^=b;b^=a;a^=b;
}
const int N = 1e3+5;
int dp[N][N];
char path[N][N];
int n,m;

int solve(int i,int j){
    if(i==n-1 && j==m-1)
        return 1;
    if(i>=n || j>=m)
        return -inf;
    if(dp[i][j]!=-1) return dp[i][j];

    int ans = 0;
    if(path[i][j]=='#') 
        return -inf;
    int ans1 = solve(i,j+1);
    int ans2 = solve(i+1,j);
    if(ans1<0) ans1 = 0;
    if(ans2<0) ans2 = 0;
    ans = (ans1+ans2)%mod;
    return dp[i][j] = ans%mod;
}

int32_t main(){
    get_it_done();
    int t=1;
    // cin >> t;
    while (t--){
        cin>>n>>m;
        loop(i,0,n) loop(j,0,m) cin>>path[i][j];
        mset(dp,-1);
        int ans = solve(0,0);
        ans %= mod;
        if(ans==(-inf)){
            ans = 0;
        }
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 9216
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;

public class Main {

    void solve() throws IOException {
        int x = ni();

        int sum = 0;
        for (int i = 1; i < 100000; i++) {
            sum += i;
            if (sum >= x) {
                out.println(i);
                return;
            }
        }
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

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

using namespace std;

vector<vector<long double>> grid;
vector<long double> p;

long double retrieve(int x, int y) {
    if(x < 0 || y < 0)
        return 0;
    return grid[x][y];
}

int main() {
    int n;
    long double ans = 0;
    cin >> n;
    grid.resize(n, vector<long double>(n+1));
    p.resize(n);
    for(int i = 0; i < n; i++) {
        cin >> p[i];
    }
    grid[0][0] = 1-p[0];
    grid[0][1] = p[0];
    
    for(int i = 1; i < n; i++) {
        for(int j = 0; j <= i+1; j++) {
            grid[i][j] = p[i]*retrieve(i-1, j-1) + ((1-p[i])*retrieve(i-1,j));
        }
    }
    for(int i = n/2+1; i <= n; i++)
        ans += grid[n-1][i];
    cout << setprecision(10) << ans << "\n";
}

Measured memory_bytes: 141056
N,*S = `dd`.split.map &:to_i

ans = 0
(1..N-2).each{ |c|
  v = 0
  (1..N/c).each{ |n|
    cn = c*n
    a = N-1 - cn
    break if c >= a || ((a % c == 0) && (a / c <= n))
    #$stderr.puts "A = #{a}, B = #{a - c}, C = #{c}, n = #{n}"
    v += S[-1-cn]
    v += S[cn]
    ans = [ans, v].max
  }
}
p ans


Measured memory_bytes: 12040
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
using P = pair<int, int>;

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


    int n; cin >> n;
    vector<P> a(n);
    rep(i, n) {
        int x, y; cin >> x >> y;
        a[i] = P(x, y);
    }
    sort(all(a));

    double total = 0;
    int cnt = 0;
    do {
        rep(i, n-1) {
            double dx = (a[i+1].first-a[i].first)*(a[i+1].first-a[i].first);
            double dy = (a[i+1].second-a[i].second)*(a[i+1].second-a[i].second);
            total += sqrt(dx+dy);
        }
        cnt++;
    } while (next_permutation(all(a)));

    cout << setprecision(12) << total / cnt << endl;
}

Measured memory_bytes: 256