akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> A(N), B(N);
    REP(i,N) cin >> A[i];
    REP(i,N) cin >> B[i];
    int ODD = (N + 1) / 2;
    int EVEN = N / 2;

    int ans = INF;
    REP(bits, 1<<N){
        vector<pair<int,int>> even, odd;
        REP(j,N){
            if((bits >> j) & 1){
                if(j & 1) odd.emplace_back(B[j], j);
                else even.emplace_back(B[j], j);
            }
            else{
                if(j & 1) even.emplace_back(A[j], j);
                else odd.emplace_back(A[j], j);
            }
        }
        if(ODD != (int)odd.size() || EVEN != (int)even.size()) continue;
        sort(odd.begin(), odd.end());
        sort(even.begin(), even.end());
        vector<pair<int,int>> v;
        REP(i,ODD){
            v.emplace_back(odd[i]);
            if(i < EVEN) v.emplace_back(even[i]);
        }
        bool ok = true;
        for(int i=1;i<N;i++) if(v[i-1].first > v[i].first) ok = false;
        if(!ok) continue;
        int cnt = 0;
        REP(i,N) for(int j=i+1;j<N;j++) if(v[i].second > v[j].second) cnt++;
        chmin(ans, cnt);
    }
    if(ans == INF) ans = -1;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include<string.h>
typedef long long ll;

char s[10005];
int main(){
	int N;
	scanf("%d",&N);
	scanf("%s",&s);
	int length=strlen(s);
	for(int i=0;i<length;i++){
		if((s[i]+N)>'Z'){
			s[i]=s[i]+N-26;
		}else{
			s[i]+=N;
		}
		printf("%c",s[i]);
	}
	printf("\n");
	
	
	
}

Measured memory_bytes: 1620
#include<stdio.h>
int selectionSort(int A[],int N){
    int i,j,t,sw=0,minj;
    for(i=0;i<N-1;i++){
        minj=i;
        for(j=i;j<N;j++){
            if(A[j]<A[minj])minj=j;}
         t=A[i];A[i]=A[minj];A[minj]=t;
         if(i!=minj)sw++;
        }
    return sw;
    }
    int main(){
    int A[100],N,i,sw;
    scanf("%d",&N);
    for(i=0;i<N;i++)scanf("%d",&A[i]);
    sw=selectionSort(A,N);
    for(i=0;i<N;i++){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
    printf("%d\n",sw);
return 0;
}

Measured memory_bytes: 2692
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	vector<int> p(n + 1);
	rep(i, 1, n)cin >> p[i];
	int cnt = 0;
	rep(i, 1, n - 1)
	{
		if (p[i] == i)
		{
			int x = p[i];
			p[i] = p[i + 1];
			p[i + 1] = x;
			++cnt;
		}
	}
	if (p[n] == n)++cnt;
	cout << cnt << endl;
}


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

#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 1e9 + 7;

int main(){
    ll N, A, B, C, D, E;
    cin >> N >> A >> B >> C >> D >> E;
    ll m = min(A,min(B,min(C,min(D,E))));
    ll ans;
  	if(N % m != 0) ans = N / m + 5;
    else ans = N / m + 4;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m, k;
    cin >> n >> m >> k;
    FOR(i, 0, n)FOR(j, 0, m){
        if(k == i * m + j * n - j * i * 2){
            cout << "Yes" << "\n";
            return 0;
        }
    }

    cout << "No" << "\n";
    return 0;
}


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

int main()
{
    ll n, d, res = 0;
    cin >> n >> d;

    for(int i = 0; i < n; ++i)
    {
        ll x, y;
        cin >> x >> y;
        if(sqrt(x * x + y * y) <= d)
            res ++;
    }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 3676
#include <cstdio>
#include <algorithm>
#include <set>
using namespace std;
int main() {
    int N, K, ans = 0;
	scanf("%d %d", &N, &K);
	int p[N + 1];
	p[0] = 0;
	for (int i = 1; i <= N; ++i) scanf("%d", &p[i]), p[i] += p[i - 1];
	for (int i = 0; i <= N - K; ++i) ans = max(ans, p[i + K] - p[i]);
	printf("%.6lf", (ans + K) / 2.0);
	return 0;
}

Measured memory_bytes: 896
#pragma optimize("", off)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:36777216")
#include <bits/stdc++.h>

#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define all(v) v.begin(),v.end()
#define pb push_back
#define sz(i) (int)(i.size())
#define setto(n) cout << fixed << setprecision(n)
#define fi first
#define se second
#define ld long double
#define inf LONG_MAX
#define pii pair<int, int>
#ifdef ONLINE_JUDGE
#define endl '\n'
#endif
const int mod = 1000000007;
using namespace std;

#define meta __FUNCTION__<<" : "<<__LINE__<<" "
#define tr1(x) cerr<<meta<<"| "<<#x<<" : "<<x<<" | "<<endl
#define tr2(x,y) cerr<<meta<<"| "<<#x<<" : "<<x<<" | "<<" "<<#y<<" : "<<y<<" | "<<endl
#define tr3(x,y,z) cerr<<meta<<"| "<<#x<<" : "<<x<<" | "<<" "<<#y<<" : "<<y<<" | "<<" "<<#z<<" : "<<z<<" | "<<endl
#define tr4(w,x,y,z) cerr<<meta<<"| "<<#w<<" : "<<w<<" | "<<" "<<#x<<" : " <<x<<" | "<<" "<<#y<<" : "<<y<<" | "<<" "<<#z<<" : "<<z<<" | "<<endl
#define tr5(v,w,x,y,z) cerr<<meta<<"| "<<#v<<" : "<<v<<" | "<<" "<<#w<<" : "<<w<<" | "<<" "<<#x<<" : "<<x<<" | "<<" "<<#y<<" : "<<y<<" | "<<" "<<#z<<" : "<<z<<" | "<<endl
#define tr6(u,v,w,x,y,z) cerr<<meta<<#u<<" : "<<u<<" | "<<" "<<#v<<" : "<<v<<" | "<<" "<<#w<<" : "<<w<<" | "<<" "<<#x<<" : "<<x<<" | "<<" "<<#y<<" : "<<y<<" | "<<" "<<#z<<" : "<<z<<" | "<<endl

template<class T> void smin(T& a, T val) {if (a > val) a = val;}
template<class T> void smax(T& a, T val) {if (a < val) a = val;}
template<typename T>inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v){bool first = true;os << "[";for(auto i: v){if(!first)os << ", ";os << i;first = false;}return os << "]";}
//Check N size twiceeeeeeeeeeeeeeeeee, and verify it

const int N = 2*1e5 + 10;

int n;
int main(){_

	cin>>n;

	if(n == 1){
		cout<<"Hello World";
	}
	else{
		int a, b;
		cin>>a>>b;
		cout<<a+b;
	}

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int N;
	string S;
	scan(N>>S);
	int ans=0;
	rep1(len,N-1){
		int samemax=0;
		int samenow=0;
		rep(i,N-len){
			if(S[i]==S[i+len]) samenow++;
			else samenow=0;
			samemax=max(samemax,samenow);
		}
		ans=max(ans,min(len,samemax));
	}
	prin(ans);
	return 0;
}


Measured memory_bytes: 384
def inpl(): return [int(i) for i in input().split()]
A, B, K = inpl()
if B-A+1 <= 2*K:
    for i in range(A, B+1):
        print(i)
else:
    for i in range(A, A+K):
        print(i)
    for i in range(B-K+1, B+1):
        print(i)

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

int main(){
    int h,w; cin >> h >> w;
    vector<string> s(h);
    for (int i=0;i<h;i++){
        cin >> s[i];
    }
    vector<vector<int> > L(h),R(h),U(h),D(h);
    for (int i=0;i<h;i++){
        vector<int> t1(w,0),t2(w,0),t3(w,0),t4(w,0);
        L[i] = t1; R[i] = t2; U[i] = t3; D[i] = t4; 
    }
    for (int i=0;i<h;i++){
        for (int j=0;j<w;j++){
            if (i==0){
                if(s[i][j] == '.'){L[i][j]=1;}
            }else{
                if(s[i][j] == '.'){L[i][j]=L[i-1][j]+1;}
                else{L[i][j]=0;}
            }
        }
    }
    for (int i=0;i<h;i++){
        for (int j=0;j<w;j++){
            if (j==0){
                if(s[i][j] == '.'){U[i][j]=1;}
            }else{
                if(s[i][j] == '.'){U[i][j]=U[i][j-1]+1;}
                else{U[i][j]=0;}
            }
        }
    }
    for (int i=h-1;i>=0;i--){
        for (int j=w-1;j>=0;j--){
            if (i==h-1){
                if(s[i][j] == '.'){R[i][j]=1;}
            }else{
                if(s[i][j] == '.'){R[i][j]=R[i+1][j]+1;}
                else{R[i][j]=0;}
            }
        }
    }
    for (int i=h-1;i>=0;i--){
        for (int j=w-1;j>=0;j--){
            if (j==w-1){
                if(s[i][j] == '.'){D[i][j]=1;}
            }else{
                if(s[i][j] == '.'){D[i][j]=D[i][j+1]+1;}
                else{D[i][j]=0;}
            }
        }
    }
    int res = 0;
    for (int i=0;i<h;i++){
        for (int j=0;j<w;j++){
            res = max(res,L[i][j]+R[i][j]+U[i][j]+D[i][j]-3);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 67200
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
/*----------------------------------------------------------------*/

// int MOD = 998244353;
int MOD = 1000000007;
int n,k;
vector<int> a;
vector<int> f;
int cnt(int x){
    int res = 0;
    rep(i,n){
        int b = x/f[i];
        res += max(0LL,a[n-1-i]-b);
    }
    return res;
}


/*----------------------------------------------------------------*/
signed main(){

    cin >> n >> k;
    rep(i,n){
        int A;cin >> A;
        a.pb(A);
    }
    rep(i,n){
        int F;cin >> F;
        f.pb(F);
    }
    SORT(a);
    SORT(f);

    ll ok = 1000000000000;  //解が存在する値
    ll ng = -1;//解が存在しない値 

    while(abs(ok-ng)>1){
        ll mid = (ok+ng)/2;
        if(cnt(mid) <= k){
            ok = mid;
        }else{
            ng = mid;
        }
    }
    cout << ok << endl;

	return 0;
}
/*----------------------------------------------------------------*/

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://pakencamp-2019-day3.contest.atcoder.jp/tasks/pakencamp_2019_day3_c
// rm -r -f test;oj dl https://abc144.contest.atcoder.jp/tasks/abc144_e

Measured memory_bytes: 4848
#include <bits/stdc++.h>
    using namespace std;
    #define int long long int
    #define vi vector<int>
    #define pii pair<long long ,long long>
    #define pll pair<int,int>
    #define mod 1000000007
    #define hell 998244353
    #define all(x) x.begin(),x.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb push_back
    #define ff first
    #define ss second
    #define rep(n) for(int i=0;i<n;i++)
    #define lb lower_bound
    #define up upper_bound
    int dp[1003][1003];
    char a[1003][1003];
    void solve()
    { 
      
      int h,w;
      cin>>h>>w;
      for(int i=0;i<h;i++)
      {
         for(int j=0;j<w;j++)
         {
           char c;
            cin>>c;
            a[i][j]=c;
         }
      }
      dp[0][0]=1;
      for(int i=1;i<w;i++)
      {
         int x=0;
         if(a[0][i]=='.')
          x=dp[0][i-1];
         dp[0][i]=x;
      }
     for(int i=1;i<h;i++)
      {
         int x=0;
         if(a[i][0]=='.')
          x=dp[i-1][0];
         dp[i][0]=x;
      }

      for(int i=1;i<h;i++)
      {
         for(int j=1;j<w;j++)
         {
            int x=0;
            if(a[i][j]=='.')
              x=(dp[i][j-1]%mod+dp[i-1][j]%mod)%mod;
            dp[i][j]=x%mod;

         }
      }
      cout<<dp[h-1][w-1];
     

      

    }



    signed main()
    {

      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      cout.tie(NULL);


      /*#ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
      #endif*/
      
      
      int T;
      T=1;
      
      while(T--)
      {
        solve();
      }
      return 0;
    }

Measured memory_bytes: 9088
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);		
		int n = scan.nextInt();
		
		for (int i = 1; i <= n; i++) {
			int x = i;
			if (x % 3 == 0) {
				System.out.print(" " + i);
				continue;
			}
			if (x % 10 == 3) {
				System.out.print(" " + i);
				continue;
			}
			
			for (x /= 10; x != 0; x /= 10) {
				if (x % 10 == 3) {
					System.out.print(" " + i);
					break;
				}
			}
		}
		System.out.println();
		scan.close();
	}

}

Measured memory_bytes: 24260
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <limits>
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define pint_INF 2000000000
#define ll_INF 	9223372036854775807
#define MOD 1000000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvll vector<vector<long long>>
#define vvc vector<vector<char>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define sysp system("PAUSE")
#define pno cout << "no" << endl
#define pyes cout << "yes" << endl
#define pYes cout << "Yes" << endl
#define pNo cout << "No" << endl
#define pNO cout << "NO" << endl
#define pYES cout << "YES" << endl
#define endl "\n"
#define pi 3.14159265358979
using namespace std;
using ll = long long;
int main() {
	int n, x, t; cin >> n >> x >> t;
	int repeat = (n + (x - 1)) / x;
	cout << t * repeat << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, q; cin >> n >> q;
  vector<int> C(n);
  rep(i, n) {
    cin >> C[i];
    C[i]--;
  }
  vector<pair<int, int>> Q(q);
  vector<int> id(q);
  rep(i, q) {
    cin >> Q[i].first >> Q[i].second;
    Q[i].first--; Q[i].second--;
    id[i] = i;
  }
  sort(all(id), [&](int i, int j) {
      return Q[i].second < Q[j].second;
    });
  vector<int> last(n, -1);
  BinaryIndexedTree<int> bit(n);
  int tmp = -1;
  vector<int> ans(q);
  rep(i, q) {
    while(tmp < Q[id[i]].second) {
      tmp++;
      if(last[C[tmp]] != -1) bit.add(last[C[tmp]], -1);
      last[C[tmp]] = tmp;
      bit.add(tmp, 1);
    }
    ans[id[i]] = bit.sum(Q[id[i]].second) - bit.sum(Q[id[i]].first-1);
  }
  rep(i, q) cout << ans[i] << "\n";
  return 0;
}


Measured memory_bytes: 17396
#include <bits/stdc++.h>
using namespace std;
const int N = 3050;
int n, a[N];
long long mem1[N][N], mem2[N][N];
bool vis1[N][N], vis2[N][N];

long long dpmax(int, int);
long long dpmin(int, int);

long long dpmax(int l, int r) {
	if (l > r) {
		return 0;
	}
	if (vis1[l][r]) {
		return mem1[l][r];
	}
	vis1[l][r] = true;

	long long a1 = a[l] + dpmin(l + 1, r);
	long long a2 = a[r] + dpmin(l, r - 1);
	
	return mem1[l][r] = max(a1, a2);
}

long long dpmin(int l, int r) {
	if (l > r) {
		return 0;
	}
	if (vis2[l][r]) {
		return mem2[l][r];
	}
	vis2[l][r] = true;

	long long a1 = dpmax(l + 1, r) - a[l];
	long long a2 = dpmax(l, r - 1) - a[r];
	
	return mem2[l][r] = min(a1, a2);
}

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

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}

	cout << dpmax(0, n - 1) << '\n';

	return 0;
}


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

using namespace std;

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

    int ans = 1000; //差の


//// 1 2 3 4 5 6 7 8 7 6
//// * * * * * * * * 

    for(int i=0; i<S.size()-2; i++){
        int n;
        n=100* (S.at(i)-'0') + 10* (S.at(i+1)-'0') + (S.at(i+2) -'0');
        ans = min( ans, abs(n-753) );
    }

    cout << ans << endl;

}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String b = sc.next();
        switch (b) {
            case "A":
                System.out.println("T");
                break;
            case "C":
                System.out.println("G");
                break;
            case "G":
                System.out.println("C");
                break;
            case "T":
                System.out.println("A");
                break;
            default:
                break;
        }
    }
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define P 1000000007
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
 
using namespace std;
using ll = long long;
typedef pair<int, int> ii;
typedef vector<ii> vii; 
typedef vector<int> vi;
 
//recollect
//simplify
//divide into cases (i.e. i = 1, 2, N, a prime number, etc...)
  
void solve() {
	cout << setprecision(10);
	
	int n;
	cin >> n;
	
	using vd = vector<double>;
	vd p(n);
	for(int i = 0; i < n; i++) cin >> p[i];
	
	vector<vd> dp(n + 1, vd(n + 1, 0));
	dp[0][0] = 1;
	for(int coin = 0; coin < n; coin++) {
		for(int heads = 0; heads <= n; heads++) {
			dp[coin + 1][heads + 1] += dp[coin][heads] * (p[coin]);
			dp[coin + 1][heads] += dp[coin][heads] * (1 - p[coin]);
		}
	}
	
	double ans = 0;
	for(int i = n / 2 + 1; i <= n; i++) {
		ans += dp[n][i];
	}
	
	cout << ans << endl;
}
 
int main(){
#define MULTITEST 0
#if MULTITEST   
 
    CASET {
        solve();
    }
    
#else
 
    solve();
    
#endif
 
    return 0;
}

Measured memory_bytes: 73768
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 a = 0;
		int b = 0;

		while(true){
			String str = br.readLine();
			String[] s = str.split(" ");

			a = Integer.parseInt(s[0]);
			b = Integer.parseInt(s[1]);
			if((a <= 300) &&(b <= 300)){
				if((a == 0)&&(b == 0)){
					break;
				}

				for(int i = 0; i < a; i++){
					for(int j = 0; j < b; j++){
						System.out.print("#");
					}
					System.out.println();
				}
				System.out.println();
			}
		}
	}
}

Measured memory_bytes: 35884
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int N = 100001;

int n, dp[N], cnt[N], mod = 1e9 + 7;
ll A, B;
vector <ll> a;

int solve(int idx){
    if(idx == n) return 1;
    int &ret = dp[idx];
    if(ret != -1) return ret;
    ret = 0;
    int j = lower_bound(a.begin(), a.end(), a[idx] + A) - a.begin();
    bool ok = (idx == 0 || idx == n - 1 || a[idx + 1] - a[idx - 1] >= B);
    if(idx + 2 < j){
        ok &= cnt[j - 1] - cnt[idx + 1] == j - idx - 2;
    }
    if(ok) ret = solve(j);
    if(idx == 0 || a[idx] - a[idx - 1] >= B){
        ret += solve(idx + 1);
        if(ret >= mod) ret -= mod;
    }
    return ret;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(dp, -1, sizeof dp);
    cin >> n >> A >> B;
    if(A < B) swap(A, B);
    a.resize(n);
    for(auto &i : a) cin >> i;
    for(int i = 1 ; i < n ; i++){
        cnt[i] = cnt[i - 1] + (a[i] - a[i - 1] >= B);
    }
    cout << solve(0) << endl;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define int long long
#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++)
using namespace std;
signed main(){
    int n, k; cin >> n >> k;
    int ans = 0;
    for (int i = k; i <= n+1; i++){
        int mn = i*(i-1)/2;
        int mx = i*(2*n-i+1)/2;
        ans += (mx - mn + 1) % 1000000007;
    }
    ans %= 1000000007;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF = 1e9;
const int MOD = 1000000007;
const int MAX = 1000000;
int n = 100000;
vector<vector<P>> graph(n,vector<P>());
vector<bool> seen(n,false);
vector<int> dis(n);

bool dfs(int i,int p = -1,int d = 0){
        if(!seen[i]) dis[i] = d;
        else return dis[i] == d;
        seen[i] = true;
        bool res = true;
        for(P child:graph[i]){
                if(child.first == p) continue;
                 res = res && dfs(child.first,i,d+child.second);
        }
        return res;
}


int main(){
        int m;
        cin >> n >> m;
        rep(i,m){
                int l,r,d;
                cin >> l >> r>> d;
                --l;--r;
                graph[l].push_back(P(r,d));
                graph[r].push_back(P(l,-d));
        }

        rep(i,n){
                if(!seen[i]){
                        if(!dfs(i)){
                                cout << "No" << endl;
                                return 0;
                        }
                }
        }

        cout << "Yes" << endl;
        return 0;
}

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

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    vector<int> l(n);
    for(int i = 0; i < n; i++) cin >> l[i];
    int ans = 0;
    sort(l.begin(), l.end());
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            for(int k = j + 1; k < n; k++){
                if(l[i] == l[j] || l[j] == l[k]) continue;
                if(l[i] + l[j] > l[k]){
                    ans++;
                }
            }
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>

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


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

int digitSum(int t);

int main() {
    int n, sum;
    cin >> n;
    sum = digitSum(n);
    if(n % sum) cout << "No" << endl;
    else cout << "Yes" << endl;
}

int digitSum(int t) {
    if(t == 0) return 0;
    return t % 10 + digitSum(t / 10);
}

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

int main(){
  ll a, b, c; cin >> a >> b >> c;
  ll x = 4*a*b, y = (c-a-b) * (c-a-b);
  if(c <= a+b){
    cout << "No" << endl;
    return 0;
  }
  if(x < y){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

#define SQ(x) ((x)*(x))
#define MIN(x,y) (((x)<(y))?(x):(y))

int main(void){
  int sum,a[100],N,ave;
  int i,j,k,c1,c2,c3;
  scanf("%d",&N);
  for(i=0;i<N;i++) scanf("%d",a+i);
  sum=0;
  for(i=0;i<N;i++) sum+=a[i];

  c1=0;
  ave=sum/N;
  for(i=0;i<N;i++) c1+=SQ(ave-a[i]);
  ave++;
  c2=0;
  for(i=0;i<N;i++) c2+=SQ(ave-a[i]);
  ave-=2;
  c3=0;
  for(i=0;i<N;i++) c3+=SQ(ave-a[i]);


  printf("%d\n",MIN(MIN(c1,c2),c3));
  return 0;
}


Measured memory_bytes: 128
INF = float('inf')


def tc():
    n, cap = map(int, input().split())

    # dp[i]: max total value with weights exactly i
    dp = [0] * (cap + 1)

    for i in range(n):
        w, v = map(int, input().split())
        for prev_w in reversed(range(cap - w + 1)):
            dp[prev_w + w] = max(dp[prev_w + w], dp[prev_w] + v)

    ans = max(dp)
    print(ans)


tc()


Measured memory_bytes: 74232
#include <iostream>
#include <math.h>
using namespace std;
using P = pair<int, int>;

int main(void){
    int n, m;
    P d[5];
    
    cin >> n >> m;
    
    for(int i = 0; i < m; i++){
        cin >> d[i].first >> d[i].second;
    }
    
    int res = pow(10, n-1);
    res = (res == 1) ? 0 : res;
    int lim = pow(10, n);
    for(; res < lim; res++){
        string str = to_string(res);
        int i;
        for(i = 0; i < m; i++){
            if(str.at(d[i].first - 1) != d[i].second + '0') break;
        }
        if(i == m) break;
    }
    
    if(res == lim) res = -1;
    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const ll INF=1<<30;

int main(){
	ll n;cin>>n;
	vector<ll> po;
	vector<ll> ne;
	for(int i = 0; i < n; i++) {
		ll x;cin>>x;
		if (x >= 0){
			po.pb(x);
		}
		else{
			ne.pb(x);
		}
	}
	sort(ALL(po),greater<ll>());
	sort(ALL(ne));
	if (ne.size() == 0){
		ne.pb(po.back());
		po.pop_back();
	}
	if (po.size() == 0){
		po.pb(ne.back());
		ne.pop_back();
	}
	vector<P> v;
	while(1){
		if (po.size() == 1 && ne.size() == 1){
			v.pb(mp(po[0],ne[0]));
			cout << po[0] - ne[0] << endl;
			break;
		}
		else if (po.size() > 1){
			ll pos = po.back();
			ll neg = ne.back();
			po.pop_back();
			ne.pop_back();
			ne.pb(neg - pos);
			v.pb(mp(neg,pos));
		}
		else if (ne.size() > 1){
			ll pos = po.back();
			ll neg = ne.back();
			po.pop_back();
			ne.pop_back();
			po.pb(pos - neg);
			v.pb(mp(pos,neg));
		}
	}
	for(int i = 0; i < v.size(); i++) {
		cout << v[i].fs << " "<< v[i].sc << endl;
	}
	
	return 0;
}

Measured memory_bytes: 5104
import java.util.Scanner;

public class Main {

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

		int a = sc.nextInt();	
		int b = sc.nextInt();
		
		int c=1;
		for(int i=2;i<b-a;i++) {
			c+=i;
		}
		System.out.println(c-a);
	}
}


Measured memory_bytes: 23252
#include <iostream>
#include <iomanip>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional>
#include <cmath>
#include <numeric>
#include <bitset>
#include <cstdint>
#include <stdexcept>
using namespace std;

// 整数型

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

// [0,n)を昇順/降順でループ

#define rep(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define repd(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)

// [a,b)を昇順/降順でループ

#define FOR(i, a, b) for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define FORD(i, a, b) for (int i = static_cast<int>(b) - 1; i >= static_cast<int>(a); --i)

// デバッグ

#ifdef DEBUG
#include <cassert>
#define my_assert(x) assert(x)
#else
#define my_assert(x)
#define assert(x)
#endif

//////////////// //////////////// //////////////// //////////////// ////////////////
//////////////// //////////////// //////////////// //////////////// ////////////////

// fenwick tree
struct fw
{
    int n;
    vector<int> data;

    // data[0] は使わない
    fw(int size) : n(size), data(size + 1, 0) {}

    void add(int i, int a)
    {
        ++i;
        while (i <= n)
        {
            data[i] = data[i] + a;
            i += i & -i;
        }
    }

    void inline incr(int i)
    {
        add(i, 1);
    }
    
    void inline decr(int i)
    {
        add(i, -1);
    }

    // [0,i), i <= n
    int sum0(int i)
    {
        int ret = 0;
        while (i >= 1)
        {
            ret = ret + data[i];
            i -= i & -i;
        }
        return ret;
    }

    // [l,r)
    int sum(int l, int r)
    {
        return sum0(r) - sum0(l);
    }
};

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // 浮動小数の表示の精度
    cout << fixed << setprecision(15);

    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<fw> occ(26, fw(n));
    rep(i, n)
    {
        int c = s[i] - 'a';
        occ[c].incr(i);
    }

    int q;
    cin >> q;
    rep(i_q, q)
    {
        int t;
        cin >> t;
        if (t == 1)
        {
            int i;
            char ch;
            cin >> i >> ch;
            --i;
            int old_c = s[i] - 'a', c = ch - 'a';
            s[i] = ch;
            occ[old_c].decr(i);
            occ[c].incr(i);
        }
        else
        {
            int l, r;
            cin >> l >> r;
            --l;
            int ans = 0;
            rep(c, 26)
            {
                if (occ[c].sum(l, r) > 0)
                {
                    ++ans;
                }
            }
            cout << ans << "\n";
        }
    }

    return 0;
}


Measured memory_bytes: 56532
#include <bits/stdc++.h>
#define N 1005
using namespace std;
int n,m,home[N],col[N],cnt=-1,D=1,s[N][2],tot,sum,P,f[N][N];
bool a[N][N];
void dfs(int k){
	P++;
	if(col[k]==1) sum++;
	for(int i=1;i<=n;i++) if(!a[k][i]&&i!=k){
		if(!col[i]) col[i]=3-col[k],dfs(i);
		else if(col[i]==col[k]) D=0;
	}
}
int main(){
	memset(home,-1,sizeof(home));
	scanf("%d%d",&n,&m);
	for(int i=1,x,y;i<=m;i++){
		scanf("%d%d",&x,&y);
		a[x][y]=a[y][x]=1;
	}
	for(int i=1;i<=n;i++) if(!col[i]){
		sum=P=0;
		col[i]=1;
		dfs(i);
		s[++tot][0]=sum;
		s[tot][1]=P-sum;
	}
	if(!D) return puts("-1"),0;
	f[0][0]=1;
	for(int i=1;i<=tot;i++){
		for(int p=0;p<=n;p++){
			if(p>=s[i][0]) f[i][p]|=f[i-1][p-s[i][0]];
			if(p>=s[i][1]) f[i][p]|=f[i-1][p-s[i][1]];
		}
	}
	int ans=1e9;
	for(int i=0;i<=n;i++)if(f[tot][i]){
		int sum=i*(i-1)/2+(n-i)*(n-i-1)/2;
		ans=min(ans,sum);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
int fact(int a);



int node[10][2]={0},n;
double yol=0;
int main(){
	int i,j,k,m,x,y;
	cin>>n;
	for(i=0;i<n;i++){
		cin>>x>>y;
		node[i][0]=x;
		node[i][1]=y;
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(i==j) continue;
			yol+=(double)sqrt(pow(node[i][0]-node[j][0],2)+pow(node[i][1]-node[j][1],2));
		}
	}
	printf("%.10lf",(double)yol/(double)n);
	return 0;
}
int fact(int a){
	if(a==0) return 1;
	return a*fact(a-1);
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
bool is_prime(int x){
    if(x <= 1) return false; 
    for(int i = 2; i*i <= x; i++)
    if(x%i==0)
    return false; 
    return true;
    
    }
	signed main(){
    int X;
    cin >>X;
    int p = X;
	while(!is_prime(p)) p++;
	cout<< p <<endl;
    return 0;
}


Measured memory_bytes: 256
line_cnt = 0
tmp_line = ""
shuffle_cnt = 0
while True:
    line_cnt = line_cnt + 1
    tmp_line = input().rstrip()

    if tmp_line =="-":
        break
    
    if line_cnt == 1:
        str_cards = tmp_line
    elif line_cnt == 2:
        shuffle_time = int(tmp_line)
    else:
        h =  int(tmp_line)
        str_cards = str_cards[h:] + str_cards[:h]
        shuffle_cnt = shuffle_cnt + 1
        if shuffle_cnt == shuffle_time:
            line_cnt = 0
            shuffle_time = 0
            shuffle_cnt = 0
            print(str_cards)

Measured memory_bytes: 7672
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

int main(){
    int n ;
    cin >> n ;
    vector<int> a(n) ;
    int p ;
    for (size_t i = 0; i < n-1; i++)
    {
        cin >> p ;
        a.at(p-1) ++ ;
    }
    for (size_t i = 0; i < n; i++)
    {
        cout << a.at(i) << endl ;
    }
    
    }

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

long gcd (long,long);

int main(){
	long N,M;
	bool flag=1;
	string S,T;
	cin >> N >> M >> S >> T;
	long g=gcd(N,M);
	long L=N*M/g;
	long shorter;
	
	if(S.at(0)!=T.at(0)){
		flag=0;
	}else{
		if(N>M)shorter=M;
		else shorter=N;
		for(int i=1;i<shorter;i++){
			if(N/g*i>N-1||M/g*i>M-1)break;
			if(S.at(N/g*i)!=T.at(M/g*i)){
				flag=0;
				break;
			}
		}
	}
	
	if(flag==0){
		cout << -1 << endl;
	}else{
		cout << L << endl;
	}
	
	return 0;	
}

long gcd(long x, long y)
{
    int r;

    if(x == 0 || y == 0)  // 引数チェック
    {
//        fprintf(stderr, "引数エラーです。\n");
        return 0;
    }

    // ユーグリッドの互除法
    while((r = x % y) != 0) // yで割り切れるまでループ
    {
        x = y;
        y = r;
    }
    return y;
}


Measured memory_bytes: 512
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    int n, k;
    cin >> n >> k;
    vector<int> a, b;
    REP(i, n)
    {
        int temp;
        cin >> temp;
        if (temp < 0)
        {
            a.push_back(-temp);
        }
        else if (temp > 0)
        {
            b.push_back(temp);
        }
        else
        {
            k--;
        }
    }
    if (k == 0)
    {
        cout << "0" << endl;
    }
    else
    {
        a.push_back(0);
        b.push_back(0);
        sort(a.begin(), a.end());
        sort(b.begin(), b.end());
        int ans = 1e9;
        REP(i, k + 1)
        {
            int j = k - i;
            if (a.size() > i && b.size() > j)
            {
                if (i == 0)
                {
                    ans = min(ans, b[j]);
                }
                else if (j == 0)
                {
                    ans = min(ans, a[i]);
                }
                else
                {
                    ans = min(ans, a[i] + b[j] + min(a[i], b[j]));
                }
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
int main()
{
   string s;
   cin>>s;
   if(s[0]==s[1]||s[2]==s[3]||s[1]==s[2])
   {
       cout<<"Bad";
   }
    else
   {
       cout<<"Good";
   }


  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] s = new int[N];
        for (int i = 0; i < N; i++) {
            s[i] = scan.nextInt();
        }
        boolean[][] dp = new boolean[N+1][10001];
        for (int i = 0; i <= N; i++) {
            Arrays.fill(dp[i], false);
        }
        dp[0][0] = true;
        for (int i = 1; i <= N; i++) {
            for (int j = 0; j <=10000; j++) {
                if (!dp[i - 1][j]) {
                    continue;
                }
                dp[i][j] = true;
                if (j + s[i-1] <= 10000) {
                    dp[i][j+s[i-1]] = true;
                }
            }
        }
        int answer = 0;
        for (int i = 0; i <= 10000; i++) {
            if (i % 10 == 0) {
                continue;
            }
            if (dp[N][i]) {
                answer = Math.max(answer, i);
            }
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 24404
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  ll n,k;
  cin>>n>>k;
  ll d=((n*(n+1))/2);
  ll ans=0;
  while(k<=n+1)
  {
    ll summin=((k*(k-1))/2);
    ll summax=d-((n-k)*(n-k+1))/2;
    //cout<<summin<<" "<<summax<<endl;
    ans+=(summax-summin+1);
	k++;
  }
  cout<<(ans%1000000007);
  return 0;
}

Measured memory_bytes: 3652
// Try AtCoder
// author: Leonardone @ NEETSDKASU
import std.algorithm  : min;
import std.stdio      : readln, writeln;
import std.string     : chomp;
import std.array      : split;
import std.conv       : to;

auto gets(T)() {
    return readln.chomp;
}
auto getVals(T)() {
    return readln.chomp.split.to!(T[]);
}

void main() {
    auto xs = getVals!long;
    auto n = getVals!long[0];
    n <<= 2;
    auto a = n / 8, ar = n % 8;
    auto b = ar / 4, br = ar % 4;
    auto c = br / 2;
    auto d = br % 2;
    auto ans = d * xs[0];
    ans += min(c * 2 * xs[0], c * xs[1]);
    ans += min(b * 4 * xs[0], b * 2 * xs[1], b * xs[2]);
    ans += min(a * 8 * xs[0], a * 4 * xs[1], a * 2 * xs[2], a * xs[3]);
    writeln(ans);
}

Measured memory_bytes: 256
using System;
using System.Linq;
public class Hello{
    public static void Main(){
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();
        var t = s.Substring(0,n / 2);
        var u = s.Substring(n / 2);
        if(n % 2 == 0 && t == u){
            Console.WriteLine("Yes");
        }else{
            Console.WriteLine("No");
        }
    }
}


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{

    string s;
    cin >> s;

    cout << (s == "ABC" ? "ARC" : "ABC") << '\n';

    return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
   int n;
   string s;
   cin >> n;
   double pi = 3.141;
   cout << pi*n*2 << endl;
   return 0;
}


Measured memory_bytes: 3820
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,i,blb = 0;
    cin>>n;
    for(i = 1;i <= n;i++)
    {
       if(i%3!=0 && i%5!=0)
            blb += i;
    }
    cout<<blb<<endl;
    return 0;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=1000000007,MAX=400005;
const ll INF=1LL<<60;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N,M;
    ll K;cin>>N>>M>>K;
    vector<ll> A(N+1),B(M+1);
    for(int i=0;i<N;i++){
        cin>>A[i+1];
        A[i+1]+=A[i];
    }
    for(int i=0;i<M;i++){
        cin>>B[i+1];
        B[i+1]+=B[i];
    }
    A.push_back(INF);
    B.push_back(INF);
    
    int ans=0;
    int j=M;
    for(int i=0;i<=N;i++){
        if(A[i]>K) break;
        while(j>=0&&A[i]+B[j]>K) j--;
        chmax(ans,i+j);
    }
    
    cout<<ans<<endl;
    
}


Measured memory_bytes: 7932
import java.util.Scanner;

public class Main {

	static long n;
	static long[] stones;
	static long memo[];

	public static void main(String[] args) {

		String input1 = "";
		String input2 = "";
		Scanner scanner = new Scanner(System.in);
		input1 = scanner.nextLine();
		input2 = scanner.nextLine();

		n = Long.parseLong(input1.trim());
		String[] arr = input2.split(" ");
		stones = new long[(int) n];
		for (int i = 0; i < arr.length; i++) {
			stones[i] = Integer.parseInt(arr[i]);
		}

		memo = new long[(int) n];
		for (int i = 0; i < memo.length; i++) {
			memo[i] = -1;
		}
		System.out.println(getMinCostStone(0));
		scanner.close();
	}

	/**
	 * public static int getMinCostStone(int i, int j) { if (j == stones.length && i
	 * == stones.length - 1) { return 0; } if (j == stones.length - 1 && i ==
	 * stones.length - 2) { return memo[i] = Math.abs(stones[i] - stones[j]); } if
	 * (stones[i] == stones[j]) { return 0; } if (memo[i] != -1) { return memo[i]; }
	 * int cost1 = Math.abs(stones[i] - stones[j]) + getMinCostStone(j, j + 1);
	 * memo[i] = cost1; int cost2 = Math.abs(stones[i] - stones[j + 1]) +
	 * getMinCostStone(j + 1, j + 2);
	 * 
	 * memo[i] = cost2; return memo[i] = Integer.min(cost1, cost2); }
	 */

	public static long getMinCostStone(int i) {
		if (i >= stones.length) {
			return 0;
		}
		if (memo[i] != -1) {
			return memo[i];
		}
		if (i + 1 >= stones.length)
			return 0;
		long cost1 = Math.abs(stones[i] - stones[i + 1]) + getMinCostStone(i + 1);
		memo[i] = cost1;

		long cost2 = (long) 1e18;
		if (i != stones.length - 2) {
			cost2 = Math.abs(stones[i] - stones[i + 2]) + getMinCostStone(i + 2);
		}
		memo[i] = cost2;
		return memo[i] = Long.min(cost1, cost2);
	}

}


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

int a[3][3]; int b[100]; int d[3][3];

int main(){
    rep(i,3)rep(j,3) cin >> a[i][j];
    int N; cin >> N;
    rep(i,N) cin >> b[i];
    
    rep(i,3)rep(j,3) {
        rep(k,N) {
            if(a[i][j]==b[k]) d[i][j]=1;
        }
    }
    string ans = "No";
    rep(i,3) {
        int c=0;
        rep(j,3) {
            c+=d[i][j];
            if(c==3) ans = "Yes";
        }
    }
    rep(j,3) {
        int c=0;
        rep(i,3) {
            c+=d[i][j];
            if(c==3) ans = "Yes";
        }
    }
    {
        int c=0;
        rep(i,3) c+=d[i][i];
        if(c==3) ans = "Yes";
    }
    {
        int c=0;
        rep(i,3) c+=d[2-i][i];
        if(c==3) ans = "Yes";
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedInputStream;
import java.util.Scanner;

/**
 * Created by Harry on 4/7/20.
 */
public class Main {
    public static void main(String[] args){
        Scanner scanner = new Scanner(new BufferedInputStream(System.in));
        long N = scanner.nextLong();
        if(N==2){
            System.out.print(1);
            return;
        }
        long res = 2;
        for(long k=2; k*k<=N; k++){
            if(isFeasible(N, k)){
                res++;
            }
        }
        res += count(N);
        System.out.print(res);
    }

    public static boolean isFeasible(long N, long k){
        if(N%k==0){
            while(N%k==0){
                N /= k;
            }
            return N%k==1;
        }
        return false;
    }

    public static long count(long N){
        int res = 0;
        for(long k=2; k*k<=N-1; k++){
            if(N%k!=0 && (N-1)%k==0){
                res++;
                if(k*k!=(N-1)){
                    res++;
                }
            }
        }
        return res;
    }
}


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

int main(){
  int n; cin >> n;
  vector<int> a(n), b(n);
  for(int i=0;i<n;i++) cin >> a[i] >> b[i];
  int m = 1000000000;
  for(int i=0;i<n;i++) if(a[i] > b[i] && m > b[i]) m = b[i];
  long long int sum = 0;
  for(int i=0;i<n;i++) sum = sum + a[i];
  if(m == 1000000000) cout << 0 << endl;
  else cout << sum - m << endl;
  return 0;
}


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

#define ll long long
#define ar array
 
using namespace std;


int main() {
	
	string a;
	int resp=0;
	cin>> a;
		
	for(int i=1;i<a.length();i++){
		if(i%2){
			if(a[0] == a[i]){
				resp++;
			}
		}else{
			if(a[0] != a[i]){
				resp++;
			}
		}			
	}	
	
	cout<<resp<<endl;
	
	
   	return 0;
}

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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD =   1000000007;

/// Lib
///

int main(){
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif
    int a, b, c; cin >> a >> b >> c;
    int res = a-b;
    int ans = max(0, c-res);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main(){
  int N, L, i, j;
  char s[100][101], t[101];
  
  scanf("%d %d", &N, &L);
  for (i = 0; i < N; i++){
    scanf("%s", s[i]);
    for (j = i; j > 0; j--){
      if(strcmp(s[j], s[j - 1]) < 0){
        strcpy(t, s[j]);
        strcpy(s[j], s[j - 1]);
        strcpy(s[j - 1], t);
      }
    }
  }
  
  for (i = 0; i < N; i++){
    printf("%s", s[i]);
  }
  printf("\n");
  
  return 0;
}
  

Measured memory_bytes: 128
t1 = ['0', '1'] * 50000
t2 = ['1', '0'] * 50000

s = input()
sl = list(s)

a1 = 0
a2 = 0

for i in range(len(sl)):
    if sl[i] != t1[i]:
        a1 += 1
    if sl[i] != t2[i]:
        a2 += 1

print(min(a1, a2))


Measured memory_bytes: 5492
#include<bits/stdc++.h>
#include<utility>
using namespace std;
int main(){
  int n;cin>>n;
  vector<pair<int,int>> tasks;
  for(int i=0;i<n;i++){
    int a,b; cin>>a >>b;
    tasks.emplace_back(b,a);
  }
  sort(tasks.begin(),tasks.end());
  int sum=0;
  bool ok=true;
  for(auto v:tasks){
    sum+=v.second;
    if(sum>v.first){
      ok=false;
      break;
    }
  }
  cout<<(ok ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 2420
from itertools import product
from copy import deepcopy

H, W, K = map(int, input().split())
c = []
for _ in range(H):
    c.append(list(input()))

ans = 0

for a in product([0,1], repeat = H+W):
    ca = deepcopy(c)
    for i in range(H):
        if a[i] == 1:
            for j in range(W):
                ca[i][j] = 'r'
    for j in range(W):
        if a[H+j] == 1:
            for i in range(H):
                ca[i][j] = 'r'
    count = 0
    for i in range(H):
        for j in range(W):
            if ca[i][j] == '#':
             count += 1
    if count == K:
             ans += 1

print(ans)

Measured memory_bytes: 9348