akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
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; }

const int MOD = 1000000007;
const int INF = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};

map<ll, int> prime_factor(ll n){
	map<ll, int> res;
	for(ll i = 2; i*i<=n; i++){
		while(n%i==0){
			res[i]++;
			n/=i;
		}
	}
	if(n!=1) res[n]++;
	return res;
}

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

void solve(){
	ll a, b;
	cin >> a >> b;
	auto mp = prime_factor(__gcd(a, b));
	int ans = mp.size()+1;
	cout << ans << endl;
}

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

Measured memory_bytes: 256
import sys
import collections


while True:
    N, M, P = map(int, sys.stdin.readline().split())
    if N == 0:
        break
    X = []
    for n in xrange(N):
        X.append(int(sys.stdin.readline()))
    if X[M - 1] == 0:
        print 0
    else:
        print int(float(sum(X)) * 100 * (100 - P) / 100 / X[M - 1])

Measured memory_bytes: 4608
local h,n=io.read("n","n")
local a,b={},{}
for i=1,n do
    a[i],b[i]=io.read("n","n")
end

local dp={0}
for i=2,h+1 do
    dp[i]=10^9
end

for i=1,n do
    for j=1,h+1 do
        local k=math.min(j+a[i],h+1)
        dp[k]=math.min(dp[k],dp[j]+b[i])
    end
end
print(dp[h+1])

Measured memory_bytes: 2704
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a, b, c=0;
    cin>>b>>a;
    if(2*b<=a)
    {
        c+=b;
        if(a%2==0)
            a-=2*b;
        else
            a-=2*b;
        while(a>=4)
        {
            c++;a-=4;
        }
    }
    else if(2*b>a)
    {
        c+=a/2;
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
import collections
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
N = int(input())
c = collections.Counter(prime_factorize(N))
def getCount(w):
    i = 1
    n = 1
    while n <= w:
        i+=1
        n+=i
    return i - 1
cnt = 0
for v in c.values():
    cnt += getCount(v)
print(cnt)

Measured memory_bytes: 9308
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

#define MAX_N (100000L)

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  long N, as[MAX_N + 1], bs[MAX_N];
  scanf("%ld", &N);
  for (long i = 0; i < N + 1; i++) {
    scanf("%ld", &as[i]);
  }
  for (long i = 0; i < N; i++) {
    scanf("%ld", &bs[i]);
  }

  // solve
  long ans = 0;
  ans += min(as[0], bs[0]);
  bs[0] -= min(as[0], bs[0]);
  for (long i = 1; i < N; i++) {
    const long num0 = min(as[i], bs[i - 1]);
    as[i] -= num0;
    const long num1 = min(as[i], bs[i]);
    as[i] -= num1;
    bs[i] -= num1;
    ans += num0 + num1;
  }
  ans += min(as[N], bs[N - 1]);
  printf("%ld\n", ans);
  
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <map>
using namespace std;

bool check(vector<string> &S, int d){
    int N = S.size();
    for(int i=0; i<N; i++)
        for(int j=0; j<N; j++)
            if(S[i][(j+d)%N] != S[j%N][(i+d)%N])
                return false;
    return true;
}

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    for(int i=0; i<N; i++)
        cin >> S[i];

    long long ans = 0;
    for(int i=0; i<N; i++){
        if(check(S, i))
            ans++;
    }
    ans *= N;
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;

int main()
{
	ll  n;
	cin >> n;
	ll ans = n / 11;
	ans *= 2;

	ll tmp = n % 11;
	if (tmp > 6) ans += 2;
	else if (tmp) ans++;

	cout << ans << endl;
}

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

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      String[] line = br.readLine().split(" ");
      int buf = 0;
      Stack stack = new Stack(line.length);

      for (String s : line) {
        switch(s) {
          case "+" :
            buf += stack.pop();
            buf += stack.pop();
            stack.push(buf);
            buf = 0;
            break;

          case "-" :
            buf -= stack.pop();
            buf += stack.pop();
            stack.push(buf);
            buf = 0;
            break;

          case "*" :
            buf  = stack.pop();
            buf *= stack.pop();
            stack.push(buf);
            buf = 0;
            break;

          default :
            stack.push(Integer.parseInt(s));
            break;
        }
      }

      System.out.println(stack.pop());
    }
  }
}

class Stack {
  int[] stack;
  int ite;

  public Stack(int capacity) {
    stack = new int[capacity];
    ite = 0;
  }

  public void initialize() {
    ite = 0;
  }

  public int getIte() {
    return ite;
  }

  public boolean isEmpty() {
    return ite == 0;
  }

  public boolean isFull() {
    return ite >= stack.length-1;
  }

  public  boolean push(int x) {
    if(isFull()) return false;

    stack[++ite] = x;
    return true;
  }

  public int pop() {
    if(isEmpty()) return 0;

    return stack[ite--];

  }
}


Measured memory_bytes: 24444
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define size(a) int((a).size())
#define present(c, x) (c.find(x) != c.end()) 
#define printVerdict(verdict) cout << (verdict ? "YES": "NO") << '\n'
#define printDecimal(d) printf("%.9f\n", d)
#define inrange(val, start, end) (val >= start && val <= end)
 
const int mod = 1e9 + 7; 
 
template <class T1, class T2, class T3> 
void printTuple(tuple<T1, T2, T3> t) { cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << '\n'; }
template <class T1, class T2>
void printPair(pair<T1, T2> p) { cout << p.first << " " << p.second  << '\n'; }
template <class T>
void printArray(vector<T> arr) { for (int i = 0; i<size(arr); i++) {cout << arr[i] << " ";} cout << '\n'; } 

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s,t; cin >> s >> t;
	int ret = 1e9;
	for (int i = 0; i+size(t)-1<size(s); i++) {
		int curr = 0;
		for (int j = 0; j<size(t); j++) {
			if (s[i+j] != t[j]) curr++;
		}
		ret = min(ret, curr);
	}
	cout << ret << '\n';
}


Measured memory_bytes: 3616
#include <stdio.h>

int main(){
  char c;
  long long int ans = 0;
  int num_b = 0;
  while (1) {
    c = getchar();
    if(c == 'B'){
      num_b++;
    }else if (c == 'W'){
      ans = ans + num_b;
    }else{
      break;
    }
  }
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
const int INF=1e9;
const int MOD=1e9+7;
//const int MOD=998244353;
const long long LINF=1e18;
using namespace std;
#define int long long
//template
//main
signed main(){
  int N,M;cin>>N>>M;
  std::vector<int> v[N];
  typedef pair<int,int> P;
  map<P,int> m;
  for(int i=0;i<M;i++){
    int a,b;cin>>a>>b;a--;b--;
    v[a].push_back(b);
    v[b].push_back(a);
    if(a>b)swap(a,b);
    m[P(a,b)]++;
  }
  if(M&1){
    cout<<-1<<endl;
    return 0;
  }
  std::vector<int> w[N],used(N,0);
  queue<int> que;
  que.push(0);used[0]++;
  while(que.size()){
    int p=que.front();que.pop();
    for(int q:v[p]){
      if(used[q])continue;used[q]++;
      w[p].push_back(q);
      w[q].push_back(p);
      m[P(min(p,q),max(p,q))]--;
      que.push(q);
    }
  }
  std::vector<int> fr(N,0);
  std::vector<P> ans;
  for(auto p:m){
    if(p.second==0)continue;
    ans.push_back(p.first);
    fr[p.first.first]++;
  }
  std::vector<int> si(N);
  for(int i=0;i<N;i++){
    si[i]=w[i].size();
    if(si[i]==1)que.push(i);
  }
  while(que.size()){
    int p=que.front();que.pop();
    for(int q:w[p]){
      if(m[P(min(p,q),max(p,q))])continue;
      m[P(min(p,q),max(p,q))]++;
      if(fr[p]&1)ans.push_back(P(p,q));
      else{
        ans.push_back(P(q,p));
        fr[q]++;
      }
      si[q]--;
      if(si[q]==1)que.push(q);
    }
  }
  int a=1,o=0;
  if(ans.size()!=M)a/=o;
  for(auto p:ans){
    cout<<p.first+1<<" "<<p.second+1<<endl;
  }
}


Measured memory_bytes: 24056
#![allow(clippy::needless_range_loop)]

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        #[allow(unused_mut)]
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize
    }
    println!("{}", (10000 - n) % 1000);
}


Measured memory_bytes: 2128
num = gets.to_i
flag = true
arr = Array.new
num.times do |i|
  arr.push(gets)
  if (arr[i][0] != arr[i-1][-2] && i >= 1) then
    flag = false
  end
end
if (arr.size == arr.uniq.size && flag == true) then
  puts "Yes"
else puts "No"
end


Measured memory_bytes: 1788
import os
def energy(ith,distance):
    if (ith==1): return distance+((1+1)**2)*distance
    return (2*ith+1)*distance

def solve(k):
    tmp=0
    starti=N-1
    endi=starti-k+1

    times = N/k
    if (N%k): times+=1
    for i in range(times):
        totStart=suma[starti]
        if (endi-1<0): totEnd=0
        else: totEnd=suma[endi-1]
        tot=totStart-totEnd
        tmp+=energy(i+1,tot)
        starti=endi-1
        endi=starti-k+1
    return tmp



N,X = map(int,raw_input().split())
a = map(int,raw_input().split())
ans = 0
ans += N*X

suma=a
for i in range(1,len(a)):
    suma[i]=suma[i-1]+a[i]
MIN = 100000**6
for i in range(1,N+1):
    tmpAns=solve(i)+X*i
    if (tmpAns<MIN):
        MIN=tmpAns
ans=ans+MIN
print(ans)


Measured memory_bytes: 23992
a,b=map(int,input().split())

# aをずっと足していくパターン
i1=b-a if a<b else float("inf")

# aをずっと足していき、-aにするパターン
i2=-a-b+1 if -a>=b else float("inf")

# -aにしてずっと足していくパターン
i3=a+b+1 if -a<=b else float("inf")

# -aにしてずっと足して、さらに -aにするパターン
i4=a-b+2 if a>=b else float("inf")


print(min(i1,i2,i3,i4))

Measured memory_bytes: 8972
#include <stdio.h>
int main(void){
    int n,a,b,c,d,x;
    while(~scanf("%d",&n)){
        x=0;
        for(a=0;a<=9;a++)
        for(b=0;b<=9;b++)
        for(c=0;c<=9;c++)
        for(d=0;d<=9;d++)
            if(a+b+c+d==n)x++;
        printf("%d\n",x);
    }
    return 0;
}

Measured memory_bytes: 1024
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include<ext/rope>
using namespace __gnu_cxx;
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<int> C;
#define X real()
#define Y imag()
//typedef unordered_set<ll> usll;
//typedef unordered_multiset<ll> umsll;
typedef multiset<ll> msll;
typedef set<ll> sll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef vector<pair<ll,ll> > vpll;
typedef priority_queue<ll> pqll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
//typedef unordered_multiset<int> umsi;
//typedef unordered_set<int> usi;
typedef pair<int,int> pi;
typedef vector<pair<int,int> > vpi;
typedef vector<pair<double,double> > vpd;
typedef pair<double,double> pd;
typedef priority_queue<int> pqi;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ind_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ind_setll;
#define in insert
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define be begin
#define en end
#define itr iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define mo 998244353
#define inf 1000000000000000001
#define ninf -1000000000000000001
#define ima INT_MAX
#define imi INT_MIN
#define oncnt __builtin_popcount
#define zerobegin __builtin_clz
#define zeroend __builtin_ctz
#define parity __builtin_parity
const ld pii=3.14159265359;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return((a-b+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}

void dfs(int cur,stack<int> &s,vi ch[],bool vis[])
{
	if(!vis[cur])
	{
		vis[cur]=true;
		for(int i=0;i<ch[cur].size();i++)
		{
	
			dfs(ch[cur][i],s,ch,vis);
		}
	}
	s.push(cur);
}

int main()
{
//io
int testcases=1;//cin>>testcases;
while(testcases--)
{	
int n,m;
cin>>n>>m;
vi par[n+1];
vi ch[n+1];
for(int i=0;i<m;i++)
{
	int a,b;
	cin>>a>>b;
	par[b].pb(a);
	ch[a].pb(b);
}


vi zd;
for(int i=1;i<=n;i++)
{
	if(par[i].size()==0)
	{
		zd.pb(i);
	
	}
}


int ma=imi;

int dp[n+1]={0};
for(int i=0;i<zd.size();i++)
{
stack<int> s;
bool vis[n+1]={false};

	dfs(zd[i],s,ch,vis);

while(!s.empty())
{
int k=s.top();
s.pop();
for(int j=0;j<ch[k].size();j++)
{
	int l=ch[k][j];
dp[l]=max(1+dp[k],dp[l]);
}
}

}

for(int i=0;i<n;i++)
{
	ma=max(ma,dp[i+1]);
}
cout<<ma;

}return 0;}








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

#include "bits/stdc++.h"

using namespace std;
#define int long long
#define FOR(i, a, b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i, n)  FOR(i,0,(n))


class AMaximizeTheFormula {
public:
    void solve(std::istream &in, std::ostream &out) {
      vector<int> a(3);
      REP(i, 3) in >> a[i];
      sort(a.begin(), a.end(), greater<int>());
      out << a[0] * 10 + a[1] + a[2] << endl;
    }
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
  AMaximizeTheFormula solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    set<ll> a;
    rep(i, n) {
        ll tmp;
        cin >> tmp;
        if (a.count(tmp) > 0) {
            a.erase(tmp);
        }
        else {
            a.insert(tmp);
        }
    }
    cout << sz(a) << endl;
    return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
const lint MOD = pow(10, 9) + 7;

int main() {
	int N;
	cin >> N;
	char C;
	int A;
	vector<bool>V(52,false);
	rep(i, N) {
		cin >> C >> A;
		if (C == 'S') {
			V[0 + A - 1] = true;
		}
		else if (C == 'H') {
			V[13 + A - 1] = true;
		}
		else if (C == 'C') {
			V[26 + A - 1] = true;
		}
		else if (C == 'D') {
			V[39 + A - 1] = true;
		}
	}
	string TRP = "SHCD";
	rep(i, 52) {
		if (V[i] == false) {
			cout << TRP[i / 13] <<' '<< i % 13+1 << endl;
		}
	}
}


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

struct query{
  int type;//0=empty, 1=add-sum ,2=set-min
  ll value;
  query(int a=0,ll b=0):type(a),value(b) {}
};


#define SIZE (1<<17)

ll INF=(1LL<<60);


struct segtree{
  query s[SIZE*2];
  ll t[SIZE*2];// sum-add
  ll u[SIZE*2];// min-set

  void func(int k,int l,int r,query q){
    if(q.type==1){
      if(s[k].type==0)s[k]=q;
      else s[k].value+=q.value;
      t[k]+=q.value*(r-l);
      u[k]+=q.value;
    }
    if(q.type==2){
      s[k]=q;
      t[k]=q.value*(r-l);
      u[k]=q.value;
    }
  }

  void compute(int k,int l,int r){
    query q=s[k];
    s[k]=query();
    if(q.type==0||r-l==1)return;
    int m=(l+r)/2;
    func(k*2+1,l,m,q);
    func(k*2+2,m,r,q);
  }

  void Update(int a,int b,query x,int k=0,int l=0,int r=SIZE){
    if(b<=l || r<=a)return;
    compute(k,l,r);
    if(a<=l && r<=b){
      func(k,l,r,x);
    }else{
      int m=(l+r)/2;
      Update(a,b,x,k*2+1,l,m);
      Update(a,b,x,k*2+2,m,r);
      t[k]=t[k*2+1]+t[k*2+2];
      u[k]=min(u[k*2+1],u[k*2+2]);
    }
  }

  ll Dfs(int type,int a,int b,int k=0,int l=0,int r=SIZE){
    if(b<=l || r<=a){
      if(type==1)return 0; //add
      if(type==2)return INF; // min
    }
    compute(k,l,r);
    if(a<=l && r<=b){
      if(type==1)return t[k];
      if(type==2)return u[k];
    }else{
      int m=(l+r)/2;
      ll lv=Dfs(type,a,b,k*2+1,l,m);
      ll rv=Dfs(type,a,b,k*2+2,m,r);
      if(type==1)return lv+rv; // add
      if(type==2)return min(lv,rv); // min
    }
  }

  ll Getsum(int a,int b){
    return Dfs(1,a,b);
  }

  ll Getmin(int a,int b){
    return Dfs(2,a,b);
  }
  
};

segtree T;

int main(){
  int n,q;
  scanf("%d %d",&n,&q);
  for(int i=0;i<q;i++){
    int type,a,b,c;
    scanf("%d %d %d",&type,&a,&b);
    if(type==0){
      scanf("%d",&c);
      T.Update(a,b+1, query(1,c) );
    }else{
      printf("%lld\n", T.Getmin(a,b+1) );
    }
  }
  return 0;
}



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

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		long a = in.nextLong();
		long b = in.nextLong();
		long gcd = gcd(a, b);
		System.out.println(a * b / gcd);
	}

	public static long gcd(long n1, long n2) {
    if (n2 == 0)
        return n1;
    return gcd(n2, n1 % n2);
	}
}



Measured memory_bytes: 21332
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define INF 999999

using namespace std;

int dp[101][101][6001];
int main(){
	int n;
	while(cin >> n ,n){
		int p[n];
		rep(i,n) cin >> p[i];
		rep(i,n+1) rep(j,n+1) rep(k,6000){
			dp[i][j][k] = INF;
		}
		dp[0][0][0] = 0;
		rep(i,n) rep(j,n) rep(k,5000) if(dp[i][j][k] != INF){
			dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j][k]);
		/*	if(k >= 500){
				cout << " k >=500" << endl;
				dp[i][j+k/500][k] = min(dp[i][j+k/500][k], dp[i][j][k]);
			}*/
			int cost = p[i]%1000;
			//cout <<"i= "<< i << " j= " << j << " k = " << k << " " << "cost = " << cost << endl;
			
			
			if(cost-500 <= k && cost >= 500) {
				//cout << "A " <<k-cost+500<< endl;
				dp[i+1][j+1][k - cost+500] = min(dp[i+1][j+1][k-cost+500],dp[i][j][k] + p[i]);
			}

			if(cost <= 500 && cost > 0){
				//cout << "B" << endl;
				dp[i+1][j+1][k + 500 - cost] = min(dp[i+1][j+1][k+500-cost],dp[i][j][k] + p[i]);
			}
			
			
			if(cost <= 500 && k >= cost+500){
				//cout << "C" << endl;
				dp[i+1][j+1][k-500-cost] = min(dp[i+1][j+1][k-500-cost], dp[i][j][k] + p[i]);
			}
			
			if(k-cost >= 0){
				dp[i+1][j][k-cost] = min(dp[i+1][j][k-cost], dp[i][j][k] + p[i]);		
			}
			else{
				dp[i+1][j][k+1000-cost] = min(dp[i+1][j][k+1000-cost], dp[i][j][k] + p[i]);
			}
			
		}
		int ans = 0,ans_min = INF;
		rep(i,n+1) rep(j,n+1) rep(k,5000) if(dp[i][j][k] != INF){
			if(j > ans || (j== ans && ans_min > dp[i][j][k]) ){
				ans = j;
				ans_min = dp[i][j][k];
			}
		}
		cout << ans << " " << ans_min << endl;
	}
	return 0;
}

Measured memory_bytes: 242196
#include <cstdio>
#include <cstring>
using namespace std;
int main(int argc, char *argv[]) {
    int n;
    int left[300000],right[300000];
    memset(left, 0, sizeof(left));
    memset(right, 0, sizeof(right));
    scanf("%d\n", &n);
    char s[300001];
    for (int i = 0; i < n; i++) {
        s[i]=getchar_unlocked();
    }
    for (int i = 1, k = 0; i < n; k = i++) {
        if (s[k] == 'W') {
            left[i] = left[k] + 1;
        }
        else {
            left[i] = left[k];
        }
    }
    for (int i = n - 2, k = n - 1; i >= 0; k = i--) {
        if (s[k] == 'E') {
            right[i] = right[k] + 1;
        }
        else {
            right[i] = right[k];
        }
    }
    int mx = n;
    for (int i = 0; i < n; i++) {
        int t;
        if ((t = left[i] + right[i]) < mx) {
            mx = t;
        }
    }
    printf("%d\n", mx);
    return 0;
}

Measured memory_bytes: 2816
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int n,s;
	while(cin>>n>>s,n||s){
		int r[n];
		rep(i,n)cin>>r[i];
		int sum=0;
		rep(i,n){
			loop(j,i+1,n){
				if(r[i]+r[j]>s)sum++;
			}
		}
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while(cin >> n)
    {
        vector<int> v;
        for(int i = 0; i < 10; i++)
        {
            if(n & (1<<i)) v.push_back(pow(2, i)); 
        }
        for(int i = 0; i < v.size(); i++)
        {
            if(i > 0) cout << " " << v[i];
            else cout << v[i];
        }
        cout << endl;
    }
    return 0;
}




Measured memory_bytes: 3260
program AntiDivision;
var re,a,b,c,d:int64;

function lcm(x,y:int64):int64;
var tmp,t:int64;
begin
	tmp:=x*y;
	while y>0 do 
	  begin
	    x:=x mod y;
        t:=x;
        x:=y;
        y:=t;
      end;
    lcm:=tmp div x;
end;

function sp(x:int64):int64;
var k,y:int64;
begin
	k:=a div x;
	if a mod x <> 0 then inc(k);
	y:=b div x;
	exit(y-k+1); 
end;

begin
	readln(a,b,c,d);
	re:=b-a+1-sp(c)-sp(d)+sp(LCM(c,d));
	write(re);
end.

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(void) {
    int A, B, K;
    cin >> A >> B >> K;

    if (abs(A - B) <= K) {
        for (int i = A; i <= B; ++i) {
            cout << i << endl;
        }
    } else {
        for (int i = A; i < A + K; ++i) {
            cout << i << endl;
        }
        for (int i = B - K + 1; i <= B; ++i) {
            if (i > A + K - 1) cout << i << endl;
        }
    }
    return 0;
}

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

int main()
{

    int a,b,p,q,r;

    cin>>a>>b;

    if(a>=1&&a<=9 && b>=1&&b<=9)
    {
        cout<<a*b<<endl;
    }
    else
        cout<<"-1"<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1e9+7;
const ll  longinf = 1LL<<60;
const ll mod=998244353;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

int main(){
  string s;cin>>s;
  int n=s.size();
  if(n==3){
    if(s[0]==s[1]&&s[1]==s[2])cout<<1<<endl;
    else if(s[0]==s[1]||s[1]==s[2])cout<<6<<endl;
    else if(s[0]==s[2])cout<<7<<endl;
    else cout<<3<<endl;
    return 0;
    }
  
  int b=0;
  rep(i,n){
    if(s[i]=='a')b+=2;
    if(s[i]=='b')b++;
    }
  ll ok=1,flag=1;
  rep(i,n-1){
    if(s[i]==s[i+1])flag=0;
    if(s[i]!=s[i+1])ok=0;
    }
  if(ok){
    cout<<1<<endl;
    return 0;
    }
  b%=3;
  ll dp[n][3][3],dpp[n][3][3];
  rep(i,3)rep(j,3)
    dp[0][i][j]=dpp[0][i][j]=0;
  dp[0][0][2]=dpp[0][0][2]=1;
  dp[0][1][1]=dpp[0][1][1]=1;
  dp[0][2][0]=dpp[0][2][0]=1;
  rep(i,n-1)rep(j,3){
    dp[i+1][0][j]=(dp[i][0][(j+1)%3]+dp[i][1][(j+1)%3]+dp[i][2][(j+1)%3])%mod;
    dp[i+1][1][j]=(dp[i][0][(j+2)%3]+dp[i][1][(j+2)%3]+dp[i][2][(j+2)%3])%mod;
    dp[i+1][2][j]=(dp[i][0][j]+dp[i][1][j]+dp[i][2][j])%mod;
    dpp[i+1][0][j]=(dpp[i][1][(j+1)%3]+dpp[i][2][(j+1)%3])%mod;
    dpp[i+1][1][j]=(dpp[i][0][(j+2)%3]+dpp[i][2][(j+2)%3])%mod;
    dpp[i+1][2][j]=(dpp[i][0][j]+dpp[i][1][j])%mod;
    }
  ll ans=flag;
  rep(i,3)ans+=dp[n-1][i][b]-dpp[n-1][i][b]+mod;
  ans%=mod;
  cout<<ans<<endl;
  return 0;    
  }

Measured memory_bytes: 28676
import math
n = input()
x = map(float,raw_input().split(' '))
y = map(float,raw_input().split(' '))
d1,d2,d3,d4 = 0.0,0.0,0.0,0.0
for i in range(0,n):
	d1 += abs(x[i]-y[i])
	d2 += abs(x[i]-y[i])**2.0
	d3 += abs(x[i]-y[i])**3.0
	if d4 < abs(x[i]-y[i]):
		d4 = abs(x[i]-y[i])
print d1
print math.sqrt(d2)
print d3**(1.0/3)
print d4

Measured memory_bytes: 4476
#include<stdio.h>

int main(void){
  
  int i,j,tmp,N = 0;
  int a[100];

  scanf("%d",&N);

  for(i = 0;i < N ;i++){
    scanf("%d",&a[i]);
  }

  for (i=0; i<N; ++i) {
    for (j=i+1; j<N; ++j) {
      if (a[i] > a[j]) {
        tmp =  a[i];
        a[i] = a[j];
        a[j] = tmp;
      }
    }
  }
  printf("%d\n",a[N-1]-a[0]);

  return 0;
}


Measured memory_bytes: 128
n, m = map(int, input().split())
# A = [[1, 2, 0, 1,],
#     [0, 3, 0, 1,],
#     [4, 1, 1, 0]]
# b = [1, 2, 3, 0]
A = []
b = []
for _ in range(n):
    A.append(list(map(int, input().split())))
for _ in range(m):
    b.append(int(input()))


for i in range(n):
    output = 0
    for j in range(m):
        output += A[i][j]*b[j]
    print(output)





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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(ll i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    ll A, B, C;
    cin >> A >> B >> C;
    ll ans = 0;
    if(C <= A + B) {
        ans = C + B;
    }
    else {
        ans = A + B + B + 1;
    }
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
A = map(int,input().split())

B = {}
B[0] = 1
tmp = 0
ans = 0

for a in A:
        tmp = (tmp+a)%M
        ans += B.get(tmp,0)
        B[tmp] = B.get(tmp,0)+1

print(ans)

Measured memory_bytes: 16100
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    int n;
    cin >> n;

    ll ans=1;
    for(int i=1;i<=n;i++){
        ans*=i;
        ans%=MOD;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3584
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
A.reverse()
A_sum = sum(A)
bound = 0
if A_sum % (4 * M) == 0:
    bound = A_sum // (4 * M)
else:
    bound = A_sum // (4 * M) + 1
if A[M - 1] >= bound:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n)-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(b)-1;i>=(a);--i)
#define ALL(a) a.begin(),a.end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
    if (a < b) { a = b; return true; }
    return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
    if (a > b) { a = b; return true; }
    return false;
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "{";
    int a = 0;
    for (auto &tp : mp) {
        if (a) os << ", "; a = 1;
        os << tp;
    }
    return os << "}";
}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << p.first << ":" << p.second;
    return os;
}


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

    int N, H, W; cin >> N >> H >> W;
    int ans = 0;
    for (int i = 0; i < N; i += 2) {
        int x, y; cin >> x >> y;
        ans += min(x + y, 2 * W - (x + y));
    }
    cout << ans * H << endl;

    return 0;
}



Measured memory_bytes: 3220
#include <iostream>

int main()
{
    int64_t x;
    std::cin >> x;
    // 5と6を交互に出す
    // どちらから始めてもいいので、最後を6にできる
    const auto r = x % 11;
    std::cout << x / 11 * 2 + (r + 5) / 6 << std::endl;
    return 0;
}


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

int main() {
	int n, m, l;
	cin >> n >> m >> l ;
	
	int a[n][m];
	int b[m][l];
	
	long long c[n][l];
	
	for(int i=0; i<n; i++){
		for(int j=0; j<m; j++){
			cin >> a[i][j];
		}
	}
	for(int i=0; i<m; i++){
		for(int j=0; j<l; j++){
			cin >> b[i][j];
		}
	}
	
	for(int i=0; i<n; i++){
		for(int j=0; j<l; j++){
			if(j!=0)cout << " ";
			c[i][j]=0;
			for(int k=0; k<m; k++){
				c[i][j] += a[i][k]*b[k][j];
			}
			cout<<c[i][j];
		}
		cout<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3212
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pp() pop_back()
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(),a.end()),a.end())
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 /*int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }*/
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int a){
  par= vector<int>(a,-1);
  }
  int find(int a){
    if(par[a]<0)
      return a;
    else
      return par[a]=find(par[a]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
int gcm(int a,int b){
    if(b==0)
        return a;
    return gcm(b,a%b);
}
int lcm(int a,int b){
    return a/gcm(a,b)*b;
}
/*struct aa{
  vector<int> gt;
  aa(int n){
  gt= vector<int>(n, 1);
  }
  void c(V<int> d,int b){
  if(d[b]==0){
    gt[d[b]-1]++;
    gt[gt.sz-1]++;
  }
  else{
    gt[d[b]-1]++;
    c(d,d[d[b]]-1);
  }
}
void cok(int a){
  cout<<gt[a-1]<<endl;
  fo(i,a-1)
  cout<<gt[i]<<endl;
}
};
*/
/*struct dfs(){

}*/
signed main(){
  int a;
  cin>>a;
  int b=a;
  int c=0;
  int d=0;
  while(b){
    b/=2;
    c++;
  }
  d=pow(2,c);
  cout<<d-1<<endl;
}


Measured memory_bytes: 256
n,a,t,s=int(input()),[],0,0
for i in range(n):
  aa=int(input())
  if aa%10==0:t+=aa
  else:s+=aa;a.append(aa)
a.sort()
if s==0:print(0)
elif s%10==0:print(t+s-a[0])
else:print(t+s)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    string s;
    cin >> s;
    s.push_back('B');
    int ans = 0, c = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'A' || s[i] == 'G' || s[i] == 'C' || s[i] == 'T'){
            c++;
        }else{
            ans = max(ans, c);
            c = 0;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
	long x, y;
	cin >> x >> y;
	vector<long> a;
	a.push_back(x);
	int i = 2;
	while (true) {
		if (a.back() > y / i) break;
		long nxt = a.back() * i;
		bool flag = false;
		for (auto q : a) {
			if (nxt % q != 0) flag = true;
		}
		if (flag) {
			i++;
			continue;
		}
		a.push_back(nxt);
		i = 2;
	}
	cout << a.size() << endl;
}

Measured memory_bytes: 3644
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int x = sc.nextInt();
      int count = 0;
        for(int i = 0 ; i < a+1 ; i++){
         for(int j = 0 ; j < b+1 ; j++){
           for(int k = 0 ; k < c+1 ; k++){
           	if(500*i + 100*j + 50 *k == x){
            	count++;
            }
           }
         }  
        }
            System.out.println(count);
    }
}


Measured memory_bytes: 35688
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007

bool prime_judge(int A)
{
  for (int i = 2; i <= sqrt(A); i++)
  {
    if(A%i == 0) return true;
  }

  return false;
  
  
}


void solve(void)
{ 
   int A,B,C;
   cin>>A>>B>>C;
   if((A==B)&&(B==C))
   {
     cout<<1<<endl;
   }
   else if((A==B)||(B==C)||(A==C))
   {
     cout<<2<<endl;
   }
   else
   {
     cout<<3<<endl;
   }
   





  return;  
}



int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

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

int main() {
    int N, L;
    cin >> N >> L;
    vector<string> S(N);
    REP(i, N) {
        cin >> S[i];
    }
    sort(ALL(S));
    REP(i, N) {
        cout << S[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
n=gets.to_i
x=Array.new(n,0.0)
y=Array.new(n,0.0)
n.times do |i|
    x[i],y[i]=gets.split.map(&:to_f)
end

ans=0
count=0
[*0..(n-1)].permutation.to_a.each do |perm|
    (n-1).times do |i|
        ans+=((x[perm[i+1]]-x[perm[i]])**2+(y[perm[i+1]]-y[perm[i]])**2)**0.5
    end
    count+=1
end

puts sprintf("%.7f", ans/count)


Measured memory_bytes: 20616
w_numbers=[]
h_numbers=[]
while True:
    rect=[]
    rect=input().split()
    rect[0]=int(rect[0])
    rect[1]=int(rect[1])
    if rect[0]==0 and rect[1]==0:
        break
    h_numbers.append(rect[0])
    w_numbers.append(rect[1])

for i in range(0,len(w_numbers)):
    for j in range(0,h_numbers[i]):
        print('#'*w_numbers[i])
    print()

Measured memory_bytes: 7700
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	LD R;
	cin >> R;
	cout << 2 * R * PI << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
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; }
 
int main() {
  int N, K;
  cin >> N >> K;
  int ans = K;
  for (int i = 0; i < (int)N - 1; ++i) ans *= (K - 1);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    #include<chrono>
                
    using namespace std;
    using namespace std::chrono;
    typedef long long ll;
    typedef vector<int> vi;
    typedef pair<int,int> pi;
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
    #define F first
    #define S second
    #define PB push_back
    #define EB emplace_back
    #define MP make_pair
    #define REP(i,a,b) for(i=a;i<=b;i++)
    #define RAP(i,a,b) for(i=a;i>=b;i--)
    #define all(x) (x).begin(), (x).end()
    ll mod=1000000007;
    const int MX=0x3f3f3f3f;
    
    int main(){
        IOS;
        int n,p,i;
        cin>>n>>p;
        string s;
        cin>>s;
        ll ans=0;
        if(p==2||p==5){
            RAP(i,n-1,0)
                if((s[i]-'0')%p==0) ans+=i+1;
        }else{
        vi a(p);
        a[0]++;
        int num=0,t=1;
        RAP(i,n-1,0){
            num+=((s[i]-'0')*t)%p;
            num%=p;
            ans+=a[num];
            a[num]++;
            t*=10;
            t%=p;
        }
        }
        cout<<ans;
        return 0;
    }

 

Measured memory_bytes: 720
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>
#include<random>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=1000000007;
int d;
int c[30]={};
int s[370][30];
int num=130000;
int calc(vector<int>const& t,vector<vector<int>>& last_list){
  int res=0;
  vector<int> last(30,0);
  rep1(i,d){
    res+=s[i][t[i]];
    last[t[i]]=i;
    last_list[i]=last;
    int buf=0;
    rep1(j,26){
      buf+=c[j]*(i-last[j]);
    }
    res-=buf;
    //cout<<res<<"\n";
  }
  return res;
}
int change(int nd,int nq,int& res,vector<int>& t,vector<vector<int>>& last_list){
  int flag_t=false;
  int flag_q=false;
  int x=t[nd];
  t[nd]=0;
  res+=s[nd][nq];res-=s[nd][x];
  for(int i=nd;i<=d;++i){
    if(flag_t&&flag_q)break;
    if(t[i]==x||flag_t)flag_t=true;
    else{
      res+=c[x]*(i-last_list[i][x]);
      last_list[i][x]=last_list[i-1][x];
      res-=c[x]*(i-last_list[i][x]);
    }
    if(t[i]==nq||flag_q)flag_q=true;
    else{
      res+=c[nq]*(i-last_list[i][nq]);
      last_list[i][nq]=nd;
      res-=c[nq]*(i-last_list[i][nq]);
    }
  }
  t[nd]=nq;
  return res;
}
vector<int> greedy(int d){
  vector<int> res(d+1,0);
  vector<int> last(30,0);
  rep1(i,d){
    int mx=-inf;
    int mx_ind=0;
    rep1(j,26){
      int tmp=s[i][j];
      rep1(k,26){
        if(k==j)continue;
        tmp-=c[k]*(i-last[k]);
      }
      if(mx<tmp){
        mx=tmp;
        mx_ind=j;
      }
    }
    last[mx_ind]=i;
    res[i]=mx_ind;
  }
  return res;
}
signed main(){
  cin>>d;
  rep1(i,26)cin>>c[i];
  rep1(i,d){
    rep1(j,26)cin>>s[i][j];
  }
  vector<int> t=greedy(d);
  vector<vector<int>> last_list(d+1,vector<int>(30,0));
  int res=calc(t,last_list);
  //cout<<res<<"\n";
  int param=2;
  rep(xx,num){
    random_device rand;
    mt19937 mt(rand());
    vector<int> nd(param);rep(i,param)nd[i]=mt()%d+1;
    vector<int> nq(param);rep(i,param)nq[i]=mt()%26+1;
    vector<int> bq(param);rep(i,param)bq[i]=t[nd[i]];
    int bval=res;
    rep(i,param){
      change(nd[i],nq[i],res,t,last_list);
    }
    int yakinamasi=mt()%100;
    //if(yakinamasi<20&&res+res/10000>bval)continue;
    if(bval>res){
      rep(i,param){
        change(nd[i],bq[i],res,t,last_list);
      }
    }
  }
  rep(xx,num){
    random_device rnd;
    mt19937 mt(rnd());
    int nd=mt()%d+1;
    int nq=mt()%26+1;
    int bq=t[nd];
    int bval=res;
    int hoge=change(nd,nq,res,t,last_list);
    if(hoge<bval){
      change(nd,bq,res,t,last_list);
    }
  }
  rep1(i,d){
    cout<<t[i]<<"\n";
  }
  //cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 3820
n,m = map(int, input().split())
l = []
r = []
for _ in range(m):
  a,b = map(int, input().split())
  l.append(a)
  r.append(b)
  
ans = min(r) - max(l)+1
if ans > 0: print(ans)
else: print(0)

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

ll findpow(ll a,ll b){
    ll cnt=0,i,j;
    while(a>1){
        a=a/b;
        cnt++;
    }
    return cnt;
}

float squareRoot(int number, int precision) 
{ 
    int start = 0, end = number; 
    int mid; 
  
    // variable to store the answer 
    float ans; 
  
    // for computing integral part 
    // of square root of number 
    while (start <= end) { 
        mid = (start + end) / 2; 
        if (mid * mid == number) { 
            ans = mid; 
            break; 
        } 
  
        // incrementing start if integral 
        // part lies on right side of the mid 
        if (mid * mid < number) { 
            start = mid + 1; 
            ans = mid; 
        } 
  
        // decrementing end if integral part 
        // lies on the left side of the mid 
        else { 
            end = mid - 1; 
        } 
    } 
  
    // For computing the fractional part 
    // of square root upto given precision 
    float increment = 0.1; 
    for (int i = 0; i < precision; i++) { 
        while (ans * ans <= number) { 
            ans += increment; 
        } 
  
        // loop terminates when ans * ans > number 
        ans = ans - increment; 
        increment = increment / 10; 
    } 
    return ans; 
} 

int main() {
	
	ll n,m,i,j,l,flag=0,flag1=0,cnt=0,sum=0,a,b,c,k,t;
	ll x,y;
	
//	cin>>t;
    cin>>a>>b>>c;
    k=c-a-b;
    t=4*a*b;
    if(t<k*k&&k>=0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    
	return 0;
}

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

#ifdef DEBUG
    #define IFD if(true)
#else
    #define IFD if(false)
#endif

int list(multiset<int, greater<int> > &s)
{
    cout << "list: ";
    for(auto itr = s.begin(); itr != s.end(); itr++) {
        cout << *itr << " ";
    }
    cout << endl;
}

int main()
{
    int N, tmp;
    int d = 0;
    multiset<int, greater<int> > s;
    int ans = 0;

    cin >> N;
    for(int i = 0; i < N; i++) {
        cin >> tmp;
        s.insert(tmp);
    }

    while(!s.empty()) {
        IFD list(s);
        long v = *s.begin();
        s.erase(s.begin());
        IFD cout << "v: " << v << endl;
        long val = 1;
        while (val <= v) {
            val *= 2;
        }
        IFD cout << "val = " << val << endl;
        auto p = s.find(val - v);
        if(p != s.end()) {
            IFD cout << "hit = " << v << ", " << val - v << endl;
            s.erase(p);
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9600
import java.util.Scanner;

public class Main{
	
	static Scanner s=new Scanner(System.in);
	
	public static void main(String[] __){
		StringBuilder sb=new StringBuilder();
		String[] in= {s.next(),s.next()};
		int l=in[0].length()+in[1].length();
		
		for(int i=0;i<l;i++)
			sb.append(in[i%2].charAt(i/2));
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 22608