akhauriyash/Code-Regression huggingface dataset:
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <cctype>    // isupper, islower, isdigit, toupper, tolower
#include <cstdint>   // int64_t, int*_t
#include <cstdio>    // printf
#include <deque>     // deque
#include <iomanip>   // setprecision
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <utility>       // pair, make_pair
#include <vector>        // vector
using namespace std;

int gcd(long long a, long long b) { return b != 0 ? gcd(b, a % b) : a; }

int main() {
    string S;
    cin >> S;
    for(auto x : S){
        cout << "x";
    }

    cout << endl;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define INF 1100000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007
#define Decimal fixed << setpresicion(20)
#define SHOWP(x) cerr<<"("<<(x).FI<<", "<<(x).SE<<")"<<endl;
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}

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

int dp[11000];
int num[] = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};

int main()
{
  REP(i, 11000) dp[i] = -1;
  dp[0] = 0;
  int N, M; cin >> N >> M;
  vector<int> A(M);
  REP(i, M) cin >> A[i];
  REP(i, N) {
    REP(j, M) {
      if (dp[i] == -1) continue;
      dp[i + num[A[j]]] = max(dp[i + num[A[j]]], dp[i] + 1);
    }
  }

  vector<int> v;
  REP(i, M) v.PB(A[i]);
  sort(ALL(v), greater<int>());

  int now = N;
  while (now > 0) {
    REP(i, M) {
      if (now >= num[v[i]] && dp[now - num[v[i]]] == dp[now] - 1) {
        cout << v[i];
        now = now - num[v[i]];
        break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;
using pli = pair<long long, int>;
using vpli = vector<pli>;

int main() {
  ll A, B;
  cin >> A >> B;
  if (A < 10 && B < 10)
    cout << A * B << endl;
  else
    cout << -1 << endl;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
N,Q=map(int,input().split())
L=[i for i in range(N+2)]
P=1
C=[0 for i in range(N+2)]
C[P-1]=1
C[P+1]=1
C[P]=1
for i in range(Q):
    A,B=map(int,input().split())
    if A==P:
        P=B
    elif B==P:
        P=A
    L[A],L[B]=L[B],L[A]
    C[L[P-1]]=1
    C[L[P+1]]=1
ans=0
for i in range(1,N+1):
    if C[i]==1:
        ans+=1
print(ans)
#print(L)
#print(C)
    

Measured memory_bytes: 7904
#include<bits/stdc++.h>
using namespace std;
     
#define ll long long
#define loop(i,a,n) for(ll i=a;i<n;++i)
#define revloop(i,a,b) for(ll i=a;i>=b;--i)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 9999999999999999
#define MOD 1000000007

void func()
{
    ll k,a,b;
    cin>>k>>a>>b;
    ll t=b/k-(a-1)/k;
    if (t>0)
    {
        cout<<"OK"<<"\n";
    }
    else
    {
        cout<<"NG"<<"\n";
    }
}

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

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

    ll t=1;
    //cin>>t;
    while(t--)
    {
        func();
    }
}

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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, init, n) for (int i = init; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second

using namespace std;
using ll = long long int;
using P = pair<ll, ll>;
using T = tuple<int, int, int>;
using edge = struct
{
    int to, cost;
};

const int MOD = 1e9 + 7;
const int iINF = 1e9;
const long long int llINF = 1e18;
const double PI = acos(-1.0);

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

template <typename T> //Maximum
struct RMQ
{
  private:
    int N = 1;
    vector<T> node;

  public:
    RMQ(vector<T> vec)
    {
        int size = vec.size();

        while (N < size)
        {
            N *= 2;
        }

        node.resize(2 * N - 1, make_pair(-llINF, 0));

        REP(i, size)
        {
            node[i + N - 1] = vec[i];
        }

        for (int i = N - 2; 0 <= i; i--)
        {
            node[i] = max(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    void update(int i, T value)
    {
        i += (N - 1);

        node[i] = value;

        while (i > 0)
        {
            i = (i - 1) / 2;

            node[i] = max(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    T getMax(int a, int b, int i = 0, int l = 0, int r = -1)
    {
        if (r < 0)
        {
            r = N;
        }

        if (r <= a || b <= l)
        {
            return P(-llINF, llINF);
        }

        if (a <= l && r <= b)
        {
            return node[i];
        }

        T vl = getMax(a, b, 2 * i + 1, l, (l + r) / 2);

        T vr = getMax(a, b, 2 * i + 2, (l + r) / 2, r);

        return max(vl, vr);
    }
};

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

    int N, R, L;
    cin >> N >> R >> L;

    vector<P> vec(N);

    vector<ll> time(N, 0);

    REP(i, N)
    {
        vec[i] = make_pair(0, -i);
    }

    RMQ<P> rmq(vec);

    vector<int> d(R), t(R), x(R);

    REP(i, R)
    {
        cin >> d[i] >> t[i] >> x[i];
    }

    t.push_back(L);

    time[0] = t[0];

    REP(i, R)
    {
        P pre = rmq.getMax(d[i] - 1, d[i]);
        rmq.update(d[i] - 1, make_pair(pre.fi + x[i], pre.se));
        P team = rmq.getMax(0, N);

        time[-team.se] += (t[i + 1] - t[i]);        
    }

    int ans = 0;
    ll Max = 0;

    REP(i, N)
    {
        if(Max < time[i])
        {
            ans = i;
            Max = time[i];
        }
    }

    cout << ans + 1 << endl;

    return 0;
}


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

typedef long long ll;
#define N (1<<18)

ll ai[N*2];
ll value[N*2];
ll max_num = 1;

int find(int k){
    k += N-1;
    int ans = ai[k];
    int v = value[k];
    while(k > 0){
        k = (k-1)/2;
        if(value[k] > v){
            ans = ai[k];
            v = value[k];
        }
    }
    return ans;
}

void update(int s, int t, int x, int i, int k = 0, int l = 0, int r = N){
    if(r <= s || t <= l) return;
    if(s <= l && r <= t){
        value[k] = i;
        ai[k] = x;
    }else{
        update(s, t, x, i, k*2+1, l, (l+r)/2);
        update(s, t, x, i, k*2+2, (l+r)/2, r);
    }
}

int main(){
    for(int i = 0; i < 31; i++) max_num *= 2;
    max_num -= 1;

    for(int i = 0; i < N*2; i++){
        ai[i] = max_num;
        value[i] = -1;
    }

    int n, q;
    cin >> n >> q;

    for(int i = 0; i < q; i++){
        int com, s, t, x;
        cin >> com;
        if(com == 1){
            cin >> s;
            cout << find(s) << endl;
        }else{
            cin >> s >> t >> x;
            update(s, t+1, x, i);
        }
    }

}




Measured memory_bytes: 11300
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [isize; n],
    };

    let mut ans = std::usize::MAX;

    for i in *a.iter().min().unwrap()..*a.iter().max().unwrap() + 1 {
        let mut cost = 0;
        for j in &a {
            cost += (j-i).pow(2) as usize;
        }
        if cost < ans {
            ans = cost;
        }
    }
    println!("{}", ans);
}


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

using namespace std;

#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000000
#define INFL 10000000000000000LL
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main() {
  ll k, a, b;
  cin >> k >> a >> b;
  if(a <= b){
    if(k <= a) cout << 1 << endl;
    else cout << -1 << endl;
  }
  else if(k <= a) cout << 1 << endl;
  else cout << 1+(2*(1 + (k-a-1)/(a-b))) << endl;
  return 0;
}


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

#define int long long

#define loop1(i,a,b) for(int i=a;i<b;i++)

using namespace std;
#define m 1000000007
void dfs(int s ,pair<int,int> val[],int v[],  map<int,vector<int>>* mp )
{   
    // cout<<s<<"\n";
    v[s]=1;
    int w=1;
    int b=1;
    for(auto x: (*mp)[s])
    {
        if(v[x]==0)
        {
            
            dfs(x,val,v,mp);
            w=(w*(val[x].first+val[x].second))%m;
            b=(b*(val[x].first))%m;
        }

    }
    val[s]=make_pair(w%m,b%m);



}
signed main()
{
    // typedef tree<int,null_type,less<int>,rb_tree_tag,
    // tree_order_statistics_node_update> indexed_set;
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    // vector<pair<int,int>> v;
    map<int,vector<int>> mp;
    loop1(i1,0,n-1)
    {  
       int x,y;
        cin>>x>>y;
        mp[x-1].push_back(y-1);
        mp[y-1].push_back(x-1);
    }
    int v[n];
    pair<int,int> val[n];
    loop1(i1,0,n)
    {
        v[i1]=0;
    }
    dfs(0,val,v,&mp);
    int x=((val[0].first%m)+(val[0].second%m))%m;
    cout<<x;
    
}

Measured memory_bytes: 21888
import sys

input = sys.stdin.readline
s = input()

if 0 < int(s[0:2]) < 13:
    if 0 < int(s[2:]) < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < int(s[2:]) < 13:
        print('YYMM')
    else:
        print('NA')


Measured memory_bytes: 2940
#include<stdio.h>
int main(void)
{
  char s[3];
  int n;
  
  scanf("%s",s);
  if(s[0]!=s[1]){
    if(s[1]!=s[2]){
      if(s[2]!=s[0]){
      puts("Yes");
  }
  else
    puts("No");
  } 
    else
    puts("No");
  } 
  else
    puts("No");
  
      
  return(0);
  }

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

int main(){
    int n;
    cin>>n;
    for(int k=0;k<n;k++){
        string s;cin>>s;
        vector<string> buf;
        for(int i=1;i<s.size();i++){
            string s1=s.substr(0,i);
            string s2=s.substr(i,s.size()-i);
            string sr1;
            reverse(s1.begin(),s1.end());
            sr1=s1;
            reverse(s1.begin(),s1.end());
            string sr2;
            reverse(s2.begin(),s2.end());
            sr2=s2;
            reverse(s2.begin(),s2.end());
            buf.push_back(s1+s2);
            buf.push_back(s1+sr2);
            buf.push_back(sr1+s2);
            buf.push_back(sr1+sr2);
            buf.push_back(s2+s1);
            buf.push_back(s2+sr1);
            buf.push_back(sr2+s1);
            buf.push_back(sr1+sr2);




        }
        sort(buf.begin(),buf.end());
        buf.erase(unique(buf.begin(),buf.end()),buf.end());
        cout<<buf.size()<<endl;




    }

    return 0;
}

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

using namespace std;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n, m, a, b; cin>>n>>m;
    priority_queue<int> q;
    vector<vector<int>> loc(m+1, vector<int>());
    for (int i=0; i<n; ++i){
        cin>>a>>b;
        if (m - a >= 0) loc[m-a].push_back(b);
    }
    int ans=0;
    for (int i=m; i>=0; --i){
            for(auto j : loc[i])q.push(j);
            if(!q.empty()){
                a=q.top();
                q.pop();
                ans+=a;
    }   }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define rv(s) reverse(s.begin(),s.end());
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vs = vector<string>;
using vd = vector<double>;
using ul = unsigned long;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }

int main()
{
  cin.tie( 0 );
  ios::sync_with_stdio( false );
  
  int n,W;
  cin>>n>>W;
  
  int v[100],w[100];
  rep(i,n){
    cin>>v[i]>>w[i];
  }
  
  // dp[i+1][j]:=i番目の品物の中から重さの総和がj以下となるように選んだ時の価値の総和の最大値
  int dp[101][10001]={0};
  
  rep(i,n){
    for(int j=0;j<=W;++j){
      if(j<w[i]){ // 入らない
        dp[i+1][j]=dp[i][j];
      }else{ // 入る
        // ”i-1番目までの品物から重さj以下となるように選んだ価値の総和”
        // VS
        // ”i番目の品物と、i-1番目までの品物から重さがj-w[i]以下となるように選んだ価値の総和、の和”
        dp[i+1][j]=max(dp[i][j], dp[i][j-w[i]]+v[i]);
      }
    }
  }
  
  cout(dp[n][W]);
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template <typename T1, typename T2> 
inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  ll ans = s[0] - '0';
  ll ans2 = 0;
  rep(i, s.size()) ans2 += s[i] - '0';
  ans--;
  bool flag = true;
  FOR(i,1, s.size()) if (s[i] != '9') flag = false;
  FOR(i, 1, s.size()) { ans += 9; }
  ans += flag;

  cout << max(ans2, ans) << endl;
  return 0;
}


Measured memory_bytes: 256
S=input()
s=list(S)

cnt=0
i=0
n=len(s)

for i in range(len(s)//2):
	if s[i]!=s[n-1]:
		cnt+=1
		n-=1
		i+=1
		continue
	else:
		n-=1
		i+=1
		continue

print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
#define pb push_back
int main(void){
    rep(0,i,5){
        ll x;
        cin>>x;
        if(x==0){
            cout<<i+1;
            return 0;
        }
    }
}


Measured memory_bytes: 3632
program Changing_a_Character
    implicit none
    integer(4):: n, k
    character(:),allocatable:: s

    read*, n,k
    allocate(character(n):: s)
    read*, s

    s(k:k) = char(ichar(s(k:k)) - (ichar('A') - ichar('a')))
    print*, s(:)
end program Changing_a_Character

Measured memory_bytes: 768
#include <stdlib.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mini(vec) return *std::min_element(vec.begin(), vec.end());
#define maxi(vec) return *std::max_element(vec.begin(), vec.end());

int main() {
    string a;
    cin>>a;
    a.at(3)='8';
    cout<<a<<endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 100009
using namespace std;
typedef long long LL;
const LL INF = 0x3f3f3f3f;
 
LL h[N];
LL n, a, b;
 
bool judge(LL mid)
{
    LL ans = mid;
    for(int i = 1; i <= n; i++)
    {
        LL tm = h[i] - b*mid;
        if(tm > 0)
        {
            LL cnt = tm / (a - b) + (tm % (a - b) == 0 ? 0 : 1);
            ans -= cnt;
            if(ans < 0) return false;
        }
    }
    return true;
}
 
int main()
{
    scanf("%lld%lld%lld", &n, &a, &b);
    for(int i = 1; i <= n; i++) scanf("%lld", &h[i]);
    LL l = 0, r = INF;
    LL ans = INF;
    while(l <= r)
    {
        LL mid = (l + r)>>1;
        if(judge(mid)) ans = mid, r = mid - 1;
        else l = mid + 1;
    }
    printf("%lld\n", ans);
    return 0;
}


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


public class Main {

	final static long MOD = (long)1e9+7;
	//final static long MOD = 998244353;

	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static long cnt=0;
	public static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		slove(args);
		if(in!=null){
			in.close();
		}
		pw.flush();
		pw.close();
	}

	public static void slove(String[] args) throws Exception{
		int N = nextInt();
		int[] A = nextInts();

		HashMap<Integer,Integer> map = new HashMap<>();
		for(int x:A) {
			map.put(x,map.getOrDefault(x, 0)+1);
		}
		int ans ;
		if(map.size()%2==0) {
			ans=map.size()-1;
		}else {
			ans=map.size();
		}
		pw.println(ans);


	}


	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}



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

int main() {
    int N;
    cin >> N;
    
    int prev = N % 10;
    N = N / 10;
    int next = N % 10;
    N = N / 10;
    if (prev == next) {
        next = N % 10;
        if (prev == next)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    } else {
        prev = next;
        next = N % 10;
        N = N / 10;
        if (prev == next) {
            next = N % 10;
            if (prev == next)
                cout << "Yes" << endl;
            else
                cout << "No" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 3604
typedef long long ll;
typedef long double LD;

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



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int s_n = 0;
    int x = n;
    while(x>0){
        int d = (x%10);
        s_n +=d;
        x = (x-d)/10;
    }
    bool id = n%s_n==0;
    if(id)
        cout << "Yes\n";
    else
        cout << "No\n";


}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1e9
#define PI acos(-1)
typedef long long ll;

ll a[200010], b[200010];
ll at[200010], bt[200010];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = 0; i < n; i++)cin >> b[i];
	ll ans = 0;
	for (int i = 0; i < 30; i++) {
		ll idigit = 0;
		ll T = 1;
		for (int j = 0; j < i; j++) T *= 2;
		for (int j = 0; j < n; j++) {
			at[j] = a[j] % (2*T);
			bt[j] = b[j] % (2*T);
		}
		sort(bt, bt + n);
		for (int j = 0; j < n; j++) {
			ll *p =lower_bound(bt, bt + n, T - at[j]);
			ll *q = lower_bound(bt, bt + n, 2*T - at[j]);
			ll *r = lower_bound(bt, bt + n, 3*T - at[j]);
			idigit += distance(bt, q)-distance(bt, p);
			idigit += n - distance(bt, r);
		}
		if (idigit % 2 == 1)ans += T;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep2(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define ALL(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
const ll INF = 100100100100;
const int MOD = 1000000007;
const ld EPS = 1e-10;

struct Eratos {
  vector<int> primes, min_factor;
  vector<bool> isprime;
  Eratos(int MAX) : primes(),
                    isprime(MAX+1, true),
                    min_factor(MAX+1, -1) {
    isprime[0] = isprime[1] = false;
    min_factor[0] = 0, min_factor[1] = 1;
    for (int i = 2; i <= MAX; i++) {
      if (!isprime[i]) continue;
      primes.push_back(i);
      min_factor[i] = i;
      for (int j = i*2; j <= MAX; j += i) {
        isprime[j] = false;
        if (min_factor[j] == -1) min_factor[j] = i;
      }
    }
  }
  // prime factorization
  vector<pair<int,int>> factorize(int n) {
    vector<pair<int,int>> res;
    while (n != 1) {
      int prime = min_factor[n];
      int exp = 0;
      while (min_factor[n] == prime) {
        exp++;
        n /= prime;
      }
      res.push_back(make_pair(prime, exp));
    }
    return res;
  }
};

int main(){
  Eratos era(2e5);
  int X; cin >> X;

  rep2(i, X, 2*X){
    if (era.isprime[i]) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 1280
import java.util.Scanner;
import java.util.SortedMap;
import java.util.TreeMap;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        final int H = sc.nextInt();
        final int W = sc.nextInt();
        
        final int[] left = new int[H];
        final int[] right = new int[H];
        
        for (int i = 0; i < H; i++) {
            left[i] = sc.nextInt() - 1;
            right[i] = sc.nextInt();
        }
        
        SortedMap<Integer, Integer> currToOrigin = new TreeMap<>();
        for (int j = 0; j < W; j++) {
            currToOrigin.put(j, j);
        }
        
        int[] gaps = new int[W];
        gaps[0] = W;
        int minGapIdx = 0;
        
        StringBuilder result = new StringBuilder();
        final String BR = System.lineSeparator();
        
        int i = 0;
        for (; i < H && !currToOrigin.isEmpty(); i++) {
            SortedMap<Integer, Integer> subMap = currToOrigin.subMap(left[i], right[i]);
            
            if (!subMap.isEmpty()) {
                int biggestOrigin = subMap.get(subMap.lastKey());
                
                subMap.forEach((curr, orig) -> gaps[curr - orig]--);
                subMap.clear();
                
                if (right[i] < W && !currToOrigin.containsKey(right[i])) {
                    currToOrigin.put(right[i], biggestOrigin);
                    gaps[right[i] - biggestOrigin]++;
                }
                
                while (minGapIdx < W && gaps[minGapIdx] == 0) {
                    minGapIdx++;
                }
            }
            result.append(minGapIdx < W ? minGapIdx + i + 1 : -1).append(BR);
        }
        for (; i < H; i++) {
            result.append(-1).append(BR);
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 77352
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, N, a, b) for(int i = a; i < N; i += b)

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

	vector<int> brick(N);
	rep(i, N) cin >> brick.at(i);
	int cnt = 0;
	rep(i, N){
		if (brick.at(i) == cnt + 1) cnt++;
	}
	if (cnt == 0) cout << "-1" << endl;
	else cout << N - cnt << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

std::set<int> ans;

int n;
int a[200010];

int main()
{
	scanf("%d", &n);
	for (int i = 0 ; i < n ; i++) {
		scanf("%d", &(a[i]));
	}
	sort(a, a + n);
	
	std::map<int, int> numMap;
	for (int i = 0 ; i < n ; i++) {
		if (numMap.find(a[i]) == numMap.end()) {
			numMap[a[i]] = 1;
		} else {
			numMap[a[i]]++;
		}
	}
	
	int delCount = 0;
	std::map<int, int>::iterator iNumMap;
	for (iNumMap = numMap.begin() ; 
		iNumMap != numMap.end() ; 
		iNumMap++) {
		if (iNumMap->second > 1) {
			delCount++;
		}
	}
	
	ans.clear();
	for (int i = 0 ; i < n ; i++) {
//		if (ans.find(a[i]) != ans.end())
//			continue;
		if (numMap.find(a[i]) != numMap.end()) {
			if (numMap[a[i]] > 1) {
				continue;
			}
		}
		
		if (a[i] == 1) {
			ans.insert(1);
			continue;
		}
		
		if (numMap.find(1) != numMap.end()) {
			continue;
		}
		
			
		bool findNum = false;
		int d = 2;
		while ((d * d) <= a[i]) {
			if (a[i] % d != 0) {
				d++;
				continue;
			}
				
			if (numMap.find(d) != numMap.end()) {
				findNum = true;
				break;
			}
			
			int r = a[i] / d;
			if (numMap.find(r) != numMap.end()) {
				findNum = true;
				break;
			}
			
			d++;
		}
		
		if (findNum == false) {
			ans.insert(a[i]);
		}
	}
	
	
	printf("%d\n", ans.size());
		
	return 0;
}


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

int n;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	while(1){
		cin >> n;
		if(n == 0) return 0;
		int cnt = 0;
		for(int i=1; i<n; ++i){
			int tmp = 0;
			int j = 0;
			while(tmp < n){
				tmp += i + j;
				++j;
				if(tmp == n) ++cnt;
			}
		}
		cout << cnt << "\n";
	}
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<P,P> PP;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#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 ALL(v) (v).begin(), (v).end()

int gcd(int p, int q){
    if(p%q==0) return q;
    else return gcd(q, p%q);
}

int main() {
    int x, y, g;
    cin >> x >> y;
    g = gcd(x,y);
    x /= g;
    y /= g;
    cout << (x+y-1)*g+1 << endl;
    return 0;
}



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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());

		int dept = 100000; // 10万円の借金

		for (int i = 0; i < n; i++) {
			dept *= 1.05; // 5%の利子

			// 1000未満を切り上げ
			if (dept % 1000 != 0) {
				dept = (dept / 1000) + 1;
				dept *= 1000;
			}

		}

		System.out.println(dept);
	}

}

Measured memory_bytes: 16848
#include <stdio.h>

int main()
{
    int a, b, c, t;
    scanf("%d%d%d", &a, &b, &c);
    if(a>b) t=a,a=b,b=t;
    if(b>c) t=b,b=c,c=t;
    if(a>b) t=a,a=b,b=t;
    printf("%d %d %d\n", a, b, c);
    return 0;
}

Measured memory_bytes: 596
#include <stdio.h>

int main(void)
{
	int sum = 0, i, a;
	
	for (i = 0; i < 5; i++){
		scanf("%d", &a);
		
		if (a < 40){
			sum += 40;
		}
		else {
			sum += a;
		}
	}
	
	printf("%d\n", sum / 5);
	
	return (0);
}

Measured memory_bytes: 600
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return ((fact(i - 1)) * i) % MOD;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された
    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }
    return true;
}
/*signed*/int main(void){
    string w;
    cin >> w;
    int N = w.size();
    vector<int> a(26);
    rep(i, N) {
        ++a[w[i] - 'a'];
    }
    rep(i, 26) {
        if (a[i] % 2 != 0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3520
#ifdef __APPLE__
#include <iostream>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <iomanip>
#include <cmath>
#include <ctgmath>
#include <math.h>
#else
#include <bits/stdc++.h>
#endif

using namespace std;
#define io ios_base::sync_with_stdio(false), cin.tie(NULL)
#define GFOR(i,a,n) for (i=a;i<n;i++)
#define FOR(i,a,n) for (int i=a;i<n;i++)
#define RFOR(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define tc(t) for (int tc=1; tc<=t; tc++)
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<long long int> vll;
typedef vector<pair<int, int> > vpi;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
ll modInverse (ll a) {ll p = mod - 2; return powmod(a, p);}
// head

void solve() {
    ll n;
    cin >> n;

    string ans = "";
    while (n > 0) {
        n--;
        ans += (n%26 + 'a');
        n = n/26;
    }

    reverse(ans.begin(), ans.end());
    cout << ans << "\n";
}

int main() {
    io;
    int t = 1;
    tc(t) {
        solve();
    }
}
//check for edge cases in limits
//printing double may print 1.223232e9 like values, beware of that


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

using namespace std;

int main(){
  double W, H;
  cin >> W >> H;
  
  double x, y;
  cin >> x >> y;
  
  cout << (double)((W * H)/2.0) << " ";
  
  if (x == (W/2) && y == (H/2)) cout << "1";
  else cout << "0";
}

Measured memory_bytes: 256
n,x = map(int,input().split())
a = list(map(int,input().split()))
cnt = 0
for i in range(n):
  if a[i] >= x:
    cnt += a[i]-x
    a[i]=x
    
for j in range(n-1):
  if a[j]+a[j+1]>=x:
    d = a[j]+a[j+1]-x
    cnt += d   
    a[j+1] -= d 
        
print(cnt)    

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;

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

    int cnt = 0;
    int trig = 0;
    int r_cnt = 0;
    vector<int> res(S.size()); REP(i, S.size()) res[i] = 0;

    REP(i, S.size()) {
        if((S[i] == 'R' && S[i - 1] == 'R') || i == 0) {
            cnt++;
        } else if(S[i - 1] == 'R' && S[i] == 'L') {
            trig = i - 1;
            r_cnt = cnt - 1;
            cnt++;
        } else if(S[i - 1] == 'L' && S[i] == 'L') {
            cnt++;
        } else if(S[i] == 'R' && S[i - 1] == 'L') {
            if(cnt % 2 == 0) {
                res[trig] = cnt / 2;
                res[trig + 1] = cnt / 2;
            } else {
                if(r_cnt % 2 == 1) {
                    res[trig] = cnt / 2;
                    res[trig + 1] = cnt / 2 + 1;
                } else {
                    res[trig] = cnt / 2 + 1;
                    res[trig + 1] = cnt / 2;
                }
            }
            cnt = 1;
            trig = 0;
        }

        // ラストLのとき
        if(i == S.size() - 1) {
            if(cnt % 2 == 0) {
                res[trig] = cnt / 2;
                res[trig + 1] = cnt / 2;
            } else {
                if(r_cnt % 2 == 1) {
                    res[trig] = cnt / 2;
                    res[trig + 1] = cnt / 2 + 1;
                } else {
                    res[trig] = cnt / 2 + 1;
                    res[trig + 1] = cnt / 2;
                }
            }
            cnt = 1;
            trig = 0;
        }
    }

    REP(i, S.size()) cout << res[i] << " ";
    cout << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int R,C;
char arr[1001][1001];
int memo[1001][1001];
int main()
{
	scanf("%d %d",&R,&C);
	for(int i=0;i<R;i++)
		scanf("%s",arr[i]);
	for(int i=0;i<R;i++)
		for(int j=0;j<C;j++)
			memo[i][j]=0;
	memo[0][0]=1;
	for(int j=1;j<C;j++)
	{
		if(arr[0][j]=='.')
			memo[0][j]=1;
		else	break;
	}
		
	
	for(int i=1;i<R;i++)
	{
		if(arr[i][0]=='.')
			memo[i][0]=1;
		else	break;
	}
	
	for(int i=1;i<R;i++)
	{
		for(int j=1;j<C;j++)
			if(arr[i][j]=='.')
				memo[i][j]=(memo[i-1][j] + memo[i][j-1]) % 1000000007;
	}
	printf("%d\n",memo[R-1][C-1]);
}

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

long long int k,i;
string s;

signed main()
{
    ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>k>>s;
	if (s.size()<=k) cout<<s;else
	{
		for (i=0;i<k;i++) cout<<s[i];cout<<"...";
	}
}


Measured memory_bytes: 3652
#define _LIBCPP_DEBUG 0
    #include <bits/stdc++.h>
    using namespace std;
    int main(){
      int N;
      cin >> N;
      vector<string> S(N);
      vector<int> C(N);
      for(int i=0; i < N; i++){
        cin >> S[i];
      }
      
      sort(S.begin(),S.end());
      int pin=0;
      int nowmax=0;
      for(int i=0; i < N; i++){
        if(!(S[pin]==S[i])){
          pin=i;
        } 
        C[pin]++;
        nowmax = max(C[pin],nowmax);
      }
      for(int i=0; i < N; i++){
        if(C[i]==nowmax){
         cout << S[i] << endl;
        }
      }
      return 0;
    }

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

using namespace std;
typedef long long ll;

ll big = 1000000007ll;
ll n,m,k,x,y;

vector<ll> A;
vector<ll> B;

ll mod(ll i , ll b){
    if(i < 0)return mod(b - mod(-i,b),b);
    return i%b;
}

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

    ll c1,c2,c3,c4,c5;
    ll a,b,c;

    cin >> n;

    ll ans = 0;

    for(c1 = 0; c1 < n; c1++){
        cin >> a >> b;
        A.push_back(a);
        B.push_back(b);
    }
    for(c1 = n-1; c1 >= 0; c1--){
        a = A[c1];
        b = B[c1];
        ans += mod(- ans - a,b);
    }
    cout << ans << "\n";

    return 0;
}


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

using namespace std;

string S, T;

int main(void)
{
    cin >> S;
    cin >> T;

    int max = 0;
    for (int i = 0; i < S.length() - T.length() + 1; i++)
    {

        int count = 0;
        for (int j = 0; j < T.length(); j++)
        {

            if (S[i + j] == T[j])
            {
                count++;
            }
        }
        if (count > max)
        {
            max = count;
        }
    }

    cout << T.length() - max << endl;
}

Measured memory_bytes: 3588
#include <stdio.h>
#include <stdlib.h>

int main (void) {
    int n;

    scanf("%d", &n);

    int a, sum[n];

    int i;
    for ( i=0; i<n; i++ )
        sum[i] = 0;
    for ( i=0; i<n-1; i++ ) {
        scanf("%d", &a);
        sum[a-1]++;
    }

    for ( i=0; i<n; i++ )
        printf("%d\n", sum[i]);
    return EXIT_SUCCESS;
}


Measured memory_bytes: 2512
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)
function main()
  a = parseInt(readline())
  #N,K = parseMap(split(readline()))
  #p = parseMap(split(readline()))
  #println("$N,$K")
  #println("$p")
  #println("$p")
  if mod(a,1000) != 0
    println(1000-mod(a,1000))
  else
    println(0)
  end
end
main()


Measured memory_bytes: 157024
#include <cstdio>

int main()
{
  double w;
  while (~scanf("%lf", &w)) {
    if (w <= 48.0)
      puts("light fly");
    else if (w <= 51.0)
      puts("fly");
    else if (w <= 54.0)
      puts("bantam");
    else if (w <= 57.0)
      puts("feather");
    else if (w <= 60.0)
      puts("light");
    else if (w <= 64.0)
      puts("light welter");
    else if (w <= 69.0)
      puts("welter");
    else if (w <= 75.0)
      puts("light middle");
    else if (w <= 81.0)
      puts("middle");
    else if (w <= 91.0)
      puts("light heavy");
    else
      puts("heavy");
  }
  return 0;
}

Measured memory_bytes: 0
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std; 

inline void solve(){ 
	int n; string s; 
    cin>>n>>s; 
	vi cnt(26,1); 
	for (int i=0;i<sz(s);i++) 
		cnt[s[i]-'a']++; 
	int ans=1;
	for (int i=0;i<26;i++){
		ans = (ans*cnt[i])%1000000007;
	} 
	cout << (ans-1) << endl; 
} 
 
signed main() 
{ 
    int n=1; // cin>>n; 
    while (n--) solve(); 
    return 0; 
} 

/* 
all possible substring :---> 
	(2^N  - 1 ) 
*/ 


Measured memory_bytes: 3784
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
using namespace std;


int main() {
	
	double r;

	cin >> r;
	
	printf("%.7lf %.7lf\n", M_PI*r*r, 2*r*M_PI);


//	system("pause");
	return 0;
}


Measured memory_bytes: 3156
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;
const long LIM=1e18;
int T;
long N,A,B,C,D;
main()
{
	cin>>T;
	for(;T--;)
	{
		cin>>N>>A>>B>>C>>D;
		vector<pair<long,long> >X;
		X.push_back(make_pair(2,A));
		X.push_back(make_pair(3,B));
		X.push_back(make_pair(5,C));
		long ans=60*(A+D);
		map<long,long>all;
		all[N]=0;
		priority_queue<pair<long,long> >Q;
		Q.push(make_pair(-N,0L));
		while(!Q.empty())
		{
			long t=-Q.top().first,c=Q.top().second;Q.pop();
			if(all[t]<c||ans<=c)continue;
			if(t<=ans/D)
			{
				ans=min(ans,c+t*D);
			}
			for(pair<long,long>q:X)
			{
				long a=t%q.first,b=t/q.first;
				int lim=q.first%2?q.first%3?5:3:2;
				if(a<lim&&b>0&&a*D+q.second+c<ans)
				{
					long nc=a*D+q.second+c;
					if(all.find(b)==all.end()||all[b]>nc)
					{
						Q.push(make_pair(-b,nc));
						all[b]=nc;
					}
				}
				if(q.first-a<lim&&(q.first-a)*D+q.second+c<ans)
				{
					long nc=(q.first-a)*D+q.second+c;
					if(all.find(b+1)==all.end()||all[b+1]>nc)
					{
						Q.push(make_pair(-b-1,nc));
						all[b+1]=nc;
					}
				}
				if(q.first>t)break;
			}
		}
		cout<<ans<<endl;
	}
}


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

int main(){
  vector<int> a(4), b(4);

  while (cin >> a.at(0) >> a.at(1) >> a.at(2) >> a.at(3) >> b.at(0) >> b.at(1) >>
b.at(2) >> b.at(3)) {
    int hit = 0, blow = 0;
    for (int i = 0; i < 4; i++) {
      for (int j = 0; j < 4; j++) {
        if (a.at(i) == b.at(j)) {
          if (i == j) {
            hit++;
          } else {
            blow++;
          }
        }
      }
    }
    cout << hit << " " << blow << endl;
  }
}



Measured memory_bytes: 3088
package main

import (
	"fmt"
)

func main() {
	var n, k, x, y int
	fmt.Scan(&n)
	fmt.Scan(&k)
	fmt.Scan(&x)
	fmt.Scan(&y)
	// fmt.Printf("x = %d, k = %d, x = %d, y = %d\n", n, k, x, y)

	var sum int
	for i := 1; i <= n; i++ {
		if i <= k {
			sum += x
		} else {
			sum += y
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 512
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

long solve(long x)
{
  auto a = x / 500;
  auto b = x % 500 / 5;
  return a * 1000 + b * 5;
}

int main()
{
  long x;
  std::cin >> x;

  std::cout << std::setprecision(20);
  std::cout << solve(x) << std::endl;
}


Measured memory_bytes: 256
program one_hundred_to_one_hundred_five
  implicit none
  integer :: x, l, u, i, d
  read(*,*) x
  l = x/105
  u = (x+99)/100
  do i = l, u
    d = x-100*i
    if (0 <= d .and. d <= 5*i) then
      write(*,'(i0)') 1
      stop
    end if
  end do
  write(*,'(i0)') 0
end program one_hundred_to_one_hundred_five

Measured memory_bytes: 640
N = int(input())
abcList = [[int(i) for i in input().split()] for _ in range(N)]

dp = [[0 for _ in range(3)] for _ in range(N)]
dp[0] = abcList[0]
for i in range(1, N):
    for j in range(3):
        for k, element in enumerate(abcList[i]):
            if j == k:
                continue
            dp[i][k] = max(dp[i - 1][j] + element, dp[i][k])

print(max(dp[N - 1]))



Measured memory_bytes: 45664
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<stack>
using namespace std;
int n, k, x;
int vis[10];
int solve(int x)
{
    while(x)
    {
        if(vis[x%10])
            return 0;
        x/=10;
    }
    return 1;
}
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=0; i<k; i++)
    {
        scanf("%d",&x);
        vis[x] = 1;
    }
    while(1)
    {
        if(solve(n))
        {
            printf("%d\n",n);
            break;
        }
        n++;
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

/*
*/

ll h[2],m[2],k;

int main(void){
	rep(i,2)cin>>h[i]>>m[i];
	cin>>k;
	cout<<(h[1]*60+m[1])-(h[0]*60+m[0])-k<<endl;
	return 0;
}

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

int main() {
  int N, D, X;
  cin >> N >> D >> X;
  vector<int> A(N);
  int sum = X;
  for(int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < 1001; j++) {
      if(1 + j * A.at(i) <= D) {
        sum++;
      }
      else {
        break;
      }
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60


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

	int N, K;
	cin >> N >> K;
	string S; cin >> S;

	for (int i = 0; i < N; i++) {
		if (i != K-1) {
			cout << S[i];
		}
		else {
			if (S[i] == 'A') cout << 'a';
			else if (S[i] == 'B') cout << 'b';
			else if (S[i] == 'C') cout << 'c';
		}
	}

	cout << endl;


	return 0;
}

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

#define rep(i, n)  for (int i = 0; i < (int) (n); i++)
#define Rrep(i, n) for (int i = ((int) n - 1); i >= 0; i--)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
#define INF 2e15
#define MOD 10e9 + 7

typedef vector <int> vint;
typedef long long    ll;



int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    int h, w, m;
    cin >> h >> w >> m;

    vector <int> hbomb(h, 0);
    vector <int> wbomb(w, 0);

    vector <pair <int, int> > bomb(m);
    rep(i, m) {
        int tmp1, tmp2;
        cin >> tmp1 >> tmp2;
        tmp1--;
        tmp2--;

        bomb[i] = make_pair(tmp1, tmp2);
        hbomb[tmp1]++;
        wbomb[tmp2]++;
    }

    int hmax = -1;
    int wmax = -1;

    int hctr = 1;
    int wctr = 1;

    rep(i, h) {
        if (hmax == hbomb[i]) { hctr++; }
        else if (hmax < hbomb[i]) { hctr = 1; hmax = hbomb[i]; }
    }
    rep(i, w) {
        if (wmax == wbomb[i]) { wctr++; }
        else if (wmax < wbomb[i]) { wctr = 1; wmax = wbomb[i]; }
    }

    int cross   = 0;
    int pattern = hctr * wctr;

    rep(i, m) {
        if (hbomb[bomb[i].first] == hmax && wbomb[bomb[i].second] == wmax) { cross++; }
    }

    if (!(pattern - cross)) { cout << hmax + wmax - 1 << endl; }
    else { cout << hmax + wmax << endl; }

    return 0;
}


Measured memory_bytes: 7952