akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
#define inf 0x3f3f3f3f
#define fast    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 3e5+5;
const ll mod =   1e9+7;
int n;
int main()
{  fast
cin>>n;
cout<<(1000-n%1000)%1000<<endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <queue>
#include <stack>
#include <set>
#include <cmath>

typedef long long ll;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<x<<endl
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SUM(vec) accumulate(all(vec),0)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<#a<<':'<<a<<endl

const ll INF = 1e9+7;

template<typename T>inline T digit(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);}
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;}
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;}


int main() {
  cin.tie(0); ios::sync_with_stdio(0);
  int n;cin>>n;
  double ans = 0;
  int tmp = 0;
  for(int i = 1;i <= n;++i)tmp += i%2;
  ans = ((double)tmp/(double)n);
  print(ans);
  return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

combination table(1e6);

int main(){
    int n, k;
    cin >> n >> k;
    k = min(n - 1, k);
    lint ans = 0;
    for(int i = 0; i <= k; i++){
        ans += table.C(n, i) * table.C(n - 1, i) % mod;
    }
    cout << ans % mod << endl;
}


Measured memory_bytes: 15872
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

int A, B;

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


    cin >> A >> B;

    cout << CEIL(B - 1, A - 1) << "\n";

    return 0;
}



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

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i=0;i<(n);i++)
#define rep2(i, m, n) for(int i=m;i<(n);i++)
#define rrep(i, n, m) for(int i=n;i>=(m);i--)
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

int dp[100005][13];

void Main() {
    string s;
    cin >> s;
    dp[0][0] = 1;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '?') {
            for (int j = 0; j < 10; ++j) {
                for (int k = 0; k < 13; ++k) {
                    dp[i+1][(10*k + j) % 13] += dp[i][k];
                    dp[i+1][(10*k + j) % 13] %= MOD;
                }
            }
        }else{
            int j = s[i] - '0';
            for (int k = 0; k < 13; ++k) {
                dp[i+1][(10*k + j) % 13] += dp[i][k];
                dp[i+1][(10*k + j) % 13] %= MOD;
            }
        }
    }
    cout << dp[s.length()][5] << endl;

}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


Measured memory_bytes: 5584
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {

		try {
			InputStreamReader isr = new InputStreamReader(System.in);
			BufferedReader br = new BufferedReader(isr);
			String buf = br.readLine();
			int n = Integer.parseInt(buf);
			for(int i=3; i<=n; i++){
				int	x = i;
				if(x%3==0){
					System.out.print( " " + i );
					continue;
				}
				while(x!=0){
					if(x%10==3){
						System.out.print( " " + i );
						break;
					}
					x /= 10;
				}
			}
			System.out.println();
		} catch (IOException e) {
			System.err.println(e);
		}
	}

}

Measured memory_bytes: 20196
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

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

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100;

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

long long lcm(long long a, long long b) {
	return a/gcd(a,b)*b;
}

int main() {
	int n;cin>>n;
	long long t[N];
	cin>>t[0];
	long long ans=t[0];
	rep(i,n-1) {
		cin>>t[i+1];
		ans=lcm(ans,t[i+1]);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
s = int(input())

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


x = s // 3
ans = 0
for i in range(1, x + 1):
    #数列の個数 i
    #残りの数 y
    y = s - 3 * i
    #数列の個数
    ans += cmb(y + i - 1, i - 1)
print(ans % (10 ** 9 + 7))


Measured memory_bytes: 9236
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Wolfgang Beyer
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ColorfulCreatures solver = new ColorfulCreatures();
        solver.solve(1, in, out);
        out.close();
    }

    static class ColorfulCreatures {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] a = in.readIntArray(n);
            Arrays.sort(a);

            int res = 0;
            long sum = 0;
            for (int i = 0; i < n - 1; i++) {
                sum += a[i];
                if (2 * sum >= a[i + 1]) {
                    res++;
                } else {
                    res = 0;
                }
            }
            res++;
            out.println(res);
        }

    }

    static class InputReader {
        private static BufferedReader in;
        private static StringTokenizer tok;

        public InputReader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public int[] readIntArray(int n) {
            int[] ar = new int[n];
            for (int i = 0; i < n; i++) {
                ar[i] = nextInt();
            }
            return ar;
        }

        public String next() {
            try {
                while (tok == null || !tok.hasMoreTokens()) {
                    tok = new StringTokenizer(in.readLine());
                }
            } catch (IOException ex) {
                System.err.println("An IOException was caught :" + ex.getMessage());
            }
            return tok.nextToken();
        }

    }
}



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

int main()
{
    unsigned long long int a,b,c,d,e;
    cin>>a>>b>>c;
    	if(a%c==0)
    	{
    		d=a/c;
    	}
    	else
    	{
    		d=a/c+1;
    	}
    		e=b/c;
    if(e-d>0)
    {
    	cout<<e-d+1<<endl;
    }
    else if(e==d)
    {
    	cout<<"1"<<endl;
    }
    else
    cout<<"0"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d", &tmp);v.push_back(tmp);}}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

int main(){

  int a[5], k;
  REP(i,5){
    cin >> a[i];
  }

  cin >> k;
  REP(i,5){
    REP(j,5){
      if(abs(a[i] - a[j]) > k){
        cout << ":(\n";
        return 0;
      }
    }
  }
  cout << "Yay!\n";

  return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    string s;
    cin >> s;
    int count = 0;
    if (s[0] == 'o') ++count;
    if (s[1] == 'o') ++count;
    if (s[2] == 'o') ++count;
    cout << 700 + count * 100 << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
	int n;
	cin >> n;
	int x;
	cin >> x;
	vector<int> dn(n);
	int ans = 0;
	for(int i = 0; i < n; i++) {
		cin >> dn[i];
	}
	sort(dn.begin(), dn.end());
	for(int i = 0; i < n; i++) {
		 x-=dn[i];
		 ans++;
	}
	ans += x/dn[0];
	
	cout << ans << endl;
	return 0;
}


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

#define ll long long
using namespace std;

const int N = 1e5 + 5;
int n, m, u, v, dp[N];
vector<int> adj[N];
bool vis[N];
vector<int> ve;

void dfs(int x) {
    vis[x] = true;
    for(int y : adj[x]) {
        if(!vis[y]) {
            dfs(y);
        }
    }
    ve.push_back(x);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for(int i = 0; i < m; i++) {
        cin >> u >> v;
        u--; v--;
        adj[u].push_back(v);
    }
    for(int i = 0; i < n; i++) {
        if(!vis[i]) dfs(i);
    }
    int ans = 0;
    for(int x : ve) {
        for(int y : adj[x]) {
            dp[x] = max(dp[x], 1 + dp[y]);
        }
        ans = max(ans, dp[x]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 8824
#include <iostream>
#include <vector>

using namespace std;

int search(int& target, vector<int>& data, int l, int r, int count)
{
	if(l > r)
	{
		return(count);
	}
	++count;
	int pos = (l + r) / 2;	
	if(data[pos] == target)
	{
		return(count);
	}
	else if(data[pos] < target)
	{
		return(search(target, data, pos + 1, r, count));
	}
	else
	{
		return(search(target, data, l, pos - 1, count));
	}
}

void solve()
{
	int n;
	while(cin >> n, n)
	{
		vector<int> data(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> data[i];
		}
		int target;
		cin >> target;
		cout << search(target, data, 0, data.size() - 1, 0) << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 1192
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
using llong = long long;

llong n;
llong a[100];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];

    llong res = 1000;
    llong k = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > a[i + 1]) continue;
        k += res / a[i];
        res %= a[i];

        res += a[i + 1] * k;
        k = 0;
    }

    cout << res << endl;
}

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

#define FOR(i,a,b) for(int i = (a);i < (b);++i)
typedef long long ll;

int main(){
    int n,k; cin >> n >> k;
    if(n %k == 0) cout << 0 << endl;
    else cout << 1 << endl;
}

Measured memory_bytes: 256
/*
g++ -std=c++11 -o2 -Wall Educational_DP_B.cpp -o .\out\Educational_DP_B.out
.\out\Educational_DP_B.out
*/

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

typedef long long ll;

int h[100005];
int dp[100005];

constexpr int INF = 1e9;

int main(){
//  freopen("./input/input.txt", "r", stdin);
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> h[i];
  }
  dp[0] = 0;
  for (int i = 1; i <= n - 1; ++i) {
    dp[i] = dp[i-1] + abs(h[i] - h[i-1]);
    for (int j = 2; i-j >= 0 && j <= k; ++j) {
      dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]));
    }
  }
  cout << dp[n-1] << "\n";
}


Measured memory_bytes: 1024
object Main extends App {
  val n = readInt
  val a = (1 to n).map{_ => readInt}
  
  var m = Map[Int,Boolean]()
  
  for (i <- 0 until n) {
    m.get(a(i)) match {
      case Some(v) => m = m.updated(a(i),!v)
      case None => m = m.updated(a(i),true)
    }
  }
  
  println(m.values.count{_ == true})
}

Measured memory_bytes: 64380
#include <stdio.h>

int main(void)
{
    int H, W;
    
    while (1) {
        scanf("%d %d", &H, &W);
        
        if ( H == 0 && W == 0) break;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (i == 0 || i == H - 1 || j == 0 || j == W - 1) printf("#");
                else printf(".");
            }
            printf("\n");
            }
        printf("\n");
    }
    return 0;
}

Measured memory_bytes: 1000
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;



//1-indexedに注意！！！
struct BIT{
    private:
    int n,n_;
    vector<long long> bit;

    public:
    BIT(int n):n(n){
        bit.resize(n+1);
        n_ = 1;
        while(n_<=n) n_<<=1;
        n_ >>= 1;
    }
    //1-index
    long long sum(int i){
        long long res = 0;
        while(i > 0){
            res += bit[i];
            i -= i&-i;
        }
        return res;
    }
    //1-index
    void add(int i,long long val){
        while(i <= n){
            bit[i] += val;
            i += i&-i;
        }
    }
    //return 1-index
    int lowerbound(long long w){
        if(w <= 0) return 0;
        int x = 0;
        for(int k=n_;k>0;k>>=1){
            if(x+k<=n&&bit[x+k]<w){
                w -= bit[x+k];
                x += k;
            }
        }
        return x+1;
    }
};



int main(){
    int n;
    scanf("%d",&n);
    int q;
    scanf("%d",&q);
    vector<int> c(n);
    rep(i,n) scanf("%d",&c[i]),--c[i];
    vector<vector<P>> r(n);
    rep(i,q){
        int left,right;
        scanf("%d %d",&left,&right);
        --left;--right;
        r[right].push_back(P(left,i));
    }

    vector<int> queryans(q,0);

    vector<int> color(n,-1);
    BIT bit(n);

    rep(i,n){
        if(color[c[i]]==-1){
            bit.add(i+1,1);
            color[c[i]] = i+1;
        }
        else{
            bit.add(color[c[i]],-1);
            bit.add(i+1,1);
            color[c[i]] = i+1;
        }

        rep(j,r[i].size()){
            queryans[r[i][j].second] = bit.sum(i+1) - bit.sum(r[i][j].first);
        }
    }

    rep(i,q) printf("%d\n",queryans[i]); // cout << queryans[i] << endl;

    return 0;
}

Measured memory_bytes: 35168
N, M = gets.split.map(&:to_i)
require 'set'
KS = M.times.map { Set.new(gets.split.drop(1).map(&:to_i)) }
P = gets.split.map(&:to_i)

ans = 0
(0...(1 << N)).each do |state|
  is_ok = M.times.all? do |k|
    set = KS[k]
    c = (1..N).count do |s|
      state[s - 1] == 1 && set.include?(s)
    end
    c % 2 == P[k]
  end
  ans += 1 if is_ok
end
puts ans

Measured memory_bytes: 3964
#include<iostream>
using namespace std;
int main()
{
    string s;
    int ans=0;
     getline(cin,s);
    for(int i=0 ;i<=s.length() ;i++ ){
    if(s[i]=='A'){
                  for(int j=0 ;j<=s.length() ;j++ ){
                          if(s[j]=='Z'){
                          ans=(j-i)+1;
                          }
                          }
                          }
                          
        
if(ans!=0){
         
       cout<<ans;
       break ;}

}}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
#define rrep(i, n) for(i = n - 1; i >= 0; i--)
#define int long long
using namespace std;

struct UF {
	int par[100000];
	int sz[100000];
	
	UF() {
		int i;
		rep(i, 100000) {
			par[i] = i;
			sz[i] = 1;
		}
	}
	
	int root(int x) {
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}
	
	void unit(int x, int y) {
		x = root(x);
		y = root(y);
		if (x != y) {
			par[x] = y;
			sz[y] += sz[x];
		}
	}
	
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	
	int size(int x) {
		return sz[root(x)];
	}
};

int n, m;
int a[100000], b[100000];
int ans[100000];
UF uf;

signed main() {
	int i;
	
	cin >> n >> m;
	rep(i, m) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
	}
	
	int cnt = 0;
	rrep(i, m) {
		ans[i] = n * (n - 1) / 2 - cnt;
		int u = a[i];
		int v = b[i];
		if (!uf.same(u, v)) {
			cnt += uf.size(u) * uf.size(v);
			uf.unit(u, v);
		}
	}
	
	rep(i, m) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
//for(int i = 0; i < n; i++)
 
int main() {
  int n, a, b, ans = 0;
  cin >> a >> b;
  if(a >= 13) ans = b;
  else if (a >= 6) ans = b / 2;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#include<tuple>
#include<stack>


using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef tuple<int, int, int> tpl;
int dx[4] = { 1,0,0,-1 };
int dy[4] = { 0,1,-1,0 };

#define ARRAY_MAX 1500

const int INF = 1 << 30;
const int MOD = 1e9 + 7;



//ユークリッド互除法
template<typename T>
T gcd(T x, T y) {

	if (y == 0) {
		return x;
	}
	else {
		return gcd(y, x % y);
	}
}

/*最小公倍数*/
template<typename T>
T lcm(T x, T y) {
	T tmp = gcd(x, y);
	return (x/tmp) * y;
}

int main() {

	ll n;
	cin >> n;
	vector<ll> t(n);
	ll maxi = 0;
	for (ll i = 0; i < n; i++)
	{
		cin >> t[i];
		maxi = max(maxi, t[i]);
	}

	for (int i = 0; i < n; i++)
	{
		maxi = lcm(maxi, t[i]);
	}
	cout << maxi << endl;



	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll INF=1e18;
const ll mod=1e9+7;
const double eps=0.000000001;

int main(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll k;
    cin >> k;
    k--;
    char c=s[k];
    rep(i,n){
        if(s[i]!=c) s[i]='*';
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3592
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        var a = int.Parse(str[0]);
        var b = int.Parse(str[1]);
        var c = int.Parse(str[2]);
        var min = a + b;
        var t1 = a + c;
        if (min > t1) min = t1;
        var t2 = b + c;
        if (min > t2) min = t2;
        Console.Write("{0}", min);
    }
}

Measured memory_bytes: 11220
import java.util.Arrays;
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	int a=sc.nextInt();
    	int b=sc.nextInt();
    	int c=sc.nextInt();
    	
    	if(a+b>=c) {
    		System.out.println("Yes");
    	}else {
    		System.out.println("No");
    	}

    }

}







Measured memory_bytes: 21204
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

int par[100100];
int rannk[100100];

void init(int n) {
    rep(i, n) {
      par[i] = i;
      rannk[i] = 0;
    }
}

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

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

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

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int N, M;
  cin >> N >> M;
  init(N);
  vector<int> p;
  rep(i, N) {
      int q; cin >> q; q --;
      p.push_back(q);
  }
  rep(i, M) {
      int x, y; cin >> x >> y; x --; y --;
      unite(p[x], p[y]);
  }
  int ans = 0;
  rep(i, N) {
      if(same(i, p[i])) ans ++;
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,x,k,y,j;
  cin>>n>>k;
  int i,a[n];
  for(i=0;i<n;i++)
     cin>>a[i];
  int ans[n];
  ans[0]=0;
  for(i=1;i<n;i++)
  {
      j=max(i-k,0);
      x=INT_MAX;
      for(;j<i;j++)
      {
          x=min(x,ans[j]+abs(a[j]-a[i]));
      }
      ans[i]=x;
  }
  cout<<ans[n-1];
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const int INF = 2000000000;
using namespace std;

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

    vector<double> vs, v;
    rep(i,n){
        double a;
        cin >> a;
        v.emplace_back(a);
        vs.emplace_back(a);
    }
    sort(all(vs));

    rep(i,n){
        auto it = equal_range(all(vs), v[i]);
        cout << 3.0 * (it.first - vs.begin()) + (it.second - it.first - 1.0) << endl;
    }

}

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

int main(){

  int a[3],b,c;

  for(int i=0;i<3;i++) cin >> a[i];
  cin >> b >> c;

  sort(a, a+3);

  cout << a[0]+min(b,c)-50 << endl;

}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
#define int long long int
using namespace std;
int DP[100001];

signed main() {
    int n,k;
    cin>>n>>k;
    int H[n+1];
    for(int i=1;i<=n;i++)
    cin>>H[i];
    DP[n]=0;
    DP[n-1] = abs(H[n]-H[n-1]);
    for(int i=n-2;i>=1;i--)
    {
        DP[i] = INT_MAX;
        int g = min(i+k,n);
        for(int j=i+1;j<=g;j++)
        {
            DP[i] = min(DP[i],abs(H[i] - H[j]) + DP[j]);
        }
    }

    cout<<DP[1];

    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = 1'000'000'007;//998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 200'000;
const int LOGN = 19;

int n, m, k;
void solve(int test)
{
  cin >> n;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  sort(begin(a), end(a), [] (const auto& l, const auto& r) {
    return atan2(l.second, l.first) < atan2(r.second, r.first);
  });
  int64 ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int l = 1; l <= n; ++l) {
      int64 tx = 0;
      int64 ty = 0;
      for (int j = 0; j < l; ++j) {
        tx += a[(j + i) % n].first;
        ty += a[(j + i) % n].second;
      }
      ans = max(ans, tx * tx + ty * ty);
    }
  }

  cout.precision(20);
  cout.setf(ios::fixed);
  cout << sqrt(ans) << '\n';
}

void precalc()
{
}

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i)
    solve(i);
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

    ll operator"" _64(unsigned long long x){ return ll(x); }
    ull operator"" _64u(unsigned long long x){ return ull(x); }

    template<class T>
    vector<T> make_vector(int n, T t){
        return vector<T>(n, t);
    }
    template<class ...Ts>
    auto make_vector(int n, Ts ... ts){
        return vector<decltype(make_vector(ts...))>(n, make_vector(ts...));
    }

    template<class T>
    ostream& operator<<(ostream& os, const vector<T>& v){
        for (auto &&x : v) { os << x << ' '; } cout << endl; return os ;
    }
}
using namespace utils;

class solver{
    istream& is;
    ostream& os;

public:
    solver(istream& I, ostream& O) :is(I), os(O) {}
    void run(){
        ll N;
        is >> N;
        if(!is) return;
        if(N % 2){
            double ans = (N/2+1.)/N;
            os << ans << endl;
        }
        else {
            os << 0.5 << endl;
        }

    }
};

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_A.txt";
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int loop = 0;
    while(fs) {
        loop++;
        cout << '#' << loop << "#------\n";
        solver(fs, cout).run();
    }
    if(loop <= 1) {
        cout << "===" << endl;
        while(cin) solver(cin, cout).run();
    }
#else
    solver(cin, cout).run();
#endif
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

int main(void){
  ll a, b;
  cin >> a >> b;
  
  a = (a + 11) % 13;
  b = (b + 11) % 13;

  if (a > b)
    cout << "Alice" << endl;
  else if (a < b)
    cout << "Bob" << endl;
  else
    cout << "Draw" << endl;


  return 0;
}


Measured memory_bytes: 256
/*Made by Shivam Solanki*/
#include<bits/stdc++.h>
#pragma GCC optimize ("Ofast")
using namespace std;
#define DEBUG(x) cerr << '>' << #x << ':' << x << endl;
#define ll long long int
#define endl '\n'
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<pii> vp;
typedef vector<pll> vpll;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef set<int> sii;
typedef set<ll> sll;
typedef queue<int> qii;
typedef priority_queue<int> pq;
typedef unordered_map<int,int> umii;
typedef unordered_map<ll,ll> umll;
#define all(x) x.begin(),x.end()
#define rep(i,k,n) for (int i = k; i < n; ++i) 
#define repr(i,k,n) for (int i = n; i>=k; --i)
#define repll(i,k,n) for (ll i = k; i < n; ++i) 
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int INF = 1e9+5;
const int MOD = 1e9+7;
double pi = 2 * acos(0.0); 

void solve(){
   int n;
   cin>>n;
   if(n%1000==0) cout<<0;
   else cout<<1000-(n%1000);
}

int main(){ 
    // #ifndef ONLINE_JUDGE  
        // freopen("input.txt", "r", stdin); 
        // freopen("output.txt", "w", stdout); 
    // #endif 
    fastio;
    int t=1;
   //  cin>>t;
    while(t--)
        solve();
    return 0;
}


Measured memory_bytes: 3592
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-12;
const int N=500000+10,maxn=400000+10,inf=0x3f3f3f3f;

int t[N],x[N],y[N];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d%d%d",&t[i],&x[i],&y[i]);
    int lastx=0,lasty=0,lastt=0;
    for(int i=0;i<n;i++)
    {
        int te=abs(x[i]-lastx)+abs(y[i]-lasty);
        int tet=t[i]-lastt;
       // cout<<te<<" "<<tet<<endl;
        if(tet<te||(tet>=te&&(tet-te)%2!=0))return 0*puts("No");
        lastx=x[i];lasty=y[i];lastt=t[i];
    }
    puts("Yes");
    return 0;
}
/********************

********************/


Measured memory_bytes: 2944
#include <iostream>
#include <unordered_map>
#include <queue>

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    unordered_map<ll, ll> count;
    for(int i = 0; i < n; ++i){
        ll a;
        cin >> a;
        count[a]++;
    }
    priority_queue<ll> q;
    for(auto it = count.begin(); it != count.end(); ++it){
        q.push(it->second);
    }
    while(!q.empty()){
        ll fst = q.top();
        if(fst == 1){
            break;
        }else if(fst >= 3){
            q.pop();
            q.push(fst - 2);
        }else{ // fst == 2
            q.pop();
            ll snd = q.top();
            q.pop();
            if(snd == 2){
                q.push(1);
                q.push(1);
            }else{
                q.push(1);
            }
        }
    }
    cout << q.size() << endl;
    return 0;
}


Measured memory_bytes: 7328
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>



using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

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












 
int main(){
    ll n;
    string s;
    cin >> n >> s;
    ll c = 1;
    REP(i, n - 1){
        if(s[i] != s[i + 1]) c++;
    }
    cout << c << endl;
}

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

using namespace std;

typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin>>n;
  double p[n+1];
  for(ll i=1;i<=n;i++)
  {
  cin>>p[i];
  }
  double dp[n+1][n+1];
  dp[1][0]=1-p[1];
  dp[1][1]=p[1];
  for(ll i=2;i<=n;i++)
  {
  dp[i][0]=dp[i-1][0]*(1-p[i]);
  }
  for(ll i=2;i<=n;i++)
  {
  for(ll j=1;j<=i;j++)
  {
  dp[i][j]=dp[i-1][j]*(1-p[i])+dp[i-1][j-1]*p[i];
  }
  }
  double ans=0.0;
  for(ll i=n;i>n/2;i--)
  {
  ans=ans+dp[n][i];
  }
  cout<<fixed<<setprecision(15)<<ans;
}


Measured memory_bytes: 49904
#include <iostream>

using namespace std;

uint64_t X;

bool is_large_enough(uint64_t n) {
  return 2 * X <= n * (n + 1);
}

uint64_t calc() {

  uint64_t lower = 0;
  uint64_t higher = X;

  do {
    uint64_t mid = (lower + higher) / 2;

    if (is_large_enough(mid))
      higher = mid;
    else
      lower = mid;
  } while (1 < higher - lower);

  return higher;
}

int main() {
  cin >> X;

  uint64_t n = calc();
  cout << n << endl;

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

struct edge
{
	int to;
	long long cost;
	edge(int to_, long long cost_) :
		to(to_), cost(cost_) {}
};
const long long INF = 123456789012345;
using P = pair<long long, int>;//first:cost,second:vertice
void dijkstra(vector<edge>graph_[], long long dist[], int n_, int s_)
{
	priority_queue<P, vector<P>, greater<P>>que;
	que.push({ 0,s_ });
	fill(dist, dist + n_, INF);
	dist[s_] = 0ll;
	while (!que.empty())
	{
		auto q = que.top();
		que.pop();
		long long thd = q.first;
		int thv = q.second;
		if (thd > dist[thv])
		{
			continue;
		}
		for (auto ed : graph_[thv])
		{
			if (dist[ed.to] > ed.cost + thd)
			{
				dist[ed.to] = ed.cost + thd;
				que.push({ dist[ed.to],ed.to });
			}
		}
	}
}

vector<edge>graph[234567];
LL dist[234567];
int N, M;

int main(void)
{
	cin >> N >> M;
	for (int i = 0; i < M; ++i)
	{
		int a, b;
		cin >> a >> b;
		--a; --b;
		graph[a].push_back(edge(b, 1));
		graph[b].push_back(edge(a, 1));
	}
	dijkstra(graph, dist, N, 0);
	if (dist[N - 1] <= 2)
	{
		cout << "POSSIBLE\n";
	}
	else
	{
		cout << "IMPOSSIBLE\n";
	}
	return 0;
}


Measured memory_bytes: 19808
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N,M=map(int,input().split())
uf = UnionFind(N)
for i in range(M):
  a,b=map(int,input().split())
  uf.union(a-1, b-1)
result=[uf.size(i) for i in range(N)]
print(max(result))

Measured memory_bytes: 93208
open Printf
open Scanf

let a, b, c = scanf "%d %d %d\n" (fun a b c -> a, b, c)
let k = scanf "%d" (fun k -> k)

let run () =
    let a = ref a in
    let b = ref b in
    let c = ref c in
    let step () =
        if !a >= !b then b := !b * 2
        else if !b >= !c then c := !c * 2
        else ()
    in
    let check () = !a < !b && !b < !c in
    for i = 1 to k do
        step()
    done;
    print_endline (if check () then "Yes" else "No")

let () = run ()

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(long long i=s;i<n;i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

typedef long long ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<vll> vvll;
const double pi = acos(-1.0);
const ll mod = pow(10,9) + 7;
const ll INF = pow(2,31) - 1;

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n,a,b,ans = 0;
    cin >> n >> a >> b;

    ans += a * (n / (a+b));
    ans += min(a, n%(a+b));
    cout << ans << endl;
    return 0;
}

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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define Yes cout << "Yes" << endl ;
#define yes cout << "yes" << endl ;
#define No cout << "No" << endl ;
#define no cout << "no" << endl ;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio

    lli a , b ;
    cin >> a >> b ;
    int m = max(a , b) , mm = min(a , b) ;
    (m % mm == 0 ? cout << m + mm : cout << m - mm ) ;
    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;
typedef long long ll;
int n;
ll mod = 1e9+7;
vector<int> v[100100];
ll dp[10][100100];
bool fl[100100];
ll rec(int color,int node){
    if(dp[color][node]){
        return dp[color][node];
    }
    fl[node] = true;
    ll res = 1;
    for(auto i:v[node]){
        if(fl[i]){
            continue;
        }
        res*=rec(0,i);
        res%=mod;
    }
    if(color==0){
        ll tmp = 1;
        for(auto i:v[node]){
            if(fl[i]){
                continue;
            }
            tmp*=rec(1,i);
            tmp%=mod;
        }
        res+=tmp;
        res%=mod;
    }
    fl[node] = false;
    return dp[color][node] = res;
}
int main(){
    cin >> n;
    rep(i,n-1){
        int x,y;
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    ll ans = rec(0,1);
    cout << ans%mod << endl;
    return 0;
}

Measured memory_bytes: 16128
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;


int main(){
	ll a,b,x;cin >> a >> b >> x;
	ll ans =b/x - max(a-1,ll(0))/x ;
	if(a == 0) ans += 1;
	cout << ans << endl;
} 


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

ans = a[0]
if n%2 == 0:
  ans += sum(a[1:n//2])*2
else:
  ans += sum(a[1:n//2])*2+a[n//2]
print(ans)

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

int main() {
  int N,sum;
  sum=0;
  cin >> N;
  for(int i=0;i<N;i++){
  	int a,b;
    cin >> a >> b;
    sum += (b-a+1);
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))

dp = [0 for _ in range(N)]  # dp[足場index - 1] = 最小コスト
dp[1] = dp[0] + abs(h[1] - h[0])

for i in range(2, N):
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))

print(dp[N - 1])


Measured memory_bytes: 13928
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int topping = 0;
		for (char c : S.toCharArray()) {
			if (c == 'o') {
				topping += 100;
			}
		}
		System.out.println(700 + topping);
	}
}

Measured memory_bytes: 21844
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string alphabets = "abcdefghijklmnopqrstuvwxyz";//26文字
		string s = Console.ReadLine();
    char[] c = s.ToCharArray();
    char answer = 'a';

    for(int i = 0; i < 25; i++)
    {
      if(c[0] == alphabets[i]) answer = alphabets[i+1];
    }

		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 11092
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  k <- unsafeTextToInt <$> T.getLine :: IO Int
  print . fromLunlunToInt $ k

ls :: VU.Vector Int
ls = VU.constructN (succ $ 10 ^ 5) (encode . rec)
  where
    rec v | k < 10    = (0, k)
          | r <= min 8 r' = (k', succ r)
          | otherwise = (k'', max 0 (pred r''))
      where
        k = VU.length v
        (k', r) = decode $ VU.last v
        r' = snd . decode $ v VU.! k'
        k'' = succ k'
        r'' = snd . decode $ v VU.! k''

fromLunlunToInt :: Int -> Int
fromLunlunToInt 0 = 0
fromLunlunToInt k = 10 * fromLunlunToInt k' + r
  where
    (k', r) = decode $ ls VU.! k

encode :: (Int, Int) -> Int
encode (k, r) = 10 * k + r

decode :: Int -> (Int, Int)
decode = (`divMod` 10)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n


Measured memory_bytes: 1788
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    S = input()
    w = int(input())
    ans = ""
    for i in range(0, len(S), w):
        ans += S[i]
    print(ans)


def main():
    solve()


if __name__ == '__main__':
    main()


Measured memory_bytes: 9956