akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>

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

int a[567][567];
int main() {

	int H, W;

	scanf("%d %d", &H, &W);

	rep(h, H) rep(w, W) {
		int aaa;
		scanf("%d", &aaa);
		a[h][w] = aaa % 2;
	}

	vector<pair<pair<int, int>, pair<int, int>>> out, sub;

	bool one = false;
	rep(h, H) rep(w, W) {
		if (h % 2) {
			if (one) {
				if (w == 0 && h) {
					sub.push_back(make_pair(make_pair(h, W - 1 - w), make_pair(h - 1, W - 1 - w)));
				}
				else {
					sub.push_back(make_pair(make_pair(h, W - 1 - w), make_pair(h, W - 1 - w + 1)));
				}
				if (a[h][W - 1 - w]) {
					rep(i, sub.size()) out.push_back(sub[sub.size() - 1 - i]);
					sub.clear();
					one = false;
				}
			}
			else if (a[h][W - 1 - w]) one = true;
		}
		else {
			if (one) {
				if (w == 0 && h) {
					sub.push_back(make_pair(make_pair(h, w), make_pair(h - 1, w)));
				}
				else {
					sub.push_back(make_pair(make_pair(h, w), make_pair(h, w - 1)));
				}
				if (a[h][w]) {
					rep(i, sub.size()) out.push_back(sub[sub.size() - 1 - i]);
					sub.clear();
					one = false;
				}
			}
			else if (a[h][w]) one = true;
		}
	}

	printf("%d\n", out.size());
	rep(i, out.size()) {
		printf("%d %d %d %d\n", out[i].first.first + 1, out[i].first.second + 1, out[i].second.first + 1, out[i].second.second + 1);
	}

	return 0;
}

Measured memory_bytes: 5232
function main(input){
    input = input.split(' ');
    inputA = parseInt(input[0]);
    inputB = parseInt(input[1]);
    out = 'No';
    
    if(inputA==inputB){
        out = 'Yes';
    }

    console.log(out);
}

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

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if ((A + D - 1) / D >= (C + B - 1) / B)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 3628
var fs = require('fs');

// class Stdin
function Stdin() {
  this.__input = null;
  this.__lines = [];
  this.__index = 0;
}
Stdin.prototype.init = function() {
  this.__input = fs.readFileSync('/dev/stdin', 'utf-8');
  this.__lines = this.__input.split("\n");
  this.__index = 0;
}
Stdin.prototype.readline = function() {
  if(this.__index === this.__lines.length) this.init();
  return this.__lines[this.__index++];
};
Stdin.prototype.readlines = function() {
  if(this.__index === this.__lines.length) this.init();
  cur = this.__index; this.__index = this.__lines.length;
  return this.__lines.slice(cur);
};
var stdin = new Stdin;

Array.prototype.imap = function() { return this.map((x)=>parseInt(x)); }
Array.prototype.fmap = function() { return this.map((x)=>parseFloat(x)); }
Array.prototype.smap = function() { return this.map((x)=>String(x)); }
Array.prototype.ffill = function(cb) {
  for(var i=0; i<this.length; ++i) { this[i] = cb(i); } return this;
}
Array.prototype.max = function(cb) {
  if(this.length === 0) return undefined;
  res = cb ? cb(this[0], 0) : this[0];
  for(var i=1; i<this.length; ++i){ var val = cb ? cb(this[i], i) : this[i]; if(res < val) res = val; }
  return res;
}
Array.prototype.min = function(cb) {
  if(this.length === 0) return undefined;
  res = cb ? cb(this[0], 0) : this[0];
  for(var i=1; i<this.length; ++i){ var val = cb ? cb(this[i], i) : this[i]; if(val < res) res = val; }
  return res;
}
Array.prototype.sum = function(cb) {
  if(this.length === 0) return undefined;
  res = cb ? cb(this[0], 0) : this[0];
  for(var i=1; i<this.length; ++i) res += cb ? cb(this[i], i) : this[i];
  return res;
}

Number.prototype.times = function(cb) { res = []; for(var i=0; i<this; ++i) res.push(cb ? cb(i) : i); return res; }

Object.prototype.forEach = function(cb) { Object.keys(this).forEach(cb); }
Object.prototype.map = function(cb) { Object.keys(this).map(cb); }

var l = stdin.readline().split(' ').imap();
var N = l[0], M = l[1];
var S = N.times(x=>stdin.readline());
//var cnts = new Array(N).ffill(()=>new Array(M).ffill(()=>[0,0,0]));
var memo = {};
function calc(i, col) {
  if([i, col] in memo) return memo[[i, col]];
  var res = 0;
  for(var j = 0; j < M; ++j) if(S[i][j] == col) res++;
  return memo[[i, col]] = M - res;
}
var p = 0, ans = N*M;
for(var i = 0; i < N; ++i) {
  p += calc(i, 'W');
  var q = 0;
  for(var j = i+1; j < N-1; ++j) {
    q += calc(j, 'B');
    var r = 0;
    for(var k = j+1; k < N; ++k) {
      r += calc(k, 'R');
    }
    ans = [ans, p+q+r].min();
  }
}
console.log(ans);

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

int main() {
  int N,T,A;
  vector<int> high(1010);
  vector<int> temp(1010);
  int temp_min = 500000;
  int place;

  cin >> N >> T >> A;
  A = A * 1000;
  T = T * 1000;
  for(int i = 0;i < N;i++){
    cin >> high.at(i);
    temp.at(i) = T - high.at(i) * 6;
    if(temp.at(i) < A)temp.at(i) = A - temp.at(i);
    else temp.at(i) = temp.at(i) - A;
    temp_min = min(temp.at(i),temp_min);
    if(temp_min == temp.at(i))place = i;
  }
  
  cout << place+1 << endl;
}

Measured memory_bytes: 256
solve :: [Int] -> [String]
solve (x:y:xs)
  | x == 0 && y == 0 = []
  | otherwise = (show (min x y) ++ " " ++ show (max x y)) : solve xs

main = getContents >>= mapM_ putStrLn . solve . (++[1,1]) . map read . words

Measured memory_bytes: 4448
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _001_FindingMissingCards
{


    class Program
    {
        static Boolean primeNumber(int x)
        {
            if (x == 2) return true;
            if (x % 2 == 0 || x < 2) return false;

            var i = 3;
            while (i <= Convert.ToInt32(Math.Sqrt(Convert.ToDouble(x))))
            {
                if (x % i == 0) return false;
                i += 2;
            }

            return true;
        }
        static void Main()
        {
            var num = Convert.ToInt32(Console.ReadLine());

            var count = 0;

            for (int i = 0; i < num; i++)
            {
                var x = Convert.ToInt32(Console.ReadLine());
                if (Program.primeNumber(x))
                {
                    count++;
                }
            }
            Console.WriteLine(count);
            
        }
    }
}

Measured memory_bytes: 9320
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <cmath>
#include <iomanip>


int main()
{
    // std::cout << std::fixed << std::setprecision(10);
    int n; std::cin >> n;
    std::vector<std::pair<int, int>> p(n);
    for(int i=0; i<n; i++) std::cin >> p[i].first;
    for(int i=0; i<n; i++) std::cin >> p[i].second;
    int ans = 0;
    for(int i=0; i<n; i++)
        if(p[i].first - p[i].second > 0) ans += p[i].first - p[i].second;

    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF=1e9,MOD=1e9+7;
const long long LINF=1e18;
using namespace std;
#define int long long
//template

//main
signed main(){
  int N;cin>>N;
  std::vector<string> s(N);
  for(int i=0;i<N;i++)cin>>s[i];
  int ans=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<s[i].size()-1;j++){
      if(s[i][j]=='A'&&s[i][j+1]=='B')ans++;
    }
  }
  int a=0;int b=0;
  int sta=0;int goa=0;
  for(int i=0;i<N;i++){
    if(s[i][0]=='B')b++;
    if(s[i][s[i].size()-1]=='A')a++;
    if(s[i][0]=='B'&&s[i][s[i].size()-1]!='A')sta++;
    if(s[i][0]!='B'&&s[i][s[i].size()-1]=='A')goa++;
  }
  int k=0;
  if(sta&&goa)cout<<min(a,b)+ans<<endl;
  if(sta&&goa==0)cout<<a+ans<<endl;
  if(sta==0&&goa)cout<<b+ans<<endl;
  if(sta==0&&goa==0)cout<<ans+max(0LL,a-1)<<endl;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
const int N=3e5+5;
const int mod=998244353;
int f[N],n,s,x,ans=0;
int main(){
    cin>>n>>s;
    for(int i=1;i<=n;i++){
        cin>>x;
        for(int j=s-x;j>0;j--) f[j+x]=(f[j+x]+f[j])%mod;
        f[x]=(f[x]+i)%mod;
        ans=(ans+f[s])%mod;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>

int main() {
  int top, under;
  int count = 0;
  std::cin >> under >> top;
  for (int i=under; i < top+1; i++) {
    std::string data=std::to_string(i);
    for (int j=0; j<data.size()/2+1;j++) {
      if (data.at(j) != data.at(data.size()-1-j)) {
        break;
      }
      else if (j==data.size()/2) {
        count++;
      }
    }   
  }
  std::cout << count << std::endl;
}


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

int main(){
    int n; cin >> n;
    vector<int> a(n);
    a.at(0) = 1;
    for(int i = 1; i < n; i++) cin >> a.at(i);
    vector<int> b(n);

    for(int i = 1; i < n; i++){ b.at(a.at(i)-1)++; }

    for(int i = 0; i < n; i++)
        cout << b.at(i) << endl;
    
}

Measured memory_bytes: 4848
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f3f3f3f3f;

ii d[MAXn];
string dir = "UDRL";
ll dx[] = {0,0,1,-1};
ll dy[] = {1,-1,0,0};
int main(){
  IOS();
  int n;
  cin>>n;
  REP(i,n) cin>>d[i].X>>d[i].Y;
  bool fg = false;
  if( (d[0].X+d[0].Y)%2 == 0 ){
    fg = true;
    REP(i,n) d[i].X--;
  }
  REP(i,n)if( (d[i].X+d[i].Y)%2 == 0 ) return cout<<-1<<endl,0;
  vector<ll> base;
  REP(i,32) base.eb((1LL<<i));
  if( fg ) base.eb(1LL);
  reverse(ALL(base));
  cout<<SZ(base)<<endl;
  REP(i,SZ(base)) cout<<base[i]<<(i==SZ(base)-1 ?'\n':' ');
  string s;
  REP(i,n){
    s.clear();
    if( fg ) s += 'R';
    for(int j=31;j>=0;j--){
      ll bst = -1, cur = INF;
      REP(k,4){
        ll tmp = abs(d[i].X-dx[k]*(1LL<<j))+abs(d[i].Y-dy[k]*(1LL<<j));
        if( tmp < cur ) bst = k, cur = tmp;
      }
      d[i].X -= dx[bst]*(1LL<<j);
      d[i].Y -= dy[bst]*(1LL<<j);
      s += dir[bst];
    }
    cout<<s<<endl;
  }
}


Measured memory_bytes: 384
#include<iostream>

int main(void){
    long long x;
    std::cin >> x;
    long long cur = 100;
    long long ans = 0;

    while(true){
	ans++;
	cur += cur / 100;
	if(cur >= x){
	    break;
	}
    }
    std::cout << ans << std::endl;


    return 0;
}



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

using namespace std;
using lli = long long int;

vector<lli> input(int N) { vector<lli> r(N); for (int i = 0; i < N; i++)cin >> r[i]; return r; }

int main() {
	int N, M;
	cin >> N >> M;
	int dp_max = pow(2, N);
	vector<int> dp(dp_max + 10);
	for (int i = 0; i < dp_max; i++)dp[i] = INT32_MAX;
	dp[0] = 0;
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		int num = 0;
		for (int j = 0; j < b; j++) {
			int c;
			cin >> c;
			num += pow(2, c - 1);
		}
		//orとっていい感じにやる
		for (int x = dp_max - 1; x >= 0; x--) {
			if (dp[x] == INT32_MAX)continue;
			dp[x | num] = min(dp[x] + a, dp[x | num]);
		}
	}

	//for (int i = 0; i < dp_max; i++)cout << i << " : " << dp[i] << endl;
	if (dp[dp_max - 1] == INT32_MAX)cout << -1 << endl;
	else cout << dp[dp_max - 1] << endl;
}


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

int main(){
  int c500, c100, c50, sum;
  cin >> c500 >> c100 >> c50 >> sum;
  auto count = 0;
  
  for(auto a = 0; a <= c500; a++){
    for(auto b = 0; b <= c100; b++){
      for(auto c = 0; c <= c50; c++){
        auto total = 500*a + 100*b + 50*c;
        if(total == sum) count++;
      }
    }
  }
  cout << count << endl;  
}
  


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String args[] ) throws Exception {
    	new Main().exec(args);
    }

    public Main() {
    }

    private long[] ABC = new long[3];

    public void exec(String args[]) throws Exception {
    	//初期化読み込み
    	Scanner sc = new Scanner(System.in);
    	ABC[0] = sc.nextInt();
    	ABC[1] = sc.nextInt();
    	ABC[2] = sc.nextInt();
    	if(ABC[0] > ABC[1]) swap(0,1);
    	if(ABC[1] > ABC[2]) {
    		swap(1,2);
    		if(ABC[0] > ABC[1]) swap(0,1);
    	}
    	//System.out.println(ABC[0]+","+ABC[1]+","+ABC[2]);
    	if(ABC[0]%2==0 || ABC[1]%2==0 || ABC[2]%2==0) {
    		System.out.println("0");
    	}else{
    		System.out.println(ABC[0]*ABC[1]);
    	}
	}

    private void swap(int index1, int index2) {
		long temp=ABC[index1];
		ABC[index1]=ABC[index2];
		ABC[index2]=temp;
    }
}

Measured memory_bytes: 9808
A, B, C, X = [int(input()) for _ in range(4)]
result = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if 500 * i + 100 * j + 50 * k == X:
                result += 1
print(result)


Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include <queue>
#include <algorithm>
#include <stack>
#include <functional>
#define rep(i,j,n) for(i=j;i<(n);i++)
#define rrep(i,j,n) for(i=j;i>(n);i--)
typedef long long int lli;
#define N 1000000007

using namespace std;

//lli gcd(lli a,lli b){
//    lli x,y;
//    x=max(a,b);
//    y=min(a,b);
//    if(x%y==0){
//        return y;
//    }
//    else{
//        return gcd(y,x%y);
//    }
//}
//
//lli lcm(lli a,lli b){
//    lli x,y;
//    x=max(a,b);
//    y=min(a,b);
//    return x*y/gcd(x,y);
//}

int main(){
    lli n,k,s;
    vector<lli> f;
    lli i,j;
    cin>>n>>k>>s;
    rep(i,0,n){
        if(i<k){
            cout<<s;
        }
        else{
            if(s!=1){
                cout<<s-1;
            }
            else{
                cout<<s+1;
            }
        }
        if(i<n-1){
            cout<<" ";
        }
    }
    cout<<endl;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define fastIO ios::sync_with_stdio(0); cin.tie(NULL);
typedef long long ll;
using namespace std;


int main(){
    fastIO
    string s, t; cin>>s>>t;
    int res = t.length();
    for(int i=0; i<=s.length()-t.length(); i++){
      int d =0;
      for(int j=0; j<t.length(); j++){
        if(t[j] != s[j+i]){
          d++;
        }
      }
      res = min(res,d);
    }
    cout<<res;
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _GLIBCXX_DEBUG

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int mod = 1e9 + 7;
const int MAX = 510000;
const int V = 100005;
ll dy[8] = {1,0,-1,0,1,-1,1,-1};
ll dx[8] = {0,1,0,-1,1,-1,-1,1};

int main(){
    int N; cin >> N;
    vector<int> L(N);
    for(int i = 0; i < N; i++){
        cin >> L[i];
    }
    sort(L.begin(), L.end());
    int ans = 0;
    for(int i = 0; i < N; i++){
        for(int j = i + 1; j < N; j++){
            int a = L[i], b = L[j];
            auto it = lower_bound(L.begin(), L.end(), b + a);
            ans += it - (L.begin() + j + 1);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
#define sa(a,n,t) for(int ii=0;ii<n;ii++) scanf("%"#t"",&(a)[ii])
#define rep(i,n) for(int i=0;i<n;i++) 
#define reps(i,a,n) for(int i=a;i<n;i++) 
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rreps(i,a,n) for(int i=n-1;i>=a;i--)
#define validl(i,a,b) ((i>=a)&&(i<=b))?1:0
#define validmat(x,y,a,b,c,d) (validl(x,a,b) && validl(y,a,b))?1:0
#define validmn(x,y,m,n) validmat(x,y,0,m,0,n)
#define valid(i,n) validl(i,0,n)
#define v(t) vector<t>
#define vv(t) vector<vector<t> >
#define mk make_pair
#define pb push_back
#define pa(a,n,t)  for(int i=0;i<n;i++) printf("%"#t"",a[i])
#define p2 pair<int,int>
#define p3 pair<p2,int>
#define fi first
#define se second
#define sd(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define pl(a) printf("%lld",a)
#define pd(a) printf("%d",a)
#define sf(a) scanf("%lf",&a)
#define pf(a) printf("%lf",a)
#define nline printf("\n")
#define ss(a) scanf("%s",a)
#define ps(a) printf("%s",a)
#define sc(a) scanf("%c",&a)
#define pc(a) printf("%c",&a)
#define mf(m,f) m.find(f)!=m.end()
#define pp3(m) cout<<m.fi.fi<<" "<<m.fi.se<<" "<<m.se<<" "
#define pp2(m) cout<<m.fi<<" "<<m.se<<" "
#define debug 0
/*v(int) adj[200001];
void dfs(int i,int p){
    rep(j,adj[i].size()){
        if(p!=adj[i][j])
            dfs(adj[i][j],i);
    }
}*/
int main()
{
  int n;
  int a[200001];
  cin>>n;
  sa(a,n,d);
  map<int,int> mp;
  lli ans=0;
  rep(i,n){
      ans+=mp[i-a[i]];
      mp[a[i]+i]++;
  }
  cout<<ans<<endl;
  return 0;
}


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

#define HOUR	3600	//1??????????§???°
#define MINUTE	60		//1???????§???°

class Time{
public:
	int h=0;
	int s=0;
	int m=0;
//???????????¢??°
	void changeSerialToTime(long Serial){
		h	= Serial/HOUR;
		s	=(Serial%HOUR)/MINUTE;
		m	=(Serial%HOUR)%MINUTE;
	};
};
//???????????¢??°
int main(){
	long S = 0;
	Time time;
	cin >> S;
	time.changeSerialToTime(S);
	cout << time.h << ":"<< time.s  <<":"<< time.m << endl;
	return 0;
}

Measured memory_bytes: 3116
#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[]) {
    //データを与えられる変数
    int n;
    double x[100],y[100];
    //アクセス用変数
    int i;
    //答えを入れる変数
    double D1,D2,D3,Dinf;
    //計算で一時的に数値を入れる変数
    double a=0.0;
    
    D1=0.0;
    D2=0.0;
    D3=0.0;
    Dinf=0.0;
    
    scanf("%d",&n);//n次元か入力
    for(i=0;i<n;i++){
        scanf("%lf",&x[i]);//x方向のベクトルを入力
    }
    for(i=0;i<n;i++){
        scanf("%lf",&y[i]);//y方向にベクトルを入力
    }
    
    for(i=0;i<n;i++){
        D1=D1+fabs(x[i]-y[i]);//マンハッタン距離を求める
    }
    
    for(i=0;i<n;i++){
        a=a+pow(fabs(x[i]-y[i]),2.0);
    }
    D2=sqrt(a);//ユークリッド距離を求める
    
    a=0;
    
    for(i=0;i<n;i++){
        a=a+pow(fabs(x[i]-y[i]),3.0);
    }
    D3=cbrt(a);//三次元距離を求める
    
    for(i=0;i<n;i++){
        if(fabs(x[i]-y[i])>Dinf){
            Dinf=fabs(x[i]-y[i]);
        }
    }
    
    printf("%f\n",D1);
    printf("%f\n",D2);
    printf("%f\n",D3);
    printf("%f\n",Dinf);
    

    return 0;
}



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

using namespace std;


int main()
{
    int n;
    cin >> n;
    string ar;
    cin >> ar;
    int t = n;
    for(int i =0;i<n-1;i++){
        if(ar[i]==ar[i+1]){
            t--;
        }
    }
    cout << t;
}

Measured memory_bytes: 512
s=gets.chop
k=gets.to_i
n=s.size
for i in 0..n-1
    x=s[i].ord-97
    if x>0 and k>=26-x
        s[i]=?a
        k-=26-x
    end
end
s[-1]=((s[-1].ord-97+k%26)+97).chr
puts s


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

#define loop(s, e, i) for (int i=s; i<e; ++i)
#define print(s) cout << s << endl;
using namespace std;
using ll = long long;

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  while(b != 0) {
    ll tmp = b;
    b = a % b;
    a = tmp;
  }
  return a;
}

int main() {
  ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
  ll N;
  cin >> N;
  vector<ll> A(N+1);
  vector<ll> NUM(N+1);

  loop(1, N+1, i) {
    cin >> A[i];
  }
  int cnt = 0;
  for (int i=N; i >= 1; i--) {
    int k = 0;
    for (int j=i; j<=N; j+=i) {
      if (NUM[j] == 1) {
        k++;
      }
    }
    if (k%2 != A[i]) {
      NUM[i] = 1;
      cnt++;
    }
  }
  if (cnt == 0) {
    print(0);
    return 0;
  }
  print(cnt);
  bool flag = true;
  for (int i=1; i<=N; i++) {
    if (NUM[i] == 1) {
      if (flag) {
        cout << i;
        flag = false;
      } else {
        cout << " " << i;
      }
    }
  }
  cout << "\n";
  return 0;
}

Measured memory_bytes: 6348
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define last Last
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
#define gc getchar
inline int read()
{
	int ret=0,f=0;char c=gc();
	while(!isdigit(c)){if(c=='-')f=1;c=gc();}
	while(isdigit(c)){ret=ret*10+c-48;c=gc();}
	if(f)return -ret;return ret;
}
signed main()
{
    int k=read(),n=read();
    if(k%2==0)
    {
        cout<<k/2<<" ";
        for(int i=2;i<=n;i++)cout<<k<<" ";
        return 0;
    }
    vector<int>ans;
    for(int i=1;i<=n;i++)ans.push_back(k/2+1);
    for(int i=1;i<=n/2;i++)
    {
        if(ans.back()==1)ans.pop_back();
        else{
            ans.back()--;
            while(ans.size()<n)ans.push_back(k);
        }
    }
    for(int i=0;i<ans.size();i++)cout<<ans[i]<<" ";
}
/*
逐位确定 
*/

Measured memory_bytes: 3568
#include <stdio.h>

void insertionSort(int num[],int n){
    int i,v,j;
    for(i=1;i<n;i++){
        v=num[i];
        j=i-1;
        while(j>=0&&num[j]>v){
            num[j+1]=num[j];
            j--;
            num[j+1]=v;
        }
        for(j=0;j<n;j++){
            printf("%d",num[j]);
            if(j!=n-1){
                printf(" ");
            }
        }
        printf("\n");
    }
} 

int main(void){
    int num[101];
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&num[i]);
        printf("%d",num[i]);
        if(i!=n-1){
            printf(" ");
        }
    }
    printf("\n");
    insertionSort(num,n);
    return 0;
}



Measured memory_bytes: 2148
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

struct Data {
    val: u64,
    cnt: u64,
    gt: u64,
    lt: u64,
}

fn main() {
    let nmvp: Vec<u64> = read_vec();
    let n = nmvp[0] as usize;
    let m = nmvp[1];
    let v = nmvp[2];
    let p = nmvp[3] as usize;
    let mut a: Vec<u64> = read_vec();
    a.sort_by(|x, y| y.partial_cmp(x).unwrap());

    let border = a[p - 1];

    //println!("border : {}", border);

    let mut q = 0;
    for i in 0..n {
        if a[i] == border {
            q = i;
            break;
        }
    }

    let mut d: Vec<Data> = vec![];

    let mut tmp = 0;
    for i in 1..n {
        if a[i - 1] > a[i] {
            d.push(Data {
                val: a[i - 1],
                cnt: i as u64 - tmp,
                gt: tmp,
                lt: n as u64 - i as u64,
            });
            tmp = i as u64;
        }
    }
    d.push(Data {
        val: a[n - 1],
        cnt: n as u64 - tmp,
        gt: tmp,
        lt: 0,
    });

    /*
    println!("q : {}", q);

    for i in 0..d.len() {
        println!("{} {} {} {}", d[i].val, d[i].cnt, d[i].gt, d[i].lt);
    }
    */

    let mut ans = 0;
    let mut tmp = 0;
    let mut tmpcnt = 0;

    for i in 0..d.len() {
        /*
        println!("ans : {}", ans);
        println!("");
        */

        if d[i].val >= border {
            ans += d[i].cnt;
        } else if d[i].val + m < border {
            break;
        } else if d[i].cnt + d[i].lt + q as u64 >= v {
            //println!("hoge : {}", d[i].val);
            ans += d[i].cnt;
        } else {
            let rest = m * (v - d[i].cnt - d[i].lt - q as u64);

            let capacity = tmp + (d[i].val + m - border) * tmpcnt + (p - q) as u64;

            /*
            println!("i: {}", i);
            println!("tmp : {}", tmp);
            println!("tmpcnt : {}", tmpcnt);
            println!("rest : {}", rest);
            println!("capa : {}", capacity);
            */

            if rest < capacity {
                ans += d[i].cnt;
            } else {
                break;
            }
        }

        if d[i].val <= border {
            tmpcnt += d[i].cnt;
        }
        if d[i].val < border {
            tmp += (border - d[i].val) * d[i].cnt;
        }
    }

    println!("{}", ans);
}


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

namespace ABC166
{
    class Program
    {
        static void Main(string[] args)
        {
            a();
        }

        public static void a()
        {
            string s = Console.ReadLine();
            if(s == "ABC")
            { Console.WriteLine("ARC"); }
            else
            { Console.WriteLine("ABC"); }
        }
    }
}


Measured memory_bytes: 25716
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}

int main(void) {

	int n, m, X, Y;
	cin >> n >> m >> X >> Y;

	int maxi = -1000,mini = 1000;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		CHMAX(maxi, x);
	}
	maxi += 1;
	CHMAX(maxi,X + 1);
	for (int i = 0; i < m; i++) {
		int y;
		cin >> y;
		CHMIN(mini, y);
	}
	CHMIN(mini,Y);
	
	if (maxi <= mini) {
		COUT("No War");
	}
	else {
		COUT("War");
	}


	return 0;
}


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

int main()
{
	string str, com, p;

	int q, a, b;

	cin >> str >> q;

	for (int t = 0; t < q; t++){
		cin >> com >> a >> b;

		if (com == "print"){
			cout << str.substr(a, b - a + 1) << endl;
		}
		else if (com == "reverse"){
			string tmp = str.substr(a, b - a + 1);
			int n = tmp.size();
			for (int i = 0; i < n; i++)
				str[i + a] = tmp[n - i - 1];
		}
		else if (com == "replace"){
			cin >> p;
			str = str.replace(a, b - a + 1, p);
		}
	}
	return 0;
}

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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
map<ll,ll>mp_a,mp_b;

map<ll,ll> prime_factors(ll n){
    map<ll,ll> factors;
    for(ll i=2;i*i<=n;i++){
            while(n%i==0){
                factors[i]++;
                n/=i;
            }
    }
    //greatest prime > sqrt()
    if(n>1)factors[n]=1;
    return factors;
}

int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    ll a,b;
    init();
    scanf("%lld%lld",&a,&b);
    
    for(auto it :prime_factors(a)){
        while(it.second--){
            mp_a[it.first]++;
        }
    }
   
    for(auto it :prime_factors(b)){
        while(it.second--){
            mp_b[it.first]++;
        }
    }
    ll cnt=0;
    for(auto it:mp_a){
        if(mp_b[it.first]>0)cnt++;
    }
    printf("%lld",cnt+1);
    return 0;
}

Measured memory_bytes: 256
def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n - r] % mod


mod = 10**9 + 7  #出力の制限
N = 10**5
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  #逆元テーブル
inverse = [0, 1]  #逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)

N, K = map(int, input().split())

for i in range(1, K + 1):
    blue = cmb(K - 1, i - 1, mod)
    red_num = (N - K) - (i - 1)
    if red_num < 0:
        print(0)
        continue
    red = cmb(red_num + i, i, mod)
    print(blue * red % mod)


Measured memory_bytes: 58224
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	string a, b, c;
	cin >> a >> b >> c;
	if (a[a.size() - 1] == b[0] && b[b.size() - 1] == c[0])cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
int N, K, S;
	cin >> N >> K >> S;
	fx(K) {
		cout << S << ' ';
	}
	if (S==1000000000) {
		fx(N - K) {
			cout << 1000000000-1 << ' ';
		}
	}
	else {
		fx(N-K) {
			cout << 1000000000 << ' ';
		}
	}

    return 0;
}



Measured memory_bytes: 1280
#include<stdio.h>

int main(int argc, char* argv[])
{
  int d[101][101];
  int r, c, i, j;

  for(i = 0; i < 101; i++){
    for(j = 0; j < 101; j++){
      d[i][j] = 0;
    }
  }

  scanf("%d %d", &r, &c);
  for(i = 0; i < r; i++){
    for(j = 0; j < c; j++){
      scanf("%d", &d[i][j]);
      d[i][c] += d[i][j];
      d[r][j] += d[i][j];
      d[r][c] += d[i][j];
    }
  }

  for(i = 0; i <= r; i++){
    for(j = 0; j < c; j++){
      printf("%d ", d[i][j]);
    }
    printf("%d\n", d[i][j]);
  }

  return(0);
}

Measured memory_bytes: 640
from collections import Counter
li=[]
d={}
t=int(input())
for i in range(t):
    p=input()
    if(p in d):
        d[p]+=1
    else:
        d[p]=1  
if('AC' not in d):
    d['AC']=0
if('WA' not in d):
    d['WA']=0
if('TLE' not in d):
    d['TLE']=0
if('RE' not in d):
    d['RE']=0
print('AC','x',d['AC'] )
print('WA','x',d['WA'])
print('TLE','x',d['TLE'])
print('RE','x',d['RE'])

Measured memory_bytes: 9332
#include<iostream>
#include<algorithm>
#include<tuple>
#include<vector>
#include<cstdio>
using namespace std;
#define MAX_N 514514
tuple<int, int, int>A1[MAX_N], A2[MAX_N];
int N, Q, X1, Y1, X2, Y2; vector<int>vec;
int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		scanf("%d%d", &X1, &Y1);
		A1[i] = make_tuple(X1, Y1, i);
		A2[i] = make_tuple(Y1, X1, i);
	}
	sort(A1, A1 + N); sort(A2, A2 + N);
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		scanf("%d%d%d%d", &X1, &X2, &Y1, &Y2);
		int pos1 = lower_bound(A1, A1 + N, make_tuple(X1, Y1, 0)) - A1;
		int pos2 = upper_bound(A1, A1 + N, make_tuple(X2, Y2, MAX_N)) - A1;
		int pos3 = lower_bound(A2, A2 + N, make_tuple(Y1, X1, 0)) - A2;
		int pos4 = upper_bound(A2, A2 + N, make_tuple(Y2, X2, MAX_N)) - A2;
		int size1 = pos2 - pos1;
		int size2 = pos4 - pos3;
		vec.clear();
		if (size1 <= size2) {
			for (int j = pos1; j < pos2; j++) {
				int Y = get<1>(A1[j]);
				if (Y1 <= Y && Y <= Y2) { vec.push_back(get<2>(A1[j])); }
			}
		}
		else {
			for (int j = pos3; j < pos4; j++) {
				int X = get<1>(A2[j]);
				if (X1 <= X && X <= X2) { vec.push_back(get<2>(A2[j])); }
			}
		}
		sort(vec.begin(), vec.end());
		for (int j = 0; j < vec.size(); j++) { printf("%d\n", vec[j]); }
		cout << endl;
	}
	return 0;
}

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

using namespace std;

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

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

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int main()
{
	char c;
	cin>>c;
	cout<<char(c+1)<<endl;
	return 0;
}

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

int main() {
    ll H, W;
    cin >> H >> W;

    ll area = H * W;
    if (H == 1 || W ==1) {
        cout << 1 << endl;
        return 0;
    }
    if (area % 2 == 0) {
        cout << area / 2 << endl;
    }
    else {
        cout << area / 2 + 1 << endl;
    }
    return 0;
}

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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s,t;
	cin >>s>>t;
	if(s.compare(t.substr(0,t.length()-1)) == 0)
		cout <<"Yes"<<endl;
	else
	{
			cout <<"No\n";
	}
	

}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
using namespace std;
const int N = 1e6 + 10, Mod = 1e9 + 7;
int n, a, b, C[3];
int main()
{
    scanf("%d%d%d", &n, &a, &b);
    for (int i = 1; i <= n; i++)
    {
        int c;
        scanf("%d", &c);
        if (c <= a) C[0] ++;
        else if (a < c && c <= b) C[1] ++;
        else C[2] ++;
    }
    printf("%d\n", min({C[1], C[2], C[0]}));
    return (0);
}

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

def main():
    N,M,X,Y = map(int, input().split())
    z = [i for i in range(X+1,Y+1)]
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    x.sort()
    y.sort()
    b = False
    for i in z:
        if x[-1] < i and i <= y[0]:
            b = True        
    if b:
        print("No War")
    else:
        print("War")
            
if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
// 2019-11-01-18.57.19
#include <bits/stdc++.h>

using namespace std;
using ll=long long;
using vi=vector<int>;

int main() {
    ios::sync_with_stdio (false), cin.tie (0);
    int n;
    cin >> n;
    vi a(n);
    int mx = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        mx = max(a[i] , mx);
    }
    sort(a.begin(), a.end());
    pair < int , int > ans = {1e9 , -1};
    for(int i = 0; i < n; i++){
            int x = abs(a[i] * 2 -  a[n - 1]);
        ans = min(ans , make_pair(x , a[i]));
    }
    cout<< a[n - 1] << ' ' << ans.second << '\n';
    return 0;
}













Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
vector<ll> prime_factorize(ll x){
    vector<ll> res;
    ll y=x;

    for(ll i=2; i*i<=x; i++){
        while(y%i==0){
            y/=i;
            res.push_back(i);
        }
    }
    if(y>1) res.push_back(y);

    return res;
}

ll pow(ll n, ll x, ll mod){
    // return (n^x)%mod
    if(x==0) return 1;
    if(x%2==0){
        ll t=pow(n, x/2, mod);
        return (t*t)%mod;
    }else{
        return (n*pow(n, x-1, mod))%mod;
    }
}

ll gcd(ll a, ll b){
    if(a<b) swap(a,b);
    if(a%b==0) return b;
    else return gcd(b, a%b);
}

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


int main(){
    ll n; cin>>n;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    ll res=a[0];
    rep(i,n-1) res=lcm(res, a[i+1]);
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3108
#include <iostream>
#include <map>
#include <algorithm>
using namespace std; typedef long long ll; const int INF=1e9+7;
typedef pair<ll,ll> P;

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

  ll xo=0;
  for(ll i=0;i<n;i++) {
    ll yk; if (i==n-1) yk=a[n-1]; else yk=a[i]-a[i+1];
    yk%=2;
    xo ^= (i+1) * yk;
  }
  if (xo == 0) cout<<"second"<<endl;
  else cout<<"first"<<endl;
}

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

using namespace std;
typedef long long ll;

int main(){
	
	vector<int> P(4);
	for(int i = 0; i < 3; i++){
		int a, b;
		cin >> a;
		P[--a]++;
		cin >> b;
		P[--b]++;
	}		

	sort(P.begin(), P.end(), greater<int>());
//	for(int i = 0; i < 4; i++) cout << P[i] << endl;
	if(P[0] > 2 || P[3] == 0) cout << "NO" << endl;
	else cout << "YES" << endl;
}

Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	as <- readInts
	print $ sum as - maximum as


Measured memory_bytes: 508
import java.util.*;
public class Main {
	public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	// 整数の入力
      	int count = 0;
	int K = sc.nextInt();
		for(int i = 2;i <= K; i = i + 2){
          		for(int j = 1;j <= K; j = j + 2){
            			count++;
          		}
        	}

	System.out.print(count);

	}
}

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

// ---------------------------template starts here-------------------------- 

#define int long long int
#define pb push_back
#define MAX INT_MAX
#define F first
#define precise std::cout << std::fixed;std::cout << std::setprecision(6); 
#define S second  
#define mp make_pair
#define MIN INT_MIN
#define MOD 1000000007
#define FO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

set <int> s;
bool ar[100001];
void seive() {
    ar[0] = ar[1] = true;

    for(int p=2; p*p<=100001; p++) {
        if(ar[p] == false) {
            for(int i=p*p;i<=100001;i+=p)
                ar[i] = true ;
        }
    }

    for(int p=2;p<=100001;p++) {
        if(ar[p] == false)
            s.insert(p);
    }
}

bool is_palindrome(string str) {
    int len = str.length();
    for(int i=0;i<=len/2;i++) {
        if(str[i] != str[len-1-i])
            return false;
    }
    return true;
}

int binexpo(int x, int y, int p) {    
    int res = 1;     // Initialize result  
    x = x % p; // Update x if it is more than or  
                // equal to p  

    while (y > 0)  {  
        // If y is odd, multiply x with result  
        if (y & 1)  
            res = (res*x) % p;  
  
        // y must be even now  
        y = y>>1; // y = y/2  
        x = (x*x) % p;  
    }  
    return res;
}
// --------------------------template ends here------------------------------

void solve() {
    string s1, s2;
    cin >> s1 >> s2;

    int l1 = s1.length();
    int l2 = s2.length();

    int dp[l1+1][l2+1];

    for(int i=0;i<=l1;i++) {
        for(int j=0;j<=l2;j++) {
            if(i == 0 || j == 0)
                dp[i][j] = 0;
            else if(s1[i-1] == s2[j-1])
                dp[i][j] = dp[i-1][j-1]+1;
            else
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
        }
    }    

    // for(int i=0;i<=l1;i++) {
    //     for(int j=0;j<=l2;j++) {
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    // cout << dp[l1][l2] << endl;

    if(dp[l1][l2] == 0)
        cout << " " << endl;
    else {
        string str = "";
        int i = l1;
        int j = l2;

        while(i > 0 && j > 0) {
            if(s1[i-1] == s2[j-1]) {
                str += s1[i-1];
                i--;
                j--;
            }
            else {
                if(dp[i-1][j] > dp[i][j-1]) {
                    i--;
                }
                else {
                    j--;
                }
            }
        }

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

        cout << str << endl;
    }
    return;
}
int32_t main() {
    FO;
    solve();
    return 0;
}

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

#define int long long

#define all(v) (v).begin(),(v).end()
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define low(a,b) lower_bound(all(a),(b))
#define upp(a,b) upper_bound(all(a),(b))
#define fill(i,n) memset(i,n,sizeof(i)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
static const ll maxLL = (ll)1 << 62;
const ll MOD=1000000007;
const ll INF=1e18;

int ans=0;
int N;

void dfs(int x,int y,int cnt3,int cnt5,int cnt7){
    y++;
    if(x+pow(10,y)*3<=N){
        if(cnt3+1&&cnt5&&cnt7)ans++;
        dfs(x+pow(10,y)*3,y,cnt3+1,cnt5,cnt7);
    }
    if(x+pow(10,y)*5<=N){
        if(cnt3&&cnt5+1&&cnt7)ans++;
        dfs(x+pow(10,y)*5,y,cnt3,cnt5+1,cnt7);
    }
    if(x+pow(10,y)*7<=N){
        if(cnt3&&cnt5&&cnt7+1)ans++;
        dfs(x+pow(10,y)*7,y,cnt3,cnt5,cnt7+1);
    }
}

signed main() {
    //IOS();
    /*シフト演算は(1ll<<x)*/
    cin>>N;
    dfs(3,0,1,0,0);
    dfs(5,0,0,1,0);
    dfs(7,0,0,0,1);
    cout<<ans<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

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

int main(void) {
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  int x = x2; 
  int y = y2;

  int dx = x2 - x1;
  int dy = y2 - y1;

  int ans_x[2];
  int ans_y[2];

  for (int i = 0; i < 2; i++) {
    swap(dx, dy);
    dx = -dx;
    x += dx;
    y += dy;

    ans_x[i] = x;
    ans_y[i] = y;
  }

  cout << ans_x[0] << " " << ans_y[0] << " " << ans_x[1] << " " << ans_y[1] << endl;

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define rep(i,n) for(int i=2;i<n;i++)
ll a[1919];
using namespace std;
int main() {
	int n;
	cin>>n;
	a[0]=2;
	a[1]=1;
	rep(i,n+1){a[i]=a[i-1]+a[i-2];}
	cout<<a[n]<<endl;
	}


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

long long sum_ra(long long fi, long long la)
{
	return (fi + la) * (la - fi + 1) / 2;
}

int main()
{
	long long n, k;
	cin >> n >> k;
	long long sum = 0;
	long long d(1e9 + 7);
	for (long long i = k; i <= n + 1; i++)
	{
		sum += ((sum_ra(n - i + 1, n) - sum_ra(0, i - 1)) + 1);
		sum %= d;
	}
	cout << sum << endl;
}

Measured memory_bytes: 3624
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();
    if ((a*b)%2==0) {
      System.out.println("Even");
    }else{
      System.out.println("Odd");
    }
  }
}


Measured memory_bytes: 23636