akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int main() {
    std::ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    double prod = 1;
    for(int i=0;i<n;++i){
        cin >> a[i];
        prod *= a[i];
    }

    double dia = 0;
    for(int i=0;i<n;++i) {
        dia += prod/a[i];
    }

    printf("%.10lf\n", prod/dia);

}


Measured memory_bytes: 256
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1130&lang=jp

#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

int W,H;

void dfs(vector<string> &field, vector<vector<bool> > &move,int now_x, int now_y)
{
	int dx[4] = {1,0,-1,0};
	int dy[4] = {0,1,0,-1};

	if(now_x < 0 || now_x >= W || now_y < 0 || now_y >= H){ return; }
	
	if(field[now_y][now_x] == '#'){ return; }

	if(move[now_y][now_x]){ return; }

	move[now_y][now_x] = true;

	rep(i,4){
		dfs(field, move, now_x+dx[i], now_y+dy[i]);
	}

	return;
}

int main() {

	while(cin >> W >> H && W && H)
	{

		vector<string> field(H);
		vector<vector<bool> > move(H, vector<bool>(W,false));

		rep(y,H){
			cin >> field[y];
		}

		pair<int, int> start;
		rep(y,H){
			rep(x,W){
				if(field[y][x] == '@'){start = make_pair(x,y);}
			}
		}

		
		dfs(field, move, start.first, start.second);

		int count=0;
		rep(y,H){
			rep(x,W){
				if(move[y][x]){ count++; }
			}
		}

		cout << count << endl;

	}
	return 0;
}

Measured memory_bytes: 1256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        System.out.println(t.startsWith(s)&&t.length() == s.length()+1?"Yes":"No");
    }
}


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


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define w(x)  int x; cin>>x; while(x--)
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"
#define watch4(x,y,z,q) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<" and "<<(#q)<<" is "<<(q)<<"\n"
#define MOD 1000000007
#define INF 1000000007;
#define F first
#define S second
#define pb(x) push_back(x);


#define ll  long long
#define all(c) (c).begin(),(c).end()
#define endl "\n"

typedef vector<int> vl;
typedef vector< vl > vvl;
typedef pair< int, int> pll;
typedef map< int, int> mll;


#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif





void c_p_c()
{
#ifndef ONLINE_JUDGE
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void parray(int a[], int n) {
	for (int i = 0; i < n; i++) {
		cout << a[i] << " ";
	}
	cout << endl;
}
int disum(int n) {
	int sum = 0;

	while (n) {

		sum += n % 10;
		// sum++;
		n /= 10;





	}
	return sum;

}


// #define maxa 1000000










int main() {
	int i, n, m, k, c1 = 0, sum = 0;
	c_p_c();
	// w(t){

	int a,b;
	cin>>n>>m>>a>>b;
	int mina=-INF;
	int maxa=INF;
	for (int i = 0; i < n; ++i)
	{
		/* code */
		cin>>k;
		mina=max(mina,k);
	}
	for (int i = 0; i < m; ++i)
	{
		/* code */
		cin>>k;
		maxa=min(maxa,k);
	}
	// debug(mina,maxa);

	if(mina<maxa and a<maxa and maxa<b){
		cout<<"No War"<<endl;

	}else
		cout<<"War"<<endl;





		









		
	return 0;


}


// 3
// 2
// 3
// 4
// 2
// 3
// 4
// 2
// 3

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

using namespace std;

//defines
typedef long long ll;
typedef double ld;
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define prev _prev
#define y0 _y0
#define kill _kill

//permanent constants
const ld pi = acos(-1.0);
const int day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int digarr[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
const int dxo[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
const int dyo[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
const int alf = 26;
const int dig = 10;
const int two = 2;
const int th = 3;
const ll prost = 239;
const ll btc = 30;
const ld eps = 1e-8;
const ll INF = (ll)(1e18 + 239);
const int BIG = (int)(2e9 + 239);
const ll MOD = 998244353;

//random
#ifdef ONPC
mt19937_64 rnd(239);
#else
mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

//constants
const int M = (int)(2e5 + 239);
const int N = (int)(2e3 + 239);
const int L = 25;
const int T = (1 << 18) + 239;
const int B = 500;
const int X = 310;

string st;
int g, n, k;
int dp[two][X][X];
int a[X], s[X];

int32_t main()
{
#ifdef ONPC
    freopen("input", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> st >> g;
    n = (int)st.size();
    k = 0;
    for (int i = 0; i < n; i++)
        k += (st[i] == '0');
    if (k == 0)
    {
        cout << "1\n";
        return 0;
    }
    g = min(g, n - k);
    vector<int> pos;
    for (int i = 0; i < n; i++)
        if (st[i] == '0')
            pos.push_back(i);
    a[0] = pos[0];
    for (int i = 1; i < k; i++)
        a[i] = pos[i] - pos[i - 1] - 1;
    s[0] = a[0];
    for (int i = 1; i < k; i++)
        s[i] = s[i - 1] + a[i];
    s[k] = n - k;
    dp[0][0][0] = 1;
    int cur = 0;
    for (int i = 1; i <= k; i++)
    {
        memset(dp[i & 1], 0, sizeof(dp[i & 1]));
        int up = 0;
        if (i >= 2)
            up = s[i - 2];
        for (int sum = s[i - 1]; sum <= n - k; sum++)
            for (int ans = 0; ans <= g; ans++)
            {
                for (int ls = 0; ls <= sum - up; ls++)
                {
                    cur = ans - max(ls - a[i - 1], 0);
                    if (cur >= 0)
                    {
                        dp[i & 1][sum][ans] += dp[(i + 1) & 1][sum - ls][cur];
                        if (dp[i & 1][sum][ans] >= MOD)
                            dp[i & 1][sum][ans] -= MOD;
                    }
                }
            }
    }
    int res = 0;
    for (int sum = s[k - 1]; sum <= s[k]; sum++)
        for (int ans = 0; ans <= g; ans++)
        {
            res += dp[k & 1][sum][ans];
            if (res >= MOD)
                res -= MOD;
        }
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 4412
#include<bits/stdc++.h>
using namespace std;
char str[100100];
bool shp[100100];
int n;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n;
	scanf("%s",str);
	for(int mask=0;mask<4;mask++){
		shp[0]=(mask&1);
		shp[1]=(mask>>1)&1;
		for(int j=1;j<n-1;j++){
			shp[j+1]=shp[j-1]^shp[j]^(str[j]=='x');
		}
		if(shp[0]==shp[n-2]^shp[n-1]^(str[n-1]=='x')){
			if(shp[1]==shp[n-1]^shp[0]^(str[0]=='x')){
				for(int i=0;i<n;i++){
					if(shp[i])
						cout<<'W';
					else
						cout<<'S';
				}
				return 0;
			}
		}
	}
	cout<<-1;
	return 0;
}

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

int main(){
	int n, m=0;
	map<int,int> a;
	vector<int> ans;

	for(int i=1 ; i<=100 ; i++){
		a.insert( map<int,int>::value_type( i , 0 ) );
	}
	while( cin >> n ){
		a[n] += 1;
	}
	for(int i=1 ; i<=100 ; i++){
		m = max( a[i] , m );
	}
	for(int i=1 ; i<=100 ; i++){
		if( m == a[i] ) ans.push_back(i);
	}

	sort( ans.begin() , ans.end() );
	for(int i=0 ; i<ans.size() ; i++){
		cout << ans[i] << endl;
	}
}

Measured memory_bytes: 0
import java.util.*;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {	
		 Scanner scanner = new Scanner(System.in);
		   long N = scanner.nextLong();
		   Map<Long,Long> map_A = new HashMap<>();
      	   Map<Long,Long> map_B = new HashMap<>();

      		for(long i = 1; i < N+2; i++){
              long A = scanner.nextLong();
              map_A.put(i,A);
            }
      		for(long i = 1; i < N+1; i++){
              long B = scanner.nextLong();
              map_B.put(i,B);
            }

      		long ans = 0;
      		for(long i = 1; i < N+1; i++){
            ans += Math.min(map_A.get(i), map_B.get(i));
			long j = Math.max(0, map_B.get(i) -map_A.get(i));
			ans += Math.min(map_A.get(i+1), j);
            map_A.put(i+1,Math.max(0, map_A.get(i+1) - j));
            }
      System.out.println(ans);
	}

}


Measured memory_bytes: 108688
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int d[10][10];

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

  repo(i, n){
    int matubi=i%10;
    int sentou=i;
    int next=i/10;
    while(next!=0){
      sentou=next;
      next/=10;
    }
    d[sentou][matubi]++;
  }
  ll ans=0;
  rep(i,10){
    ans+=d[i][i]*d[i][i];
  }
  rep(i, 10){
    for(int j=i+1; j<10; j++){
      ans+=d[i][j]*d[j][i]*2;
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int main(){

  int h,w;
  cin >> h >> w;
  string a[h];
  for(int hi=0;hi < h; hi++){
    cin >> a[hi];
  }

  vector<string> ans;  
  for(int hi=0;hi<h;hi++){
    bool ok=false;
    for(int wi=0;wi<w;wi++){
      if(a[hi][wi]=='#'){
	ok=true;
	break;
      }
    }
    if(ok) ans.push_back(a[hi]);    
  }
  vector<string> res; //column
  for(int wi=0;wi<w;wi++){
    bool ok=false;
    for(int hi=0;hi<ans.size();hi++){
      if(ans[hi][wi]=='#'){
	ok=true;
	break;
      }
    }
    if(ok){
      string tmp;
      for(int hi=0;hi<ans.size();hi++){
	tmp += ans[hi][wi];
      }
      res.push_back(tmp);      
    }	
  }
  for(int i=0;i<res[0].size();i++){
    for(int j=0;j<res.size();j++){
      cout << res[j][i];
    }
    cout << endl;
  }

  return 0;
  
}


Measured memory_bytes: 256
line = gets.chomp.split(" ").map(&:to_i)

n = line[0]
d = line[1]

points = []
ans = 0
n.times do
    new_point = gets.chomp.split(" ").map(&:to_i)
    points.each do |point|
        distance = 0
        square_d = 0
        d.times do |i|
            square_d += (point[i] - new_point[i]) ** 2
        end
        distance = square_d ** (1.0/2)
        if distance % 1 == 0
            ans += 1
        end
    end
    points.push(new_point)
end

puts ans


Measured memory_bytes: 1916
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
using namespace std;
const int MAXN=10;
int p, q, r, a[MAXN], b[MAXN], cnt=0;
int main()
{
	cin>>p>>q>>r;
	b[1]=p, b[2]=q, b[3]=r;
	for(int i=1; i<=3; i++)
		for(int j=i+1; j<=3; j++)
		{
			a[++cnt]=b[i]+b[j];
		}
	sort(a+1, a+cnt+1);
	cout<<a[1]<<endl;
	return 0;
}

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


def main():
    N = int(input())
    H = [int(x) for x in input().split()]

    dp = [0] * (N + 1)
    dp[2] = abs(H[0] - H[1])

    for i in range(3, N + 1, 1):
        dp[i] = min(dp[i - 2] + abs(H[i - 3] - H[i - 1]), dp[i - 1] + abs(H[i - 2] - H[i - 1]))

    print(dp[N])


if __name__ == '__main__':
    main()



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

def main():
    input_string = raw_input().strip()
    down_positions = []
    ponds = []
    for index, value in enumerate(input_string):
        if value == '\\':
            down_positions.append(index)
        elif value == '/' and down_positions:
            right = index
            left = down_positions.pop()
            area = right - left
            candidate_pond = []
            while ponds and left < ponds[-1][0]:
               candidate_pond.append(ponds.pop(-1))

            new_pond = (left, area + sum([x[1] for x in candidate_pond]))
            ponds.append(new_pond)
    
    print sum(x[1] for x in ponds)
    print len(ponds), 
    for pond in ponds:
        print pond[1], 

if __name__ == '__main__':
    main()

Measured memory_bytes: 6896
/* [Template].cpp 
Example code to use when starting new code. This particular problem was problem 
977A_Wrong_Subtraction from CodeForces

Compile: g++  -o C.exe C.cpp 
Execute: ./C
*/ 

#include <cstdio>
#include <iostream>
#include <cmath> 
#include <limits> 
#include <iomanip>
#include <cstring> 
#include <bits/stdc++.h>
#include <string>  
using namespace std;

/*
say n = 100
A=1: --> 99*2-1
	(1,1,.)
	(1,2,.)
	...
	(1,99,.) --> 99 = (100-1)/1
	
A=2: --> 
	(2,2,.)
	(2,3,.)
	...
	(2,49,.) --> 49 = (100-1)/2 = m. (m-i+1)*2-1
*/

int main() { 	
	int n; 
	cin >> n; 
	
	int result = 0; 
	int m; 
	
	for(int i = 1; i < n; i++) {
		m = (n-1)/i; 
		if((m-i+1)*2-1 > 0)
			result += (m-i+1)*2-1; 
			
		// Checking
		// cout << m << "\t" << (m-i+1)*2-1 << endl; 
	}
	
	cout << result << endl; 
	
	return 0; 
} 


Measured memory_bytes: 3676
/*input
7
1 2 3 4 5 6 7
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<int,int>
#define f first
#define s second
#define pb emplace_back
#define REP(i,n) for(ll i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n) memset(n,0,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;

ll mypow(ll a,ll b){
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int arr[maxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
    int n;
    cin>>n;
    REP(i,n) cin>>arr[i];
    REP(i,n-1){
    	if(arr[i]>arr[i+1] or (arr[i]>arr[i-1] and i>0)) arr[i]--;
    }
    bool wk=true;
    REP(i,n-1) if(arr[i]>arr[i+1]) wk=false;
    if(wk) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second
#define popcount __builtin_popcount

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(x) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

class UnionFind{
  vector<int> _parent, _depth, _size;
  int _count;
public:
  UnionFind(int n): _parent(n), _depth(n,1), _size(n,1), _count(n){REP(i, n) _parent[i] = i;}
  int root(int i){
    if(_parent[i] == i) return i;
    else return _parent[i] = root(_parent[i]);
  }
  bool same(int i, int j){return root(i) == root(j);}
  int merge(int i, int j){
    int ri = root(i), rj = root(j);
    if(ri == rj) return ri;
    else{
      --_count;
      if(_depth[ri] < _depth[rj]){
	_parent[ri] = rj; _size[rj] += _size[ri];
	return rj;
      }else{
	_parent[rj] = ri; _size[ri] += _size[rj];
	if(_depth[ri] == _depth[rj]) ++_depth[ri];
	return ri;
      }
    }
  }
  int size(int i){return _size[root(i)];}
  int count(){return _count;}
};

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

  int N,M;
  while(cin >> N >> M){
    vector<int> X(M), Y(M), Z(M);
    UnionFind uf(N);

    REP(i,M){
      int x, y, z;
      cin >> x >> y >> z;
      --x, --y;

      uf.merge(x,y);
    }

    int ans = uf.count();

    cout << ans << endl;
  }
  
  return 0;
}


Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			int m = scanner.nextInt();
			int count = 0;
			for (int i = n; i <= m; i++) {
				if (slove(i)) {
					count++;
				}
			}
			System.out.println(count);
		}
	}

	private static boolean slove(int i) {
		while (true) {
			if (i % 2 == 0) {
				i /= 2;
			} else if (i % 3 == 0) {
				i /= 3;
			} else if (i % 5 == 0) {
				i /= 5;
			} else {
				break;
			}
		}

		return i == 1;
	}
}

Measured memory_bytes: 18988
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;


void solve(){

    int n,k;
    cin >> n >> k;
    int r,s,p;
    cin >> r >> s >> p;
    string t;
    cin >> t;
    ll ans = 0;
    rep(i,t.size()){
        if(i<k){
            if(t[i]=='r') ans += p;
            if(t[i]=='s') ans += r;
            if(t[i]=='p') ans += s;
        }
        else if(t[i]!=t[i-k]){
            if(t[i]=='r') ans += p;
            if(t[i]=='s') ans += r;
            if(t[i]=='p') ans += s;
        }
        else{
            t[i] = 'w';
        }
    }

    cout << ans << endl;

}

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


Measured memory_bytes: 512
import sys

data_list = sys.stdin.readlines()
data_length = int(data_list.pop(0))

for x in xrange(data_length):
	lines = map(int, data_list[x].strip().split())
	lines.sort(reverse = True)
	if lines[0]**2 == (lines[1]**2 + lines[2]**2):
		print "YES"
	else:
		print "NO"

Measured memory_bytes: 4228
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a[200100], b[200100];

ll dp[200100];

ll gcd(ll x, ll y) {
    if (y == 0) return x;
    return gcd(y, x%y);
}

ll mod_pow(ll x, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

ll solve() {
    map<P, ll> m;
    for (int i = 0; i < n; i++) {
        if (a[i] == 0 && b[i] == 0) {
            m[P(0, 0)]++;
        } else if (a[i] == 0) {
            m[P(0, 1)]++;
        } else if (b[i] == 0) {
            m[P(1, 0)]++;
        } else {
            ll g = gcd(abs(a[i]), abs(b[i]));
            a[i] /= g;
            b[i] /= g;
            if ((a[i] > 0 && b[i] > 0) || (a[i] < 0 && b[i] < 0)) {
                a[i] = abs(a[i]);
                b[i] = abs(b[i]);
            } else {
                a[i] = -abs(a[i]);
                b[i] = abs(b[i]);
            }
            m[P(a[i], b[i])]++;
        }
    }

    ll res = 1;
    ll z = 0;
    for (auto v : m) {
        if (v.first == P(0, 0)) {
            z = v.second;
        } else {
            ll x0 = v.first.first;
            ll y0 = v.first.second;
            ll x1, y1;
            if (x0 == 0) {
                x1 = 1;
                y1 = 0;
            } else if (y0 == 0) {
                x1 = 0;
                y1 = 1;
            } else if (x0 > 0 && y0 > 0){
                x1 = -y0;
                y1 = x0;
            } else {
                x1 = y0;
                y1 = -x0;
            }
            if (m.count(P(x1, y1)) == 0) {
                res *= mod_pow(2, v.second);
                res %= mod;
            } else if (P(x0, y0) < P(x1, y1)){
                ll c = mod_pow(2, v.second) + mod_pow(2, m[P(x1, y1)]) - 1;
                res *= c;
                res %= mod;
            }
        }
    }
    return (res-1+z+mod)%mod;
}

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

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

    input();
    cout << solve() << endl;
}


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

int main()
{
    int n;
    cin >> n;
    if(n%10 == 2 || n%10 == 4 || n%10 == 5 || n%10 == 7 || n%10 == 9)
    {
        cout << "hon";
    }
    if(n%10 == 0 || n%10 == 1 || n%10 == 6 || n%10 == 8)
    {
        cout << "pon";
    }
    if(n%10 == 3)
    {
        cout << "bon";
    }
    return 0;
}


Measured memory_bytes: 3624
from math import ceil,sqrt,log,gcd
def ii():return int(input())
def si():return input()
def mi():return map(int,input().split())
def li():return list(mi())


# for _ in range(ii()):
    
x,y=mi()
f=0
if(2*x<=y<=4*x):
    if(y%2==0):
        f=1
if(f):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 61844
#include<iostream>
#include<vector>
#include<set>
#include<string>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    //vector<string> v = {"ABC"};
    int a,b,c;
    cin>>a>>b>>c;
    if(a+b==c || a+b>c){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 256
N,M = [int(i) for i in input().split()]
Nodes = []
Mlist = []
count = 0
for i in range(N):
    Mlist.append(1)
for i in range(M):
    Nodes.append(list(map(int, input().split())))


def search(x):
    Mlist2[x-1] = 0
    answer = 1
    for i in range(len(Nodes2)):
        if x in Nodes2[i]:
            if Nodes2[i].index(x) == 0:
                if Mlist2[Nodes2[i][1]-1] != 0:
                    search(Nodes2[i][1])
                else: continue
            if Nodes2[i].index(x) == 1:
                if Mlist2[Nodes2[i][0]-1] != 0:
                    search(Nodes2[i][0])
                else: continue
        else: continue
    #print(Mlist2)
    for i in range(len(Mlist2)):
        if Mlist2[i] == 0:
            continue
        else:
            answer = 0
            break
    if answer == 1:
        return 1
    if answer == 0:
        return 0

for i in range(M):
    #print (i)
    Nodes2 = Nodes[:]
    Mlist2 = Mlist[:]
    del Nodes2[i]
    ans = search(1)
    if ans == 0:
        count += 1
print(count)



Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
using namespace std;

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

int main(){
    int N, T, A;
    cin >> N >> T >> A;
    int H[N];
    double sub[N];
    rep(i, N){
        cin >> H[i];
        double ave_temp = T - H[i] * 0.006;
        sub[i] = fabs(ave_temp - A);
    }
    double min = sub[0];
    int min_index = 0;
    rep(i, N){
        if(min > sub[i]){
            min = sub[i];
            min_index = i;
        }
    }
    cout << min_index + 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#AGC034-B ABC
"""
ABC→BCA
ABCBC→BCABC→BCBCA
AABC→ABCA→BCAA

"BC"の文字列は絶対に不変で、これが"A"を左から右にキャリーする役割を持つ。
それ以外の文字列、Bの後にCが無い状態もしくは、Cの前にBが無い時、キャリーが終わる。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

s = readline().rstrip().decode('utf-8')
ans = 0 
a_ct = 0
bc_ct = 0
flag = 0
for i in range(len(s)-1):
    if flag:
        flag = 0
        continue
    if s[i] == "A":
        a_ct += 1
    elif s[i] == "B":
        if s[i+1] == "C":
            bc_ct += 1
            ans += a_ct
            flag = 1
        else:
            a_ct = 0
            bc_ct = 0
    else:
        a_ct = 0
        bc_ct = 0

print(ans)

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

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int s = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		int mod = 998244353;
		long ans = 0;
		long[][] dp = new long[n + 1][s + 1];
		dp[0][0] = 1;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j <= s; j++) {
				dp[i + 1][j] += dp[i][j];
				if (j == 0) {
					if (a[i] <= s) {
						dp[i + 1][a[i]] += i + 1;
					}
				} else {
					if (j + a[i] <= s) {
						dp[i + 1][j + a[i]] += dp[i][j];
					}
				}
			}
			for (int j = 0; j <= s; j++) {
				dp[i + 1][j] %= mod;
			}
		}

		for (int i = 1; i <= n; i++) {
			ans += (dp[i][s] - dp[i - 1][s] + mod) % mod * (n - i + 1) % mod;
		}
		ans %= mod;
		System.out.println(ans);
	}
}


Measured memory_bytes: 129488
#include <bits/stdc++.h>
const long long MOD = 1e9+7;
using namespace std;
#define ll long long
#define ar array

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

	int m1,d1,m2,d2;
	cin >> m1 >> d1 >> m2 >> d2;

	if (m1!=m2 && d1!=d2) {
		cout << 1 << endl;
	} else {
		cout << 0 << endl;
	}
	return 0;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Enum various numbers
//-------------------------------------------------
namespace Enum
{
    using fint = ::std::int_fast64_t;
    //素因数分解(素因数列挙)
    ::std::map<fint,int> factor(fint n)
    {
        ::std::map<fint,int> ret;
        for(fint i=2; i*i<=n; i++){
            while(n%i==0){
                ret[i]++;
                n/=i;
            }
        }
        if (n!=1) ret[n]++;
        return ret;
    }
    //約数列挙
    ::std::vector<fint> divisor(fint n)
    {
        ::std::vector<fint> ret;
        for(fint i=1; i*i<=n; i++){
            if (n%i==0){
                ret.push_back(i);
                if (i*i!=n) ret.push_back(n/i);
            }
        }
        return ret;
    }
    //商列挙(割る最小の数と商のペア)
    ::std::vector<::std::pair<fint,fint> > quotient(fint n)
    {
        ::std::vector<::std::pair<fint,fint> > ret;
        fint i=0;
        for(i=1; i*i<=n; i++){
            ret.emplace_back(i,n/i);
        }
        for(; i<=n; i++){
            fint d = n/i;
            ret.emplace_back(i,d);
            i+=(n-d*i)/d;
        }
        return ret;
    }
    //素数判定(おまけ)
    bool isprime(fint n)
    {
        for(fint i=2; i*i<=n; i++){
            if (n%i==0) return false;
        }
        return true;
    }
}

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vll a(n);
    rep(i,n) cin>>a[i];
    ll ans=0;
    rep(i,n){
        auto p = Enum::factor(a[i]);
        ans+=p[2];
    }
    cout<<ans<<endl;
    return 0;
}


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

int main(){
    long long n, u, v; cin >> n;
    long long res = n * (n + 1) * (n + 2) / 6;
    while(cin >> u >> v){
        if(u > v) swap(u, v);
        res -= u * (n + 1 - v);
    }
    cout << res << '\n';
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
// #include <boost/lexical_cast.hpp>
using namespace std;

#define ll long long int
#define vll vector<ll>
#define vllv vector<vector<ll>> 
#define vpii vector<pair<ll,ll>>
#define pll  pair<ll,ll>
#define sz size()
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll MOD=1000000000+7;
ll ceil1(ll n,ll m){if(n%m==0){return n/m;}return n/m +1;}
ll factor(ll n){
    vll ans;
	if(n==2)ans.pb(2);
	else
    {for(ll i=2;i*i<=n;i++){if(n%i==0 && n%i!=i){ans.pb(i);if(n/i!=i)ans.pb(n/i);}}ans.pb(n);}
    return ans.sz+1;
}
ll fact(ll n){ll res = 1;for (ll i = 2; i <= n; i++)res = res * i; 
    return res; } 
  
ll nCr(ll n, ll r){ return fact(n) / (fact(r) * fact(n - r)); } 
  
void dfs(vllv &v,ll k,vll &par,vll &dis,ll p)
{
    par[k]=p;
    dis[k]=dis[p]+1;
    for(ll i=0;i<v[k].sz;i++){
        if(v[k][i]!=p){
            dfs(v,v[k][i],par,dis,k);
        }
    }
}
bool sortbysec(const pair<string,int> &a,const pair<string,int> &b){return (a.second<b.second);} 

ll pow2(ll n,ll k){ll ans=1;
    while(k>0){
        if(k%2==1)ans=ans*n;n=n*n;k/=2;
    }return ans;}
bool prime(int n){
    int i,j;
    for(i=2;i<=sqrt(n);i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}

void solve()
{
ll n;
cin>>n;
vll a(n);
	for(ll i=0;i<n;i++)
		cin>>a[i];
	sort(all(a));
	cout<<a[n-1]-a[0];
	return;
}            
int main()
{
	fast;
    ll q;
    q=1;
    // cin>>q;
    while(q--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    cout<<min(a,k)-max(0,k-a-b)<<endl;
}

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

int main()
{
  int n, tmp = 0, a = 0, h, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++)
  {
    cin >> h;
    if (h <= tmp)
      a++;
    else
      a = 0;
    ans = max(ans, a);

    tmp = h;
  }
  cout << ans << endl;
}

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


public class Main {
    static ArrayList<Integer>[] graph;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //String[] buf = reader.readLine().split(" ");
        int a = sc.nextInt(), b = sc.nextInt();
        int ans = 0;
        if(a>=6&&a<=12) b/=2;
        else  if(a<=5) b = 0;
        ans = b;
        System.out.println(ans);

    }
}



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

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


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

using namespace std;

const int MAX = 1000000;
int s[MAX];

void eratos();

int main(int argc, char const *argv[]) {
    int a, d, n, tmp;
    int cnt = 0;
    vector<int> results;

    eratos();
    
    while(1){
        cin>>a>>d>>n;
        if( a == 0 && d == 0 && n == 0 ) break;
        tmp = a;
        cnt = 0;
        while(1){
            if(s[tmp]) cnt++;
            if(cnt==n) break;
            tmp += d;
        }
        results.push_back( tmp );
    }

    for(auto it = results.begin(); it != results.end(); it++){
        cout<<*it<<endl;
    }

    return 0;
}

void eratos(){
    for(int i = 2; i < MAX; i++ ){
        s[i] = 1;
    }

    int j=0;
    int k=2;
    do {
        if (s[k]!=0) {
            j++;
            for (int i=k*k;i<=MAX;i+=k){
                s[i]=0;
            }
        }
        k++;
    } while (k * k<=MAX);
}

Measured memory_bytes: 7036
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

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


int n, m;
vector<string> fi;

int main() {
    while (cin >> n >> m) {
        fi.clear();
        for (int i = 0; i < n; ++i) {
            string str;
            cin >> str;
            fi.push_back(str);
        }
        
        vector<vector<int> > res(n, vector<int>(m, 0));
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < m; ++j) {
                for (int k = 0; k < 8; ++k) {
                    int ni = i + dx[k], nj = j + dy[k];
                    if (ni < 0 || ni >= n || n < 0 || nj >= m) continue;
                    if (fi[ni][nj] == '#') {
                        ++res[i][j];
                    }
                }
            }
        }
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < m; ++j) {
                if (fi[i][j] == '.') cout << res[i][j];
                else cout << "#";
            }
            cout << endl;
        }
    }
}





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

// extended Euclidean Algorithm
// ax + by = gcd(a, b)
// return : gcd(a, b)
template <typename Integer = int_fast64_t>
constexpr Integer extgcd(Integer a, Integer b, Integer &x, Integer &y) {
    Integer u = 0, v = 1, q = 0, tmp = 0;
    x = v = 1;
    y = u = 0;

    while (b) {
        q = a / b;
        x ^= u ^= x ^= u;
        u = u - q * x;
        y ^= v ^= y ^= v;
        v = v - q * y;
        a ^= b ^= a ^= b;
        b = b - q * a;
    }

    return a;
}

// mod inverse(設計が変わるかもしれません)
// return : val^(-1) mod MOD
template <uint_fast64_t MOD, typename Integer = int_fast64_t>
constexpr Integer modinv(Integer val) {
    int_fast64_t ret = 0, tmp = 0;

    extgcd<int_fast64_t>(static_cast<int_fast64_t>(val),
                         static_cast<int_fast64_t>(MOD), ret, tmp);

    return static_cast<Integer>(ret > 0 ? ret % MOD : (MOD - (-ret % MOD)));
}

// const expression factorial mod MOD
template <std::size_t N, std::uint_fast64_t MOD> struct Fact {
    std::uint_fast64_t val[N + 1];

    constexpr Fact() : val() {
        val[0] = 1;
        for (std::size_t i = 1; i <= N; ++i)
            val[i] = val[i - 1] * i % MOD;
    }
};

// const expression factorial inverse mod MOD
template <std::size_t N, std::uint_fast64_t MOD, std::uint_fast64_t F>
struct IFact {
    std::uint_fast64_t val[N + 1];

    constexpr IFact() : val() {
        val[N] = F;
        for (std::size_t i = N; i; --i)
            val[i - 1] = val[i] * i % MOD;
    }
};

constexpr std::uint_fast64_t MOD = 1000000007, maxN = 300000;

constexpr auto fact = Fact<maxN, MOD>();
constexpr auto ifact = IFact<maxN, MOD, modinv<MOD>(fact.val[maxN])>();

// const expression binomial mod MOD
constexpr std::uint_fast64_t binommod(std::uint_fast64_t n,
                                      std::uint_fast64_t r) {
    if (r < 0 || r > n)
        return 0;
    return fact.val[n] * (ifact.val[r] * ifact.val[n - r] % MOD) % MOD;
}

int main() {
    using namespace std;
    ios::sync_with_stdio(false);
    cin.tie(0);
    long long H, W, A, B, ans = 0;
    cin >> H >> W >> A >> B;
    for (int i = 0; i < H - A; i++) {
        ans += binommod(B - 1 + i, B - 1) *
               binommod(H - i - 1 + W - B - 1, W - B - 1);
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

        int N = sc.nextInt();

        boolean found = false;
        for (int i = 0; i < N; i++) {
            int a = sc.nextInt();
            if (a % 2 == 1) {
                found = true;
                break;
            }
        }

        if (found) {
            System.out.println("first");
        } else {
            System.out.println("second");
        }
    }
}


Measured memory_bytes: 48728
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll a, b;
  cin >> a >> b;
  rep(i, 100000){
    if((i*108)/100 - i == a && (i*110)/100 - i == b){
      print(i);
      return 0;
    }
  }
  print(-1);
}


Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""

n = onem()

a = l()

ans = a[0]

for i in range(1,n):
	if ans == -1:
		if a[i] == 0:
			ans *= 0
			break
	if ans != -1:
		ans *= a[i]
	if ans > 10**18:
		ans = -1

print(ans)



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

using namespace std;

int main()
{
    string a;
    cin>>a;
    int len=a.length(),i,sum=0;
    for(i=0;i<len;i++){
       if(a[i]=='0' && a[i]==a[i+1]){
        sum+=1;
        a[i+1]='1';
       }
       else if(a[i]=='1' && a[i]==a[i+1]){
        sum+=1;
        a[i+1]='0';
       }
    }
    cout<<sum;
    return 0;
}


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

int nth_bit(int64_t num, int n){
    return (num >> n) & 1;
}

void chmax(int64_t& a, int64_t b){
    a = max(a, b);
}

int main(){
    int N;
    int64_t K, A[100000];
    cin >> N >> K;
    for(int i=0; i<N; i++) cin >> A[i];

    int64_t dp[41][2];
    for(int d=40; d>=0; d--) for(int j=0; j<2; j++) dp[d][j] = -1e18;
    dp[40][0] = 0;

    for(int d=39; d>=0; d--){
        int64_t D = 1LL<<d;

        int num1 = 0;
        for(int i=0; i<N; i++) if(nth_bit(A[i], d)) num1++;
        int num0 = N - num1;

        if(nth_bit(K, d)){
            chmax(dp[d][0], dp[d+1][0] + D * num0);
            chmax(dp[d][1], dp[d+1][0] + D * num1);
        }else{
            chmax(dp[d][0], dp[d+1][0] + D * num1);
        }

        chmax(dp[d][1], dp[d+1][1] + D * max(num0, num1));
    }

    int64_t ans = max(dp[0][0], dp[0][1]);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define int long long

typedef pair<int, int> ii;

const int N = 55;

const int inf = 1e15;
const int mod = 1e9 + 7;

int n, times;

struct mat{
    int a[N][N];
    mat() {
        memset(a, 0, sizeof(a));
    }
}base;

int add1(int x, int y) {
    return (x + y) % mod;
}

int mul1(int x, int y) {
    return (x * y) % mod;
}

mat mul(mat x, mat y) {
    mat z;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            for(int k = 1; k <= n; k++)
                z.a[i][j] = add1(z.a[i][j], mul1(x.a[i][k], y.a[k][j]));
        }
    }
    return z;
}

mat BinPow(int m) {
    if(m == 1)
        return base;
    else {
        mat sum = BinPow(m / 2);
        sum = mul(sum, sum);
        if(m % 2)
            sum = mul(sum, base);
        return sum;
    }
}

signed main() {
    cin.tie(0), ios::sync_with_stdio(0);
    cin >> n >> times;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++)
            cin >> base.a[i][j];
    }
    mat lmao = BinPow(times);
    int sum = 0;
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++)
            sum = (sum + lmao.a[i][j]) % mod;
    }
    cout << sum;
}


Measured memory_bytes: 9856
#include <iostream>
#include <stack>
#include <string>
#include <cstdlib>
using namespace std;

int main(void) {
    string s;
    stack<int> in;
    int a,b;
    while(cin>>s) {
        if(s[0]=='+') {
            a=in.top();in.pop();
            b=in.top();in.pop();
            in.push(a+b);
        } else if(s[0]=='-') {
            a=in.top();in.pop();
            b=in.top();in.pop();
            in.push(b-a);
        } else if(s[0]=='*') {
            a=in.top();in.pop();
            b=in.top();in.pop();
            in.push(a*b);
        } else {
            in.push(atoi(s.c_str()));
        }
    }
    cout<<in.top()<<endl;
    return 0;
}

Measured memory_bytes: 3204
a = ['1','3','5','7','8','10','12']
b = ['4','6','9','11']
c = ['2']
i,j = map(str,input().split())
if (i in a) and (j in a):
 print("Yes")
elif (i in b) and (j in b):
 print("Yes")
elif i == "2" and j == "2":
 print("Yes")
else:
 print("No")

Measured memory_bytes: 3064
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    var dn = input[0].split(' ');
    var d = parseInt(dn[0], 10);
    var n = parseInt(dn[1], 10);

    var n2 = n; 
    if (n % 100 === 0) {
        n2 = n + 1;
    }
    var ans = Math.pow(100, d) * n2;
    console.log(ans);

    return 0;
}


Measured memory_bytes: 22204