akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/









int N, A, B;
int cnt[301010];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> A >> B;

    if (N < A + B - 1 or 1LL * A*B < N) {
        printf("-1\n");
        return;
    }

    cnt[0] = B;
    N -= B;
    rep(i, 1, A) cnt[i]++, N--;
    rep(i, 1, A) {
        while (N and cnt[i] < B) {
            cnt[i]++;
            N--;
        }
    }

    vector<int> ans;
    int pre = 1;
    rep(i, 0, A) {
        int L = pre;
        int R = pre + cnt[i] - 1;
        rrep(i, R, L) ans.push_back(i);
        pre += cnt[i];
    }

    N = ans.size();
    rep(i, 0, N) {
        if (i) printf(" ");
        printf("%d", ans[i]);
    } printf("\n");
}

Measured memory_bytes: 4208
import math
n = int(input())
xy = [list(map(int,input().split())) for hoge in range(n)]
dist = 0
for i in range(n-1):
         for j in range(i+1,n):
                  dist+=(((xy[i][0]-xy[j][0])**2+(xy[i][1]-xy[j][1])**2)**(1/2))
print(dist*(n-1)*(2/(n*(n-1))))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back

int main(){
    ll x,y;
    cin >> x >> y;
    ll a=x;
    ll count=1;
    while(true){
        a=a*2;
        if(a>y) break;
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.math;

void main()
{
	int[3] n;
	n = numText2IntArray(readln());
	if((n[0] + n[1]) == n[2] || (n[0] + n[2]) == n[1] || (n[1] + n[2]) == n[0])
	{
		writeln("Yes");
	}
	else
	{
		writeln("No");
	}

}
int[] numText2IntArray(string text)
{
	return map!(to!int)(split(text)).array;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
long long int n;
cin>>n;
vector<long long int>v;
for(long long int i=1LL;i<=sqrt(n);i++){
    if(n%i==0){
        long long int a=i;
        long long int b=n/i;
            v.push_back(a);
            v.push_back(b);
      
       
    }

}   
sort(v.begin(),v.end());
int pos=v.size()/2-1;
long long int a=v[pos];
long long int b=n/a;
cout<<(a-1)+(b-1)<<endl;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
using namespace std;
typedef long long ll;
typedef pair<int, int> P; 
const int inf = 1<<21;
const ll INF = 1LL << 60;
const ll mod = 1e9+7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main() {
    int h, w, d;
    cin >> h >> w >> d;
    vector<vector<int>> a(h, vector<int>(w));
    vector<pair<int, int>> xy(h*w+1);
    rep(i, h)rep(j, w) {
        cin >> a[i][j];
        xy[a[i][j]] = make_pair(i, j);
    }

    vector<ll> b(h*w+1, 0LL);
    for(int i=d+1; i<=h*w; i++){
        ll x = xy[i].first, y = xy[i].second;
        ll px = xy[i-d].first, py = xy[i-d].second;
        b[i] = b[i-d] + abs(x-px) + abs(y-py);
    }
    int q;
    cin >> q;
    rep(i, q){
        int l, r;
        cin >> l >> r;
        cout << b[r] - b[l] << endl;
    }

    return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int64_t N,K;
cin >> N >> K;
if (N % K == 0) cout << 0 << endl;
else if (N % K >= K/2) {
    N -= (N/K) * K;
    N = abs(N-K);
    cout << N << endl;
} else {
    cout << N - (N/K) << endl;
    }


return 0;
}


Measured memory_bytes: 256
n, m = gets.split.map(&:to_i)
products_vote = (gets.split.map(&:to_i)).sort
#puts products_vote
# if <= products.sum / (4 * m)
products_vote_sum = products_vote.sum


count = 0
#puts n, m
border =  products_vote_sum * (1.0 / (4.0 * m))
#puts  border
puts products_vote[-m] < border ? :No : :Yes

# (0..n-1).each { |product|
#   if border < products_vote[product]
#     count += 1
#   end
#   print border, " ",products_vote[product],"\n"
# }

# if count >= m
#   puts "Yes"
# else
#   puts "No"
# end  


Measured memory_bytes: 14392
import kotlin.math.*

typealias Num = Int

fun binarySearch(ok:Num,ng:Num,eps:Num,f:(Num)->Boolean):Num {
	var _ok = ok
	var _ng = ng
	while(abs(_ok-_ng)>eps) {
		val mid = (_ok+_ng)/2
		if(f(mid))
			_ok = mid
		else
			_ng = mid
	}
	return _ok
}

fun main() {
	for(n in 1..readLine()!!.toInt()) {
		var r = 0L
		for(x in 1..n) {
			if(n<x*x+2*x+3)
				break

			for(y in x..n-x*x) {
				val o = n-x*x-y*y-x*y
				if(o<x+y+1)
					break

				val z = binarySearch(y,o,1) {z-> z*z+x*z+y*z<=o}
				if(z*z+x*z+y*z==o) {
					when {
						x==y&&y==z->++r
						x==y||y==z||z==x->r += 3
						else->r += 6
					}
				}
			}
		}
		println(r)
	}
}


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

int main(){
int A,B;
  cin>>A>>B;
  char S[11];
  cin>>S;
  
for(int i=0; i<A; i++){
 if(!('0'<=S[i] && S[i]<='9')){cout<<"No"<<endl; return 0;}
}
if(S[A]!='-'){cout<<"No"<<endl; return 0;}
for(int i=A+1; i<=A+B; i++){
 if(!('0'<=S[i] && S[i]<='9')){cout<<"No"<<endl; return 0;}
}  
cout<<"Yes"<<endl;  
}

Measured memory_bytes: 256
//11:13-11:44
#include <stdio.h>

char label[] = { 'M', 'A', 'R', 'C', 'H'};

             
long cache[30]; //MARCH
char name[11];

int main(){
  int N;
  scanf("%d",&N);
  for(int i = 0 ; i < 30 ; i++) cache[i] = 0;

  for(int i = 0; i < N ; i++){
    scanf("%s",name);
    cache[name[0]-'A']++;
  }
  
  
  long totalcount = 0;
  for(int x = 0; x < 5 ; x++){
      for(int y = 0; y < 5; y++){
          for(int z = 0; z < 5; z++){
              if(label[x] != label[y] &&
                 label[y] != label[z] &&
                 label[z] != label[x]){
                     totalcount += cache[label[x]-'A'] * cache[label[y]-'A'] * cache[label[z]-'A'];
                     /*printf("%c=%d,%c=%d,%c=%d\n",label[x], cache[label[x]-'A'],
                                                   label[y], cache[label[y]-'A'],
                                                  label[z], cache[label[z]-'A']);*/
                 }
           }
      }
  }

  printf("%ld\n",totalcount/6);
}

Measured memory_bytes: 128
#!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
INF = float("inf")
import sys,collections

N = int(sys.stdin.readline())
c = sys.stdin.readline().rstrip()
co = collections.Counter(c)
if not "R" in co or not "W" in co:
    print(0)
    exit()
ret = 0
for i in range(co["R"]):
    if c[i] != "R":
        ret += 1
print(ret)


Measured memory_bytes: 9688
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
struct multi {
  ll first;
  ll second;
  ll third;
  multi(ll first, ll second, ll third)
      : first(first), second(second), third(third) {}
};
bool multicomp(const multi &a, const multi &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vector<pll> P(N);
  REP(i, N) {
    ll a, b;
    cin >> a >> b;
    P[i] = make_pair(b, a);
  }
  sort(ALL(P));
  bool ok = true;
  ll now = 0;
  AUTO(p, P) {
    now += p.second;
    if (now > p.first) {
      ok = false;
      break;
    }
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> b(n);
    rep(i, n) {
        cin >> a[i];
        cin >> b[i];
    }
    ll add_num = 0;
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    rep(i, n) {
        if ( b[i] == 1LL ) continue;
        if ( ( a[i] + add_num ) % b[i] == 0LL ) continue;
        add_num += b[i] - ( a[i] + add_num ) % b[i];
    }
    cout << add_num << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

int main() {
    set<int> ans = {1, 2, 3};
    int a, b;
    cin >> a >> b;
    ans.erase(a);
    ans.erase(b);
    cout << *ans.begin() << endl;
}


Measured memory_bytes: 256
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
ans = 0
for _a in range(N):
    flag = C
    A = list(map(int,input().split()))
    for _ans in range(M):
        flag = flag + A[_ans]*B[_ans]
    if flag > 0:
        ans += 1
print(ans)

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

int main2() {
  int N = nextInt();
  int i = nextInt();
  cout << N+1-i << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
  char s[1001];
  while (1) {
    scanf("%s", s);
    if (s[0] == '0') {
      break;
    }
    int sum = 0;
    for (int i = 0; s[i] != '\0'; i++) {
      sum += s[i] - '0';
    }
    printf("%d\n", sum);
  }
  return 0;
}


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


  
int main(){
  
  int n;
  cin>>n;
  vector<int> data(n);
  for (int i=0;i<n;i++){
    cin>>data.at(i);
  }
  
  
  int c,r;
  
  c=0;
  r=0;
  
  for (int k=0;k<=7;k++){
    for (int i=0;i<n;i++){
      if (400*k<=data.at(i) and data.at(i)<400*(k+1)){
        c++;
        break;
      }
    }
  }
  
  for (int i=0;i<n;i++){
    if (data.at(i)>=3200){
      r++;
    }
  }
  
  int big,small;
  
  big=c+r;
  
  small=max(1,c);
  
  cout<<small<<" "<<big<<endl;
  
  

  

}
  

















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

namespace AtCoderBeginnerContest
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // B
            var S = Console.ReadLine();
            var list = new List<char>();

            for (int i = 0; i < S.Length; i++)
            {
                if(list.Contains(S[i]))
                {
                    Console.WriteLine("no");
                    return;
                }
                else
                {
                    list.Add(S[i]);
                }
            }
            Console.WriteLine("yes");
        }
    }
}


Measured memory_bytes: 13152
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

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

using std::string;
using std::pair;

using std::vector;
using std::sort;

int n;
vector<vector<int>> s;

int main(){
    cin >> n;
    s=vector<vector<int>>(n*2,vector<int>(n));
    for(int i=0;i<n;i++){
        string str;
        cin >> str;
        for(int j=0;j<n;j++){
            s[i][j]=(int)str[j];
            s[i+n][j]=s[i][j];
        }
    }

    int ans=0;
    for(int i=0;i<n;i++){
        bool flag=true;
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                if(s[i+j][k]!=s[i+k][j]){
                    flag=false;
                }
            }
        }
        ans+=flag;
    }

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



Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

public class Main {
	
	public static void main(String[] args) throws IOException {
		InputReader in = new InputReader(System.in);
		int x = in.readInt();
		int a = in.readInt();
		int b = in.readInt();
		if(Math.abs(x-a) < Math.abs(x-b)) System.out.println("A");
		else System.out.println("B");
	}
}
class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public String readString() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do {
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	public long readLong() {
		int c = read();
		while (isSpaceChar(c)) {
			c = read();
		}
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		long res = 0;
		do {
			if (c < '0' || c > '9') {
				throw new InputMismatchException();
			}
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}
	
	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public String next() {
		return readString();
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}


Measured memory_bytes: 21204
#include<cstdio>
#include<algorithm>
#include<iostream>
using namespace std;
int main(void){
	int N=0,M=0,work=0;
	cin>>N>>M;
	int A[110];
	for(int i=0;i<N;i++)
	{
		cin>>A[i];
	}
	for(int j=1;j<=M;j++){
		for(int i=0;i<N-1;i++)
		{
			if(A[i]%j>A[i+1]%j){
				work=A[i];A[i]=A[i+1];A[i+1]=work;
			}
		}
	}
	for(int i=0;i<N;i++)
	{
		cout<<A[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3108
#include <iostream>

using namespace std;

typedef long long ll;

ll sq (ll x) {
  return x * x;
}

int main () {
  ll S;
  cin >> S;

  ll p = 0;
  for (ll k = 1 << 30; k != 0; k /= 2) {
    if (sq(p + k) < S) {
      p += k;
    }
  }
  p++;

  cout << 0 << " " << 0 << " "
       << p << " " << sq(p) - S << " "
       << 1 << " " << p << endl;
}


Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int cnt = 0;

		for (int i = A; i <= B; i++) {
			String s = String.valueOf(i);
			char[] c = s.toCharArray();
			boolean x = f(c);
			if(x) cnt++;
		}
		
		System.out.println(cnt);

		sc.close();

	}

	static boolean f(char[] a) {
		boolean x = false;
		int l = a.length - 1;
		int cnt = 0;
		for (int i = 0; i < a.length / 2; i++) {
			if (a[i] == a[l - i])
				cnt++;
		}
		if (cnt == a.length / 2)
			x = true;
		return x;
	}

}

Measured memory_bytes: 30036
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug { 
    ($($a: expr),*) => { 
        println!(concat!($(stringify!($a)," = {:?}, "),*), $($a),*);
    } 
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

fn solve() {
    let s = get!(String);

    let mut num0 = 0;
    let mut num1 = 0;
    for c in s.chars() {
        if c == '0' {
            num0 += 1;
        } else {
            num1 += 1;
        }
    }
    println!("{}", 2*min(num0, num1));
}


Measured memory_bytes: 8572
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=555;
int p[N*N];
int n;
int dis[N*N];
bool e[N*N];
int main(){
	memset(e,true,sizeof(e));
	cin>>n;
	for(int i=1;i<=n*n;i++){
		cin>>p[i];
	}
	for(int i=1;i<=n*n;i++){
		int xx=(i-1)/n+1,yy=(i-1)%n+1;
		dis[i]=min(min(n-xx,xx-1),min(n-yy,yy-1));
	}
	LL ans=0;
	for(int i=1;i<=n*n;i++){
		int x=p[i];
		ans+=dis[x];
		e[x]=false;
		queue<int> q;
	#define UPD(X,D) {\
		int disw=(D);\
		int idw=(X);\
		if(disw<dis[idw]){\
			dis[idw]=disw;\
			q.push(idw);\
		}\
		}
		q.push(x);
		while(!q.empty()){
			int x=q.front();
			q.pop();
			int d=dis[x]+(e[x]?1:0);
			int xx=(x-1)/n+1,yy=(x-1)%n+1;
			if(xx>1){
				UPD(x-n,d);
			}
			if(xx<n){
				UPD(x+n,d);
			}
			if(yy>1){
				UPD(x-1,d);
			}
			if(yy<n){
				UPD(x+1,d);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 5856
#include<stdio.h>
#define N 10000

int main(void){
  int i,num,j;
  int n,ac,bc;
  int a[N],b[N];

  for(i=0;;i++){
    scanf("%d",&n);
    if(n==0)
      break;
    a[i]=0;
    b[i]=0;
    for(j=0;j<n;j++){
      scanf("%d%d",&ac,&bc);
      if(ac==bc){
        a[i]+=ac;
        b[i]+=bc;
        continue;
      }
      a[i]+=(ac>bc)?ac+bc:0;
      b[i]+=(ac<bc)?ac+bc:0;
    }
  }
  num=i;
  for(i=0;i<num;i++){
    printf("%d %d\n",a[i],b[i]);
  }
  return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int P[100001];
int kotae[100001];
inline int Find(int A) {
	if (P[A] < 0) return A;
	return P[A] = Find(P[A]);
}

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int MAX = 100000;
class shuturyoku_unko {
public:
	char C[MAX * 6 + 10];
	int K[MAX + 10];
	constexpr shuturyoku_unko() : C(), K() {
		auto di = C + 2;
		C[0] = '0';
		C[1] = '\n';
		K[1] = 2;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int i = keta - 1; i >= 0; i--)* di++ = (*(c + i));
			*di++ = '\n';
			K[i + 1] = K[i] + keta + 1;
		}
	}
} f;

const int dm = 1 << 20;
char dn[dm], * di = dn;

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


	int N = getint(), M = getint(), K = getint();

	rep1(i, N) P[i] = -1;

	rep(i, M) {
		int A = getint(), B = getint();
		int a = Find(A);
		int b = Find(B);
		if (a != b) {
			if (P[a] > P[b]) swap(a, b);
			P[a] += P[b];
			P[b] = a;
		}
		kotae[A]--;
		kotae[B]--;
	}
	rep(i, K) {
		int A = getint(), B = getint();
		int a = Find(A);
		int b = Find(B);
		if (a == b) {
			kotae[A]--;
			kotae[B]--;
		}
	}

	rep1(i, N) {
		int X = kotae[i] - P[Find(i)] - 1;
		for (int i = f.K[X]; i < f.K[X + 1]; i++)* di++ = f.C[i];
	}
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 2176
import sys
input = sys.stdin.readline

def linput(ty=int, cvt=list):
	return cvt(map(ty,input().split()))

def gcd(a: int, b: int):
	while b: a, b = b, a%b
	return a

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

def main():
	#n=int(input())
	#vA=linput()
	a,b,c = linput()
	
	res = 0
	
	x = (a%2)*b*c
	y = (b%2)*c*a
	z = (c%2)*a*b
	
	res = min(x,y,z)
	
	#sT = "No Yes".split()
	#print(sT[res])
	print(res)

if __name__ == "__main__":
	main()


Measured memory_bytes: 9144
#include <bits/stdc++.h>
 #define ll long long
 #define int long long
 #define MOD  1000000007
 #define MAX 500005
 #include<iomanip>
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define x first
 #define y second
using namespace std;
int gcd(int a, int b);
  
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;
  
    return (y%2 == 0)? p : (x * p) % m;
}
ll modInverse(int a, int m)
{
    int g = gcd(a, m);
   
    {
        // If a and m are relatively prime, then modulo inverse
        // is a^(m-2) mode m
      
             return power(a, m-2, m);
    }
}
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
//void spf(ll num)
//{
//    fore(i,0,num+1)arr[i]=i;
//    for(ll i=2;i<=num;i+=2)
//    {
//        arr[i]=2;
//    }
//    for(ll i=3;i<=num;i+=2)
//    {
//        if(arr[i]==i)
//        for(ll j=i;j<=num;j+=i)
//        {
//           if(arr[j]==j) arr[j]=i;
//        }
//    }
//}

 int32_t main()
{
    Need_for_speed(activated);
//    satisfy
//    {}
    ll n;cin>>n;ll k;cin>>k;
    ll a[1006];
    cin>>a[0]>>a[1]>>a[2];
    string s;cin>>s;
    map<char,char>m;
    m['r']='p';
    m['p']='s';
    m['s']='r';
    // R S P
    // 0 1 2
    ll ans=0;
    fore(i,0,k)
    {
        if(s[i]=='r')
        {
            ans+=a[2];
            s[i]='p';
        }
        else if(s[i]=='p')
        {
            s[i]='s';
            ans+=a[1];
        }
        else
        {
            s[i]='r';
            ans+=a[0];
        }
       // cout<<s[i];
    }
    for(ll i=k;i<n;i++)
    {
        if(m[s[i]]==s[i-k])
        {
            s[i]='a';
        }
        else
        {
            char c=m[s[i]];
            if(c=='r')
            {
                ans+=a[0];s[i]='r';
                
            }
            else if(c=='s')
            {
                ans+=a[1];s[i]='s';
            }
            else
            {
                ans+=a[2];s[i]='p';
            }
        }
        //cout<<s[i];
    }
    cout<<ans<<endl;
    return 0;
    }


Measured memory_bytes: 512
N = int(input())
K = sorted(map(int, input().split()))

for i in range(1,101):
  data1 = map(lambda x: (i-x)**2, K)
  sum_dis = sum(list(data1))
  if i == 1:
    min_min = sum_dis
  if min_min > sum_dis:
    min_min = sum_dis
print(min_min)

Measured memory_bytes: 38768
import math
 
A,B,H,M=map(int, input().split())
 
sh=math.pi*(H+M/60)/6
sm=math.pi*M/30
 
s=abs(sh-sm)
 
C=math.sqrt(A**2+B**2-2*A*B*math.cos(s))
 
print(C)

Measured memory_bytes: 9504
# coding: utf-8

n,t = [int(x) for x in input().rstrip().split(" ")]
push_times = [int(x) for x in input().rstrip().split(" ")]

total_duration = 0

for i in range(len(push_times)):
    if i == len(push_times) - 1:
        total_duration = total_duration + t
        break

    time_diff = (push_times[i+1] - push_times[i])
    if time_diff > t:
        total_duration = total_duration + t
    elif time_diff <= t:
        total_duration = total_duration + time_diff

print(total_duration)


Measured memory_bytes: 25200
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author apurba_debnath
 */

#include <bits/stdc++.h>

#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl

using namespace std;

class BTripleDots {
public:
    void solve(std::istream &in, std::ostream &out) {
        int k;
        string s;
        in >> k >> s;
        int l = s.length();
        if (k >= l)
            out << s;
        else {
            string ans = "";
            int i = 0;
            while (i < k) {
                ans += s[i];
                i += 1;
            }
            ans += "...";
            out << ans;
        }
    }
};


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

    BTripleDots solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);

    return 0;
}


Measured memory_bytes: 3644
N = int(input())
H = [int(i) for i in input().split()]

check = 0
MAX = 0
for i in range(N):
    if H[i] > MAX:
        MAX = H[i] -1
    if H[i] < MAX:
        check = 1

if check == 1:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 14224
#unbalance
s=input()
if len(s)==2:
    if s[0]==s[1]:
        print(1,2)
    else:
        print(-1,-1)
elif len(s)>2:
    flag=False
    for j in range(len(s)-1):
        if s[j]==s[j+1]:
            print(j+1,j+2)
            flag=True
            break
    if not flag:
        for k in range(len(s)-2):
            if s[k]==s[k+2]:
                print(k+1,k+3)
                flag=True
                break
        if not flag:
            print(-1,-1)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
 ll N,K;
  cin>>N>>K;
  ll ans=0;
  for(ll i=0;i<N;i++) {
ll h;
    cin>>h;
    if(h>=K) {
ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3636
//#pragma GCC optimize ("O3")
//#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

constexpr int bm = 2500;
ll BIT[50][bm];
int zero[50];
void add(int A, int gin, ll co) {
	co = 4e12 - co;
	while (gin > 0) {
		if (BIT[A][gin] >= co) break;
		BIT[A][gin] = co;
		gin -= gin & -gin;
	}
}
ll query(int A, int gin) {
	ll kotae = 0;
	while (gin < bm) {
		kotae = max(BIT[A][gin], kotae);
		gin += gin & -gin;
	}
	return 4e12 - kotae;
}

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


	int N, M, S;
	cin >> N >> M >> S;
	if (S >= 2460) S = 2460;

	vector<ll> E[50];
	rep(i, M) {
		int u, v, a;
		ll b;
		cin >> u >> v >> a >> b;
		u--;
		v--;
		b = a << 8 | b << 16;
		E[u].pb(v | b);
		E[v].pb(u | b);
	}
	int C[50], D[50];
	rep(i, N) {
		cin >> C[i] >> D[i];
	}

	add(0, S + 1, 0);
	priority_queue<ll, vector<ll>, greater<ll> > PQ;
	PQ.push(S + 1);
	ll zenbu = 0;

	while (PQ.size()) {
		auto p = PQ.top();
		PQ.pop();
		ll ti = p >> 18;
		int i = p >> 12 & 63;
		int gin = p & 4095;

		zenbu |= 1ll << i;

		if (ti > query(i, gin)) continue;

		ll ti2 = ti + D[i];
		int gin2 = gin + C[i];
		if (gin2 > 2460) gin2 = 2460;
		if (ti2 < query(i, gin2)) {
			add(i, gin2, ti2);
			PQ.push(ti2 << 18 | i << 12 | gin2);
		}

		for (auto pp : E[i]) {
			int to = pp & 255;
			ti2 = ti + (pp >> 16);
			gin2 = gin - (pp >> 8 & 255);
			if (gin2 > 0) {
				if (ti2 < query(to, gin2)) {
					add(to, gin2, ti2);
					PQ.push(ti2 << 18 | to << 12 | gin2);
				}
			}
		}
		if (zenbu == (1ll << N) - 1) break;
	}

	for (int i = 1; i < N; i++) {
		co(query(i, 1));
	}



	Would you please return 0;
}

Measured memory_bytes: 4620
#include<cstdio>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int n;
int pre[40], in[40];
int c[41], p;

void rec( int l, int r )
{
	if( l > r )
		return;

	int x = pre[p++];

	rec( l, c[x]-1 );
	rec( c[x]+1, r );

	printf( "%d%c", x, x==*pre?'\n':' ' );

	return;
}

int main()
{
	scanf( "%d", &n );

	rep( i, n )
		scanf( "%d", pre+i );
	rep( i, n )
		scanf( "%d", in+i ), c[in[i]] = i;

	rec( 0, n-1 );

	return 0;
}

Measured memory_bytes: 1024
from sys import stdin


def main():
    n = int(stdin.readline())
    a = list(map(int, stdin.readline().split()))

    a2 = [[a[i], i] for i in range(n)]
    a2.sort(reverse=True)

    dp = [[0 for _ in range(n + 1)] for _ in range(n + 1)]

    ans = 0

    for i in range(n + 1):
        for j in range(n + 1 - i):
            s1 = s2 = 0
            if i > 0:
                s1 = dp[i - 1][j] + a2[i + j - 1][0] * (a2[i + j - 1][1] - (i - 1))
            if j > 0:
                s2 = dp[i][j - 1] + a2[i + j - 1][0] * ((n - j) - a2[i + j - 1][1])
            dp[i][j] = max(s1, s2)
        ans = max(ans, dp[i][n - i])

    print(ans)


if __name__ == "__main__":
    main()


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

int main() {
	int W,H,x,y,r;
	cin >>W>>H>>x>>y>>r;
	if (x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H){
		cout <<"Yes"<< endl;
	}
	else{
		cout <<"No"<< endl;
	}
	return 0;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

bool match[21][21] = {};

ll dp[1 << 21] = {};
int main()
{
  int n;
  cin >> n;
  REP(i, n)
  {
    REP(j, n)
    {
      int a;
      cin >> a;
      if (a == 1)
        match[i][j] = true;
    }
  }

  dp[0] = 1;
  REP(s, (1 << n))
  {
    int cnt = __popcntd(s);
    int i = n - cnt;
    REP(j, n)
    {
      if (((s >> j) & 1) == 1 && match[i][j])
        dp[s] = (dp[s] + dp[s & (~(1 << j))]) % MOD;
    }
  }

  int sa = 0;
  REP(i, n)
  {
    sa += (1 << i);
  }

  cout << dp[sa] << endl;
}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(int argc, char const *argv[])
{
	int n, a, b, c; cin >> n >> a >> b >> c;
	vector<int> l(n); rep(i, n) cin >> l[i];
	sort(l.begin(), l.end());

	int ans = INF;
	do {
		reps(i, 1, n + 1)reps(j, i + 1, n + 1)reps(k, j + 1, n + 1) {
			vector<int> v(3, 0);
			// printf("%d %d %d\n", i, j, k);
			rep(t, n) {
				if (t < i) v[0] += l[t];
				else if (t < j) v[1] += l[t];
				else if (t < k) v[2] += l[t];
			}
			// printf("%d %d %d\n", v[0], v[1], v[2]);
			sort(v.begin(), v.end());
			int tans = abs(a - v[2]) + abs(b - v[1]) + abs(c - v[0]);
			tans += ((i - 1) + (j - i - 1) + (k - j - 1)) * 10;
			ans = min(ans, tans);
		}
	} while(next_permutation(l.begin(), l.end()));

	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
   std::string S;
   std::cin >> S;

   if(S=="Sunny") std::cout << "Cloudy" << std::endl;
   else if(S=="Cloudy") std::cout << "Rainy" << std::endl;
   else if(S=="Rainy") std::cout << "Sunny" << std::endl;

   return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;

public class Main{
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		String p[][] = new String[M][2];
		for(int i = 0; i < M; i++) {
			p[i][0] = sc.next();
            p[i][1] = sc.next();
		}
		int AC = 0;
		int WA = 0;
		boolean ac [] = new boolean[N];
		int wa [] = new int[N];
		for(int i = 0; i < M; i++) {
			int a = Integer.parseInt(p[i][0])-1;
			if(ac[a]){
			    continue;    
			}
			if(p[i][1].equals("WA")){
			     wa[a]++;    
			} else {
				AC++;
				WA += wa[a];
				ac[a] = true;
			}
		}
		System.out.println(AC + " " + WA);
	}
}

Measured memory_bytes: 71016
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
//#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

    string L; cin >> L;
    int len = L.size();
    ll dp[len][2]; //0:超える可能性/1:超えないこと確定
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 2;
    dp[0][1] = 1;
    for(int i = 0; i < len - 1; i++) {
        if(L[i+1] == '0') {
            dp[i+1][1] += dp[i][1] * 3;
            dp[i+1][0] += dp[i][0];
        }
        else {
            dp[i+1][1] += dp[i][0] + dp[i][1] * 3;
            dp[i+1][0] += dp[i][0] * 2;
        }
        dp[i+1][0] %= mod;
        dp[i+1][1] %= mod;
    }
    ll ans = dp[len-1][0] + dp[len-1][1];
    ans %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2000
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect_left
from heapq import heappush, heappop
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
T = [INT() for _ in range(N)]

ans = T[0]
for i in range(1, N):
	ans = ans*T[i]//gcd(ans, T[i])
print(ans)


Measured memory_bytes: 17820
#include <stdio.h>
#include <string.h>
int main(void){
  long int h;
  int n;
  scanf("%ld %d",&h,&n);
  int sum=0;
  int a[n];
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    sum=sum+a[i];
  }
  if(h>sum){
    printf("No");
  }else{
    printf("Yes");
  }
  return 0;
}

Measured memory_bytes: 2060
#include <iostream>
#include <stdio.h>
#include <memory.h>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <string.h>
#include <algorithm>

using ii = std::pair<int, int>;

int main()
{
	int arr[3];

	for (int i = 0; i < 3; i++)
		scanf("%d", &arr[i]);

	std::sort(arr, arr + 3);

	if (arr[0] == 5 && arr[1] == 5 && arr[2] == 7)
		printf("YES");
	else
		printf("NO");

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>

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

using namespace std;

const ll inf = 1LL << 60;
const ll size = 500;
template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    ll N, Ma, Mb;
    cin >> N >> Ma >> Mb;
    vector<ll> a(N), b(N), c(N);
    Rep (i, N) {cin >> a[i] >> b[i] >> c[i];}

    vector<vector<vector<ll>>> dp(N+1, vector<vector<ll>>(size, vector<ll>(size, inf)));
    dp[0][0][0] = 0;
    Rep (i, N) {
        Rep (j, size) {
            Rep (k, size) {
                chmin(dp[i+1][j][k], dp[i][j][k]);
                if (j+a[i] < size && k+b[i] < size) chmin(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k] + c[i]);
            }
        }
    }

    ll rate = 1;
    ll ans = inf;
    while (true) {
            if (Ma*rate >= size || Mb*rate >= size) {
            break;
        }

        if (dp[N][Ma*rate][Mb*rate] != inf) {
            chmin(ans, dp[N][Ma*rate][Mb*rate]);
        }
        rate++;
    }
    if (ans == inf) ans = -1;
    cout << ans << "\n";
}

Measured memory_bytes: 83072
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    int a,b,c,d; cin>>a>>b>>c>>d;
    while(1){
        c-=b;
        if(c<=0){
            cout<<"Yes"<<endl;
            break;
        }
        a-=d;
        if(a<=0){
            cout<<"No"<<endl;
            break;
        }
    }

}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main(){

    int a, b, c, d, s;
    cin >> a >> b >> c >> d;

    s = min(b,d) - max(a,c);

    if(s > 0){
        cout << s << endl;
    }
    else{
        cout << "0" << endl;
    }
    
}

Measured memory_bytes: 256
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ABlist = []
ABClist = []

for x in A:
    for y in B:
        sumple = x + y
        ABlist.append(sumple)
    ABlist.sort(reverse=True)
    ABlist = ABlist[:K]

for x in ABlist:
    for z in C:
        test = x + z
        ABClist.append(test)
    ABClist.sort(reverse=True)
    ABClist = ABClist[:K]

for x in ABClist:
    print(x)

Measured memory_bytes: 3700
# coding: utf-8
# Your code here!
import copy
import itertools
import numpy as np

h, w, k = map(int, input().split())

for i in range(h):
    row = list(input())
    # print(row)
    row = [0 if x=="." else 1 for x in row]
    row = np.array(row).reshape(1, w)
    if i == 0:
        c_matrix = row
    else:
        c_matrix = np.append(c_matrix, row, axis=0)
    
# print(c_matrix, "\n")
row_list = list(range(h))
col_list = list(range(w))
count = 0
for i in range(h+1):
    row_idx = list(itertools.combinations(row_list, i))
    for j in range(w+1):
        col_idx = list(itertools.combinations(col_list, j))
        # print(row_idx, col_idx)
        for row in row_idx:
            for col in col_idx:
                tmp = copy.deepcopy(c_matrix)
                tmp[row, :] = 0 
                tmp[:, col] = 0
                ans = np.sum(np.sum(tmp, axis=1))
                if ans == k:
                    count += 1
                    # print(tmp)
            
print(count)



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

int main() {
    int n; cin >> n;
    for (int i = 1; i <= 9; i++) {
        if (n%i == 0 && n/i <= 9) {
            cout << "Yes" << endl;
            return 0;
        }
        else continue;
    }
    cout << "No" << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<pair<int, int>> P(N);
  for (int i = 1; i <= N; i++) {
    int p;
    cin >> p;
    P[i - 1] = make_pair(p, i);
  }
  sort(P.begin(), P.end(), greater<pair<int, int>>());

  ll ans = 0;
  multiset<ll> S = {0, 0, N + 1, N + 1};
  S.insert(P[0].second);
  for (int i = 1; i < N; i++) {
    int p = P[i].second;
    S.insert(p);
    auto it = S.find(p);
    ll r1 = *next(it);
    ll r2 = *next(next(it));
    ll l1 = *prev(it);
    ll l2 = *prev(prev(it));
    ans += ((r2 - r1) * (p - l1) + (l1 - l2) * (r1 - p)) * P[i].first;
  }
  cout << ans << endl;
}


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

ll solution( vector<int> &A, int ind, vector<int> &memo ) {

    if( ind == A.size()-1 )
        return 0;
    
    if( ind >= A.size() )
        return INT_MAX;

    if( memo[ind] != -1 )
        return memo[ind];

    ll ret = INT_MAX;
    if( ind+1 < A.size() ) 
        ret = min(ret, abs(A[ind]-A[ind+1]) + solution(A, ind+1, memo));
    if( ind+2 < A.size() ) 
        ret = min(ret, abs(A[ind]-A[ind+2]) + solution(A, ind+2, memo));

    memo[ind] = (int)ret;
    return ret;
}

int main() {
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif

    int N;
    cin>>N;

    vector<int> arr(N,0);
    for( int i=0;i<N; i++ ) {
        cin>>arr[i];
    }

    vector<int> memo(N,-1);

    cout<<solution(arr,0,memo)<<endl;
    
    
}

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

int main() {
    int H, W;
    string pic;
    cin >> H >> W;
    for(int i = 0; i < W + 2; i++) cout << "#";
    cout << endl;

    for(int i = 0; i < H; i++) {
        cin >> pic;
        cout << "#" << pic << "#" << endl;
    }

    for(int i = 0; i < W + 2; i++) cout << "#";
    cout << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
edges = []
for i in range(M):
    a, b, c = map(int, input().split())
    edges.append((a, b, c))
edges.sort()

def bellmanford(n, edges, start):
    INF = float('inf')
    dist = [-INF] * (n+1) # dist[0]は使わない
    dist[start] = 0

    for i in range(n):
        for (pre, ne, weight) in edges:
            if dist[pre] != -INF and dist[pre] + weight > dist[ne]:
                dist[ne] = dist[pre] + weight
                if i == n-1 and ne == n:
                    return 'inf'
    return dist[n]

answer = bellmanford(N, edges, 1)
print(answer)

Measured memory_bytes: 3316
#include<iostream>
#include<cstdlib>
#include<string>
#include<list>
using namespace std;
int main(){
  list<int> l;
  int n,tmp;
  string s;
  cin>>n;
  for(int i=0;i<n;i++){    
    cin>>s;
    if(s=="insert"){  
      cin>>tmp;
      l.push_front(tmp);
    }
    else if(s=="delete"){
      cin>>tmp;
      for(auto t=l.begin();t!=l.end();++t){
	if(*t==tmp){
	  t=l.erase(t);
	  break;
	}
      }
    }
    else if(s=="deleteFirst"){
       l.pop_front();
    }
    else if(s=="deleteLast"){
      l.pop_back();
    }
  }
  for(auto i=l.begin();i!=l.end();){
    cout<<*i;
    i++;
    if(i!=l.end()) {cout<<" ";}
  }    cout<<'\n';

    return 0;
}


Measured memory_bytes: 34252