akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 200010
#define PI 3.1415926535897932384626433832795
struct node
{
	int x,y;
	bool operator < (const node &a)
	{
		return x<a.x;
	}
}e[MAXN];
int sx,sy,ex,ey,n;
void Pre()
{
	bool f=0;
	if(sy>ey) swap(sx,ex),swap(sy,ey);
	if(sy==ey&&sx>ex) swap(sx,ex);
	if(sx>ex) f=1,ex=2*sx-ex;
	ex-=sx,ey-=sy;
	int x,y,m=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&x,&y);
		if(f) x=2*sx-x;
		x-=sx,y-=sy;
		if(x<0||x>ex||y<0||y>ey) continue;
		e[++m].x=x,e[m].y=y;
	}
	sx=0,sy=0;
	n=m;
}
int a[MAXN],st[MAXN],r;
void Solve()
{
	for(int i=1;i<=n;i++)
		a[i]=e[i].y;
	st[0]=-1;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>st[r]) st[++r]=a[i];
		else
		{
			int p=upper_bound(st,st+r+1,a[i])-st;
			st[p]=a[i];
		}
	}
}
int main()
{
	scanf("%d%d%d%d%d",&sx,&sy,&ex,&ey,&n);
	Pre();
	sort(e+1,e+1+n);
	Solve();
	int t=min(ex,ey)+1;
	double ans=100LL*(ex+ey);
	if(r==t) ans+=(r-1)*5LL*PI+10LL*PI-20LL*r;
	else ans+=r*5LL*PI-20LL*r;
	printf("%.12lf\n",ans);
}

Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}


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

    string n;
    cin>>n;
    int ans=0;
    int c=0;

    rrep(i,n.size()-1){
        int m=n[i]-'0'+c;
        ans+=min(m,10-m);
        if(m>5||i>0&&m==5&&n[i-1]>='5') c=1;
        else c=0;
    }
    
    cout<<ans+c<<endl;

}

Measured memory_bytes: 1948
#include <limits.h>

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define all(x) x.begin(), x.end()
using namespace std;
using P = pair<int, int>;
using ll = long long;
template <typename T = long long>
vector<T> make_v(size_t a) {
  return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
  return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

int main() {
  int n;
  cin >> n;
  string x;
  cin >> x;
  reverse(all(x));
  int p = count(all(x), '1');
  vector<int> pow1(n, 1);  // 2^i(mod popcount(x)-1)
  vector<int> pow2(n, 1);  // 2^i(mod popcount(x)+1)
  for (int i = 1; i < n; i++) {
    if(p!=1)pow1[i] = pow1[i - 1] * 2 % (p - 1);
    pow2[i] = pow2[i - 1] * 2 % (p + 1);
  }
  int x1 = 0, x2 = 0;
  rep(i, n) {
    if (x[i] == '1') {
      x1 += pow1[i];
      x2 += pow2[i];
      if (p != 1) x1 %= p - 1;
      x2 %= p + 1;
    }
  }
  for (int i = n - 1; i >= 0; i--) {
    int now, cnt = 1;
    if (x[i] == '0') {
      now = x2 + pow2[i];
      now %= p + 1;
    } else {
      if (p == 1) {
        cout << 0 << endl;
        continue;
      }
      now = x1 - pow1[i];
      if (p != 1) now += p - 1;
      now %= p - 1;
    }
    while (now > 0) {
      now %= __builtin_popcount(now);
      cnt++;
    }
    cout << cnt << endl;
  }
}



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

#define int long long

#define inf 1000000007LL
#define mod 1000000007LL

#define rep(i, n) for(int i = 0; i < (n); i++)
#define trep(i, n) for(int i = 0; i <= (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define mfor(i, s, t) for(int i = (s); i < (t); i++)
#define tfor(i, s, t) for(int i = (s); i <= (t); i++)
#define rfor(i, s, t) for(int i = (t) - 1; i >= (s); i--)

int n;
vector<int> v[114514];

int dfs(int p, int o) {
  int all = 1;
  bool can = false;
  for(auto i : v[p]) {
    if(i != o) {
      int w = dfs(i, p);
      if(w % 2 == 1) {
        if(can) {
          cout << "First" << endl;
          exit(0);
        }
        can = true;
      }
      all += w;
    }
  }
  if((n - all) % 2 == 1 && can) {
    cout << "First" << endl;
    exit(0);
  }
  return all;
}

signed main() {
  cin >> n;
  rep(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs(0, -1);
  cout << "Second" << endl;
}


Measured memory_bytes: 6656
#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define int long long
#define INF 1e9 + 7
#define cae cout << ans << endl;
#define cye cout << "Yes" << endl;
#define cne cout << "No" << endl;
#define r0 return 0;
#define ll long long
using namespace std;
typedef pair<int,int>P;
signed main() {
    string s;
    cin >> s;
    int one = 0, zero = 0;
    rep(i, s.size()) {
        if (s[i] == '1') {
            one++;
        }
        if (s[i] == '0') {
            zero++;
        }
    }
    cout << min(one, zero) * 2 << endl;
    r0
}

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

typedef long long ll;
#define pii pair<int ,int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 200005

int n;
int k;
int a[MAXX];

int main()
{
    _FastIO;
    cin >> k >> n;
    int m = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if(i)   m = max(m , a[i] - a[i - 1]);
    }
    m = max(k - a[n - 1] + a[0] , m);

    cout << k - m << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	int i,j,z=1,len;
	char s[1001];
	cin >> s;
	len=strlen(s);
	for(i=0;i<len;i++){
		for(j=i+1;j<len;j++){
			if(s[i]==s[j]){
				z=0;
				break;
			}
		}
	}
	if(z==0)cout << "no" << endl;
	else cout << "yes" << endl;
	return 0;
}
	
	

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<numeric>
#include<math.h>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    string a, b, c;
    cin >> a >> b >> c;
    int ans = 0;
    rep(i, n) {
        if ( a[i] == b[i] && b[i] == c[i] ) {
            continue;
        }
        else if ( a[i] == b[i] || b[i] == c[i] || a[i] == c[i] ) {
            ++ans;
        }
        else {
            ans += 2;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

MOD = 998244353
n,m,k = MI()

s = [1]
for i in range(2, n):
    s.append(s[-1]*i%MOD)
if m == 1 and k < n-1:
    print(0)
    exit(0)
elif m == 1 and k == n-1:
    print(1)
    exit(0)
elif k == n-1:
    print(pow(m, n, MOD))
    exit(0)
ans = m*pow(m-1, n-1, MOD)%MOD
for i in range(1, k+1):
    tmp = m*pow(m-1, n-1-i, MOD)*s[n-2]*pow(s[n-2-i], MOD-2, MOD)*pow(s[i-1], MOD-2, MOD)
    ans += tmp
    ans %= MOD
print(ans)


Measured memory_bytes: 16944
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
public class Main {
	static FastScanner stdIn=new FastScanner();
	public static void main(String[] args) {
		String S=stdIn.next();
		char ori=S.charAt(0);
		int ans=0;
		for(int i=1;i<S.length();i++){
			char a=S.charAt(i);
			if(a!=ori){
				ans++;ori=a;
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 22612
#include <stdio.h>
 
int main(void){
	int N;
	scanf("%d",&N);
	if(99 < N && 111 >= N){
		printf("111\n");
	}
	else if(111 < N && 222 >= N){
		printf("222\n");
	}
	else if(222 < N && 333 >= N){
		printf("333\n");
	}
	else if(333 < N && 444 >= N){
		printf("444\n");
	}
	else if(444 < N && 555 >= N){
		printf("555\n");
	}
	else if(555 < N && 666 >= N){
		printf("666\n");
	}
	else if(666 < N && 777 >= N){
		printf("777\n");
	}
	else if(777 < N && 888 >= N){
		printf("888\n");
	}
	else if(888 < N && 999 >= N){
		printf("999\n");
	}
	return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef pair<ld,ld> id;
typedef tuple<ll,ll,ll> tl;
typedef tuple<ll,ll,ll,ll> ql;

#define FOR(i, a, b) for(ll i=(a); i<=(b); i++)
#define ROF(i, a, b) for(ll i=(a); i>=(b); i--)
#define MEM(x, v) memset(x, v, sizeof(x))
#define FILL(x, n, v) fill(x, x+n, v);
#define ALL(x) x.begin(), x.end()
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

#define f first
#define s second
#define ins insert
#define e emplace
#define eb emplace_back
#define ef emplace_front
#define p push
#define pf push_front
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define ft front
#define bk back
#define pp pop
#define ppb pop_back
#define ppf pop_front

#define db cout<<"YEET\n";
#define ct(x) cout<<x<<'\n';

const ll MOD = 1e9+7; //998244353
const ll MAXN = 10+5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);

int main(){
    FAST
    ll n;
    string ss;
    cin >> n;
    set<string> unique;
    FOR(i,1,n){
        cin >> ss;
        unique.ins(ss);
    }
    cout << unique.size();
}

Measured memory_bytes: 19244
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
 vector<ll>v;
       ll count=0, flag=1;
       string s;
       cin>> s;
  ll len = s.length();
  //cout<<len;   
       for(ll i=0;i< len; i++){
       if(s[i]=='R'){
       count++;
       flag=0;
       continue;}
       if(flag==0){
       v.push_back(count);
       count=0;
       flag=1;
       }}
       if(flag==0)
       v.push_back(count);
     
       sort(v.begin(), v.end(), greater<> ());
  if (v.empty())
    cout<<0;
  else
  cout<<v[0];
}

Measured memory_bytes: 3612
/**
 *      ABC 79 B
 *      author  : kyomukyomupurin
 *      created : 2018-09-03 02:10:50
**/

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int N; cin >> N;
    long long dp[90];

    dp[0] = 2; dp[1] = 1;
    for (int i = 0; i < 85; ++i) {
        dp[i + 2] = dp[i] + dp[i + 1];
    }
    cout << dp[N] << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pll         pair<ll,ll>
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mode        998244353
#define mod         1000000007
#define inf         1000000000000000000LL
#define vl          vector<ll>
#define F           first
#define S           second
#define db          long double
#define sz(x)       (ll)x.size()
#define fix(n)      cout<<fixed<<setprecision(n)
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define all(x)      x.begin(),x.end()
#define mset(x)     memset(x,0,sizeof x)
#define pi          3.14159265358979323

const int N = 1e5+5;
ll n, wt, v[101], w[101];

void solve()
{
       cin>>n>>wt;
       rep(i,0,n) cin>>w[i]>>v[i];
       ll valsum=0;
       rep(i,0,n) valsum += v[i];
       vl dp(valsum+1, INT_MAX);
       dp[0]=0;
       for(ll item=0; item<n; item++)
       {
              ll value = v[item];
              ll weight = w[item];
              for(ll value_already = valsum - value; value_already>=0; value_already--)
              {
                     dp[value_already + value] = min(dp[value_already + value], dp[value_already] + weight);
              }
       }
       ll ans=0;
       rep(i, 0, valsum+1) if(dp[i] <= wt) ans = i;
       cout<<ans;
}



int main() {
	ll T = 1;
	speed_up
	//cin>>T;
	while(T--)
	    solve();
	return 0;
}


Measured memory_bytes: 1024
open Batteries
open Printf
let () =
  let s = Scanf.scanf "%s " (fun a -> a) in

  let is_even str =
    let len = String.length str in
    if len mod 2 <> 0 then false else
      let fst = String.slice ~last:(len/2) str in
      let lst = String.slice ~first:(len/2) str in
      fst = lst
  in

  let rec aux str =
    let len = String.length str in
    if is_even str then len else
      aux (String.slice ~last:(len-1) str)
  in

  Printf.printf "%d\n" @@
  aux (String.slice ~last:(String.length s - 1) s)


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

typedef long long ll;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)

ll mod=1e9+7;

using namespace std;


ll inputValue(){
	ll a;
	cin >> a;
	return a;
};

void inputArray(int * p, ll a){
	rep(i, a){
		cin >> p[i];
	}
};

template<typename T>
void inputVector(vector<T>& p, ll a){
	rep(i, a){
		T input;
		cin >> input;
		p.emplace_back(input);
	}
}


template <typename T>
void output(T a) {
	cout << a << "\n";
}

int main(int argc, const char * argv[]) {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
    ll n,a,b;
    cin >> n>>a>>b;
    
    ll res = n%(a+b);
    ll num = n/(a+b);
    ll ans;
    ans= num*a+min(a,res);

    cout << ans << endl;
    

	return 0;
}



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

int main()
{
    //freopen("LCS.inp","r",stdin);
    int i, j;
    string s, t, k="";
    getline(cin,s);
    getline(cin,t);
    int f[s.length()+1][t.length()+1];
    for(i=0; i<=s.length(); i++) f[i][0]=0;
    for(j=0; j<=t.length(); j++) f[0][j]=0;

    for(i=1; i<=s.length(); i++)
        for(j=1; j<=t.length(); j++)
        {
            if(s[i-1]==t[j-1]) f[i][j]=f[i-1][j-1]+1;
            else
                f[i][j]=max(f[i-1][j], f[i][j-1]);
        }
    i=s.length();
    j=t.length();
    while(i>0 && j>0)
    {
        if(s[i-1]==t[j-1])
        {
            k=char(s[i-1])+k;
            //cout<<"chon "<<i<<j<<s[i-1]<<endl;
            i--;
            j--;
        }
        else {
            if (f[i][j-1]==f[i][j]) j--;
            else i--;
        }
    }
    cout<<k;

    return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
#define per(i,a,b) for(int i=(b)-1; i>=(a); --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define S second

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("in.txt", "r", stdin);
	string s;
	cin >> s;
	int n = s.size();
	ll cnt[26] = {0,};
	rep(i,0,n) {
		int c = s[i] - 'a';
		cnt[c]++;
	}
	ll ret = (ll)n*(n-1)/2+1;
	rep(i,0,26) {
		ll m = cnt[i];
		ret -= m*(m-1)/2;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 720
n = int(input())
A = list(map(int, input().split()))


mag = 0
con = 1
for i in range(1, n):
    #print(mag, con)
    if A[i-1] == A[i]:
        con += 1
    else:
        mag += con // 2
        con = 1
mag += con // 2
print(mag)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  int c[4];
  for(int i=0; i<4; i++)
    cin>>c[i];
  sort(c, c+4);
  if(c[0]==1 &&
     c[1]==4 &&
     c[2]==7 &&
     c[3]==9)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  LL A, B, N; cin >> A >> B >> N;

  LL x = (N >= B) ? B - 1 : N;
  cout << (A*x)/B - A*(x/B) << endl;
}


Measured memory_bytes: 3592
#include <stdio.h>

int main()
{
    int n, x;
    int l[100];
    int d = 0;
    int ans = 0;

    scanf("%d %d", &n, &x);

    for (int i = 0; i < n; i++) {
        if (d <= x) {
            ans++;
        }

        scanf("%d", &l[i]);

        d += l[i];
    }

    if (d <= x) {
        ans++;
    }

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


Measured memory_bytes: 128
# -*- coding: utf-8 -*- 

rank = ["AAA", "AA", "A", "B", "C", "D", "E"]
ref0 = [35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0]
ref1 = [71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0]

while True:
  try:
    t1,t2 = map(float,raw_input().split())
  except EOFError:
    break
  
  #print(len(rank))
  
  for i in range(len(rank)):
    if t1 < ref0[i] and t2 < ref1[i]:
      print rank[i]
      break
  else:
    print "NA"
  

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

vector<int>road[1005];
long double ar[1005],br[1005],cr[1005];

long double solve(int cur,int n)
{
    if(br[cur]) return br[cur];
         
    long double cnt = 0;
    for(int i=0;i<road[cur].size();i++)
    {
        cnt+=solve(road[cur][i],n)+1;
    }
    if(cur==n) return 0;
    return br[cur]= cnt/(road[cur].size());
}

int main()
{   int n,m,s,t;
    cin>>n>>m;
    for(int i=0;i<m;++i)
    {
        cin>>s>>t;
        road[s].push_back(t);
    }

    solve(1,n);
    ar[1]=1;
    for(int i=1;i<n;i++)
    {
        long double tv = ar[i]/road[i].size();
        for(int j=0;j<road[i].size();++j)
            ar[road[i][j]]+=tv;
    }

    long double ans = 0;
    for(int i=0;i<road[1].size();i++){
        ans += (1+br[road[1][i]]);
    }
    ans/=road[1].size();


    long double s2 = 0;
    for(int i=1;i<=n;i++){
        if(road[i].size()==1) continue;
        
        long double tsm = br[i]*road[i].size();
        
        for(int j=0;j<road[i].size();++j){
            long double s1 = ((tsm-br[road[i][j]]-1)/(road[i].size()-1)-tsm/road[i].size())*ar[i];
            s2=min(s2,s1);
        }
    }
    long double res=ans+s2;
    cout<<setprecision(11)<<std::fixed<<res<<endl;
    return 0;
}


Measured memory_bytes: 5084
import sys
s = input()
q = int(input())
a = ['', '']
r = 0
for l in sys.stdin:
    if l[0] == '1':
        r ^= 1
    else:
        a[0 if l[2] == '21'[r] else 1] += l[4]
if r:
    print(a[0][::-1] + s[::-1] + a[1])
else:
    print(a[1][::-1] + s + a[0])

Measured memory_bytes: 4484
#include<bits/stdc++.h>
using namespace std; 
using lint  =                           long long int;
using pint  =                           pair<int, int>;
using plint =                           pair<lint, lint>;
#define vli                             vector<lint>
#define pb                              push_back
#define ALL(x)                          begin(x),end(x)
#define inf                             (1LL<63)-1
#define MOD                             1000000007
#define SZ(x)                           ((lint)(x).size())
#define                                 FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define                                 IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define                                 REP(i, n) FOR(i,0,n)
#define                                 IREP(i, n) IFOR(i,0,n)
#define                                 f_ip   ios_base::sync_with_stdio(false); cin.tie(NULL);
#define                                 debug(x) cerr << #x << " " << (x) << endl
struct fast_ios                         { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T>                    istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T>                    bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T>                    bool mmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }


/* -------
         |
    **   |
   -------      
   |
   ---------------------------------------------------------------------------------------------------------------------------------*/

void solve(){  
    int N;
    cin >> N;
    vector<int> A(N);
    cin >> A;
    vector<int> idx(N);
    iota(ALL(idx),0);
    sort(ALL(idx),[&](int p,int q) { return A[p] < A[q];});
    for(int i = 0;i < N; ++i){
        cout<<idx[i] + 1<<" ";
    }
}

int main(){   
  
 solve();

 return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int a,b,c;
int ans;
int main()
{
	cin>>a>>b>>c;
	if(a<b)	swap(a,b);
	if(b<c)  swap(b,c);
	if(a<b)  swap(a,b);
	int ans=0;
	ans+=a-b;
	c+=a-b;
	int cha=a-c;
	if(cha%2==0)  ans+=cha/2;
	else          ans+=cha/2+2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	
	int r, c, n;
	cin >> r >> c >> n;
	map<int, int> mp;
	rep(i, n) {
		int ax, ay, bx, by;
		cin >> ax >> ay >> bx >> by;
		if (ax == 0 || ax == r || ay == 0 || ay == c) {
			if (bx == 0 || bx == r || by == 0 || by == c) {
				if (ax == 0) mp[ay] = i;
				if (bx == 0) mp[by] = i;
				if (ay == c) mp[ax + c] = i;
				if (by == c) mp[bx + c] = i;
				if (ax == r) mp[2 * c + r - ay] = i;
				if (bx == r) mp[2 * c + r - by] = i;
				if (ay == 0 && ax != 0) mp[2 * c + 2 * r - ax] = i;
				if (by == 0 && bx != 0) mp[2 * c + 2 * r - bx] = i;
			}
		}
	}
	vector<int> p;
	for (auto i : mp) {
		if (p.size() > 0 && p[p.size() - 1] == i.second) p.pop_back();
		else p.pb(i.second);
	}
	cout << (p.size() ? "NO" : "YES") << '\n';
}

Measured memory_bytes: 10236
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //  repマクロ
#define leng(n) (int)(log10(n)+1)  //  桁数leng
#define INF 9223372036854775807 //  巨大数INF
using namespace std;

signed main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << max(a+b,max(a-b,a*b));
}


Measured memory_bytes: 256
def resolve():
    x, k, d = map(int, input().split())
    x = abs(x)
    a = x // d
    b = x % d
    if a > k:
        print(x - k * d)
        return
    k -= a

    if k % 2 == 0:
        print(b)
    else:
        print(abs(b - d))

resolve()

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

#define pii pair<int, int> 

using namespace std;

int
main(void){
	long long n, k; cin >> n >> k;
	vector<pii> vec(n);
	for(int i = 0; i < n; i++) cin >> vec[i].first >> vec[i].second;
	sort(vec.begin(), vec.end());
	long long l = 0;
	for(int i = 0; i < n; i++){
		if(vec[i].second + l >= k){
			cout << vec[i].first;
			return 0;
		}
		l += vec[i].second;
	}
}

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

int main() {
	int n;
	int money = 100000;

	cin >> n;

	for(int i = 1; i <= n; i++) {
		money += money * 0.05;
		if(money % 1000 != 0) {
			money /= 1000;
			money++;
			money *= 1000;
		}
	}

	cout << money << endl;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <utility>
#include <cctype>
#include <vector>
using namespace std;

#ifdef __linux
#define _U(s) s##_unlocked
#else
#define _U(s) _##s##_nolock
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
#define gcu _U(getchar)
#define pcu _U(putchar)
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template <typename T>
#define _HT template <typename H,typename... T>
#define _OP(t) inline operator t()
struct _in {
#ifdef _GLIBCXX_STRING
	_OP(string){string s;char c;while(isspace(c = gcu()));do{s+=c;}while(c=gcu(),c!=' '&&c!='\n'&&c!=EOF);return s;}
#define _S
#endif
	_OP(char){char c=gcu();gcu();return c;}
	_OP(double){double d; scanf("%lf",&d); gcu();return d;}
	_T _OP(T){T n{},m{1},c;while(isspace(c = gcu()));if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
} in;
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
#ifdef _S
_SCAN(string &o) {int c{gcu()};if(c==EOF)return false;else{ungetc(c,stdin);string t=move(in);o=t;return true;}}
#endif
_T _SCAN(T &o) {int c{gcu()};return c==EOF?false:(ungetc(c,stdin),o=in,true);}
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(const char *s){while(*s)pcu(*s++);}
_OUT(char c){pcu(c);}
#ifdef _S
_OUT(string &s){for(char c:s)pcu(c);}
#endif
_T _OUT(T n){static char b[20];char *p=b;T m=n<0?pcu('-'),-1:1;
	if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
	_T _OUT(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _OUT(H &&h, T... t){out(h);out(t...);}
template <typename... T> _OUTL(T... t){out(t...);outl();}
#define dbg(...) fprintf(stderr,__VA_ARGS__)
struct range{
	int e,b=0,s=1;range(int b,int e,int s):e(e),b(b),s(s){} range(int b,int e): e(e), b(b){} range(int e):e(e){}
	struct it{int v,s; it(int v,int s):v(v),s(s){} operator int()const{return v;} operator int&(){return v;}int operator*()const{return v;}
		it& operator++(){v+=s;return *this;} }; it begin(){return {b,s};} it end(){return {e,s};}};
#define times(i,n) for(int i=n;i;i--)

_T using V = vector<T>;
struct P {
	int n, c;
};

int main() {
	for (int n; (n = in);) {
		V<P> v(n);
		int m {};
		for (int i: range(n - 1, -1, -1)) {
			P &t = v[i];
			while ((t.c = gcu()) == '.')
				t.n++;
			m = max(m, t.n);
			gcu();
		}
		V<V<int>> s(m + 1);
		for (auto i: v) {
			int a;
			if (isdigit(i.c))
				a = i.c - '0';
			else {
				a = i.c == '*';
				auto o = i.c == '*' ? [](int a, int b) {return a * b;} : [](int a, int b) {return a + b;};
				for (int j: s[i.n + 1])
					a = o(a, j);
				s[i.n + 1] = {};
			}
			s[i.n].push_back(a);
		}
		outl(s[0]);
	}
}


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long[] teaValue = new long[4];
        for(int i = 0;i < 4;i++) teaValue[i] = sc.nextLong();
        long n = sc.nextLong();
        double[][] tmpValue = new double[4][];
        double l = 0.25;
        for(int i = 0;i < 4;i++) {
            double[] tmp = new double[3];
            tmp[0] = teaValue[i] / l;
            tmp[1] = i;
            tmp[2] = l;
            tmpValue[i] = tmp;
            l *= 2d;
        }
        
        // 1リットル当たりの値段でソート
        Arrays.sort(tmpValue, (a, b) -> Double.compare(a[0], b[0]));

        long sum = 0;
        for(int i = 0;i < 4;i++) {
            sum += (((long)Math.floor(n / tmpValue[i][2])) * teaValue[(int)tmpValue[i][1]]);
            n -= (long)(((long)Math.floor(n / tmpValue[i][2])) * tmpValue[i][2]);
        }

        System.out.println(sum);
    }

}


Measured memory_bytes: 26964
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
typedef long long ll;
const ll MOD=1e+9+7;
ll N,K;

//グローバル
template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}

//グローバル
ll n_mod(ll x){
    ll ans=1;
    while(x>0){
        ans*=(x%MOD);
        ans%=MOD;
        x--;
    }
    return ans;
}

int main(){    
    cin >> N >> K;
    //int main
    vector<ll> nCk(K+1),kCi(K+1);;
    vector<ll> ans(K+1);
    nCk[0]=1;
    ll n = N-K+1;
    rep2(i,1,K+1){
        nCk[i]=((nCk[i-1]*((n-i+1)%MOD))%MOD*mod_pow((ll)i,MOD-2,MOD))%MOD;
    }
    n = K-1;
    kCi[0]=1;
    rep2(i,1,K+1){
        kCi[i]=((kCi[i-1]*((n-i+1)%MOD))%MOD*mod_pow((ll)i,MOD-2,MOD))%MOD;
    }


    rep2(i,1,K+1){
        ans[i]=(nCk[i]*kCi[i-1])%MOD;
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define PI 3.1415926535897932
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_order(long long X){
  long long ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}

vector<pair<long long,long long>> prime_factorize(long long N){
  vector<pair<long long,long long>> res;
  
  for(long long i=2;i*i<=N;i++){
    if(N%i!=0){
    continue;
    }
    
    long long ex=0;
    while(N%i==0){
      ex++;
      N/=i;
    }
    
    res.push_back({i,ex});
  }
  
  if(N!=1){
  res.push_back({N,1});
  }
  
  return res;
}


int main() {
  
  long long X,K,D;
  cin>>X>>K>>D;
  
  long long Y=abs(X);
  
  
  if((double)(Y/D)>=K){
    cout<<Y-D*K<<endl;
  }
  else{
    long long count=0;
    while(Y>0){
      count++;
      Y-=D;
    }
    
    if((K-count)%2==0){
      cout<<abs(Y)<<endl;
    }
    else{
      cout<<Y+D<<endl;
    }
  }
}

Measured memory_bytes: 3632
#include<iostream>
#include<set>

using namespace std;

int main()
{
	ios::sync_with_stdio( false );
	int n;
	cin>>n;
	set< string > dict;
	string cmd, key;
	for( int i=0; i<n; i++ ) {
		cin>>cmd>>key;
		if( "insert" == cmd ) {
			dict.insert( key );
		} else {
			if( dict.end() != dict.find( key ) ) {
				cout<<"yes\n";
			} else {
				cout<<"no\n";
			}
		}
	}
    return 0;
}

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

int main(){
  
  int h,w,a,b;
  cin >> h  >> w >> a >> b;
  
  for(int i=0;i<b;i++){
    for(int j=0;j<a;j++){
      cout << 0;
    }
    for(int k=0;k<w-a;k++){
      cout << 1;
    }
    cout << endl;
  }
  for(int i=0;i<h-b;i++){
    for(int j=0;j<a;j++){
      cout << 1;
    }
    for(int k=0;k<w-a;k++){
      cout << 0;
    }
    cout << endl;
  }
}

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

#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector
#define beg begin
#define dbg(x) cerr << #x << " = " << x << endl;

template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}

template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i;
    }
    return str;
}

template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.first << " " << a.second;
    return str;
}

template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.first >> a.second;
    return str;
}

void solve(); signed main() {
#ifdef LOCAL
    freopen("C:\\Users\\artma\\CLionProjects\\problems\\input.txt", "r", stdin);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();
    return 0;
}

const int MOD = 1e9 + 7, MAXN = 1e6 + 10, INF = 1e18 + 10, BASE = 37;

void solve() {
    int x;
    cin >> x;
    if (x >= 30) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3648
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
#include <iostream>
#include <bitset>
#include <algorithm>        // sort()
#include <vector>           // for vectors
#include <map>              // for ordered map
#include <unordered_map>
#include <list>             // for list
#include <iomanip>          // for setprecision()
#include <cmath>            // for pow(), sqrt(), log(), log10(), ....
#include <cstring>          // for memset()
#include <unordered_set>    // for unordered_set
#include <climits>          // for INT_MAX & INT_MIN
#include <set>              // for ordered set

#define C ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
typedef long long ll;
#define INF INT_MAX
#define NINF INT_MIN
#define MOD 1000000007
const double pi=acos(-1); // value of pi


bool isVowel(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u') {
        return 1;
    }
    return 0;
}

bool compare(pair<ll, ll> a, pair<ll, ll> b) {
    return a.second<b.second;
}


bool isPrime(ll n) {
    for(ll i=3; i*i<=n; i+=2) {
        if(n%i==0) {
            return false;
        }
    }
    return true;
}

map<ll, list<ll>> m;
// map<ll, ll> m;

int main() {
    C
//     freopen("input.txt","r",stdin);
// 	freopen("output.txt","w",stdout);
    int t=1;
    // cin >> t;
    while(t--) {
        ll sum=15, x=0, s=0;
        for(ll i=0; i<5; i++) {
            cin >> x;
            s+=x;

        }
        cout << sum-s << endl;
    }
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using P = pair<int, int>;
#define LARGE 1000000

vector<pair<ll, ll> > prime_factorize(ll N) {
    vector<pair<ll, ll> > res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

ll gcd(ll x,ll y){
    if(x<y) swap(x,y);
    //xの方が常に大きい
    ll r;
    while(y>0){
        r=x%y;
        x=y;
        y=r;
	}
	return x;
}

//オーバフローしないようにかける順番を気を付ける
ll lcm(ll x,ll y){
    return ll(x/gcd(x,y))*y;
}

int main() {
    ll a, b;
    cin >> a >> b;
    ll ret;
    ret = gcd(a, b);

 //   cout << ret << endl;
    const auto &res = prime_factorize(ret);
    ll z = 0;
    for(auto p : res) {
        z++;
//        cout << p.first << endl;
    }
    cout << z + 1 << endl;

	return 0;
}

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

int main() {
	//cout<<"GfG!";
	int x, y;
	vector <int> a = {1,3,5,7,8,10,12}, b = {4,6,9,11}, c = {2};
	cin>>x>>y;
	if (count(a.begin(), a.end(), x) && count(a.begin(), a.end(), y))
	    cout<<"Yes";
	else if (count(b.begin(), b.end(), x) && count(b.begin(), b.end(), y))
	    cout<<"Yes";
	else if (count(c.begin(), c.end(), x) && count(c.begin(), c.end(), y))
	    cout<<"Yes";
	else
	    cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> S;
  N=S.size();
  string G=S.substr(0,(N-1)/2);
  T=S.substr((N+3)/2-1);
  flag=1;
  rep(i,0,N){
    if(S[i]!=S[N-i-1])flag=0;
  }
  M=G.size();
  rep(i,0,M){
    if(G[i]!=G[M-i-1])flag=0;
  }
  M=T.size();
  rep(i,0,M){
    if(T[i]!=T[M-i-1])flag=0;
  }
  if(flag)Out("Yes");
  else Out("No");
}

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

int main(){
  int N;
  cin>>N;
  vector <int> H(N);
  int cnt=0;
  int cntmax=0;
  cin>>H[0];
  for (int i=1;i<N;i++){
    
    cin>>H[i];
    
    if(H[i]<=H[i-1]){
      cnt++;
      cntmax=max(cntmax,cnt);
      continue;
    }
    cnt=0;
  }
  cout<<cntmax<<endl;
  return 0;
  
  }


Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,x,kazu = 0;
	while(true){
		cin>>n>>x;
		if(n == 0 && x == 0)break;
		for(int i = 1;i<=n-2;i++){
			for(int j = i+1;j<=n-1;j++){
				for(int k = j + 1;k<=n;k++){
					if(i+j+k == x)kazu++;
				}
			}
		}
		cout<<kazu<<endl;
		kazu = 0;
	}
	return 0;
}


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

using namespace std;
using ll = unsigned long long;

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){
    if(a==0 || b == 0) return 0;
    return (a/gcd(a,b) * b);
}

int main(){
    int N;
    cin >> N;
    ll ans = 1;

    for(int i=0;i<N;i++){
        ll T;
        cin >> T;
        ans = lcm(ans, T);
    }

    cout << ans << endl;

    return 0;

}

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

public class Main {
	public static void main(String[] args){
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		try{
			String str = br.readLine();
			for(int i=0;i<str.length();i++){
				if(Character.isUpperCase(str.charAt(i))){
					sb.append(str.toLowerCase().charAt(i));
				}else{
					sb.append(str.toUpperCase().charAt(i));
				}
			}
			System.out.println(sb);
		}catch(Exception e){
			System.err.println(e);
		}
	}
}

Measured memory_bytes: 31608
N,A,B,C=map(int,input().split())
l=[]
for i in range(N):
    l.append(int(input()))

from itertools import product

P=product(range(4),repeat=N)

ans=1000000000
for p in P:
    A_len=0
    B_len=0
    C_len=0
    temp=0
    for i in range(N):
        n=int(p[i])
        if n==3:
            if A_len!=0:
                temp+=10
            A_len+=l[i]
        elif n==2:
            if B_len!=0:
                temp+=10
            B_len+=l[i]
        elif n==1:
            if C_len!=0:
                temp+=10
            C_len+=l[i]

    if A_len!=0 and B_len!=0 and C_len!=0:
        temp+=abs(A-A_len)
        temp+=abs(B-B_len)
        temp+=abs(C-C_len)

        ans=min(ans,temp)

print(ans)



Measured memory_bytes: 9204
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const a = parseInt(args[0][0], 10)
	const b = parseInt(args[0][1], 10)
	const t1 = a + b
	const t2 = t1 / 2
	if (t2 % 1 === 0) console.log(t2)
	else console.log('IMPOSSIBLE')
}

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


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

int main()
{
    string str;
    cin >> str;
    int n = 0;
    if(str == "SUN")
    {
        n = 7;
    }
    else if(str == "MON")
    {
        n = 6;
    }
    else if(str == "TUE")
    {
        n = 5;
    }
    else if(str == "WED")
    {
        n = 4;
    }
    else if(str == "THU")
    {
        n = 3;
    }
    else if(str == "FRI")
    {
        n = 2;
    }
    else if(str == "SAT")
    {
        n = 1;
    }

    cout << n << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>
#define rep(i,l,n) for(i=l;i<n;i++)

int main(void){
	int n,i,st,sh,cmp;
	char t[101],h[101];
	
	scanf("%d",&n);
	
	st=0;
	sh=0;
	rep(i,0,n){
		cmp=0;
		scanf("%s",t);
		getchar();
		scanf("%s",h);
		
		cmp=strcmp(t,h);
		if(cmp>0) st+=3;
		else if(cmp==0){
			st++; sh++;
		}else sh+=3;
		
	}
	printf("%d %d\n",st,sh);	
	
	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
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 ll INF = 1e10;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
ll XOR(ll n){
    ll res = 0;
    if (n == 0) return 0;
    if (n == 1) return 1;
    if (n == 2) return 3;
    if (n == 3) return 0;
    rep(i,56){
        ll k = (ll)1<<i;
        if (k <= n && n < k*2){
            res = XOR(n-k)+((n-k+1)%2)*k;
            break;
        }
    }
    return res;
}
int main() {
    ll a,b;
    cin >> a >> b;
    if (a != 0) PRINT((XOR(a-1)^XOR(b)));
    else PRINT(XOR(b));
}

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

public class Main {
  public static void main(String[] args) {
    try (Scanner sc = new Scanner(System.in)) {
      int[] A = new int[3];
      for (int i = 0; i < 3; i++) {
        A[i] = sc.nextInt();
      }
      Arrays.sort(A);
      int result = 0;
      for (int i = 1; i < 3; i++) {
        result = result + Math.abs(A[i-1]-A[i]);
      }

      System.out.println(result);
    }
  }
}


Measured memory_bytes: 21844
# 中間試験、期末試験のいずれかを欠席した場合成績は F。
# 中間試験と期末試験の合計点数が 80 以上ならば成績は A 。
# 中間試験と期末試験の合計点数が 65 以上 80 未満ならば成績は B。
# 中間試験と期末試験の合計点数が 50 以上 65 未満ならば成績は C。
# 中間試験と期末試験の合計点数が 30 以上 50 未満ならば成績は D。 ただし、再試験の点数が 50 以上ならば成績は C。
# 中間試験と期末試験の合計点数が 30 未満ならば成績は F。

while True:
    m, f, r = map(int, input().split())
    total = m+f
    if m==-1 and f==-1 and r==-1:
        break
    if (m==-1 or f==-1) or (total<30):
        print('F')
    elif total>=80:
        print('A')
    elif total>=65 and total<80:
        print('B')
    elif total>=50 and total<65:
        print('C')
    elif total>=30 and total<50:
        if r>=50:
            print('C')
        else:
            print('D')




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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

double kr(double a, double b, double c, double d) {
    return sqrt((a-c)*(a-c) + (b-d)*(b-d));
}

#define P pair<double,int>

int n;
bool visited[1002];
double x[1002],y[1002],r[1002];
vector<P> v[1002];
priority_queue<P,vector<P>,greater<P>> pq;

signed main() {
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> n;n+=2;
    repo(i,2,n) cin >> x[i] >> y[i] >> r[i];
    rep(i,n) repo(j,i+1,n) {
        double hoge = max(0.0,kr(x[i],y[i],x[j],y[j])-r[i]-r[j]);
        v[i].pb(mp(hoge,j));
        v[j].pb(mp(hoge,i));
    }
    visited[0] = true;
    rep(i,v[0].size()) pq.push(v[0][i]);
    while(!pq.empty()) {
        int k = pq.top().se;
        double a = pq.top().fi;
        pq.pop();
        if (visited[k]) continue;
        if (k == 1) {
            cout << setprecision(20) << a << endl;
            return 0;
        }
        visited[k] = true;
        rep(i,v[k].size()) pq.push(mp(v[k][i].fi + a,v[k][i].se));
    }

}


Measured memory_bytes: 34956
#include<bits/stdc++.h>
using namespace std;
#define int double
signed main(){
int n,k;
cin >> n >> k;
vector<int> a(n);
for(int i = 1; i <= n; i++){
    a[i -1] = i;
}
double sum = 0;
for(int i = 1; i <= n; i++){
    int j = 1;
   while(a[i - 1] < k){
       a[i - 1] *= 2;
       j /= 2;
   }
   sum += j;
}
    cout << setprecision(10) << sum / n << endl;
}

Measured memory_bytes: 1024
w, h, n = map(int, input().split())

painting = []
for i in range(h):
    li = [1]*w
    painting.append(li)


for i in range(n):
    x, y, a = map(int, input().split())
    if a == 1:
        for j in range(h):
            for k in range(x):
                painting[j][k] = 0
    elif a == 2:
        for j in range(h):
            for k in range(x,w):
                painting[j][k] = 0
    elif a == 3:
        for j in range(y):
            for k in range(w):
                painting[j][k] = 0
    elif a == 4:
        for j in range(y,h):
            for k in range(w):
                painting[j][k] = 0

ans = 0
for i in range(h):
    for j in range(w):
        if painting[i][j] == 1:
            ans += 1

print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> p;

int main(void){
  int s,k,x,y;
  cin >> k >> s;
  int cnt=0;
  for(x=0;x<=k;x++){
    for(y=0;y<=k;y++){
      int z=s-(x+y);
      if(x+y+z==s && z>=0 && z<=k){
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256