akhauriyash/Code-Regression huggingface dataset:
#pragma GCC opmize(2)
#pragma GCC opmize(2)
#include<bits/stdc++.h>
#define mem(a) memset(a, 0, sizeof a)
#define Buff ios::sync_with_stdio(false)
using namespace std;

const double INF = 1e9+7;
const int N = 1e5+7;
const double PI = acos(-1);
const double eps = 1e-8;
int dcmp(double x)
{
    if(fabs(x) < eps)   return 0;
    return x < 0 ? -1 : 1;
}
//直线，向量
struct Point
{
    double x;
    double y;
    void read() {scanf("%lf%lf", &x, &y);}
    void out()  {printf("(%.6lf, %.6lf)\n", x, y);}
    Point(double x=0, double y=0):x(x), y(y) {}
};
typedef Point Vector;
double operator * (Vector v, Vector w)                   {return v.x*w.x+v.y*w.y;}//点乘
double operator ^ (Vector v, Vector w)                   {return v.x*w.y-v.y*w.x;}//叉乘
Vector operator + (Vector v, Vector w)                   {return Vector(v.x+w.x, v.y+w.y);}
Vector operator - (Point A, Point B)                     {return Vector(A.x-B.x, A.y-B.y);}
Vector operator * (Vector v, double k)                   {return Vector(v.x*k, v.y*k);}
Vector operator / (Vector v, double k)                   {return Vector(v.x/k, v.y/k);}
bool operator < (const Point & A, const Point & B)       {return A.y < B.y || (A.x == B.x && A.y < B.y);}
bool operator == (const Point & A, const Point & B)      {return !dcmp(A.x-B.x) && !dcmp(A.y-B.y);}
double length(Vector v)                                  {return sqrt(v*v);}
double sqr(Vector v)                                     {return v*v;}
Point p[N], sta[N];
int n, top;
bool cmp(Point a, Point b)
{
    double t = (a - p[0]) ^ (b - p[0]);
    if(t < 0)   return false;
    if(!t && length(a - p[0]) > length(b - p[0]))   return false;
    return true;
}
void graham()
{
    sort(p + 1, p + n, cmp);
    int t = n - 1;
    while(!((p[n-1] - p[0]) ^ (p[t] - p[0]))) t --;
    reverse(p + t + 1, p + n);
    sta[top ++] = p[0]; sta[top ++] = p[1]; p[n ++] = p[0];
    for(int i = 2; i < n; i ++)
    {
        while(top > 1 && dcmp((sta[top-1] - sta[top-2]) ^ (p[i] - sta[top-2])) <= 0)     top --;
        sta[top ++] = p[i];
    }
    top --;
}
double diame()
{
    int i, j, k;
    double res, t;
    graham();
    sta[top] = sta[0], res = 0.0, j = 1;
    for(int i = 0; i < top; i ++)
    {
        while(dcmp(fabs((sta[i] - sta[j]) ^ (sta[i+1] - sta[j])) - fabs((sta[i] - sta[j+1]) ^ (sta[i+1] - sta[j+1]))) < 0)
            j = (j + 1) % top;
        t = sqr(sta[i] - sta[j]);
        if(dcmp(t - res) > 0)    res = t;
    }
    return sqrt(res);
}
int main()
{
    scanf("%d", &n);
    for(int i = 0; i < n; i++)
    {
        double a, b;
        scanf("%lf %lf", &a, &b);
        p[i] = {a, b};
        if(p[i] < p[0]) swap(p[i], p[0]);
    }
    printf("%.8f\n", diame());
//    int x, y;
//    graham();
//    double t, res = 0;
//    for(int i = 0; i < top; i++)
//        for(int j = 0; j < top; j ++)
//        {
//            t = sqr(sta[i] - sta[j]);
//            if(dcmp(t - res) > 0)
//            {
//                res = t;
//                x = i, y = j;
//            }
//        }
//    printf("%.8f\n", sqrt(res));
//    printf("%d %d\n", x, y);
//    printf("%.8f\n", sqrt(sqr(sta[x] - sta[y])));
    return 0;
}



Measured memory_bytes: 6344
"use strict";
function lcm(a) {
    var g = (n, m) => m ? g(m, n % m) : n;
    var l = (n, m) => n * m / g(n, m);
    var ans = a[0];
    for (var i = 1; i < a.length; i++) {
        ans = l(ans, a[i]);
    }
    return ans;
} 
function Main(input) {
    let Ln = input.split(/\s/).map((v) => v - 0);
    let a = Ln[0], b = Ln[1], k = Ln[2];
    let f = lcm([a, b]), c = 0;
    for (let n = f; n > 0; n--) {
        if (a % n == 0 && b % n == 0) {
            c++;
            if (c == k) {
                console.log(n);
                return;
            }
        }
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 11468
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	flag := true
Loop:
	for i := 0; i < 26; i++ {
		count := 0
		for _, v := range s {
			if int(v) == int('a')+i {
				count++
				if count == 2 {
					flag = false
					break Loop
				}
			}
		}
	}
	if flag {
		fmt.Println("yes")
	} else {
		fmt.Println("no")
	}
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){

  string s;
  cin >> s;
  int size = s.size();
  ll res = 0;
  for(int bit = 0;bit < (1 << (size-1));bit++){
    vector<ll> v(1,s[0]-'0');
    rep(i,size-1){
      if(bit >> i & 1){
        v.push_back(s[i+1]-'0');
      }else{
        v.back() = v.back()*10+s[i+1]-'0';
      }
    }
    for(auto au : v)res += au;
  }
  cout << res << endl;







  

  return 0;
}

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

int lca(const int B, int v, int w) {
    if (B == 1) return min(v, w);
    while (v != w) {
        while (v > w) { v = (v + B-2) / B; }
        while (v < w) { w = (w + B-2) / B; }
    }
    return v;
}

int main() {
    int N, Q;
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> Q;
    for (int j = 0; j < Q; ++j) {
        int v, w;
        cin >> v >> w;
        cout << lca(N, v, w) << endl;
    }
    return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
// using namespace atcoder;
typedef long long ll;
/* clang-format off */
#define MOD 1000000007
#define INF 1000000000000000000ll
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
//#define __DEBUG__
#ifdef __DEBUG__
#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";
#define DEBUG(x) cout<<#x<<":"<<x<<"\n"
#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"
#endif
#ifndef __DEBUG__
#define CH_P(a) 
#define DEBUG(x) 
#define DEBUGS(v) 
#endif
/* clang-format on */

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s, t;
  cin >> s >> t;
  vector<string> ans;
  for (int i = s.size() - t.size(); i >= 0; i--) {
    bool f = true;
    REP(j, t.size())
    if (s[i + j] != '?' && s[i + j] != t[j]) f = false;
    if (f) {
      string tmp = "";
      REP(j, s.size()) {
        if (j == i) {
          tmp += t;
          j += t.size()-1;
        } else if (s[j] == '?')
          tmp += 'a';
        else
          tmp += s[j];
      }
      ans.push_back(tmp);
    }
  }
  if(ans.empty()){
    cout << "UNRESTORABLE\n";
    return 0;
  }
  sort(ALL(ans));
  DEBUGS(ans);
  cout << ans[0] << endl;
  return 0;
}


Measured memory_bytes: 3592
import java.util.Scanner;

public class Main {

	public static int min2(int a, int b, int c) {
		int min = Math.min(a, b);
		int min2 = Math.min(b, c);
		int min3 = Math.min(a, c);
		if (min == min2)
			return min3;
		else if (min == min3)
			return min2;
		return min;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int p[] = new int[n];
		for (int i = 0; i < n; ++i)
			p[i] = sc.nextInt();
		sc.close();
		int cnt = 0;
		for (int i = 1; i < n - 1; ++i) {
			int min2 = min2(p[i - 1], p[i], p[i + 1]);
			if (p[i] == min2)
				++cnt;
		}
		System.out.println(cnt);
	}

}


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

int main()
{
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    for (int i = 0; i < 1000; i++)
    {
        int PIN[3] = {i/100, (i/10)%10, i%10};
        int num = 0;
        for (int j = 0; j < N; j++)
        {
            if(S[j] - '0' == PIN[num]) num++;
            if(num == 3){
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
using Graph = vector<vector<int>>;
Graph G;

int main(){
    int n, h, w; cin >> n >> h >> w;
    cout << (n - h + 1) * (n - w + 1) << endl;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <iostream>
#include <string>
#include <stdlib.h>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>
#include<numeric>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0])
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)

using namespace std;
typedef long long ll;



int main(void) {
	string s, t;
	int count = 0;
	cin >> s>>t;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] != t[i]) {
			count++;
		}
	}

	cout << count;


	return 0;
}


Measured memory_bytes: 3916
package main

import (
	"fmt"
)

func main() {
	var n int
	var s string

	fmt.Scanln(&n)
	fmt.Scanln(&s)

	fmt.Println(logic(s))
}

func logic(s string) string {
	if len(s)%2 != 0 {
		return "No"
	}

	if s[0:(len(s))/2] != s[(len(s))/2:] {
		return "No"
	}

	return "Yes"
}


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

int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int main()
{
    int N, T, A;
    cin >> N >> T >> A;
    A *= 1000, T *= 1000;
    vector<int> list(N);
    for (int i = 0; i < N; i++)
        cin >> list[i];
    int zure = mod, ans;
    for (int i = 0; i < N; i++)
    {
        double tmp = T - list[i] * 6;
        if (abs(A - tmp) < zure)
            ans = i, zure = abs(A - tmp);
    }
    cout << ans + 1;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <vector>

using namespace std;

using vs=vector<string>;

const char status[]={'.', '#'};

int send_query(vs &query, bool rightward) {
    for (size_t i=0; i<4; ++i) {
        if (rightward) {
            printf("%s%c\n", query[0].c_str(), status[i&1]);
            printf("%s%c\n", query[1].c_str(), status[i>>1]);
        } else {
            printf("%c%s\n", status[i&1], query[0].c_str());
            printf("%c%s\n", status[i>>1], query[1].c_str());
        }
        fflush(stdout);

        char buf[1<<2];
        scanf("%s", buf);
        string ans=buf;

        if (ans == "end") {
            return 2;
        } else if (ans == "T") {
            if (rightward) {
                query[0] += status[i&1];
                query[1] += status[i>>1];
            } else {
                query[0] = status[i&1] + query[0];
                query[1] = status[i>>1] + query[1];
            }
            return 0;
        }
    }
    return 1;
}

int main() {
    size_t N;
    scanf("%zu", &N);

    vs query(2);
    for (int i=0; i<2;)
        i += send_query(query, i);

    return 0;
}


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

using namespace std;

#define sz(x) ((int) ((x).size()))
typedef long long ll;
typedef long double ld;

ll n, k;
unordered_map<int, int> l;

void mul(vector<int> & a, vector<int> & b1, vector<int> & b2) {
  for (int i = n; i >= 0; i--) {
    if (b1[i] == n)
      b1[i] = b2[0];
    else
      b1[i] = b2[l[a[b1[i]]] + 1];
  }
}

void powF(vector<int> & a, vector<int> & b, vector<int> & r, ll e) {
  vector<int> p(n + 1), pp(n + 1);
  p = b;
  while ((e & 1) == 0) {
    pp = p;
    mul(a, p, pp);
    e /= 2;
  }
  r = p;
  e /= 2;
  while (e) {
    pp = p;
    mul(a, p, pp);
    if (e & 1)
      mul(a, r, p);
    e /= 2;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; i++)
    cin >> a[i];
  vector<int> b(n + 1), r(n + 1), c(n + 1);
  b[n] = n, c[n] = n;
  for (int i = n - 1; i >= 0; i--) {
    if (l.find(a[i]) == l.end())
      b[i] = i, c[i] = b[i + 1];
    else
      b[i] = b[l[a[i]] + 1], c[i] = c[b[i]];
    l[a[i]] = i;
  }
  powF(a, b, r, k);
  int i = r[0];
  if (i == n)
    cout << "\n";
  while (i < n) {
    cout << a[i] << (c[i] < n ? " " : "\n");
    i = c[i];
  }
}


Measured memory_bytes: 15304
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> ivec;
const ll N = 1e9+7;

int main(){
    string sdash,t; cin >> sdash >> t;
    vector<int> hatena;
    rep(i,sdash.size()) if(sdash[i] == '?')hatena.pb(i);
    bool rewrite = false;
    rep(i,sdash.size()){
        if(sdash.substr(i,t.size()) == t) rewrite = true;
    }
    int hsize = 0;
    for(int i = (sdash.size()-1); 0 <= i;i--){
        if(sdash[i] == '?')hsize++;
        else hsize = 0;
        if(!rewrite && hsize == t.size()){
            rep(j,t.size()){
                sdash[i+j] = t[j];
            }
            rewrite = true;
        }
        rep(j,t.size()){
            bool ok = true;
            if(t[j] == sdash[i] && !rewrite){
                rep(k,j){
                    if(sdash[i-j+k] != '?' && sdash[i-j+k] != t[k]) ok = false;
                }
                rep(k,t.size()-j-1){
                    if(sdash[i+k+1] != '?' && sdash[i+k+1] != t[k]) ok = false;
                }
                if(ok){
                    rep(k,t.size()){
                        sdash[i-j+k] = t[k];
                    }
                    rewrite = true;
                    break;
                }
            }
        }
    }
    for(auto i : hatena){
        if(sdash[i] == '?') sdash[i] = 'a';
    }
    if(rewrite)cout << sdash << endl;
    else cout << "UNRESTORABLE" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;

namespace AtCoderABC129B
{
    class Program
    {
        static void Main(string[] args)
        {
            int ans = 0;

            int N = int.Parse(Console.ReadLine());

            string[] s = Console.ReadLine().Split(' ');

            int[] W = new int[N];

            for (int i = 0; i < N; i++)
            {
                W[i] = int.Parse(s[i]);
            }

            int front = 0;
            int back = 0;

            int findex = 0;
            int bindex = N - 1;

            for(int i=0;i<N;i++)
            {
                if(front < back)
                {
                    front += W[findex];
                    findex++;
                }
                else
                {
                    back += W[bindex];
                    bindex--;
                }
            }

            if (front < back)
                ans = back - front;
            else
                ans = front - back;

            Console.WriteLine(ans.ToString());
        }
    }
}


Measured memory_bytes: 11092
def cul_even(x):
  return x // 2 * 25

def cul_odd(x):
  return x // 2 * 25 + 13

def test(a, b, x, func):
  if(b == func(a)//10):
      print(func(a))
  elif(b == (func(a)//10 + 1)):
      print((func(a)+x)//10*10)
  else:
      print(-1)

def main():
  a,b = map(int,input().split())
  if(a % 2 == 0):
    test(a, b, 12, cul_even)
  else:
    test(a, b, 11, cul_odd)

if __name__ == '__main__':
  main()  


Measured memory_bytes: 3064
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);

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

    int c = 0, d = 0, sz = (int)s.size();
    string pre = "START";
    for (int i = 0; i < sz; i++) {
        if ((int)pre.size() == 1) {
            if (pre[0] == s[i]) {
                if (i == sz - 1) {
                    c--;
                }
                pre = s.substr(i, 2);
                i++;
            }
            else {
                pre = s.substr(i, 1);
            }
        }
        else {
            pre = s.substr(i, 1);
        }
        c++;
    }

    pre = s[0];
    for (int i = 0; i < sz; i++) {
        if ((int)pre.size() == 1) {
            if (pre[0] == s[i]) {
                if (i == sz - 1) {
                    d--;
                }
                pre = s.substr(i, 2);
                i++;
            }
            else {
                pre = s.substr(i, 1);
            }
        }
        else {
            pre = s.substr(i, 1);
        }
        d++;
    }

    cout << max(c, d) << endl;

    return 0;
}

Measured memory_bytes: 640
//************************************************************************//
//*Author : Handsome How                                                 *//
//************************************************************************//
//#pragma comment(linker, "/STA    CK:1024000000,1024000000")
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <ctime>
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define foreach(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define fur(i,a,b) for(int i=(a);i<=(b);i++)
#define furr(i,a,b) for(int i=(a);i>=(b);i--)
#define cl(a) memset((a),0,sizeof(a))
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#ifdef HandsomeHow
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define dbg(x) cerr << #x << " = " << x << endl
#else
#define debug(...)
#define dbg(x)
#endif
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
const int inf=0x3f3f3f3f;
const double eps=1e-8;
const int mod=1000000007;
const double pi=acos(-1.0);
inline void gn(long long&x){
    int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
    while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;
}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
ll gcd(ll a,ll b){return a? gcd(b%a,a):b;}
ll powmod(ll a,ll x,ll mod){ll t=1ll;while(x){if(x&1)t=t*a%mod;a=a*a%mod;x>>=1;}return t;}
// (づ°ω°)づe★
//-----------------------------------------------------------------
ll a[5];
int main(){
#ifdef HandsomeHow
    //freopen("data.in","r",stdin);
    //freopen("data.out","w",stdout);
    time_t beginttt = clock();
#endif
	fur(i,1,3) cin>>a[i];
	fur(i,1,3) if(a[i]%2==0) return puts("0"),0;
	ll ans = min(a[1]*a[2],min(a[2]*a[3],a[1]*a[3]));
	cout<<ans<<endl;
#ifdef HandsomeHow
	time_t endttt = clock();
    debug("time: %d\n",(int)(endttt - beginttt));
#endif
	return 0;
}


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

int main() {
    int N;
    cin >> N;
    int A[N], B[N];
    for(int i = 0; i < N+1; i++) {
        B[i] = 0;
    }
    for(int i = 2; i <= N; i++) {
        cin >> A[i];
        B[A[i]]++;
    }
    for(int i = 0; i < N; i++) {
        cout << B[i+1] << endl;
    }
}


Measured memory_bytes: 5184
//https://atcoder.jp/contests/abc139/tasks/abc139_b
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int a,b;
    cin >> a >> b;
    int ans =0,kuti=1;
    while(kuti<b){
       kuti -= 1;
       kuti += a;
       ans ++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
const int mod=998244353;
inline void add(int &x,int y){(x+=y)>=mod?x-=mod:0;}
vector<int>d[101];
map<__int128,int>dp[101][2];
__int128 t[101];
int n;
char s[101];
int solve(int l,int r,bool b,__int128 p)
{
	if(l==r)return p+1;
	if(dp[r-l+1][b].count(p))return dp[r-l+1][b][p];
	int sum=0;
	if(!b)for(int k=l;k<r;++k)sum=(sum+1ll*solve(l,k,1,p&t[k-l+1])*solve(k+1,r,0,p>>k-l+1))%mod;
	for(int i:d[r-l+1])
	{
		__int128 np=p&t[i];
		for(int j=1;j<(r-l+1)/i;++j)np&=p>>i*j;
		add(sum,solve(l,l+i-1,0,np));
	}
	dp[r-l+1][b][p]=sum;
//	printf("%d %d %d %lld %d\n",l,r,b,(long long)p,sum);
	return sum;
}
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	for(int i=1;i<=n;++i)t[i]=t[i-1]<<1|1;
	for(int i=1;i<=n;++i)
		for(int j=2*i;j<=n;j+=i)d[j].push_back(i);
	__int128 now=0;
	for(int i=1;i<=n;++i)if(s[i]=='1')now|=((__int128)1)<<i-1;
	printf("%d",solve(1,n,0,now));
	return 0;
}

Measured memory_bytes: 7936
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,i;cin>>N>>i;
  cout << N+1-i<<endl;
  return 0;
}


Measured memory_bytes: 256
import math

N = int(input())

# a,b=map(int,input().split())
sum = 100
i = 0

# while	sum < N:
# 	sum += count
# 	i += 1

while sum < N:
	sum += sum * 0.01
	i += 1
	sum = math.floor(sum)

print(i)

Measured memory_bytes: 9160
N, M = map(int, input().split())
L_list = []
R_list = []
for i in range(M):
  L, R = map(int, input().split())
  L_list.append(L)
  R_list.append(R)
if min(R_list) - max(L_list) < 0:
  print("0")
else:
  print(min(R_list) - max(L_list) + 1)

Measured memory_bytes: 10980
#
import sys
import math
import numpy as np
import itertools

# ひとつ入力
n = int(input())

# 空白区切りの数列をリストに代入
d = [int(i) for i in input().split()] 

sum_all = 0
sum2_all = 0
for i in range(n):
    sum_all += d[i]
    sum2_all += d[i]*d[i]

print( (sum_all*sum_all - sum2_all)//2)






Measured memory_bytes: 21568
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
static const int MAX = 100000;
static const int NIL = -1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r, int c){
    stack<int> S;
    S.push(r);
    color[r] = c;
    while(!S.empty()){
        int u = S.top(); S.pop();
        for(int i=0; i<G[u].size(); i++){
            int v = G[u][i];
            //printf("G[%d][%d] = %d color[%d] = %d\n", u, i, G[u][i], v, color[v]);
            if(color[v] == NIL){
                color[v] = c;
                S.push(v);
            }
        }
    }
}

void assignColor(){
    int id = 1;
    for(int i=0; i<n; i++) color[i] = NIL;
    for(int u=0; u<n; u++){
        if(color[u] == NIL) dfs(u, id++);
    }
}

int main(){
    int s, t, m, q;
    
    cin >> n >> m;
    
    for(int i=0; i<m; i++){
        cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    
    assignColor();
    
    cin >> q;
    
    for(int i=0; i<q; i++){
        cin >> s >> t;
        if(color[s] == color[t]){
            cout << "yes" << endl;
        } else {
            cout<< "no" << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 8928
#include "bits/stdc++.h"
using namespace std;

int main() {
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	int num = max(A, max(B, C));
	int ans = A + B + C - num;
	for (int i = 0; i < K; ++i) {
		num *= 2;
	}
	ans += num;
	cout << ans << endl;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 998244353;

struct Combination {
	vector<long long> inv,finv,fac;
	Combination(int n, int kmax) : inv(kmax+1),finv(kmax+1),fac(kmax){
		if(kmax>=1){
			inv.at(1)=1;
			finv.at(1)=1;
			fac.at(0) = n;
		}
	for(int i=2; i<=kmax; i++) inv.at(i) = MOD - inv.at(MOD%i) * (MOD/i) %MOD;
	for(int i=2; i<=kmax; i++) finv.at(i) = finv.at(i-1) * inv.at(i) % MOD;
	for(int i=1; i<kmax; i++) fac.at(i) = fac.at(i-1) * (n-i) % MOD;
	}
	long long comb(int k) {return (k ? fac.at(k-1) * finv.at(k) % MOD : 1 );}
};

int main(){
	
	int n,m,k0; cin>>n>>m>>k0;
	ll cnt{m}, sum{};
	for(int i=0; i<n-k0-1; i++) (cnt *= (m-1))%=MOD;
	Combination c(n-1,k0);
	for(int k=k0; k>=0; k--){
		ll t = (cnt * c.comb(k)) % MOD;
		(sum += t) %= MOD;
		if(k>0){
			(cnt *= m-1) %= MOD;
		}
	}
	cout << sum << endl;
}


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

typedef long long ll;

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

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

vector<int> soinsuuCnt;

void soinsuubunkai(int a)
{
	int p = 2;
	while(a > 1){
		if(a % p == 0){
			int cnt = 0;
			while(a % p == 0){
				a /= p;
				cnt++;
			}
			soinsuuCnt.pb(cnt);
		}else{
			p++;
		}
	}
}

int main()
{
	int n,m;
	cin >> n >> m;
	soinsuubunkai(m);
	ll ans = 1;
	FOR(i,0,(int)soinsuuCnt.size()){
		int dp[n+1][soinsuuCnt[i]+1];
		FOR(j,1,soinsuuCnt[i]+1)dp[0][j] = 0;
		FOR(j,0,n+1)dp[j][0] = 1;
		FOR(j,1,n+1)FOR(k,1,soinsuuCnt[i]+1){
			dp[j][k] = dp[j-1][k] + dp[j][k-1];
			dp[j][k] %= MOD;
		}
		ans *= dp[n][soinsuuCnt[i]];
		ans %= MOD;
	}
	ANS(ans);
	return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n - 1);
	rep(i, n) cin >> a.at(i);
	rep(i, n) cin >> b.at(i);
	rep(i, n - 1) cin >> c.at(i);
	int o = 0;
	for (int i : b) o += i;
	int x = a.at(0);
	for (int i : a) {
		if (x + 1 == i) o += c.at(x - 1);
		x = i;
	}
	cout << o << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<tuple>
#include<algorithm>
#include<vector>
using namespace std;

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

  vector<tuple<int, int, int>> wsvs(N);
  for(int i = 0; i < N; i++){
    int w, s, v;
    cin >> w >> s >> v;
    wsvs[i] = make_tuple(w, s, v);
  }
  sort(wsvs.begin(), wsvs.end(), [](tuple<int, int, int> a, tuple<int, int, int>b){return get<0>(a) + get<1>(a) < get<0>(b) + get<1>(b);});

  // dp[n][W] := with item[0: n) and the sum of weight <= W, you can get dp[n][W] values
  // dp[0][0] = 0
  // dp[n][W] = max(dp[n - 1][W], dp[n][W - 1]);
  // if s[n - 1] >= W - w[n - 1] then dp[n][W] = max(dp[n][W], dp[n - 1][W - w[n - 1]] + v[n - 1])
  const int w_sum_max = 2e4;
  vector<vector<long long>> dp(N + 1, vector<long long>(w_sum_max + 1, -1));
  for(int n = 0; n <= N; n++){
    dp[n][0] = 0;
  }
  for(int n = 1; n <= N; n++){
    for(int w_sum = 1; w_sum <= w_sum_max; w_sum++){
      int w, s, v;
      tie(w, s, v) = wsvs[n - 1];
      dp[n][w_sum] = max(dp[n - 1][w_sum], dp[n][w_sum - 1]);
      if(s >= w_sum - w && w_sum - w >= 0){
        dp[n][w_sum] = max(dp[n][w_sum], dp[n - 1][w_sum - w] + v);
      }
    }
  }

  cout << dp[N][w_sum_max] << endl;

}


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

int main(){
	int a,b;
	int sum=0;
	cin>> a>> b;
	
	for(int i=0;i<2;i++){
		if(a <= b){	
			sum+=b;
			b--;
			}else{
		sum+=a;
			a--;
				}
			}
				
				cout << sum << endl;
	
	return 0;
	}
	

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
const ll INF = (1ll << 60);

int main() {
  ll N, M;
  cin >> N >> M;
  string S;
  cin >> S;

  vi v(N + 1);
  for (ll i = N; i >= 0; i--) {
    if (S[i] == '0') v[i] = i;
    else v[i] = v[i + 1];
  }
 
  vi ans;
  ll current = N;
  while (true) {
    if (current <= M) {
      ans.push_back(current);
      break;
    }

    if (current == v[current - M]) {
      cout << -1 << endl;
      return 0;
    }

    ans.push_back(current - v[current - M]);
    current = v[current - M];
  }

  reverse(ans.begin(), ans.end());

  for (ll i = 0; i < ans.size(); i++) {
    cout << ans[i];
    if (i == ans.size() - 1) cout << endl;
    else cout << ' ';
  }
}


Measured memory_bytes: 2296
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Integer N = Integer.parseInt(scanner.next());
        Integer M = Integer.parseInt(scanner.next());
        Integer[] inputList = new Integer[N];
        Integer sum = 0;

        for (Integer i = 0; i < N; i++) {
            Integer vote = Integer.parseInt(scanner.next());
            inputList[i] = vote;
            sum += vote;
        }

        Arrays.sort(inputList, Collections.reverseOrder());
        if (inputList[M - 1] * 4 * M >= sum) {
            System.out.println("Yes");
        } else {
            System.out.print("No");
        }
    }
}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ull = unsigned long long;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

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

    int k;cin >> k;
    string s;cin >> s;
    if(s.size() <= k)cout << s << endl;
    else cout << s.substr(0,k) << "..." << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>

int main(void){
  int a;
  int b;

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


  int seki;
  seki = a * b;
  int hantei;
  hantei = seki % 2;

  if(hantei == 1){

    printf("Odd");

  }else{

    printf("Even");

  }

  return 0;
}


Measured memory_bytes: 128
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
vector<int> d[120];
bool visit[120];
int cnt = 0;
int fin[120];
int st[120];
void dfs(int p){
	cnt++;
	st[p]=cnt;
	//cout <<"p = "<<p<<" cnt = "<<cnt<<endl;
	visit[p]=true;
	for(int i =0;i <d[p].size();i++){
		if(!visit[d[p][i]]){
			dfs(d[p][i]);
		}
	}
	cnt++;
	fin[p]=cnt;
	return ;
}
int main(){
	int n;
	cin>>n;
	memset(visit, false, sizeof(visit));
	for(int i =0;i < n;i++){
		int u,k;
		cin>>u>>k;
		for(int j =0;j < k;j++){
			int c;
			cin>>c;
			d[u].push_back(c);
		}
	}
	/*cout <<"隣接"<<endl;
	for(int i =1;i <= n;i++){
		for(int j =0;j < d[i].size();j++){
			cout <<" "<<d[i][j];
		}
		cout <<endl;
	}*/
	for(int i =1;i <=n;i++){
		if(!visit[i]){
			dfs(i);
		}
	}
	for(int i =1;i <=n;i++){
		cout <<i<<" "<<st[i]<<" "<<fin[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1224
import sys
import itertools

class Dice:
    def __init__(self):
        self.front = '1'
        self.back = '6'
        self.top = '5'
        self.bottom = '2'
        self. right = '3'
        self.left = '4'
    def turnRight(self):
        temp = self.top
        self.top = self.left
        self.left = self.bottom
        self.bottom = self.right
        self.right = temp
        return self.top
    def turnLeft(self):
        temp = self.top
        self.top = self.right
        self.right = self.bottom
        self.bottom = self.left
        self.left = temp
        return self.top
    def turnFront(self):
        temp = self.top
        self.top = self.back
        self.back = self.bottom
        self.bottom = self.front
        self.front = temp
        return self.top
    def turnBack(self):
        temp = self.top
        self.top = self.front
        self.front = self.bottom
        self.bottom = self.back
        self.back = temp
        return self.top
    def __eq__(self, other):
        return (self.top, self.bottom, self.front, self.back, self.right, self.left) == other
    def __ne__(self, other):
        return (self.top, self.bottom, self.front, self.back, self.right, self.left) != other

def compdice(A, B):
    for rot1 in range(4):
        for rot2 in range(4):
            if A == B:
                return True
            B.turnRight()
        B.turnFront()
    B.turnRight()
    B.turnFront()
    for rot in range(4):
        if A == B:
            return True
        B.turnRight()
    B.turnBack()
    B.turnBack()
    for rot in range(4):
        if A == B:
            return True
        B.turnRight()
    return False

ans = 'Yes'
n = int(input())
dices = []
for line in range(n):
    dice = Dice()
    dice.top, dice.front, dice.right, dice.left, dice.back, dice.bottom = input().split()
    dices.append(dice)
dicepairs = itertools.combinations(dices, 2)
for dicepair in dicepairs:
    A, B = dicepair
    if compdice(A, B):
        ans = 'No'
print(ans)

Measured memory_bytes: 7908
#include <stdio.h>

int main()
{
  int A,B;
  scanf("%d %d",&A,&B);
  if (A+B >= A-B && A+B >= A*B)
  {
    printf("%d",A+B);
  }
  else if (A*B >= A-B && A*B >= A+B)
  {
    printf("%d",A*B);
  }
  else
  	printf("%d",A-B);
}

Measured memory_bytes: 128
//D
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5+10;
ll suf[maxn][3];
string s;
int main(){
	int n;
	cin >> n >> s;
	for(int i = n-1;i >= 0;i--){
		for(int j = 0;j <= 2;j++)suf[i][j] = suf[i+1][j];
		if(s[i] == 'R')suf[i][0]++;
		if(s[i] == 'G')suf[i][1]++;
		if(s[i] == 'B')suf[i][2]++;
	}
	ll ans = 0;
	for(int i = 0;i < n;i++)
		for(int j = i+1;j < n;j++)if(s[i] != s[j]){
			int d = 3;
			if(s[i] == 'R'){
				if(s[j] == 'G')d = 2;
				else d = 1;
			}
			else if(s[i] == 'G'){
				if(s[j] == 'R')d = 2;
				else d = 0;
			}
			else if(s[i] == 'B'){
				if(s[j] == 'R')d = 1;
				else d = 0;
			}
			ans += suf[j+1][d];
			if(j+j-i < n and s[j+j-i] != s[i] and s[j+j-i] != s[j])ans--;
		}
	cout << ans;
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}


const int MAX = 510000;
const int MOD = 1000000007;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  // 前処理
  COMinit();
  
  ll h,w,a,b; cin >> h >> w >> a >> b;
  h--;w--;
  ll ans = 0;
  rep(i,h-a+1){
    ans += (COM(b+i-1,i) * COM(h-i+w-b,h-i)) % MOD;
  }
  
  cout << ans%MOD << endl;
}


Measured memory_bytes: 12160
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#include<set>
#include <numeric>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define DIVCEIL(a,b) ((a+b-1)/b)
//int CHMAX

int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int MODFACT(int a, int mod) {
	if (a == 0)
		return 1;
	else
		return (a * FACT(a - 1))%mod;
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
int MODnPr(int n, int r, int mod) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++) {
		sum *= i;
		sum = sum % MOD;
	}
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b)
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b)
{
	return  a * b / GCD(a, b);
}
int NUMOFDIV(int n) {
	int ans = 0;
	REP(i, n) {
		if (n % i == 0)
			ans++;
	}
	return ans;
}
int CEIL1(int n) {
	return (n + 9) / 10 * 10;
}
int DIGITSUM(int n) {
	int sum = 0, dig;
	while (n) {
		dig = n % 10;
		sum += dig;
		n /= 10;
	}
	return sum;
}
int DIVTIME(int n, int k) {
	int div = 0;
	while (n % k == 0) {
		div++;
		n /= k;
	}
	return div;
}
int MODPOW(int a, int n, int mod) {
	// a^n mod
	int ans = 1;
	while (n > 0) {
		if (n & 1)
			ans = ans * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return ans;
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool PRIMEOR(int x) {
	if (x == 1)
		return false;
	if (x == 2)
		return true;
	if (x % 2 == 0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}
bool SQRTOR(int n) {
	if (sqrt(n) == (int)sqrt(n))
		return true;
	else
		return false;
}
// 順位付け
using namespace std;
#pragma endregion
signed main() {
	int N;
	double x;
	cin >> N;
	vector<double>v(N);
	rep(i, N)
		cin >> v[i];
	sort(ALL(v));
	rep(i, N - 1) {
		x = (v[0+i] + v[1+i]) / 2.0;
		v[0+i] = x;
		v[1+i] = 0;
		sort(ALL(v));
	}
	cout << v[N-1];
}

Measured memory_bytes: 256
#include <cstdio>

#define ll long long

int main() {
    ll n, x, rez = 0, a, b;
    scanf("%lld%lld%lld", &n, &x, &a);
    for (int i = 2; i <= n; i++) {
        scanf("%lld", &b);
        if (a + b > x) {
            rez += a + b - x;
            b = x - a;
            if(b < 0) {
                b = 0;
            }
        }
        a = b;
    }

    printf("%lld", rez);
    return 0;
}


Measured memory_bytes: 128
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

#define x first
#define y second

#define INF 0x3f3f3f3f

using namespace std;

typedef long long LL;
typedef pair<int,int>PII;

int a[33] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main(void) {
	int n;
	cin >> n;
	cout << a[n - 1] << endl; 
	return 0;
} 

Measured memory_bytes: 888
#include<iostream>
using namespace std;int LCM(int a, int b) {int i = 2;int gcd = 1;while (i <= a && i <= b) {if (a % i == 0 && b % i == 0) {gcd *= i;a /= i;b /= i;}else i++;}return a * b * gcd;}
int main(){int size;cin >> size;int a;int result = 1;for (int i = 0; i < size; i++) {cin >> a;result = LCM(result, a);}cout << result << endl;return 0;}


Measured memory_bytes: 3100
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int min = a*x + b*y;
		int total = 0;
		for(int i=0; i<=x; i++){
			if(b<2*c && y>i)total = a*(x-i) + b*(y-i) + c*i*2;
			else if(b>=2*c && y>i)total = a*(x-i) + c*y*2;
			else if(y<=i)total = a*(x-i) + c*i*2;
			if(total < min)min = total;
		}
		System.out.println(min);		
	}
}

Measured memory_bytes: 21972
#include<stdio.h>
#include<string.h>
int main()
{
	int i,j,n;
	char s[101],t[101],a;

	scanf("%s%s",s,t);

	n=strlen(s);
	if(strcmp(s,t)==0){
		printf("Yes\n");
		return 0;
	}
	for(i=0;i<n-1;i++){
		a=s[n-1];
		for(j=0;j<n-1;j++){
			s[n-1-j]=s[n-2-j];
		}
		s[0]=a;
		if(strcmp(s,t)==0){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);++i)
const int N=1e2+5;
int f[N],g[N];
char a[N][N];
int main(){
  ll h,w;cin>>h>>w;
  rep(i,h)cin>>a[i];
  rep(i,h)rep(j,w)if(a[i][j]=='#')f[i]=g[j]=1;
  rep(i,h){if(f[i]){
      rep(j,w){if(g[j]){
        cout<<a[i][j];
      }}
      cout<<endl;
  }}
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main()
{
    int m,n,o,i,j,k;
    float f,g,h;
    char c,d;
    //string a;
    //cin>>m;
    cin>>m>>c>>n>>d>>i;
    //cin>>f>>g;
    //cin>>c;
    if(n>4||(n==4&&i==31)) cout<<"TBD";
    else cout<<"Heisei";
    return 0;
}


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

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

int main(void) {
    cout << fixed << setprecision(16);
    cin.tie(0); ios::sync_with_stdio(false);

    ll n, m;
    cin >> n >> m;
    vector<ll> h(n);
    bitset<200000> s;
    for(auto &e: h) cin >> e;

    for(ll i=0; i<n; i++)
        s[i]= 1;
    while(m--) {
        ll a, b;
        cin >> a >> b;
        a--, b--;
        if(h[a] <= h[b]) s[a] = 0;
        if(h[a] >= h[b]) s[b] = 0;
    }
    cout << s.count() << endl;
}


Measured memory_bytes: 3988
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
const ll mod=1e9+7 ;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,k;
    cin>>n>>k;
    vector<ll>v;
    for(ll i=0;i<n;i++){
        ll a;
        cin>>a;
        v.push_back(a);
    }
    ll res=0;
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            if(v[i]>v[j]){ll res1=k*(k-1);res1/=2;res+=res1%mod;if(res>=mod)res-=mod;}
        }
        for(ll j=i+1;j<n;j++){
            if(v[i]>v[j]){res+=k%mod;if(res>=mod)res-=mod;}
        }
    }

    cout<<(res+mod)%mod<<endl;
    return 0;
    }


Measured memory_bytes: 256
n = int(input())
s = []
grade = 0
for i in range(n):
    si = int(input())
    s.append(si)
    grade += si
if grade % 10 != 0:
    print(grade)
else:
    s.sort()
    for i in range(n):
        if s[i] % 10 != 0:
            grade -= s[i]
            break
    if grade %10 != 0:
        print(grade)
    else:
        print(0)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

const int m = 2019;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  reverse(s.begin(), s.end());
  int x = 1, tot = 0;
  vector<int> cnt(m);
  ll ans = 0;
  for(int i=0; i<n; i++){
    cnt[tot]++;
    tot += (s[i]-'0')*x;
    tot %= m;
    ans += cnt[tot];
    x = x*10%m;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define ENDL endl
using namespace std;
int main() {
  int i, N, n, d;
  while (cin >> N, N) {
    int x[200], y[200];
    x[0] = 0;
    y[0] = 0;
    int maxX = -10000, maxY = -10000, minX = 10000, minY = 10000;
    for (i = 1; i < N; i++) {
      cin >> n >> d;
      x[i] = x[n];
      y[i] = y[n];
      if (d == 0)
        x[i]--;
      if (d == 1)
        y[i]--;
      if (d == 2)
        x[i]++;
      if (d == 3)
        y[i]++;
    }
    for (i = 0; i < N; i++) {
      maxX = max(maxX, x[i]);
      minX = min(minX, x[i]);
      maxY = max(maxY, y[i]);
      minY = min(minY, y[i]);
    }
    cout << maxX - minX + 1 << ' ' << maxY - minY + 1 << endl;
  }
  return 0;
}

Measured memory_bytes: 2972
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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

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

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;cin>>n;
    map<ll,ll> mp;
    REP(i,n){
        ll d;cin>>d;
        mp[d]++;
    }
    ll m;
    cin>>m;
    REP(i,m){
        ll t;cin>>t;
        if(mp[t]<=0){
            cout<<"NO";
            return 0;
        }
        else mp[t]--;
    }
    cout<<"YES";
}

Measured memory_bytes: 12800
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <functional>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;

// #define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _fromto2(i,n) for(int i=0;i<=(n);++i)
#define _fromto3(i,a,b) for(int i=(a);i<=(b);++i)
#define fromto(...) _overload3(__VA_ARGS__,_fromto3,_fromto2,)(__VA_ARGS__)

#define rrep(i,n) for(int i=(n);i>=0;--i)
#define iter(it,v) for(auto it=v.begin();it!=v.end();++it)
const int MOD = 1e9+7;
const int INF = 1e9;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

// debug
template<class T>ostream& operator<<(ostream& os, vector<T>& vec){os<<"{";for(int i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
template<class T1,class T2>ostream& operator<<(ostream& out,const pair<T1,T2>& rhs){out<<"("<<rhs.first<<", "<<rhs.second<<")";return out;}
#include<type_traits>
template<typename T,size_t SIZE,enable_if_t<!is_same<remove_cv_t<T>,char>::value,nullptr_t> = nullptr>ostream& operator<<(ostream& os,T(&arr)[SIZE]){os<<"{";for(size_t i=0;i<SIZE;++i)os<<(i?", ":"")<<arr[i];os<<"}";return os;}
#ifdef LOCAL
    #define debug(v) cerr<<v<<"\n"
#else
    #define debug(...) 42
#endif


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

  int sum = 0;
  rep(i, N) {
    int a; cin >> a;
    sum += a;
  }
  if (sum >= H) {
    cout << "Yes\n";
  } else
    cout << "No\n";

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main() {
  int n;
  string s, t, ans = "";
  cin >> n >> s >> t;
  rep(i, n) {
    ans += s[i];
    ans += t[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256