akhauriyash/Code-Regression huggingface dataset:
#include<iostream>

using namespace std;

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

for (int i = 1; i <= n; i++)
{
int x = i / 10;
int y = i / 100;
int z = i / 1000;
if (i % 3 == 0)
 cout << " "<< i;
else if (i % 10 == 3)
 cout << " " << i;
else if (x % 10 == 3)
 cout << " " << i;
else if (y % 10 == 3)
 cout << " " << i;
else if (z % 10 == 3)
 cout << " " << i;
}
cout << endl;
}

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

long gcd(long n, long m) {
	if (n == 0)return m;
	if (n < m)swap(n, m);
	return gcd(n % m, m);
}


int main() {
	int N; cin >> N;
	long a[210000];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	for (int i = N-1; i >= 0; i -= 2) {
		cout << a[i] << " ";
	}
	for (int i = (N)%2; i < N; i += 2) {
		cout << a[i] << " ";
	}
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
int a,b,c,i,j,n,s;
int main()
{
    scanf("%d%d%d%d",&a,&b,&c,&n);
    for (i=0;i<=a;i++)
        for (j=0;j<=b;j++)
            if ((n-i*500-j*100>=0)&&(n-i*500-j*100<=c*50)) ++s;
    printf("%d\n",s);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
typedef long long i64;
int main(){
  string s;
  cin >> s;
  if(s.find('a')==string::npos) cout << "No" << endl;
  else if(s.find('b')==string::npos) cout << "No" << endl;
  else if(s.find('c')==string::npos) cout << "No" << endl;
  else cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
sat = sum(b)
for i in range(n - 1):
    if a[i + 1] - a[i] == 1:
        sat = sat + c[a[i] - 1]

print(sat)

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cout<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;

// <---------------------- > //


// <------------- Start of main() -------------------> //

void MAIN() {
	ll x,y;
	cin>>x>>y;

	for(ll i=0;i<=x;i++ ) {
		if(i*2 + (x-i)*4 == y) {
			cout<<"Yes\n";
			return;
		}
	}
	cout<<"No\n";
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;typedef long long lint;typedef vector<lint> liv;
//#define rep(i,n) for(int i=0;i<n;++i)
#define all(v) v.begin(),v.end()
#define linf 1152921504606846976
#define MAXN 100010
#define md 1000000007//998244353

#define pb push_back
#define _vcppunko4(tuple) _getname4 tuple
#define _getname4(_1,_2,_3,_4,name,...) name
#define _getname3(_1,_2,_3,name,...) name
#define _trep2(tuple) _rep2 tuple
#define _trep3(tuple) _rep3 tuple
#define _trep4(tuple) _rep4 tuple
#define _rep1(n) for(lint i=0;i<n;++i)
#define _rep2(i,n) for(lint i=0;i<n;++i)
#define _rep3(i,a,b) for(lint i=a;i<b;++i)
#define _rep4(i,a,b,c) for(lint i=a;i<b;i+=c)
#define _trrep2(tuple) _rrep2 tuple
#define _trrep3(tuple) _rrep3 tuple
#define _trrep4(tuple) _rrep4 tuple
#define _rrep1(n) for(lint i=n-1;i>=0;i--)
#define _rrep2(i,n) for(lint i=n-1;i>=0;i--)
#define _rrep3(i,a,b) for(lint i=b-1;i>=a;i--)
#define _rrep4(i,a,b,c) for(lint i=a+(b-a-1)/c*c;i>=a;i-=c)
template<class T>
istream& operator>>(istream& is,vector<T>& vec);
template<class T,size_t size>
istream& operator>>(istream& is,array<T,size>& vec);
template<class T,class L>
istream& operator>>(istream& is,pair<T,L>& p);
template<class T>
ostream& operator<<(ostream& os,vector<T>& vec);
template<class T,class L>
ostream& operator<<(ostream& os,pair<T,L>& p);
template<class T>
istream& operator>>(istream& is,vector<T>& vec){ for(T& x: vec) is>>x;return is; }
template<class T,class L>
istream& operator>>(istream& is,pair<T,L>& p){ is>>p.first;is>>p.second;return is; }
//template<class T>
//ostream& operator<<(ostream& os,vector<T>& vec){ os<<vec[0];rep(i,1,vec.size())os<<' '<<vec[i];return os; }
//template<class T>
//ostream& operator<<(ostream& os,deque<T>& deq){ os<<deq[0];rep(i,1,deq.size())os<<' '<<deq[i];return os; }
template<class T,class L>
ostream& operator<<(ostream& os,pair<T,L>& p){ os<<p.first<<" "<<p.second;return os; }

inline void in(){}
template <class Head,class... Tail>
inline void in(Head&& head,Tail&&... tail){ cin>>head;in(move(tail)...); }
template <class T>
inline bool out(T t){ cout<<t<<'\n';return 0; }
inline bool out(){ cout<<'\n';return 0; }
template <class Head,class... Tail>
inline bool out(Head head,Tail... tail){ cout<<head<<' ';out(move(tail)...);return 0; }

#define rep(...) _vcppunko4((__VA_ARGS__,_trep4,_trep3,_trep2,_rep1))((__VA_ARGS__))
#define rrep(...) _vcppunko4((__VA_ARGS__,_trrep4,_trrep3,_trrep2,_trrep1))((__VA_ARGS__))
#define lin(...) lint __VA_ARGS__;in(__VA_ARGS__)
#define stin(...) string __VA_ARGS__;in(__VA_ARGS__)
#define vin(type,name,size) vector<type> name(size);in(name)

int main(){
	lint xs=0,ys=0,cur=0;
	lin(n,m);
	vin(lint,x,n);vin(lint,y,m);
	//rep(n)x[i]+=1e9;rep(m)y[i]+=1e9;
	rep(n-1){
		cur+=x[n-i-1]-x[i]+md;cur%=md;
		xs+=cur;xs%=md;
	}cur=0;
	rep(m-1){
		cur+=y[m-i-1]-y[i]+md;cur%=md;
		ys+=cur;ys%=md;
	}lint ans=(xs*ys)%md;
	cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
 
int main(){
    char string1[100];
    int i, length;
    int flag = 0;
    
   	cin >> string1;
    
    length = strlen(string1);
    
    for(i=0;i < length ;i++){
        if(string1[i] != string1[length-i-1]){
            flag = 1;
            break;
   }
}
    
    if (flag) {
        cout << "No\n";
    }    
    else {
        int q = (length-1)/2;
        int flag1 = 0;
        int flag2 = 0;
        for(i=0;i < q ;i++){
        if(string1[i] != string1[q-i-1]){
            flag1 = 1;
            break;
   }
}
        if(flag1 == 1)
        {
            cout << "No\n";   
        }
        else
        {
            int p = ((length+3)/2 - 1);
        for(i=p;i < length ;i++){
            
        if(string1[i] != string1[length-i-1]){
            flag2 = 1;
            break;
   }
}
if(flag2 == 1)
{
    cout << "No\n";
}
else
{
    cout << "Yes\n";
}
}
    }
    
    return 0;
}

Measured memory_bytes: 384
#!/usr/bin/perl
#= CPAN mocules =====================================================#
use strict;				# strictモード
use warnings;			# 警告有効

#= Global values ====================================================#
#= Local routines ===================================================#
sub main(){
	my @inData;
	foreach (0..2){
		$inData[$_] = <>;
		chomp $inData[$_];
	}

	my $tate = $inData[0];
	my $yoko = $inData[0];

	$tate -= $inData[1];
	$tate++;
	$yoko -= $inData[2];
	$yoko++;
	
	print $tate * $yoko;
	print "\n";

	return 0;
}

#----- 実行 -----#
exit( main() );




Measured memory_bytes: 640
#include <iostream>
#include <string>
using namespace std;
string segment(int i){
	if(i==0)
	return "0111111";
	if(i==1)
	return "0000110";
	if(i==2)
	return "1011011";
	if(i==3)
	return "1001111";
	if(i==4)
	return "1100110";
	if(i==5)
	return "1101101";
	if(i==6)
	return "1111101";
	if(i==7)
	return "0100111";
	if(i==8)
	return "1111111";
	if(i==9)
	return "1101111";
}
int main() {
	// your code goes here
	
	int n,m;
	while(cin >> n && n!=0){
	string now="0000000",next;
		for(int i=0;i<n;i++){
			cin >> m;
			next=segment(m);
			for(int j=0;j<7;j++)
			if(now[j]!=next[j])
			cout << 1;
			else
			cout << 0;
			cout << endl;
			now=next;
		}
	}
	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const ll MOD = 1e9+7;


#define REP(i, N) for (ll i = 0; i < (N); i++)
#define REPP(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((ll)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<ll>>

using namespace std;


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

    double n;
    cin >> n;


    cout << n*2*3.141592 << endl;




    return 0;
}

Measured memory_bytes: 3264
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

static const int MAX = 2000000;

int main() {
  int R[MAX], n;

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

  int maxv = -2000000000;
  int minv = R[0];

  for (size_t i = 1; i < n; i++) {
    maxv = max(maxv, R[i] - minv);
    minv = min(minv, R[i]);
  }

  cout << maxv << endl;

  return 0;
}



Measured memory_bytes: 3880
#include<iostream>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<math.h>
#include<cstring>
using namespace std;

int main()
{
	
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	
	int n;
	cin>>n;
	
	int o=n%10;	
	
	if(o==2||o==4||o==5||o==7||o==9)
      cout<<"hon"<<endl;
	
	else if(o==0||o==1||o==6||o==8)
      cout<<"pon"<<endl;
		
	else if(o==3)
	cout<<"bon"<<endl;
  
	return 0;
	
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  char c='a';
  for(int i=0;i<26;i++){
    c+=i;
    bool bo=false;
    for(int j=0;j<s.size();j++){
      if(s[j]==c){
        bo=true;
      }
    }
    if(bo==false){
        cout<<c<<endl;
        return 0;
    }
    if(c=='z') cout<<"None"<<endl;
    c='a';
  }
}
    

Measured memory_bytes: 512
//Volume0-0050
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		//initialization
        char[] c;
        int    small,
               large;
        StringBuffer sb = new StringBuffer();

        //input
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        while(n-- > 0){
        	c = sc.next().toCharArray();

        	//calculation
        	sb.delete(0,8);
        	Arrays.sort(c);
        	small = Integer.parseInt(String.valueOf(c));
        	sb.append(c);
        	sb = sb.reverse();
        	large = Integer.parseInt(sb.toString());

        	//output
        	System.out.println(large - small);
        }
	}
}

Measured memory_bytes: 17172
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        List<Integer> list = new ArrayList<>();
        while (sc.hasNext()) {
            list.add(sc.nextInt());
        }

        System.out.println(list.get(0) == 1 ? "Hello World" : list.get(1) + list.get(2));
    }
}


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

int main() {
    long long N, M, K;
    cin >> N >> M >> K;
    vector<long long> A(N), B(M);
    for (int i = 0; i < N; i++) cin >> A.at(i);
    for (int i = 0; i < M; i++) cin >> B.at(i);
    long long sum = 0;
    long long a = 0, b = 0;
    while (a < N && sum + A[a] <= K) sum += A[a++];
    while (b < M && sum + B[b] <= K) sum += B[b++];
    long long ans = a + b;
    while (a > 0) {
        sum -= A[--a];
        while (b < M && sum + B[b] <= K) sum += B[b++];
        ans = max(ans, a + b);
    }
    cout << ans << endl;
    return 0;
}


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

signed main() {
  int N;
  cin >> N;
  set<int> A;
  for(int i=0;i <N; i++) {
    int a;
    cin >> a;
    if(A.count(a)) {
      puts("NO");
      return 0;
    }
    A.insert(a);
  }
  puts("YES");
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N;
	string S;
	cin >> N >> S;
	int cnt = 0;
	for (int i = 0; i < N;) {
		char c = S[i]; i++;
		while (S[i] == c) i++;
		cnt++;
	}
	cout << cnt << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
int main() {
    int a , b ;
    std::cin >> a >> b ;
    std::cout << a / b << " " ;
    std::cout << a % b << " " ;
    std::cout << std::fixed << std::setprecision( 5 ) << (double)a / b << std::endl ;
    
    
}



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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin >> n >> s;
    vector<int> b(n), w(n);
    rep (i, n - 1) {
        if (s[i] == '#') b[i + 1] = b[i] + 1;
        else b[i + 1] = b[i];
    }
    for (int i = n - 1; i > 0; --i) {
        if (s[i] == '.') w[i - 1] = w[i] + 1;
        else w[i - 1] = w[i];
    }
    int ans = Inf;
    rep (i, n) ans = min(ans, b[i] + w[i]);
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 2196
#include<cstdio>
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x;
}
#define MN 100000
#define MM 200000
struct edge{int nx,t,w;}e[MM*2+5];
int h[MN+5],en,u[MN+5],z[MN+5],O;
inline void ins(int x,int y,int w)
{
	e[++en]=(edge){h[x],y,w};h[x]=en;
	e[++en]=(edge){h[y],x,-w};h[y]=en;
}
void dfs(int x)
{
	u[x]=1;
	for(int i=h[x];i;i=e[i].nx)
		if(!u[e[i].t])z[e[i].t]=z[x]+e[i].w,dfs(e[i].t);
		else O|=z[e[i].t]!=z[x]+e[i].w;
}
int main()
{
	int n,m,x,y,i;
	n=read();m=read();
	while(m--)x=read(),y=read(),ins(x,y,read());
	for(i=1;i<=n;++i)if(!u[i])dfs(i);
	puts(O?"No":"Yes");
}

Measured memory_bytes: 7936
#include <stdio.h>

int main()
{
	int n,h,m,s;
	scanf("%d",&n);
	
	s = n % 60;
	m = (n / 60) % 60;
	h = n / 3600;
	
	printf("%d:%d:%d\n",h,m,s);
	return 0;
 } 


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

int main() {
	int a[3][3];
	for (int i = 0; i < 3; ++i) {
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}
	int n;
	cin >> n;
	vector<int> b(n);
	for (int i = 0; i < n; ++i) {
		cin >> b[i];
		for(int j=0; j<3; ++j) {
			if (b[i] == a[j][0]) a[j][0] = 0;
			if (b[i] == a[j][1]) a[j][1] = 0;
			if (b[i] == a[j][2]) a[j][2] = 0;
		}
	}

	int ans = 0;
	rep(i, 3) {
		if (a[i][0] == 0 && a[i][1] == 0 && a[i][2] == 0) ans++;
		if (a[0][i] == 0 && a[1][i] == 0 && a[2][i] == 0) ans++;
	}

	if (a[0][0] == 0 && a[1][1] == 0 && a[2][2] == 0) ans++;
	if (a[0][2] == 0 && a[1][1] == 0 && a[2][0] == 0) ans++;

	if (ans != 0) cout << "Yes";
	else cout << "No";


	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var f = Console.ReadLine().Split(' ').Select(int.Parse).OrderBy(x => x).ToList();
            var k = int.Parse(Console.ReadLine());
            var max = f[2];
            var calVal = max * Math.Pow(2, k);
            var ret = f[0] + f[1] + calVal;
            Console.WriteLine(ret);
        }
    }
}

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

n = int(input())
l = list(map(int, input().split()))

x = 0
while True:
    for i in range(len(l)):
        if l[i] > 0 and l[i]%2 == 0:
            l[i] /= 2
        else:
            print(x)
            exit()
    x += 1


Measured memory_bytes: 2940
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    ll s;
    cin >> s;
    ll x, y;
    x = (INF - s % INF)%INF;
    y = (s + x) / INF;

    cout << "0 0 " << INF << " 1 " << x << " " << y << endl;
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop(i,b,n) for(int i=b;i<(n);++i)
#define each(e,v) for(auto &&e : v)

#define all(v) (v).begin(),(v).end()
#define sz(v) (int)v.size()

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const double EPS = 1e-9;
const ll MOD = 1e+9 + 7;

template<typename A,typename B> inline void chmin(A &a,B b){ if(a>b) a=b; }
template<typename A,typename B> inline void chmax(A &a,B b){ if(a<b) a=b; }
template <typename T> inline void print(const T& x) { cout << x << endl; }

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

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

    ll money = 1000;
    for(int i=1; i<n; ++i){
        if(a[i-1]<a[i]){
            money += (a[i]-a[i-1]) * (money/a[i-1]);
        }
    }

    print(money);

    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <algorithm>
#include <cassert>
#include <string>
#include <climits>
#include <numeric>

#define all(x) begin(x),end(x)

using namespace std;
using ll = long long;

int main()
{
	int d, g; cin >> d >> g;
	vector<int> p(d);
	vector<int> c(d);
	for (int i = 0; i < d; ++i)
		cin >> p[i]  >> c[i];

	int ans = INT_MAX;
	for (int mask = 0; mask < (1<<d); ++mask) {
		int s = 0, num = 0, rest_max = -1;
		for (int i = 0; i < d; ++i) {
			if ((mask >> i) & 1) {
				s += 100 * (i+1) * p[i] + c[i];
				num += p[i];
			} else {
				rest_max = i;
			}
		}
		if (s < g) {
			int s1 = 100 * (rest_max + 1);
			int need = (g - s + s1 - 1) / s1;
			if (need >= p[rest_max])
				continue;
			num += need;
		}
		ans = min(ans, num);
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a=nxt(),b=nxt(),h=nxt();
    cout<<(h*(a+b))/2<<endl;

    
    return 0;   
}


 
 


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

int main(void)
{
  int N;
  string S,Sf,Sl;
  cin >> N;
  cin >> S;
  
  if(N%2==1)
  {
    cout << "No";
    return 0;
  }
  
  Sf = S.substr(0,N/2);
  Sl = S.substr(N/2,N);
  
  if(Sf==Sl){
    cout << "Yes";
  }else{
    cout << "No";
  }
  return 0;
}

  

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
using namespace std;
#define N (1000000000+7)
#define M 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 
ll A(ll x){
    if(x>=0)return x;
    else return -x;
}
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}



int main(void){
	int n;
	cin>>n;
	int cnt = 0;
	if(n%1000==0)cout<<0<<endl;
	else{
		cnt = n/1000+1;
		cout<<1000*cnt-n<<endl;
	}
    return 0;
}

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

int main(void){
    int N;
    cin >> N;
    vector<int> a(N);
    
    for(int i=0; i<N; i++){
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    int aliceCounter = 0;
    int bobCounter = 0;
    for(int i=0; i<N; i++){
        if(i%2 == 0){
            aliceCounter+=a.at(i);
        }
        else{
            bobCounter+=a.at(i);
        }
    }
    cout << aliceCounter - bobCounter << endl;

}

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

int main() {
  int m,d;
  cin>>m>>d;
  int ans=0;
  for(int i=4;i<=m;i++){
    for(int j=22;j<=d;j++){
      if(j%10>=2 && j/10>=2){
        
      if(i==(j%10)*(j/10)){
        ans++;
        
      }
      }
      
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int score[2];
    score[0]=0;
    score[1]=0;
    for(int i=0;i<n;i++){
        string a, b;
        cin >> a >> b;
        if(a>b) score[0]+=3;
        else if(a<b) score[1]+=3;
        else {
            score[0]+=1;
            score[1]+=1;
        }
    }
    cout << score[0] <<" " << score[1]<<endl;
    return 0;

}


Measured memory_bytes: 3180
// C - Synthetic Kadomatsu
// bit full search
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;

int N;
vi A(4), L(8);
int ans = INT_MAX;

void calc(vi v){
	vi sum(4), count(4);
	for(int i=0; i<N; ++i){
		count[v[i]]++;
		sum[v[i]] += L[i];
	}

	if(min({count[1], count[2], count[3]})!=0){
		int s = 0;
		for(int i=1; i<4; ++i){
			s += abs(A[i] - sum[i]);
			if(count[i]>1) s += (count[i]-1) * 10;
		}
		ans = min(ans, s);
	}
}

void bit_full_search(){
	int E = 1<<(N*2);
	for(int i=0; i<E; ++i){
		vi v(N);
		for(int j=0; j<N; ++j) v[j] = (i>>(2*j)) & 3;
		calc(v);
	}
}

int main(){
	cin>>N;
	for(int i=1; i<4; ++i) cin>>A[i];
	for(int i=0; i<N; ++i) cin>>L[i];
	bit_full_search();
	cout<< ans <<endl;
}

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

# define F first
# define S second
# define mp make_pair
# define pii pair<int,int>

# define long long long
# define pb push_back
# define sz(a) (int)(a.size())

# define y1     tipa_y1
# define left   tipa_left
# define right  tipa_right

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const long MXLL = 4611686018427387903;
const int Sz = 1110111;

using namespace std;

inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
}
char s[Sz];

char t[Sz];

char ans[Sz];

int main()
{
  Read_rap ();
  cin >> s + 1;
  for (int i = 1;s[i];i ++)
    ans[(i - 1) * 2 + 1] = s[i]; 

  cin >> t + 1;
  for (int i = 1;t[i];i ++)
    ans[2*i] = t[i];
  for (int i = 1;ans[i];i ++)
    cout << ans[i];

  return 0;
}









// Coded by Z...


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

typedef long long ll;

#define rep(i, a, b) for (ll i = a; i < (ll)b; ++i)
#define INF 10e12
#define MAX 51000
#define all(x) (x).begin(), (x).end()
#define MX(x) *max_element(all(x))
#define MN(x) *min_element(all(x))

using namespace std;

const long long MOD = 1e9 + 7;
const ll num[4] = {-1, 0, 1, 0};

int main(void)
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, k, r, s, p;
    string str;
    cin >> n >> k >> r >> s >> p >> str;
    vector<char> vec(n);
    ll ans = 0;
    rep(i, 0, n)
    {
        char tmp;
        if (str[i] == 'r')
            tmp = 'p';
        else if (str[i] == 's')
            tmp = 'r';
        else
            tmp = 's';
        if (i < k) //問答無用で勝てる
        {
            if (tmp == 'r')
                ans += r;
            else if (tmp == 's')
                ans += s;
            else
                ans += p;
            vec[i] = tmp;
        }
        else
        {
            if (tmp == vec[i - k]) //前に出していた場合
            {
                if (vec[i - k] == 'r' && str[i + k] == 's')
                    tmp = 'p';
                else if (vec[i - k] == 'r' && str[i + k] == 'p')
                    tmp = 'p';
                if (vec[i - k] == 's' && str[i + k] == 'r')
                    tmp = 'r';
                else if (vec[i - k] == 's' && str[i + k] == 'p')
                    tmp = 'p';
                if (vec[i - k] == 'p' && str[i + k] == 'r')
                    tmp = 's';
                else if (vec[i - k] == 'p' && str[i + k] == 's')
                    tmp = 'p';
            }
            else
            {
                if (tmp == 'r')
                    ans += r;
                else if (tmp == 's')
                    ans += s;
                else
                    ans += p;
                vec[i] = tmp;
            }
            vec[i] = tmp;
        }
    }
    cout << ans << endl;
}


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

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

  vector<int> data(N);
  int cumxor= 0;
  for(int i=0; i<N; i++){
    cin >> data.at(i);
    cumxor^= data.at(i);
  }
  
  for(int i=0; i<N; i++){
    cout << (cumxor ^ data.at(i)) <<" ";
  }
}

Measured memory_bytes: 4048
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a%3==0||b%3==0||(a+b)%3==0){
      System.out.println("Possible");
    }else{
      System.out.println("Impossible");
    }

  }
  

  
}


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

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
using Graph = vector<vector<int>>;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b == c) cout<<"Yes"<<endl;
    else if(b+c == a) cout<<"Yes"<<endl;
    else if(c+a == b) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> v(10050);

  for (int x = 1; x < 100; x++) {
    for (int y = 1; y < 100; y++) {
      for (int z = 1; z < 100; z++) {
        int a = x*x + y*y + z*z + x*y + y*z + z*x;
        if (a < 10050) v[a] += 1;
      }
    }
  }

  for (int i = 1; i <= n; i++) {
    cout << v[i] << endl;
  }
  return 0;
}



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

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

  double ans = (double)(n-n/2)/n;

  cout << fixed << setprecision(10) << ans << endl;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<ctype.h>
#define ll long long
const int N=200001;

inline int read(){
	int x=0;bool f=1;char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x*=10;x+=(ch-'0');ch=getchar();
	}
	return (f)?x:-x;
}

inline void write(int x){
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
}

int main(){
	int x,k=0,ans=0,n=read();
	for(int i=1;i<=n;++i){
		x=read();
		if(x==k){k=0;++ans;}
		else k=x;
	}
	write(ans);
	puts("");
	return 0;
}

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

int main() {
  while(true) {

    int a,b,c;
    cin >> a >> b >> c;
    if(a+b+c == 0) break;

    vector<int> parts(a+b+c+1,2);

    int n;
    cin >> n;
    vector< vector<int> > check_list;
    for(int i=0;i<n;i++) {
      vector<int> item(4);
      cin >> item[0] >> item[1] >> item[2] >> item[3];
      check_list.push_back(item);
    }

    // ??£????????¨???????????§??????
    for(int i=0;i<n;i++) {
      if(check_list[i][3] == 1) {
        parts[check_list[i][0]] = 1;
        parts[check_list[i][1]] = 1;
        parts[check_list[i][2]] = 1;
      }
    }

    // ??°????????¨???????????§??????
    for(int i=0;i<n;i++) {
      if(check_list[i][3] == 0) {
        for(int j=0;j<3;j++) {
          if(parts[check_list[i][j]] == 2) {
            if(parts[check_list[i][(j+1)%3]] == 1 && parts[check_list[i][(j+2)%3]] == 1) {
              parts[check_list[i][j]] = 0;
            }
          }
        }
      }
    }

    // print
    for(int i=1;i<=(a+b+c);i++) {
      cout << parts[i] << endl;
    }

  }
}

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

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

        int[] data = new int[1000000];
        boolean[] isPrime = new boolean[1000000];
        //default??§false. ?´???°????????°false,?´???°??§??????????????°true??¨??????.
        isPrime[0] = true;
        isPrime[1] = true;
        int count = 0;
        int max = (int)Math.sqrt(1000000);
        
        for(int i = 2; i < 1000000; i++){

            if(!isPrime[i]){
                count++;
                if(i <= max){
                    for(int j = i*i; j < 1000000; j+=i){
                        if(j <= 0) break;
                        isPrime[j] = true;
                    }
                }
            }

            data[i] = count;
        }

        String line;

        while( (line = br.readLine()) != null){
            System.out.println(data[Integer.parseInt(line)]);
        }

    }
}

Measured memory_bytes: 29908
#include<iostream>

using namespace std;

int main()
{
    int i,j,i_b;
    long long int p[2]={1,1},N;
    i_b=1;

    cin>>N;
    
    for(i=1;i<(N/(i_b));i++){
    if(N%i==0){p[0]=i;p[1]=N/i;}
    i_b=i;
    }
    
    cout<<(p[0]+p[1]-2)<<endl;
    
    return 0;
}

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

struct reputation{
    std::string name;
    int point;
    int id;
};

bool comp_name(const reputation& rep1, const reputation& rep2){
    return rep1.name < rep2.name;
}

bool comp_point(const reputation& rep1, const reputation& rep2){
    return rep1.point > rep2.point;
}

int main(){
    int n;
    scanf("%d", &n);
    reputation book[n + 1];
    for(int i = 1; i < n + 1; i++){
        char tmp[11];
        scanf("%s %d", tmp, &((book + i)->point));
        book[i].id = i;
        book[i].name = tmp;
    }

    std::stable_sort(book + 1, book + n + 1, comp_point);
    std::stable_sort(book + 1, book + n + 1, comp_name);
    
    for(int i = 1; i < n + 1; i++){
        printf("%d\n", book[i].id);
    }
}

Measured memory_bytes: 256
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rep1n(i, n) for(int i=1;i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
ll wa(string t) {
	int n = t.length();
	ll sum = 0;
	rep(i, n)sum += (int)(t[i] - '0');
	return sum;
}
int main() {
	string s;
	cin >> s;
	string c = s;
	c[0] = max('0', (char)(c[0] - 1));
	rep(i, c.length()-1)c[i + 1] = '9';
	ll a = wa(s);
	ll b = wa(c);
	if (a > b)cout << a;
	else cout << b;

	return 0;
}





Measured memory_bytes: 256
x, n = map(int,input().split())
if n != 0:
    p = list(map(int,input().split()))

if n == 0:
    print(x)
elif not (x in p):
    print(x)
else:
    r = 1
    while True:
        if not (x-r in p):
            print(x-r)
            break
        elif not (x+r in p):
            print(x+r)
            break
        else:
            r += 1

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

int main() {
  double r;
  cin >> r;
  cout << setprecision(11) << fixed;
  cout << r * 2.0 * 3.1415926 << endl;
}


Measured memory_bytes: 3804
import java.util.Arrays;

public class Main {
	public static void main(String[] args) {
		var sc = new java.util.Scanner(System.in);
		var n = sc.nextInt();
		var l = new long[n];
		for (int i = 0; i < n; i++) {
			l[i] = sc.nextLong();
		}
		Arrays.sort(l);
		var cnt = 0;
		for (int i = l.length - 1; i >= 2; i--) {
			for (int j = i - 1; j >= 1; j--) {
				for (int k = j - 1; k >= 0; k--) {
					if (l[k] + l[j] > l[i]) {
						if (l[i] != l[j] && l[i] != l[k] && l[k] != l[j]) {
							if (l[i] + l[j] > l[k]
									&& l[i] + l[k] > l[j]) {
								cnt++;
							}
						}
					}
				}
			}
		}
		System.out.println(cnt);
	}
}


Measured memory_bytes: 36872
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#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(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,a ;
    cin >> n >> a;
    int x = n % 500;
    
    if (x <= a) {
	    cout << "Yes" << endl;
    }
    else
    {
	    cout << "No" << endl;
    }
}


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

if D == 0 and N < 100:
  print(N)
elif D == 0 and N == 100:
  print(101)
elif D == 1 and N < 100:
  print(N * 100)
elif D == 1 and N == 100:
  print(10100)
elif D == 2 and N < 100:
  print(N * 100 * 100)
elif D == 2 and N == 100:
  print(1010000)

Measured memory_bytes: 3060
h,w = map(int, input().split())
s = [list(input()) for _ in range(h)]
p = [-1,0,1]
for i in range(h):
  for j in range(w):
    count = 0
    for ph in p:
      for pw in p:
        if (ph==0 and pw==0) or not(0<=i-ph<=h-1) or not(0<=j-pw<=w-1):
          continue
        if s[max(i-ph,0)][max(j-pw,0)]=='#':
          count += 1
    if s[i][j]=='.': s[i][j]=str(count)
for si in s:
  print(''.join(si))

Measured memory_bytes: 9256
#include <iostream>

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

ll modpow(ll k, ll n, int mod) {
  ll ret = 1;
  while (n > 0) {
    if (n % 2 == 1) ret = ret * k % mod;
    k = k * k % mod;
    n /= 2;
  }

  return ret;
}

int main() {
  int n, m, k;
  cin >> n >> m >> k;

  const int mod = 998244353;

  ll f[n + 1];
  f[0] = f[1] = 1;
  for (int i = 1; i <= n; ++i) {
    f[i + 1] = f[i] * (i + 1) % mod;
  }

  ll fi[n + 1];
  for (int i = 0; i <= n; ++i) {
    fi[i] = modpow(f[i], mod - 2, mod);
  }

  auto choose = [&](int a, int b) {
    return (f[a] * fi[b] % mod) * fi[a - b] % mod;
  };

  ll ans = 0;
  for (int x = 0; x <= k; ++x) {
    ans += (choose(n - 1, x) * m % mod) * modpow(m - 1, n - x - 1, mod) % mod;
    ans %= mod;
  }

  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 6752
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("O2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace std;
 
#define ll long long
#define ld long double
#define int ll
#define endl '\n'
 
typedef pair<int, int> pii; 
typedef pair<ld, ld> pdd;
 
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FileIn(file) freopen(file, "r", stdin)
#define FileOut(file) freopen(file, "w", stdout)
#define all(c) c.begin(), c.end() 
#define tr(container, it )\
for(__typeof__(container.begin()) it = container.begin(); it != container.end(); it++) 
#define present(container, element) (container.find(element) != container.end())  //map, set
#define cpresent(container, element) (find(aint(container),element) != container.end()) //vector
#define what_is(x) cout << #x << " is " << x << endl; 
#define all(c) c.begin(), c.end() 
 
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
const int MOD = 1e9+7;
 
 
int fast_pow(int a, int b){
	int res = a, ret = 1;
	while(b>0){
		if(b%2)
			ret = (ret*res)%MOD;
		res = (res*res)%MOD;b/=2;
	}
	return ret;
}
 
// --
// -- 
// -- 
// std::cout << std::fixed;
// std::cout << std::setprecision(26) << f << '\n';
// str = to_string(n)
// stoi , stoll, stol
// sort(arr, arr+n, greater<int>());
// fill(prefix.begin(), prefix.end(), 0);
// 
// 
 
 
 
////
const int maxN = 3e3+7;
ld p[maxN];
ld dp[maxN][maxN];
////
 
signed main(){
 
	fastio;
	time_t time_t1, time_t2;
	time_t1 = clock();
 
	////////////////////////////////
 
	int t = 1;
	// cin >> t ;
 
	while(t--){
 
		int n;
		cin >> n;
 
		for (int i = 1; i <= n; ++i){
			cin >> p[i];
		}
		
		memset(dp, 0, sizeof dp);
 
		dp[1][1] = 1.0*p[1];
		dp[1][0] = 1.0*(1 - p[1]);
		
		for (int i = 2; i <= n; ++i){
			dp[i][0] = 1.0*dp[i-1][0]*(1 - p[i]);
			for (int j = 1; j <= n; ++j){
				dp[i][j] = 1.0*dp[i-1][j-1]*(p[i]);
				dp[i][j] = dp[i][j] +  1.0*dp[i-1][j]*(1 - p[i]);
			}
		}
		
		ld ans = 0;
		for (int i = n/2 + 1; i <= n; ++i){
			ans += dp[n][i];
		}
		printf("%0.12Lf\n", ans);
	}
 	
	///////////////////////////////
	// 
 
	time_t2 = clock();
	// cerr << "time taken :" << time_t2 - time_t1 << endl;
 
	return 0;
}

Measured memory_bytes: 141568
input = gets.split
st = Array.new
l = input.length
for i in 0...l
  case input[i]
  when "+"
    b = st.pop
    a = st.pop
    st.push(a+b)
  when "-"
    b = st.pop
    a = st.pop
    st.push(a-b)
  when "*"
    b = st.pop
    a = st.pop
    st.push(a*b)
  else
    st.push(input[i].to_i)
  end
end
puts st[0]

Measured memory_bytes: 6104
"""Boot-camp-for-Beginners_Easy005_B_Can-you-solve-this_25-August-2020.py"""

N, M, C = map(int, input().split())
B = list(map(int, input().split()))
A = list(list(map(int, input().split())) for i in range(N))

count=0
for i in range(N):
    s=0
    for j in range(len(B)):
        s+=B[j]*A[i][j]
    if s+C>0:
        count+=1
print(count)

Measured memory_bytes: 9136
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

int main() {
	int N;
	cin >> N;
	vector<pair<double, double>> xy(N);
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> xy.at(i).first >> xy.at(i).second;
		a.at(i) = i;
	}

	double sum_dist = 0;
	int cnt = 0;
	do {
		for (int i = 0; i < N - 1; i++) {
			double tmp;
			tmp = sqrt(pow(xy.at(a.at(i)).first - xy.at(a.at(i + 1)).first, 2) + pow(xy.at(a.at(i)).second - xy.at(a.at(i + 1)).second, 2));
			sum_dist += tmp;
		}
		cnt++;
	} while (next_permutation(a.begin(), a.end()));

	printf("%.10lf\n", sum_dist / cnt);
}

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

struct Card {char suit, value;};

void bubble(struct Card A[], int N) {
    bool flag = 1;
    while(flag) {
        flag = 0;
        for(int i = N - 1; i > 0; i--) {
            if(A[i].value < A[i - 1].value) {
                swap(A[i], A[i - 1]);
                flag = 1;
            }
        }
    }
}

void selection(struct Card A[], int N) {
    for(int i = 0; i < N - 1; i++) {
        Card t = A[i];
        int minj = i;
        for(int j = i; j < N; j++) {
            if(A[j].value < A[minj].value) minj = j;
        }
        A[i] = A[minj];
        A[minj] = t;
    }
}

void print(struct Card A[], int N) {
    for(int i = 0; i < N; i++) {
        if(i) cout << " ";
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N) {
    for(int i = 0; i < N; i++) {
        if(C1[i].suit != C2[i].suit) return false;
    }
    return true;
}

int main() {
    Card C1[100], C2[100];
    int N;

    cin >> N;
    for(int i = 0; i < N; i++) cin >> C1[i].suit >> C1[i].value;

    for(int i = 0; i < N; i++) {
        C2[i] = C1[i];
    }

    bubble(C1, N);
    selection(C2, N);

    print(C1, N);
    cout << "Stable" << endl;

    print(C2, N);
    if(isStable(C1, C2, N)) {
        cout << "Stable" << endl;
    } else {
        cout << "Not stable" << endl;
    }

    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int h, w;
vector<string> s;

int main()
{
    cin >> h >> w;
    s.resize(h);
    for (int i = 0; i < h; i++)
        cin >> s.at(i);

    vector<vector<int>> c(h, vector<int>(w, 0));

    int dx[8] = {1, 0, -1, 0};
    int dy[8] = {0, 1, 0, -1};
    bool flag = true;

    for (int x = 0; x < h; ++x)
    {
        for (int y = 0; y < w && flag; ++y)
        {
            if (s.at(x).at(y) == '#')
            {
                // c.at(x).at(y) = -1;
                // continue;
                for (int dir = 0; dir < 4 && flag; ++dir)
                {
                    int nx = x + dx[dir];
                    int ny = y + dy[dir];
                    if (nx < 0 || ny < 0 || nx >= h || ny >= w)
                        continue;

                    if (s.at(nx).at(ny) == '#')
                        break;
                        // c.at(x).at(y)++;
                    if (dir == 3) {
                        flag = false;
                        break;
                    }
                }
            }
        }
    }
    if(flag) cout << "Yes";
    else cout << "No";
    cout << endl;
    // for (int i = 0; i < h; ++i)
    // {
    //     for (int j = 0; j < w; ++j)
    //     {
    //         if (c.at(i).at(j) == -1)
    //             cout << '#';
    //         else
    //             cout << c.at(i).at(j);
    //     }
    //     cout << endl;
    // }
}

Measured memory_bytes: 256
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    int k;
    scan(k);
    auto ans = (k / 2) * ((k + 1) / 2);
    writeln(ans);
}





void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


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

int main() {

    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);

    /////////////////////
    // Write code below /
    int x;
    cin >> x;
    if(x == 0){
        x=1;
    }else{
        x=0;
    }
    cout << x << endl;
    /////////////////////
    return 0;
}


Measured memory_bytes: 3656