akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
using namespace std;
const int MAX_N = 1000000; // いくつまで調べるか
bool prime[MAX_N + 1]; // 添字が素数ならtrue、それ以外はfalse
void sieve()
{
  prime[0] = prime[1] = false; // 例外処理
  // 配列prime の初期化
  for(int i = 2; i <= MAX_N; ++i)
    prime[i] = true;
  // 素数でないものを調べる
  for(int i = 2; i <= MAX_N; ++i)
    if(prime[i])
      for(int j = i * 2; j <= MAX_N; j += i)
	prime[j] = false;
	}

int is_prime(int n)
{
  return prime[n];
  }

/*bool is_prime(int n)
{
  if(n == 1)return false;
  for(int i = 2; i < n; ++i)
    if(n % i == 0)return false;
  return true;
  }
*/
int main()
{
  sieve();
  int a;
  while(cin >> a){
    //cin >> a;
    //if(a==EOF)return 0;
    int count=0;
    //int tmp;
    for(int i=1;i<=a;i++){
      if(is_prime(i))count++;
    }
    printf("%d\n",count);
  }
}

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

int main(){
 	int a,b,sum=0;
  	cin>>a>>b;
  	for(a;a<=b;a++){
      	if((a%10==a/10000%10)&&(a/10%10==a/1000%10))
          sum+=1;
    }
  	cout<<sum<<endl;
}

Measured memory_bytes: 256
import sys
def resolve():
        input = sys.stdin.readline
        N=int(input().rstrip())
        a=[input().rstrip() for _ in range(N)]

        index=0
        ans=0
        for i in range(N):
            index=int(a[index])-1
            ans+=1
            if(index==1):
                print(ans)
                return
        print(-1)



from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """3
3
1
2"""
        output = """2"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """4
3
4
1
2"""
        output = """-1"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """5
3
3
4
2
4"""
        output = """3"""
        self.assertIO(input, output)

if __name__ == "__main__":
    #unittest.main()
    resolve()

Measured memory_bytes: 62552
/// Code by Leonardo16
///   “It is not the strength of the body, but the strength of the spirit.”   —  J.R.R. Tolkien
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
/// Macros
#define int long long
#define ll long long
#define sz size
#define ull unsigned long long
#define ld long double
#define ii pair<int,int>
#define fst first
#define scd second
#define vi vector<int>
#define vii vector<ii>
#define pb push_back
#define pf push_front
#define fl '\n'
#define el endl
#define all(x) x.begin() , x.end()
#define rall(x) x.rbegin() , x.rend()
/// Functions
#define db(x) cerr << #x << ": " << (x) << '\n';
#define random() __builtin_ia32_rdtsc()
#define lg2(x) 31-__builtin_clz(x)
#define lg2ll(x) 63-__builtin_clzll(x)
#define pi acos(-1)
#define YN(x) cout<<((x)?("YES"):("NO"))<<fl;
#define yn(x) cout<<((x)?("Yes"):("No"))<<fl;
/// Red-Black Tree Template
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
//typedef tree < long long ,  null_type ,  less<long long> ,  rb_tree_tag ,  tree_order_statistics_node_update > ordered_set;
//#define less_than(n) order_of_key(n)
//#define en_pos(n) find_by_order(n)
/// Prime numbers  173,179,311,331,737,1009,2011,2027,3079,4001,100003
///=====================================================================

int sol[200005][40];

main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    vi v;
    vi bi;

    for(int j=0;j<32;j++){
        bi.pb(0);
    }
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        v.pb(x);
        for(int j=0;j<32;j++){
            if( (x&((int)1<<j)) ){
                bi[j]++;
                sol[i][j]--;
            }
        }
    }


    for(int i=0;i<n;i++){
        int num=0;

//        cout<<i<<" <-"<<fl;
        for(int j=0;j<32;j++){
            int bit=bi[j]+sol[i][j];
//            cout<<j<<" "<<bi[j]<<" "<<sol[i][j]<<fl;
            if( bi[j]!=0 &&  bit%2 != 0 ){
                num+=((int)1<<j);
            }
        }
        cout<<num<<" ";
    }
return 0;}







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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

int main(){

	int n,m;cin >> n >> m;
	ll x = 0,y = 0;
	REP(i,n){
		ll tmp;cin >> tmp;
		x += i * tmp % MOD;
		x %= MOD;
		x += (n - i - 1) * ((MOD - tmp) % MOD) % MOD;
		x %= MOD;
	}

	REP(i,m){
		ll tmp;cin >> tmp;
		y += i * tmp % MOD;
		y %= MOD;
		y += (m - i - 1) * ((MOD - tmp) % MOD) % MOD;
		y %= MOD;
	}

	cout << x * y % MOD << endl;
	return 0;
}


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

#define ll long long
#define mtv(kit) cout<<#kit<<" - "<<kit<<"\n";
#define ff first
#define ss second
#define pb push_back
#define rep(i,a,b) for(i=a;i<b;i++)
#define pii pair<ll , ll>
#define all(x) x.begin(),x.end()
#define nl "\n"
#define ump unordered_map

void doit(){
    string s;
    cin >> s;
    ll su = 0;
    for(auto ch : s)su += (ch-'0');
    if(su%9 == 0){
        cout << "Yes" << nl;
    }  
    else cout << "No" << nl;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t = 1;
    // cin >> t;
    for(ll i = 1; i <= t; i++){
        doit();
    }
}


Measured memory_bytes: 3724
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

s = input()
n = len(s)
a = s[:(n-1)//2]
b = s[((n+3)//2)-1:]
if a == b:
    print('Yes')
    exit()
print('No')


Measured memory_bytes: 60268
#include <iostream>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>

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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    REP(i,n) cin >> v[i];

    int big = 0;
    REP(i,n) big += v[i];
    
    int res = big;
    int small = 0;

    int dum = 0;
    int cnt =1;
    REP (i,n) {
        big -= v[i];
        small += v[i];
        res = min(res, abs(big-small));
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  long long  a,b,c,A,B;
  while(cin>>a>>b){
    A=a;
    B=b;
    while(b!=0){
      c=a%b;
      a=b;
      b=c;
    }
    cout<<a<<' '<<A/a*B<<endl;
  }
  
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)
#define dump(x) cerr << __LINE__ << ":\t" #x " = " << x << endl

using ld = double;
using P = complex<ld>;
using G = vector<P>;
const ld pi = acos(-1);
const ld eps = 1e-10;
const ld inf = 1e12;

ld cross(const P& a, const P& b) { return a.real()*b.imag() - a.imag()*b.real(); }
ld dot(const P& a, const P& b) { return a.real()*b.real() + a.imag()*b.imag(); }

using C = pair<ld, P>;
#define rad first
#define pnt second

C smallest_enclosing_disc(vector<P> ps){
    auto c3 = [](const P &a, const P &b, const P &c){
        ld A = norm(b - c);
        ld B = norm(c - a);
        ld C = norm(a - b);
        ld S = abs(cross(b - a, c - a));
        P p = (A*(B+C-A)*a + B*(C+A-B)*b + C*(A+B-C)*c) / (4*S*S);
        ld r = abs(p - a);
        return make_pair(r, p);
    };

    auto c2 = [](const P &a, const P &b){
        P c = (a + b) / (ld)2;
        ld r = abs(a - c);
        return make_pair(r, c);
    };

    auto in_circle = [](const P &a, const C &c){
        return norm(a - c.pnt) <= c.rad*c.rad + eps;
    };

    int n = ps.size();
    random_shuffle(ps.begin(), ps.end());
    C c = c2(ps[0], ps[1]);
    for(int i = 2; i < n; ++i){
        if(!in_circle(ps[i], c)){
            c = c2(ps[0], ps[i]);
            for(int j = 1; j < i; ++j){
                if(!in_circle(ps[j], c)){
                    c = c2(ps[j], ps[i]);
                    for(int k = 0; k < j; ++k){
                        if(!in_circle(ps[k], c)){
                            c = c3(ps[i], ps[j], ps[k]);
                        }
                    }
                }
            }
        }
    }
    return c;
}

// http://www.spoj.com/problems/QCJ4/
// http://www.spoj.com/status/ns=18116289

// int main(){
//     srand(time(0));
//     int n;
//     cin >> n;
//     vector<P> ps(n);
//     for(int i = 0; i < n; ++i){
//         ld x,y;
//         cin >> x >> y;
//         ps[i] = P(x,y);
//     }

//     printf("%.2lf\n", (double)smallest_enclosing_disc(ps).rad*2);
// }


int n,m;
ld r[111], mb[111];
 
bool used[111];

bool chk(int s){
    vector<int> b;
    rep(i,n)if(!used[i]) b.emplace_back(r[i]);
    vector<ld> a;
    for(int i = s; i < m; ++i) a.emplace_back(mb[i]);
    sort(all(a));
    sort(all(b));
    int last = -1;
    rep(i,a.size()){
        bool found = false;
        for(int j = last+1; j < (int)b.size(); ++j){
            if(a[i] < b[j] + eps){
                found = true;
                last = j;
                break;
            }
        }
        if(!found)return false;
    }
    return true;
}

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    cout << fixed << setprecision(20);
    vector<int> ans;
    cin >> n;
    G g;
    rep(i,n){
        ld x,y;
        cin >> x >> y;
        g.push_back(P(x,y));
    }
    ld mb = smallest_enclosing_disc(g).rad;
    cout << mb << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef pair<int,int> pi;

int main(){
	int n;
	cin>>n;
	vector<pair<pi,int> >dots(2*n);
	int ret = 0;
	for(int i=0; i<n; i++){
		int x,y;
		cin>>x>>y;
		dots[i].first = pi(x,y);
		dots[i].second = 0;
	}
	for(int i=n; i<2*n; i++){
		int x,y;
		cin>>x>>y;
		dots[i].first = pi(x,y);
		dots[i].second = 1;
	}
	sort(dots.begin(),dots.end());
	vector<int>s;
	vector<int>::iterator it;
	
	for(int i=0; i<2*n; i++){
		int y = dots[i].first.second;
		int color = dots[i].second;

		if(color){
			if(s.empty()) continue;
			it = lower_bound(s.begin(),s.end(),y);
			if(it==s.begin()) continue;
			ret++;
			s.erase(--it);
		}
		else{
			s.push_back(y);
			sort(s.begin(),s.end());
		}
	}
	cout<<ret;
}

Measured memory_bytes: 3172
import sys
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

n,q = read_int()
S = read_str()
lr = [read_int() for _ in range(q)]

dp = [0 for i in range(n+1)]
def solve():
    for i in range(1, n):
        dp[i+1] = dp[i]
        if S[i - 1:i + 1] == 'AC':
            dp[i +1] += 1

    for i in range(q):
        l,r = lr[i]
        print(dp[r]-dp[l])

        
if __name__ == "__main__":
    solve()

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

int main() {
  int n;
  cin >> n;
  vector<long int> h(n);
  for(int i = 0; i < n; i++){
    cin >> h.at(i);
  }
  bool p = 1;
  /*
  for(int i = 0; i < n; i++){
    cout << h.at(i) << endl;
  }
  */
  if(n == 1){
    cout << "Yes" << endl;
  }
  for(int i = 0; i < n-1; i++){
    if(n == 1){
      cout << "Yes" << endl;
      break;
    }
    if(h.at(i+1)-h.at(i) < -1){
      //cout << i << 1 << endl;
      cout << "No" << endl;
      break;
    }
    else if(h.at(i+1)-h.at(i) > 0){
      //cout << i << 2 << endl;
      p = 1;
    }
    else if(h.at(i+1)-h.at(i) == 0)
      //cout << i << 3 << endl;
      ;
    else if(h.at(i+1)-h.at(i) == -1){
      //cout << i << 4 << endl;
      if(p == 0){
        cout << "No" << endl;
        break;
      }
      else
        p = 0;
    }
    if(i == n-2)
      cout << "Yes" << endl;
  }
      
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int w,h,n,i,sx,sy;
    sx=0;
    sy=0;
    cin >>w>>h>>n;
    int x[n],y[n],a[n];
    for(i=0;i<n;i++){
      cin>>x[i]>>y[i]>>a[i];
      if(a[i]==1){
        sx=max(sx,x[i]);
      }else if(a[i]==2){
        w=min(w,x[i]);
      }else if(a[i]==3){
        sy=max(sy,y[i]);
      }else {
        h=min(h,y[i]);
      }
    }
  if(w>sx&&h>sy){
  cout<<(w-sx)*(h-sy)<<endl;
  }else{
    cout<<0<<endl;
  }
}


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


int main() {
  ll N,x;
  cin >> N >> x;;
  vector<ll> a(N);
  for(ll i = 0;i<N;i++){
    cin >> a[i];
  }
  vector<ll> A(N);
  A = a;
  if(a[0] > x){
    A[0] = x;
  }
  for(ll i = 0;i<N-1;i++){
    if(A[i] + A[i+1] > x){
      A[i+1] = x-A[i];
    }
  }
  ll ans = 0;
  for(ll i = 0;i<N;i++){
    ans += a[i]-A[i];
  }
  
  cout << ans << endl;

    
}

Measured memory_bytes: 1792
import math
import sys

def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

s = arr_data[0][0]

print(s[0] + str(len(s)-2) +  s[-1])




Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int main(){
  int n;
  while(~scanf("%d",&n)){
    ll dp[101][21];
    memset(dp,0,sizeof(dp));

    int first;
    scanf("%d",&first);
    dp[0][first] = 1;

    for(int i=0;i<n-2;i++){
      int num;
      scanf("%d",&num);
      for(int from = 0; from <= 20; from++){
	if(dp[i][from] > 0){
	  if(from+num <= 20){
	    dp[i+1][from+num] += dp[i][from];
	  }
	  if(from-num >=0){
	    dp[i+1][from-num] += dp[i][from];
	  }
	}
      }
    }
    int target_num;
    scanf("%d",&target_num);
    printf("%lld\n",dp[n-2][target_num]);
  }
}

Measured memory_bytes: 1212
#include <stdio.h>
int main()
{
	int x, y;
	scanf("%d%d", &x, &y);
	char str[2][110] = {""};
	char tab[110][110] = {""};
	for(int i=0; i<x*y; ++i)
	{
		char ch;
		scanf(" %c", &ch);
		if(ch == '#')
		{
			str[0][i/y] = 1;
			str[1][i%y] = 1;
		}
		tab[i/y][i%y] = ch; 
	}
	for(int i=0; i<x; ++i)
	{
		int flag = 0;
		for(int j=0; j<y; ++j)
		{
			if(str[0][i] + str[1][j] == 2)
			{
				putchar(tab[i][j]);
				flag = 1;				
			}			
		}
		if(flag) puts(""); 
	}
	
	return 0;
}

Measured memory_bytes: 2100
from collections import deque
MAX_VAL = 10 ** 9
H, W = map(int, input().split())
 
 
 
border_row = "#"*(W+2)
field = [border_row]
num_blacks = 0
for i in range(H):
    line = input()
    num_blacks += line.count(".")
    field.append("#"+line+"#")
field.append(border_row)
 
cost = [[MAX_VAL]*(W+2) for _ in range(H+2)]
 
if field[1][1] == ".":
    cost[1][1] = 1
else:
    cost[1][1] = MAX_VAL
 
visited = [[False]*(W+2) for _ in range(H+2)]
dxdy = [(-1, 0), (1, 0), (0, -1), (0, 1)]
def bfs():
    q = deque()
    q.append((1, 1))
    visited[1][1] = True
    while len(q):
        x, y = q.popleft()
        for dx, dy in dxdy:
            nx = x + dx
            ny = y + dy
            if field[ny][nx] == "." and not visited[ny][nx]:
                cost[ny][nx] = cost[y][x]+1
                visited[ny][nx] = True
                q.append((nx, ny))
    return 
bfs()
print(num_blacks - cost[H][W]) if cost[H][W] < MAX_VAL else print(-1)

Measured memory_bytes: 3316
{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Control.Applicative
import Data.Char

solve :: VU.Vector Int -> VU.Vector Int
solve hs =
  VU.create $ do
    table <- VUM.replicate (l+1) (10^5 :: Int)
    VUM.write table 0 0
    forM_ [1..l-1] $ \i -> 
      if i==1 then
        VUM.write table i (h i 1)
      else do
        a1 <- VUM.read table (i-1)
        a2 <- VUM.read table (i-2)
        VUM.write table i $ min (a1 + h i 1) (a2 + h i 2)
    return table
  where
    l = VU.length hs
    h x n = abs $ (hs VU.! x) - (hs VU.! (x-n)) 

main = do
  n <- readLn :: IO Int
  (hs :: VU.Vector Int) <- VU.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
  print $ solve hs VU.! (n-1)

Measured memory_bytes: 3580
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<double, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size
#define EPS (1e-10)

void add_mod(ll &a, ll b){
	a += b;
	a %= MOD;
}

void mul_mod(ll &a, ll b){
	a *= b;
	a %= MOD;
}

int main(void){
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);
	cout << (a[2]-a[0]) << endl; 
	return 0;
}


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

int main()
{
    string s;
    cin>>s;
    
    int f=0;
    long long tot=0;
    for(long long int i=0;i<s.size();++i)
    {
        int x=s[i]-'0';
        tot+=x;
    }
    if(tot%9)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
}

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

typedef long long int ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<string>vst;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef map<int,int> dct;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define all(ct) ct.begin() , ct.end()
#define endl "\n"
#define fr(i,a) for(auto i:a)
#define f(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define pb push_back
#define in(d,v) d.find(v)!=d.end()
#define mp make_pair
#define pi 3.14159265

bool compare(pair<pii,vector<int>> a, pair<pii,vector<int>> b){
    if(a.first.first*b.first.second==a.first.second*b.first.first)
        return a.first.second>b.first.second;
    return a.first.first*b.first.second<a.first.second*b.first.first;
}

const int mod = 1e9 + 9;
const ll inf = ll(1e18);

ll modexp(ll x,ll n){
    if(n==0)return 1;
    if(n%2==0)return modexp((x*x)%mod,n/2);
    return (x*modexp((x*x)%mod,n/2))%mod;
}
vl dp(1e7+1);
int main(){
    fastio;
    ll a,b;
    cin>>a>>b;
    cout<<(a*b)/__gcd(a,b)<<endl;
}

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


int main() {
  int x, a, b;
  cin >> x >> a >> b;
  x -= a;
  int d = x/b;
  int ans = x-b*d;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

S=int(input())
dp=[0]*(S+1)
dp[0]=1
for i in range(S+1):
    for j in range(i-2):
        dp[i]+=dp[j]
        dp[i]%=MOD
print(dp[-1])

Measured memory_bytes: 64972
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    ll h, w, z = (ll)100000000000;
    cin >> h >> w;
    if (h % 3 == 0) z = min(z, 0ll);
    else z = min(z, w);
    if (w % 3 == 0) z = min(z, 0ll);
    else z = min(z, h);
    for (int i = 1; i < h; i++) {
        ll a = i * w, b, c;
        if (w % 2 == 0) b = c = (w / 2) * (h - i);
        else b = (w / 2) * (h - i), c = (w / 2 + 1) * (h - i);
        z = min(z, max({a, b, c}) - min({a, b, c}));
    }
    for (int i = 1; i < w; i++) {
        ll a = i * h, b, c;
        if (h % 2 == 0) b = c = (h / 2) * (w - i);
        else b = (h / 2) * (w - i), c = (h / 2 + 1) * (w - i);
        z = min(z, max({a, b, c}) - min({a, b, c}));
    }
    cout << z;
}


Measured memory_bytes: 256
#include <stdio.h>
int stack[1005];
int stack_size = 0;
int pop()
{
  if(stack_size <= 0) return 0;
  return stack[--stack_size];
}
int push(int a)
{
  stack[stack_size++] = a;
}
int is_digit(char *s)
{
  if(*s == '+' || *s =='-'){
    s++;
    if(*s >= '0' && *s <= '9') return 1;
    return 0;
  }
  if(*s >= '0' && *s <= '9') return 1;
  return 0;
}
int get_number(char *s)
{
  int sign = 0, n = 0;
  if(*s == '+'){
    s++;
  }
  else if(*s == '-'){
    sign = 1;
    s++;
  }
  while(*s >= '0' && *s <= '9'){
    n = n * 10 + (*s - '0');
    s++;
  }
  if(sign) return -n;
  return n;
}
int calc_rpn(char *s)
{
  int a, b, n;
  while (*s){
    if(is_digit(s)){
      n = get_number(s);
      push(n);
      while (*s == '-' || *s == '+') {
	s++;
      }
      while (n) {
	n /= 10;
	s++;
      }
    }
    else {
      switch (*s) {
      case '+':
	a = pop();
	b = pop();
	push(b+a);
	break;
      case '-':
	a = pop();
	b = pop();
	push(b-a);
	break;
      case '*':
	a = pop();
	b = pop();
	push(b*a);
	break;
      case '/':
	a = pop();
	b = pop();
	if (a == 0)
	  break;
	push(b/a);
	break;
      }
      s++;
    }
  }
  return pop();
}
int main()
{
  char s[1005];
  int r;
  scanf("%[^\n]*s", s);
  printf("%d\n",calc_rpn(s));
 
  return 0;
}



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

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            decimal a = int.Parse(str[0]);
            decimal b = int.Parse(str[1]);

            decimal lcm = Lcm(a, b);

            Console.Write(lcm);
        }

        // 最小公倍数
        public static decimal Lcm(decimal a, decimal b)
        {
            return a * b / Gcd(a, b);
        }

        public static decimal Gcd(decimal a, decimal b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

ll dp[1000010];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll X; cin >> X;
    REPS(i, 100, 105) dp[i] = 1;
    reps(i, 1000) {
        rep(j, X) {
            REPS(k, 100, 105) {
                chmax(dp[j+k], dp[j]);
            }
        }
    }
    if (dp[X]) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 1024
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function breakIn(){
		$buf = str_split($this->killNewLine(fgets(STDIN)));
		return $buf;
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$s = $this->breakIn();
		
		$ans = 0;
		$buf = "";
		foreach ($s as $v){
			$ans += $v;
			$buf .= $v;
		}
		unset($v);

		if(0 == ($buf % $ans)){
			echo "Yes";
		}else{
			echo "No";
		}
	}
}
?>


Measured memory_bytes: 4728
N = int(input())
S = input()

r = 0
g = 0
b = 0
for s in S:
  if s == "R":
    r += 1
  if s == "G":
    g += 1
  if s == "B":
    b += 1
ans = r * g * b

for i in range(N):
  for j in range(i + 1, N):
    k = 2 * j - i
    if k >= N:
      continue
    if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
      ans -= 1
print(ans)

Measured memory_bytes: 9208
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define mp(a,b) make_pair(a,b)
#define pb(x) push_back(x)
const ll mod = 1e9 + 7;
ll inf = 1e16;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)



int main()
{
   fastio;
   ll n,k;
   cin>>n>>k;
   ll arr[n];
   for(ll i=0;i<n;++i){
   	cin>>arr[i];
   }
   ll dp[n];
   dp[0]=0;
   for(ll i=1;i<n;++i){
   	    ll val = inf;
   	   for(int j=i-1;j>=0 && j>=i-k;--j){
   	   	     val = min(val, dp[j]+abs(arr[i]-arr[j]));
		}
		dp[i] = val;
   }
	 cout<<dp[n-1]<<endl;
	return 0;
}



Measured memory_bytes: 5164
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


class UnionFind {
public:
    vector<int> Parent;
    
    UnionFind(int N){
        Parent = vector<int>(N, -1);
    }
    
    int root(int A){
        if(Parent[A] < 0) return A;
        else return Parent[A] = root(Parent[A]);
    }
    
    int size(int A){
        return -Parent[root(A)];
    }
    
    bool unite(int A, int B){
        A = root(A);
        B = root(B);
        if(A==B) return false;
        
        if(size(A) < size(B)) swap(A, B);
        Parent[A] += Parent[B];
        Parent[B] = A;
        return true;
    }
};


int main() {
    int N; cin >> N;
    vector<pair<PII, int>> X(N);
    vector<pair<PII, int>> Y(N);
    for(int i=0; i<N; i++){
        int x, y; cin >> x >> y;
        X[i] = {{x, y}, i};
        Y[i] = {{y, x}, i};
    }
    
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    
    struct edge {
        int from, to, cost;
    };
    vector<edge> E;
    
    for(int i=0; i<N-1; i++){
        edge e;
        e.from = X[i].sc;
        e.to = X[i+1].sc;
        e.cost = min(abs(X[i+1].fs.fs-X[i].fs.fs), abs(X[i+1].fs.sc-X[i].fs.sc));
        E.push_back(e);

        e.from = Y[i].sc;
        e.to = Y[i+1].sc;
        e.cost = min(abs(Y[i+1].fs.fs-Y[i].fs.fs), abs(Y[i+1].fs.sc-Y[i].fs.sc));
        E.push_back(e);
    }
    
    
    
    sort(E.begin(), E.end(), [](const edge &a, const edge &b){return a.cost>b.cost;});
    
    UnionFind U(N);
    ll ans = 0;
    while(E.size()){
        edge e = E.back();
        E.pop_back();
        if(U.root(e.from)!=U.root(e.to)){
            ans += e.cost;
            U.unite(e.from, e.to);
        }
    }
    
    cout << ans << endl;
    
    return 0;
}



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

using namespace std;

int main(int argc, const char *argv[]) {
  int h, w;
  cin >> h >> w;

  vector<vector<int>> va(h, vector<int>(w));
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cin >> va[i][j];
    }
  }

  vector<vector<int>> vb(h, vector<int>(w));
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cin >> vb[i][j];
    }
  }

  int max_d = 80 * (h + w - 1);
  vector<vector<vector<bool>>> memo(
      vector(h + 1, vector(w + 1, vector(max_d + 1, false))));
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      for (int k = 0; k <= max_d; ++k) {
        int d = abs(va[i][j] - vb[i][j]);
        if (i == 0 && j == 0) {
          memo[i][j][k] = k == d;
          continue;
        }

        bool ans1, ans2;
        ans1 = ans2 = false;
        if (i > 0) {
          ans1 = memo[i - 1][j][abs(k - d)] || memo[i - 1][j][abs(k + d)];
        }

        if (j > 0) {
          ans2 = memo[i][j - 1][abs(k - d)] || memo[i][j - 1][abs(k + d)];
        }

        memo[i][j][k] = ans1 || ans2;
      }
    }
  }

  int ans;
  for (int i = 0; i <= max_d; ++i) {
    if (memo[h - 1][w - 1][i]) {
      ans = i;
      break;
    }
  }

  cout << ans << '\n';
}

Measured memory_bytes: 14076
s = input()
a, b = int(s[:2]), int(s[2:])

if (a>12 or a==0) and (b>12 or b==0): print("NA")
elif (a>12 or a==0) and b<=12: print("YYMM")
elif a<=12 and (b>12 or b==0): print("MMYY")
elif a<=12 and b<=12: print("AMBIGUOUS")

Measured memory_bytes: 3060
a,b,h,m = map(int,input().split())
import math
t1 = 30 *(h+m/60)
t2 = 6 * m

x1 = a*math.cos(math.radians(t1))
y1 = a*math.sin(math.radians(t1))

x2 = b*math.cos(math.radians(t2))
y2 = b*math.sin(math.radians(t2))

ans = ((x1-x2)**2 + (y1-y2)**2)**0.5
print(ans)

Measured memory_bytes: 9584
using System;
using System.Linq;
using System.Collections.Generic;

namespace AOJ
{
	class Program
	{
		public static void Main(string[] args)
		{
			while(int.Parse(Console.ReadLine()) != 0)
			{
				var arr = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
				int diff = int.MaxValue;
				var t = new Dictionary<int, int>();
				for(var i = 1; i < arr.Count(); i++)
				{
					var d = arr[i] - arr[i-1];
					if(!t.ContainsKey(d))
					{
						t.Add(d, 1);
					}
					else
					{
						t[d]++;
					}
				}
				foreach(var i in t.Keys)
				{
					if(t[i] == t.Values.Max())
					{
						diff = i;
					}
				}
				if(t.Values.Max() == t.Values.Min())
				{
					diff = arr[1] - arr[0];
				}
				int l = arr[0];
				for(var i = 1; i < arr.Count(); i++)
				{
					l += diff;
					if(arr[i] != l)
					{
						if(i == 1 && arr[2] - arr[1] == diff)
						{
							Console.WriteLine(arr[0]);
						}
						else
						{
							Console.WriteLine(arr[i]);
						}
						break;
					}
				}
			}
		}
	}
}

Measured memory_bytes: 6720
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000
#define MAX 200001
#define PI 3.141592653589793

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 1000000007;

template <typename T > inline string toString(const T &a) {ostringstream oss; oss << a; return oss.str();};

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    ll x = a[n-1];
    ll y;
    if(x % 2 == 0){
        auto iter = lower_bound(a.begin(), a.end(), x/2);
        ll idx = iter - a.begin();
        if(idx == 0) y = a[idx];
        else{
            ll w = a[idx];
            ll z = a[idx-1];
            if(abs(w - x/2) < abs(z - x/2)) y = w;
            else y = z;
        }
    }
    else{
        auto iter = lower_bound(a.begin(), a.end(), x/2);
        ll idx = iter - a.begin();
        if(idx == 0) y = a[idx];
        else{
            ll w = a[idx];
            ll z = a[idx-1];
            if(min(abs(w - x/2), abs(w - x/2 - 1)) < abs(z - x/2)) y = w;
            else y = z;
        }
    }
    cout << x << ' ' << y << endl;
}

Measured memory_bytes: 4028
#include<bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d",&x);
#define scs(x) scanf("%s",x);
#define scl(x) scanf("%lld",&x);
#define rep(i,s,e) for(int i=s; i<=e; ++i)
#define dep(i,s,e) for(int i=s; i>=e; --i)
typedef long long ll;
using namespace std;
const ll mod=1e9+7;
const int Max=2e5+5;
int main()
{
	ll n,k,cou=0;
	scl(n);scl(k);
	for(ll i=k;i<=n+1;i++){
		ll a=(i-1)*i/2,b=(2*n-i+1)*i/2;
		cou+=b-a+1;
		cou%=mod;
	}pf("%lld",cou);
}


Measured memory_bytes: 3824
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=2002020;
int n,ans,a[N];
int read(){
	int x=0,f=1; char ch=getchar();
	while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
bool cmp(const int &x,const int &y){return x>y;}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++){
		if(a[i+1]<i+1){
			for(int j=i+1;j<=n && a[j]>=i;j++)ans^=1;
			ans|=(a[i]-i)&1; break;
		}
	}
	if(ans)puts("First");
	else puts("Second");
	return 0;
}

Measured memory_bytes: 4032
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] d = new int[5];
        int[] A = new int[5];
        int a;
        int b;
        int ans1 = 0,ans2 = 0;

        for(int i = 0;i < 5;i++){
            d[i] = sc.nextInt();
            a = d[i] % 10;
            b = 10-a;
            if(d[i]%10 == 0 || b == 0)
            continue;
            A[i] = b;
        }

        Arrays.sort(A);

        for(int i = 0;i < 4;i++){
            ans1 += A[i];
        }
        for(int i = 0;i < 5;i++){
            ans2 += d[i];
        }
        int ans = ans1 +ans2;
        System.out.println(ans);
    }
}

Measured memory_bytes: 21716
#include<stdio.h>
int N;
int A[201];
 
int main()
{
    int i;
  int res = 0;
  int odd_flg;
  
  //数値の数の設定
  scanf("%d", &N);
 
  // 整数の入力
    for(i=0;i<N;i++)
    {
      scanf("%d", &A[i]);
    }
  
  //奇数が出てくるまで2で割り続ける
  odd_flg = 0;
  while(1)
  {
    for(i=0;i<N;i++)
    {
      if(A[i] % 2 != 0)
      {
        odd_flg = 1;
      }
      else
      {
        A[i] /= 2;
      }
    }
    
    // 奇数が存在していたら抜ける
    if(odd_flg == 1)
    {
      break;
    }
	// 操作回数を加算
    res++;
  }
    printf("%d\n",res);
    return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.io.*;
class Main{
  public static void main(String args[]){
    int n=readI();
    int a[]=new int[n];
    for(int i=0;i<n;i++){
      a[i]=readI();
    }
    Arrays.sort(a);
    long count=a[n-1];
    for(int i=n-2,k=1;k<n-1;k++){
      count+=a[i];
      if(k%2==0){i--;}
    }
    pl(count+"");
  }

  static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
  public static String read(){
    try{
      return ctos((char)br.read());
    }catch(IOException e){
      e.printStackTrace();
      return "";
    }
  }
  public static char readC(){
    try{
      return (char)br.read();
    }catch(IOException e){
      e.printStackTrace();
      return (char)-1;
    }
  }
  public static String readL(){
    try{
      return br.readLine();
    }catch(IOException e){
      e.printStackTrace();
      return "";
    }
  }
  public static String readS(){
    StringBuilder sb = new StringBuilder();
    while(true){
      try{
        int k = br.read();
        if(k==-1||(char)k==' '||(char)k=='\n'){break;}
        sb.append((char)k);
      }catch(IOException e){
        e.printStackTrace();
      }
    }
    return sb.toString();
  }
  public static int readI(){
    return stoi(readS());
  }
  public static long readLong(){
    return stol(readS());
  }
  public static long stol(String s){
    return Long.parseLong(s);
  }
  public static String[] readSs(){
    return readL().split(" ");
  }
  public static int[] readIs(){
    return stoi(readSs());
  }
  public static int stoi(String s){
    return Integer.parseInt(s);
  }
  public static int[] stoi(String s[]){
    int a[]=new int[s.length];
    for(int i=0;i<s.length;i++){
      a[i]=stoi(s[i]);
    }
    return a;
  }
  public static String itos(int i){
    return String.valueOf(i);
  }
  public static String[] itos(int[] a){
    String s[]=new String[a.length];
    for(int i=0;i<a.length;i++){
      s[i]=itos(a[i]);
    }
    return s;
  }
  public static String ctos(char c){
    return String.valueOf(c);
  }
  public static String cstos(char[] c){
    return new String(c);
  }
  public static char stoc(String s){
    return s.charAt(0);
  }
  public static char[] stocs(String s){
    return s.toCharArray();
  }
}


Measured memory_bytes: 59684
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pii pair<int, int>
#define pll pair<long long, long long>
using namespace std;


void yes(){
    cout<<"YES"<<endl;
}

void no(){
    cout<<"NO"<<endl;
}

int main(){
    int n;
    cin>>n;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    vector<ll> dp(n,999999999);
    dp[0] = 0;
    for(int i =0;i<n-1;i++){
        dp[i+1] = min(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
        dp[min(i+2,n-1)] = min(dp[min(i+2,n-1)],dp[i]+abs(h[i]-h[min(i+2,n-1)]));
    }
    cout<<dp[n-1]<<endl;

    return 0;
}

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

int main(){
	int arr[4][3][10] = {};
	int t;
	cin >> t;
	for(int i = 0; i < t; i++){
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		arr[b-1][f-1][r-1] += v;
	}
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 3; j++){
			for(int k = 0; k < 10; k++){
				cout << " " << arr[i][j][k];
			}
			cout << endl;
		}
		if(i != 3){
			for(int j = 0; j < 20; j++){
				cout << "#";
			}
			cout << endl;
		}
	}
}


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

using std::cin;
using std::cout;

const int MAXN = 2e5 + 10;

int f[MAXN];

int find(int x){return x==f[x]?x:f[x]=find(f[x]);}
void unite(int x, int y){
    int fx=find(x),fy=find(y);
    if (fx==fy)return;
    f[fx]=fy;
}
void solve() {
    int n, m;
    cin >> n >> m ;
    for (int i = 1; i <= m + n; ++i) f[i] = i;
    for (int i = 1, K; i <= n; ++i) {
        cin >> K;
        for (int j = 0, x; j < K; ++j) {
            cin >> x;
            unite(x, i + m);
            // cout << x << i + m << "\n";
        }
    }
    for (int i = 1; i <= n; ++i) {
        if (find(m + i) == find(m + 1)) continue;
        cout << "NO\n";
        return;
    }
    cout << "YES\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    cin.tie(0);
#ifdef trote
    freopen("../1.txt", "r", stdin);
    freopen("../out.txt", "w", stdout);
#endif
    solve();
    return 0;
}

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

int main() {
	
	int ans = 700;
	rep(i, 3){
		char s;
		cin >> s;
		if(s == 'o') ans += 100;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;
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 (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
ll M = 1000000007;
set<int> divisor(int n)
{
	set<int> value;
	for( int ite=1; (ll)ite*ite<=n;ite++)
	{
		
			if (n % ite == 0)
			{
				value.insert(ite);
				value.insert(n / ite);
				
			}
		
	}
	return value;
}
/*

set<ll> divisor(ll n)
{
	set<ll> value;
	for( ll i=1; i*i<=n;i++)
	{
		
			if (n % i == 0)
			{
				value.insert(i);
				value.insert(n / i);
			}
		
	}
	return value;
}
*/

void solve() {
    long long N;
    cin >> N;
	ll ans=0;
	FOR(i,1,N+1){
		rep(j,N/i){
			ans+=(ll)i*(j+1);
		}
	}
	cout<<ans<<endl;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	return 0;
}


Measured memory_bytes: 3548
#include <stdio.h>
int main(){
  char a,b;
  scanf("%c %c",&a,&b);
  if(b=='H'){
    if(a=='H')printf("H");
    if(a=='D')printf("D");
  }
  if(b=='D'){
    if(a=='H')printf("D");
    if(a=='D')printf("H");
  }
  return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  set<char> hate;
  for (int i = 0; i < K; i++) {
    char c;
    cin >> c;
    hate.insert(c);
  }
  while (1) {
    string s = to_string(N);
    int l = s.size();
    bool b = true;
    for (int i = 0; i < l; i++) if (hate.count(s[i])) b = false;
    if (b) {
      cout << N << endl;
      return 0;
    }
    else N++;
  }
} 

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

vector<vector<int>> g;
vector<int> dt;
vector<int> da;
vector<int> tstop;

void dfs(vector<int> &d, const int &cnt,const int &par,const bool &t) {
    if (t && g[cnt].size() == 1) {
        tstop.push_back(cnt);
    }
    for(auto x:g[cnt]) {
        if (x == par) {
            continue;
        }
        d[x] = d[cnt] + 1;
        if (t && dt[x] >= da[x]) {
            continue;
        }
        dfs(d, x, cnt,t);
    }
}

int main(void)
{
    IOS
    int n, u, v;
    cin >> n >> u >> v;
    u--; v--;
    dt.resize(n);
    da.resize(n);
    g.resize(n);
    REP(i,n-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    // cerr << "s1" << endl;

    dfs(da,v,-1,false);
    // cerr << "s21" << endl;
    dfs(dt,u,-1,true);
    // cerr << "s2" << endl;

    for(auto x:tstop) {
        // cerr <<"st" << x << endl;
        dt[g[x][0]] = da[g[x][0]];
        dt[x] = da[g[x][0]];
    }
    // cerr << "s3" << endl;

    int ans = 0;
    REP(i,n) {
        if (dt[i] == da[i]) {
            // cerr << i << " " << da[i] << endl;
            ans = max(ans,da[i]);
        }
    }
    // cerr << "s4" << endl;

    if (g[u].size() ==1 && g[u][0] == v) OUT(0)
    else cout << ans << '\n';
    // cerr << "s5" << endl;

    return 0;
}

Measured memory_bytes: 13056
#include <cstdio>

using namespace std;

int n;

bool T[123456 * 2 + 1];
int C[123456 * 2 + 1];

void sieve() {
    for (int i = 0; i <= 123456 * 2; i++) {
        T[i] = true;
    }
    T[0] = T[1] = false;
    for (int i = 1; i <= 123456 * 2; i++) {
        if (T[i]) {
            for (int j = 2 * i; j <= 123456 * 2; j += i) {
                T[j] = false;
            }
        }
    }

    int c = 0;
    for (int i = 1; i <= 123456 * 2; i++) {
        if (T[i]) { c++; }
        C[i] = c;
    }
}

int solve() {
    return C[n * 2] - C[n];
}

int main() {
    sieve();
    for (;;) {
        scanf("%d", &n);
        if (!n) { break; }
        printf("%d\n", solve());
    }
    return 0;
}

Measured memory_bytes: 2232
#include <ext/pb_ds/assoc_container.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;
template <class c, class cmp = less<c> > using ordered_set = tree<c, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}
template <typename T,typename U>pair<T,U> operator+(const pair<T,U> & l,const std::pair<T,U> & r) { return {l.first+r.first,l.second+r.second};}
typedef long long int ll;
const ll mod =1e9+7;
const int maxn = 1000005;
#define endl '\n'
#define int ll
#define ld long double
#define all(x) (x).begin(),(x).end()
struct FT {
	vector<ll> s;
	FT(int n) : s(n,0) {}
	void update(int pos, ll dif) { // a[pos] += dif
    for (; pos < (s).size(); pos |= pos + 1) s[pos] = (s[pos]+dif);
	}
	ll query(int pos) { // sum of values in [0, pos)
		ll res = 0;
		for (; pos > 0; pos &= pos - 1) res = (res+s[pos-1]);
		return res;
	}
};

int32_t main()
{ 
  IOS
 
  int n,k;
  cin>>n>>k;
  vector<int> a(n+1);
  for(int i = 1;i<=n;i++){
    cin>>a[i];
  }
  bool changed = true;
  while((k--) and changed){
    changed = false;
    FT ft(n+2);
    for(int i = 1;i<=n;i++){
      ft.update(min(n+1,i+a[i]+1),-1ll);
      ft.update(max(0ll,i-a[i]),1ll);
    }
    for(int i = 1;i<=n;i++){
      int temp = ft.query(i+1);
      if(temp!=a[i]){
        changed = true;
        a[i] = temp;
      }
    }
  }

  for(int i = 1;i<=n;i++){
    cout<<a[i]<<" ";
  }
  cout<<endl;

}

Measured memory_bytes: 6364