akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int N;
  scanf("%d", &N);
  auto f = 0, g = 0, h = 0;
  while (N--) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    auto f_ = max(g, h) + a;
    auto g_ = max(h, f) + b;
    auto h_ = max(f, g) + c;
    f = f_;
    g = g_;
    h = h_;
  }
  printf("%d\n", max(max(f, g), h));
  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 erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 1000000009

ll gcm(ll a,ll b){
  if(a < b) swap(a,b);
  if(b == 0) return a;
  return gcm(a%b,b);
}

ll lcm(ll a,ll b){
  return a*b/gcm(a,b);
}

int main(){
  ll n,m;
  cin >> n >> m;
  string s,t;
  cin >> s >> t;
  ll nm = lcm(m,n);
  ll muln = nm / n;
  ll mulm = nm / m;
  int nown = 0;
  int nowm = 0;
  bool flag = true;
  while(nown < n && nowm < m){
    //cout << s[nown] << " " << t[nowm] << endl;
    if(s[nown] != t[nowm]){
      flag = false;
    }
    nown += mulm;
    nowm += muln;
    //cout << flag << endl;
  }
  if(flag) cout << nm << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) ll(i.size())
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

template<class T> inline bool cmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool cmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MOD=1000000007;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll MAXN=1e5+5;
const ll MAXLG=__lg(MAXN)+2;

ll n,a[MAXN];
ll ans;

/********** Main()  function **********/
int main()
{
  IOS();
  cin>>n;
  REP(i,n)cin>>a[i];
  sort(a,a+n);
  if(n&1){
    ll ret1 = 0,ret2 = 0;
    for(ll i=0;i<n/2;i++){
      ret1 -= a[i]*2;
    }

    for(ll i=n/2;i<n;i++){
      ret1 += a[i]*2;
    }
    ret1 -= a[n/2] + a[n/2+1];


    for(ll i=0;i<=n/2;i++){
      ret2 -= a[i]*2;
    }

    for(ll i=n/2+1;i<n;i++){
      ret2 += a[i]*2;
    }
    ret2 += a[n/2] + a[n/2-1];

    ans = max(ret1,ret2);
  } else {
    for(ll i=0;i<n/2;i++){
      ans -= a[i]*2;
    }

    for(ll i=n/2;i<n;i++){
      ans += a[i]*2;
    }
    ans += a[n/2-1] - a[n/2];
  }

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


Measured memory_bytes: 1024
import java.io.*;
class Main{
	public static void main(String[]args)throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		int i,j;
		String[] nm=br.readLine().split(" ");
		int n=Integer.parseInt(nm[0]);
		int m=Integer.parseInt(nm[1]);
		
		int[][] A=new int[n][m];
		int[] b=new int[m];
		int []c=new int[n];
		
		for(i=0;i<n;i++){
			String[] numA=br.readLine().split(" ");
			for(j=0;j<m;j++){
				A[i][j]=Integer.parseInt(numA[j]);
			}
		}
		for(j=0;j<m;j++){
			String numB=br.readLine();
			b[j]=Integer.parseInt(numB);
			for(i=0;i<n;i++){
				c[i]+=(A[i][j])*(b[j]);
			}
		}
		for(i=0;i<n;i++){
			System.out.println(c[i]);
		}
	}
}

Measured memory_bytes: 27296
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;

ll fact1(ll n){
	ll count = 0;
	for(ll i = 2; i*i <= n; i++){
		if(n%i == 0){
			ll x = n;
			while(x%i == 0) x/=i;
			if(x%i == 1) count++;
			x = n;
			if(i != n/i){
				ll ii = n/i;
				while(x%ii == 0) x/=ii;
				if(x%ii == 1) count++;
			}
		}
	}
return count;
}
ll fact2(ll n){
	ll count = 0;
	for(ll i = 2; i*i <= n; i++){
		if(n%i == 0){
			count++;
			if(n	/i != i) count++;
		}
	}
	return count;
}


void solve(){
	ll n;
	cin >> n;
	if(n == 2)
		cout << 1 << endl;
	else
		cout << fact1(n)+fact2(n-1)+2 << endl;
}

int main(){
	#ifndef RAY
		//freopen("input.txt", "r", stdin);
	#endif
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		int t = 1;
		//cin >> t;
		while(t--){
			solve();
		}
	return 0;
}	
	


Measured memory_bytes: 256
import java.io.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int M = nextInt();
		int[] A  = nextInts();

		long sum=0;
		for(int i=0;i<A.length;i++){
			sum+=A[i];
		}
		long ans = N-sum;
		if(ans<0){
			ans=-1;
		}
		System.out.println(ans);

	}


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

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

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

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

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

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


}


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

using namespace std;

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

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main()
{
	int n;
	scanf("%d", &n);
	rep(i, n){
		int h, m;
		scanf("%d:%d", &h, &m);
		
		double arg = fabs(h*5 + m/12.0 - m);
		if(arg >= 30.0)
			arg = 60.0 - arg;
		if(arg < 5.0)
			puts("alert");
		else if(arg < 15.0)
			puts("warning");
		else
			puts("safe");
	}
	
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef pair<double,double> pdd;
double PI=3.14159265359;
vector<pair<double,int> > angles;
int r,c,n;

bool isBoundary(int x1, int y1, int x2, int y2){
	bool ok1=false,ok2=false;
	if(x1==0 || x1==r || y1==0 || y1==c)
		ok1=true;
	if(x2==0 || x2==r || y2==0 || y2==c)
		ok2=true;

	return ok1 && ok2;
}

int main(){
	int x1,y1,x2,y2;
	cin >> r >> c >> n;
	pdd center=make_pair(r/2.0,c/2.0);
	pdd arr[n];
	double x,y;
	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2;
		if(isBoundary(x1,y1,x2,y2)){
			angles.push_back(make_pair((180/PI)*atan2(y1-center.second,x1-center.first),i));
			angles.push_back(make_pair((180/PI)*atan2(y2-center.second,x2-center.first),i));
		}
	}
	sort(angles.begin(),angles.end());
	stack<int> s;
	int len=angles.size();
	for(int i=0;i<len;i++){
		if(s.empty()){
			s.push(angles[i].second);
		}
		else if(s.top()==angles[i].second)
			s.pop();
		else
			s.push(angles[i].second);
	}
	cout << (s.empty()?"YES\n":"NO\n");

	return 0;
}

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

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

  int k;
  cin >> k;

  ll ans = 0;

  for (int a = 1; a <= k; ++a) {
    for (int b = 1; b <= k; ++b) {
      for (int c = 1; c <= k; ++c) {
        int gcd = __gcd(a, __gcd(b, c));
        ans += gcd;
      }
    }
  }
  
  cout << ans << '\n';

  return (0);
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
using namespace std;
 
#define SZ(x) ((int)(x).size())
using namespace std;
typedef pair<int,int> PII;
#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define REP(i,n) for (int i = 0; i < n; ++i)
#define FOR(i,a,b) for (int i = a; i <= b; ++i)
#define M 1000000007
#define MM 998244353
#define SZ(a) int((a).size())
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define mod 1000000007
using ll = long long;

//a and b are assumed to be taken modulo p
inline ll add(ll a, ll b, ll p = mod){ ll c = a + b; if(c >= p) c -= p; return c; }
inline ll sub(ll a, ll b, ll p = mod){ ll c = a - b; if(c < 0) c += p; return c; }
inline ll mul(ll a, ll b, ll p = mod){ return (a * 1ll * b) % p; }
 
using VI = vector<int>;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
using VLL = vector<ll>;
using ld = long double;
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
      
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;     // Initialize result
  
    x = x % p; // Update x if it is more than or
                // equal to p
  
    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;
  
        // y must be even now
        y = y>>1; // y = y/2
        x = (x*1ll*x) % p;
    }
    return res;
}
const int MX = 2e4+10;
const int MX2 = 1e6+5;

ll INF= 4 * (ll)1e18;
int mx = 2 * (ll)1e9 + 10;

vector<string> v(4);
string s;
int f;
int n;
int recur(int idx) {
    if (idx > SZ(s)) return 0;
    if (idx == SZ(s)) return 1;
    if (s[idx] != 'e' && s[idx] != 'd') return 0;
    int f1 = 1;
    if (s[idx] == 'e') {
        int j = 0;
        for (j = 0; j < 5; ++j) {
            if (idx + j >= n) return 0;
            if (s[idx+j] != v[2][j]) return 0;
        }
        f1 = recur(idx + j);
        if (f1) return 1;
        if (idx + j < n && s[idx+j] =='r') {
            f1 = recur(idx + j + 1);
        }
        return f1;
    }
    else {
        int j = 0;
                for ( j = 0; j < 5; ++j) {
                      if (idx + j >= n) return 0;
                      if (s[idx+j] != v[0][j]) return 0;
                  }
                  f1 = recur(idx + j);
        if (f1) return 1;
                  if (idx + j + 1 < n && s[idx+j] =='e' && s[idx + j + 1] == 'r') {
                      f1 = recur(idx + j + 2);
                  }
                  return f1;
            
    }
    return 0;
}
int main(int argc, const char * argv[]) {

    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0); // insert code here...
    v[0] = "dream";
    v[1]= "dreamer";
    v[2] = "erase";
    v[3] = "eraser";
    cin >> s;
    n = SZ(s);
    if (recur(0)) cout <<"YES"<<endl;
    else
        cout << "NO"<<endl;
    return 0;
}


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

int main(){
    int r,c;
    cin >> r >> c;

    vector< vector<int> > mat;
    mat.resize(r+1);
    for (int i=0;i<r+1;i++){
        mat[i].resize(c+1);
        for (int j=0;j<c+1;j++){
            mat[i][j]=0;
        }
    }

    int sr;
    for (int i=0;i<r;i++){
        sr = 0;
        for (int j=0;j<c;j++){
            cin >> mat[i][j];
            sr += mat[i][j];
            cout << mat[i][j] << " ";
        }
        cout << sr << endl;        
    }
    int total =0;
    for (int j=0;j<c;j++){
        sr = 0;
        for (int i=0;i<r;i++){
            sr += mat[i][j];
        }
        cout << sr << " ";
        total += sr;
    }
    cout << total << endl;

    return 0;
}


Measured memory_bytes: 3160
#coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    N = II()
    
    ans = 0
    isPreEven = False

    for _ in range(N):
        a = II()
        if isPreEven and a > 0:
            ans += 1
            a -= 1
        ans += a // 2
        if a % 2 == 1:
            isPreEven = True
        else:
            isPreEven = False
        

    
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 71272
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

typedef long long ll;

ll n, k, c;
vector<ll> a, b;
string s;

int main()
{
    cin>>n>>k>>c>>s;
    s = ' ' + s;
    for(ll i = 1; i <= n; )
    {
        if(a.size() >= k) break;
        if(s[i] == 'x') i++;
        else a.push_back(i), i += c + 1;
    }
    for(ll i = n; i >= 1; )
    {
        if(b.size() >= k) break;
        if(s[i] == 'x') i--;
        else b.push_back(i), i -= c + 1;
    }
    for(ll i = 0; i < k; i++)
    {
        if(a[i] == b[k - 1 - i]) printf("%lld\n", a[i]);
    }
    return 0;
}


Measured memory_bytes: 5044
using System.Collections.Generic;
using System.Linq;
using System;

public class hello
{
    public static void Main()
    {
        var dict = new Dictionary<int, int>();
        var lst = new List<int>();
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(',');
            var p = int.Parse(line[0]);
            var s = int.Parse(line[1]);
            if (p == 0 && s == 0) break;
            dict[p] = s;
            lst.Add(s);
        }

        var lst2 = lst.Distinct().ToList();
        string line2;
        for (; (line2 = Console.ReadLine()) != null;)
        {
            var q = int.Parse(line2.Trim());
            var qq = dict[q];
            var ans = lst2.Count(x => x > qq) + 1;
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 10032
#include<stdio.h>

#define MAX 100000

int parent(int);
int left(int);
int right(int);


int main(){

  int i,n;
  int H[MAX];

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&H[i]);
  }

  for(i=1;i<=n;i++){
    
    printf("node %d: key = %d, ",i,H[i]);

    if(parent(i) >= 1){
      printf("parent key = %d, ",H[parent(i)]);
    }
    if(left(i) <= n){
      printf("left key = %d, ",H[left(i)]);
    }
    if(right(i) <= n){
      printf("right key = %d, ", H[right(i)]);
    }
    
    printf("\n");
  }

  return 0;
}

int parent (int i){
  return i/2;
}

int left (int i){
  return i*2;
}

int right (int i){
  return i*2+1;
}
  



Measured memory_bytes: 2052
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int sum = 0, time, minute, second;
	for (int i = 0; i < 4; i++)
	{
		scanf("%d",&time);
		sum += time;
	}
	minute = sum / 60;
	second = sum % 60;
	printf("%d\n%d\n", minute, second);
	return 0;
}

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

int main(){
string s;

int ans =0,n;
cin>>n;
int h,w;
cin>>h>>w;
for(int i=0;i<n;i++){
  int a,b;
cin>>a>>b;
if((a/h)*(b/w) )ans++;

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

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

struct Edge{
    ll dst;
    ll weight;
    Edge(ll dst, ll weight): dst(dst), weight(weight) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
const ll INFLL = LLONG_MAX/3;

pair<bool, vector<ll> > BellmanFord(Graph &G, ll r){
	bool negative_cycle = false;
	ll V = G.size();
	vector<ll> dist(V, INFLL);
	dist[r] = 0;
	for(int t=0;t<V;t++){
		for(int i=0;i<V;i++){
			if(dist[i]==INFLL) continue; 
			for(int j=0;j<G[i].size();j++){
				Edge e = G[i][j];
				if(dist[e.dst] > dist[i] + e.weight){
					dist[e.dst] = dist[i] + e.weight;
					if(t==V-1) negative_cycle = true;
				}
			}
		}
	}
	return {negative_cycle, dist};
}

int main(){
	ll V, E, r;
    cin >> V >> E >> r;
    Graph G(V);
    ll s, t, w;
    for(int i=0;i<E;i++){
        cin >> s >> t >> w;
        Edge e(t, w);
        G[s].push_back(e);
    }

    auto res = BellmanFord(G, r);
    bool negative_cycle = res.first;
    vector<ll> dist = res.second;
    if(negative_cycle){
    	cout << "NEGATIVE CYCLE" << endl;
    	return 0;
    }
    for (int i=0;i<V;i++){
        if(dist[i] == INFLL) cout << "INF" << endl;
        else cout << dist[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3204
a,b,c=map(int,input().split())
l=[int(input())for i in range(a)]
l.sort()
p=0
k=0
d=0
for i in range(a):
    q=l[i]
    if p==b or d<q:
        d=q+c
        k+=1
        p=1
    else:
        p+=1
print(k)        

Measured memory_bytes: 7384
N=int(input())
a=1
b=0#われた回数の最大値
def count(x):
    y=0#割れる回数
    for i in range(10):
        if x%2==0:
            x=x//2
            y+=1
        else:
            break
    return y

for i in range(1,N+1):
    if count(i)>b:
        a=i
        b=count(i)
    #print(count(i))
print(a)

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

int main() {
  string S;
  int i;
  getline(cin,S);
  for(i=0; i < S.size() ; i++){
    char s = S.at(i);
    char space = ' ';
    if(i == 0){
      cout << s;
    }else if(s == space){
      cout << S.at(i+1);
    }
  }
  cout << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

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

    // int T;cin>>T;while(T--) 
    {
        ll x,t=100;
        cin>>x;
        ll ans = 0;
        while(t<x) {
            t += (t/100);
            ans++;
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3652
n = int(input())
ac_c = 0
wa_c = 0
tle_c = 0
re_c = 0
for i in range(n):
    s = input()
    if s == "AC":
        ac_c += 1
    elif s == "WA":
        wa_c += 1
    elif s == "TLE":
        tle_c += 1
    else:
        re_c +=1
print("AC" +" "+ "x"+" " + str(ac_c))
print("WA" +" "+ "x"+" "+ str(wa_c))
print("TLE" +" "+ "x"+" "+ str(tle_c))
print("RE" +" "+ "x"+" "+ str(re_c))

Measured memory_bytes: 9232
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] s = new int[n];
        int [] t;
        for (int x = 0; x < n; x++){
            s[x] = scan.nextInt();
        }
        int q = scan.nextInt();
        t = new int[q];
        for (int x = 0; x < q; x++){
            t[x] = scan.nextInt();
        }
        int counter = 0;
        for (int x = 0; x < q; x++){
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
    public static boolean binarysearch(int arr[], int l, int r, int x){
        if(r >=l){
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        }
        else{
         return false;
        }
    }
}


Measured memory_bytes: 67948
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(n); i++)
int main(){
    string s;
    cin >> s;
    while (s != "-"){
        int a;
        cin >> a;
        rep(i, a){
            int b; cin >> b;
            string cs = s.substr(0, b);
            s += cs;
            s = s.substr(b, s.size());
        }
        cout << s << endl;
        cin >> s;
    }
}


Measured memory_bytes: 3212
import math
#import numpy as np
#"""
h,n=list(map(int,input().split()))
#a=list(map(int,input().split()))


#"""
dp=[[float("inf") for _ in range(h+1)] for _ in range(n)]
dp[0][0]=0
ma=list(map(int,input().split()))
for i in range(1,h+1):
    dp[0][i]=math.ceil(i/ma[0])*ma[1]
#print(np.array(ma))
for i in range(1,n):
    ma=list(map(int,input().split()))
    #print("number:{},magic:{}".format(i,ma[i]))
    for j in range(h+1):
        if j<ma[0]:
            cal=ma[1]
        else:
            #print("sansyo before")
            cal=ma[1]+dp[i][j-ma[0]]
        #print("j:{},cal:{}".format(j,cal))
        dp[i][j]=min(dp[i-1][j],cal)
    #print()


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

Measured memory_bytes: 305544
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
//#define MOD 1000000007
using namespace std;
typedef long long ll;

const int MOD = 998244353;
const ll MAX = 1000010;

ll add(ll x, ll y){
  x += y;
  if (x >= MOD) return x - MOD;
  return x;
}
ll sub(ll x, ll y){
  x -= y;
  if (x < 0) return x + MOD;
  return x;
}
ll mult(ll x, ll y){
  return (x * y) % MOD;
}
ll powm(ll x, ll p){
  if (p == 0) return 1;
  if (p & 1) return mult(x, powm(x, p - 1));
  return powm(mult(x, x), p / 2);
}
ll modinv(ll a) {
  return powm(a, MOD-2);
}

ll w[MAX]; // index:i のiを除く約数xについて Sum of w[x] が 1/i な w[i]
void winit(){
  reps(i,1,MAX){
    w[i]=modinv(i);
  }
  reps(i,1,MAX){
    for(int j=2*i; j<MAX; j+=i){
      w[j] += MOD-w[i];
      w[j] %= MOD;
    }
  }
}

void Main(){

  int N;
  cin>>N;

  winit();

  ll a[MAX]={};

  rep(i,N){
    ll aa; cin>>aa;
    ++a[aa];
  }

  ll ans=0;
  reps(i,1,MAX){
    ll sum1=0; ll sum2=0;
    for(int j=i; j<MAX; j+=i){
      sum1+=j*a[j];
      sum1%=MOD;
      sum2+=(a[j]*j%MOD)*j%MOD;
      sum2%=MOD;
    }
    sum1*=sum1;
    sum1%=MOD;

    ll here=(w[i]*(sum1-sum2+MOD))%MOD;
    ans+=here;
    ans%=MOD;
  }

  ans*=modinv(2);
  ans%=MOD;

  cout<< ans <<"\n";
}

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


Measured memory_bytes: 15872
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0009
  * Prime Number
  */
object Main {
  def main(args: Array[String]): Unit = {
    val primes = Primes(999999)
    Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).map(_.toInt)
      .map(n => primes.count(p => p <= n))
      .foreach(println)
  }

  object Primes {

    def isPrime(n: Int): Boolean = {
      n match {
        case 2 | 3 => true
        case _ => !(2 to n).takeWhile(p => p * p <= n).exists(n % _ == 0)
      }
    }

    def apply(n: Int): Seq[Int] = {
      2 +: (3 to n by 2).filter(isPrime)
    }

  }

}

Measured memory_bytes: 98076
package main

import (
	"fmt"
)

func main() {
	var S, T string
	fmt.Scan(&S)
	fmt.Scan(&T)

	str := make([]string, len(S))
	for i := 0; i < len(S); i++ {
		str[i] = string(S[i])
	}
	l := len(S)
	f := true
	for i := 0; i < l; i++ {
		tmp := ""
		for y := l - i; y < l; y++ {
			tmp += string(S[y])
		}
		for x := 0; x < l; x++ {
			tmp += string(str[x])
			if len(tmp) == l {
				break
			}
		}
		if tmp == T {
			fmt.Print("Yes")
			f = false
			break
		}
	}
	if f {
		fmt.Print("No")
	}
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
 
using namespace std;
 
#define MAX 110
#define INF 1e9
 
struct State{
    int v,s;
    State(int v,int s) : v(v),s(s) {}
};
 
int N,W[2][MAX];
 
int bfs(int s){
    queue<State> Q;
    Q.push(State(0,s));
    bool visited[2][MAX];
    memset(visited,false,sizeof(visited));
    int dist[2][MAX];
    fill(dist[0],dist[0]+MAX*2,INF);
    dist[s][0] = 0;
   
    while(!Q.empty()){
	int v = Q.front().v; 
	int s = Q.front().s;
	Q.pop();
 
	if(visited[s][v]) return INF;
	visited[s][v] = true;
 
	int cur = v;
	if(W[s][v] == 1){
	    for(int i = v+1 ; i < N ; i++){
		if(W[s][i] != 1) break;
		dist[s][i] = min(dist[s][i],dist[s][v]);
		cur = i;
	    }
	}else if(W[s][v] == 2){
	    for(int i = v-1 ; i >= 0 ; i--){
		cur = i;
		dist[s][i] = min(dist[s][i],dist[s][v]);
		if(W[s][i] != 2) break;
	    }
	}
    
	if(cur == N-1){
	    return dist[s][v];
	}
	v = cur;
	for(int i = 0 ; i < 3 ; i++){
	    if(dist[s][v] + 1 < dist[!s][v+i]){
		dist[!s][v+i] = dist[s][v] + 1;
		Q.push(State(v+i,!s));
	    }   
	}
    }
    return INF;
}
 
int main(){
    while(cin >> N, N){
	for(int i = 0 ; i < 2 ; i++){
	    for(int j = 0 ; j < N ; j++){
		cin >> W[i][j];
	    }
	}
	int res = min(bfs(0),bfs(1));
	if(res == INF){
	    cout << "NA" << endl;
	}else{
	    cout << res << endl;
	}
    }
    return 0;
}

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

int main(){

    vector<int> v(5);
    for(int i = 0; i < 5; i++){
        cin >> v[i];
    }

    int modMin = 10;
    int sum = 0;
    for(int i = 0; i < 5; i++){
        int mod = v[i] % 10;
        if(mod != 0 && mod < modMin) modMin = mod;

        sum += (v[i] / 10) * 10;
        if(mod != 0) sum += 10;
    }

    if(modMin == 10) cout << sum << endl;
    else cout << sum - 10 + modMin << endl;

}

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

int merge_sort(int S[], int left, int right) {
    int cnt = 0;
    if (left == right) return cnt;
    int mid = (left + right) / 2;
    cnt += merge_sort(S, left   , mid  );
    cnt += merge_sort(S, mid + 1, right);
    queue<int> A;
    queue<int> B;
    for (int i = left; i <= mid; i++) {
        A.push(S[i]);
    }
    A.push(1e9 + 1);
    for (int i = mid + 1; i <= right; i++) {
        B.push(S[i]);
    }
    B.push(1e9 + 1);

    for (int i = left; i <= right; i++) {
        cnt++;
        if (A.front() <= B.front()) {
            S[i] = A.front();
            A.pop();
        } else {
            S[i] = B.front();
            B.pop();
        }
    }
    return cnt;
}

int main(){
    int n;
    cin >> n;
    int S[n];
    for (int i = 0; i < n; i++) {
        cin >> S[i];
    }
    int cnt = merge_sort(S, 0, n - 1);
    cout << S[0];
    for (int i = 1; i < n; i++) {
        cout << " " << S[i];
    }
    cout << endl;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 6852
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>

#define INF 2000000001
#define MAX 10001
#define NIL -1

using namespace std;

typedef struct {
    int toid;
    int far;
} PATH;

vector<PATH> D[MAX];
int N;
int Dist[MAX];

void dijkstra(){//0??????????????¢??????????????£?????????
    
    bool complete[MAX];
    vector<int> S;
    
    for (int i = 0; i < N; i++) {
        complete[i] = false;
        Dist[i] = INF;
    }
 
    //???????¨????
    priority_queue<pair<int, int> > DistPQ;
    
    
    S.push_back(0);
    int u=0;
    complete[u] = true;
    
    Dist[0] = 0;
    DistPQ.push(make_pair(0,0));
    
    while (1) {
        if (S.size() == N) break;
        
        //????????????
        for (int j = 0; j < D[u].size(); j++) {
            if (!complete[D[u][j].toid] && Dist[u] + D[u][j].far < Dist[D[u][j].toid]) {
                Dist[D[u][j].toid] = Dist[u] + D[u][j].far;
                DistPQ.push(make_pair(-1*(Dist[u] + D[u][j].far),D[u][j].toid));
            }
        }

        u = NIL;
        
        //?¬?????????????
        while (1) {
            pair<int, int> P = DistPQ.top(); DistPQ.pop();
            if (!complete[P.second]) {
                u = P.second;
                break;
            }
        }
        
        S.push_back(u);
        complete[u] = true;
    }
}

int main(){
    cin >> N;
    for (int i = 0; i < N; i++) {
        int bb1,bb2;
        cin >> bb1 >> bb2;
        for (int j = 0; j < bb2; j++) {
            PATH bb3;
            cin >> bb3.toid >> bb3.far;
            D[i].push_back(bb3);
        }
    }
    
    dijkstra();
    
    for (int i = 0; i < N; i++) {
        printf("%d %d\n",i,Dist[i]);
    }
    
    return 0;
}

Measured memory_bytes: 6296
import java.util.*;
import java.util.TreeMap;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    long K = sc.nextLong();
    int cnt = 0;
    while ((cnt < K - 1)) {
      if (S.charAt(cnt) != '1')
        break;
      cnt++;
    }
    System.out.println(S.charAt(cnt));

  }
}


Measured memory_bytes: 21844
#include<stdio.h>
#include<cmath>

int main(){
    while(1){
        int n=0;
        int num[1000]={};
        double sum=0;
        scanf("%d",&n);
        if(n==0)break;
        for(int i=0;i<n;i++){
            scanf("%d",&num[i]);
            sum+=num[i];
        }
        double ave=sum/n,temp=0;
        for(int i=0;i<n;i++){
            temp+=(num[i]-ave)*(num[i]-ave);
        }
        double std=sqrt(temp/n);
        printf("%.5lf\n",std);
    }
}


Measured memory_bytes: 2696
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    vector<ll> p(n), q(n), v(n);
    rep(i, 0, n) v[i] = i+1;
    rep(i, 0, n) cin >> p[i];
    rep(i, 0, n) cin >> q[i];

    ll cnta=0, cntb=0, cnt=0;

    while(true){
        if(p == v) cnta = cnt;
        if(q == v) cntb = cnt;
        cnt++;
        if(!next_permutation(v.begin(), v.end())) break;
    }

    cout << abs(cnta - cntb) << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;

int main()
{
	int n;
	cin>>n;
	int *A = new int[n];
	rep(i,n) cin>>A[i];
	int q;
	cin>>q;
	int *m = new int[q];
	rep(i,q) cin>>m[i];
	set<int> possibleNumbers;

	for(int bit = 0; bit < (1<<n); bit++){
		int localSum = 0;
		for(int i = 0; i < n; i++){
			if( bit & (1<<i)) localSum += A[i];
		}
		possibleNumbers.insert(localSum);
	}

	rep(k,q){
		if( possibleNumbers.count(m[k]) != 0){
			cout<<"yes"<<endl;
		}else{
			cout<<"no"<<endl;
		}
	}

	return 0;
}




Measured memory_bytes: 3140
object Main extends App {
  var get = readLine
  var sum,sum2 = 0
  var collor = '0'
  for(i <- 0 until get.size){
    if(collor != get(i))
    	sum = sum + 1
    if(collor == get(i))
    	sum2 = sum2 + 1
    if(collor=='0') {
      collor='1'
    }
    else {
      collor='0'
    }
  }
  println(math.min(sum,sum2))
}

Measured memory_bytes: 29268
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int h,a;
int ans;

int main(){
    cin>>h>>a;
    ans=h/a;
    if(h%a)ans++;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
2 3 1 2
---+/
/+---test
2 2 1 1
---+/

void main(string[] args) {
  long W, H, x, y;
  readf(" %d %d %d %d ", &W, &H, &x, &y);

  "%.10f %d".writefln(W*H/2., W%2 == 0 && H%2 == 0 && x == W/2 && y == H/2);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int x, a, b;
    cin >> x >> a >> b;
    if (abs(x-a) < abs(x-b)) cout << "A" << endl;
    else cout << "B" << endl;
}


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

typedef long long ll;
#define mod 1000000007

void dfs(ll u,vector<ll> g[],vector<bool> &vis,ll &count)
{
   vis[u]=1;
   count++;
   for(auto x:g[u])
   {
      if(vis[x]==0)
      {
         dfs(x,g,vis,count);
      }
   }
}
int main() 
{
   ll n,m;
   cin>>n>>m;
   vector<ll> g[n];
   for(ll i=0;i<m;i++)
   {
      ll x,y;
      cin>>x>>y;
      x--;y--;
      g[x].push_back(y);
      g[y].push_back(x);
   }
   vector<bool> vis(n,false);
   ll ans=INT_MIN;
   for(ll i=0;i<n;i++)
   {
      if(vis[i]==0)
      {
         ll count=0;
         dfs(i,g,vis,count);
         ans=max(ans,count);
      }
   }
   cout<<ans<<endl;
   return 0;
}

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

int main() {
  int a,b,m;
  cin >> a >> b >> m;
  vector<int> ref(a);
  vector<int> mic(b);
  for(int i=0; i<a; i++){
    cin >> ref[i];
  }
  for(int i=0; i<b; i++){
    cin >> mic[i];
  }
  
  int pr=0;
  int minref=1e6;
  int minmic=1e6;
  
  for(int i=0; i<a; i++){
    if(ref[i] < minref){
      minref = ref[i];
    }
  }
  for(int i=0; i<b; i++){
    if(mic[i] < minmic){
      minmic = mic[i];
    }
  }
  
  pr = minref + minmic;
  
  int x,y,c;
  
  for(int i=1; i<=m; i++){
    cin >> x >> y >> c;
    if(ref[x-1] + mic[y-1] - c <= pr){
      pr = ref[x-1] + mic[y-1] - c;
    }
  }
  
  cout << pr << endl;
  
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0; i<(n); ++i)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF = 1LL<<60;
int main(){
    int n;  cin >> n;
    vector<int> v(n);
    rep(i,n){
        cin >> v[i];
    }
    int flg=0;
    rep(i,n){
      if(v[i]!=i+1) flg++;
      if(flg>2){
        cout << "NO";
        break;
      }
    }
    if(flg<=2) cout << "YES";
    
    //cout << "test";

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") // wonderful

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






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


    int x; cin >> x;
    if (x == 0) cout << "1";
    else cout << "0";

    return 0;
}


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

int main() {

	int x1, y1, x2,y2;
	scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    printf("%d %d %d %d\n", x2 - (y2 - y1), y2 + x2 - x1, x1 - (y2 - y1), y1 + x2 - x1);
}

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

dp=[[0,0]for i in range(N+1)]
#print(dp)

dp[0][0]=1
for i in range(N):
    if A[i]%2==0:
        dp[i+1][0]=dp[i][0]*2
        dp[i+1][1]+=dp[i][1]
        dp[i+1][1]+=dp[i][0]*(3**(N-i-1))
    else:
        dp[i+1][0]=dp[i][0]
        dp[i+1][1]+=dp[i][1]
        dp[i+1][1]+=dp[i][0]*2*(3**(N-i-1))
print(dp[N][1])

Measured memory_bytes: 38256
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
    for j in range(i+1,n):
        if l[i] != l[j]:
            for k in range(j+1,n):
                if l[i] != l[k] and l[j] != l[k]:
                    if l[i] + l[j] > l[k]:
                        ans += 1

print(ans)


Measured memory_bytes: 9092
#include <bits/stdc++.h>
using namespace std;
#define Online
#define nowtime (double)clock()/CLOCKS_PER_SEC
void tie()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
}
int main()
{
	tie();
	#ifndef Online
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	long long a,b,c,d;
	cin>>a>>b>>c>>d;
	long long ans=max(max(max(a*c,b*c),a*d),b*d);
	cout<<ans<<endl;
	#ifndef Online
	fclose(stdin);
	fclose(stdout);
	#endif
	return 0;
}


Measured memory_bytes: 3648
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int[] h = new int[N];
        h[0] = Integer.parseInt(sc.next());
        int max = h[0];
        int count = 1;
        for(int i= 1; i < N; i++) {
            h[i] = Integer.parseInt(sc.next());
            if(h[i] >= max) {
                count++;
                max = h[i];
            }
        }
        System.out.println(count);
        
        
        
    }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
long long int INF = 3e18;
const ll fact_table = 5000000;
double Pi = 3.1415926535897932384626;
 
//vector<ll> G[550010];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←
 
 
#define p(x) cout<<x<<"\n";
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
 
 
ll mod = 998244353;
//ll mod = 1000000007;
 
ll rui(ll number1,ll number2){
 
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
 
    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){
 
    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){
 
    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}
 
/*
ll fact[fact_table + 5],rfact[fact_table + 5];
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = rui(fact[fact_table],mod - 2);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/
 
ll n,m,num,sum,a,b,c,d,e,g,h,w,i,j,q,r,l;
ll k,idx,ans;
ll x[500005],y[500005],z[500005];
bool used[500005];
char s[500005];

int main(){
    cin >> n;
    p(rui(n, 2));
    return 0;
}


















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

using namespace std;
typedef long long ll;
const int MAXN = 100100;

int N;
ll D[MAXN];
vector <int> edge[MAXN];

map <ll, int> ord;
map <ll, int> ssize;
map <ll, ll> stot;

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> D[i];
        ord[D[i]] = i;
        ssize[D[i]] = 1;
        stot[D[i]] = 0;
    }

    for (auto it = ord.rbegin(); it != ord.rend(); it++)
    {
        ll cv = it -> first;
        int ind = it -> second;

        int csize = ssize[cv];
        if (csize == N) break;
        ll ntot = D[ind] - ((N - csize) - csize);
        //cout << cv << " " << ntot << "\n";
        if (ord.find(ntot) == ord.end())
        {
            cout << "-1\n";
            return 0;
        }

        ssize[ntot] += csize;
        stot[ntot] += (stot[cv] + ssize[cv]);
        edge[ord[ntot]].push_back(ind);
    }
    //cout << "made it\n";

    int mloc = 0;
    for (int i = 0; i < N; i++)
        if (D[i] < D[mloc])
            mloc = i;
    if (stot[D[mloc]] != D[mloc])
    {
        cout << "-1\n";
        return 0;
    }
    else
    {
        for (int i = 0; i < N; i++)
        {
            for (int neigh : edge[i])
                cout << neigh + 1 << " " << i + 1 << "\n";
        }
    }
}

Measured memory_bytes: 26368
#include<bits/stdc++.h>
#define N 200005
using namespace std;
struct node {
	int a,b;
	bool operator <(const node &_)const {
		return b>_.b;
	}
} x[N];
struct Time {
	int l,r;
	bool operator <(const Time &b)const {
		return r<b.r;
	}
};
int n,l;
int main() {
	scanf("%d",&n);
	for(int i=1; i<=n; i++)scanf("%d%d",&x[i].a,&x[i].b);
	sort(x+1,x+1+n);
	bool f=1;
	if(x[1].b<x[1].a)f=0;
	else {
		l=x[1].b-x[1].a;
		for(int i=2; i<=n; i++) {
			l=min(l,x[i].b);
			l-=x[i].a;
			if(l<0){
				f=0;
				break;
			}
		}
	}
	puts(f?"Yes":"No");
	return 0;
}


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

using namespace std;

typedef long long int ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1000000000;
const ll LINF = (ll) 4000000000000000000;
const ll MOD = (ll) 1000000007;
const double PI = acos(1.0);
const int limit = 100010;

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define NP(v) next_permutation(v.begin(),v.end())
#define smaller_queue  priority_queue <ll, vector<ll>, greater<ll> >
//------------------------------------------------------

int main() {
    ld n, m, d;
    cin >> n >> m >> d;
    if (d == 0) {
        cout << setprecision(20) << (m - 1) / n << endl;
    } else {
        cout << setprecision(20) << 2 * (n - d) / n / n * (m - 1) << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
typedef pair<int,int> P;
typedef vector<int> Vi;
typedef tuple<int,int,int> TUi;
int const MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { return a = b; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { return a = b; } return false; }

int n;
double dp[310][310][310];
double rec(int i, int j, int k) {
    if (dp[i][j][k] >= 0) return dp[i][j][k];
    if (i == 0 && j == 0 && k == 0) return 0.0;

    double res = 0.0;
    if (i > 0) res += rec(i-1, j, k) * i;
    if (j > 0) res += rec(i+1, j-1, k) * j;
    if (k > 0) res += rec(i, j+1, k-1) * k;
    res += n;
    res *= 1.0 / (i + j + k);

    return dp[i][j][k] = res;
}

int main(){
  cin.tie(0); ios::sync_with_stdio(false);
    
  int a,n1=0,n2=0,n3=0; cin>>n;
  for (int i = 0; i < n; i++){
    cin>>a;
    if(a==3)n3++;
    else if(a==2)n2++;
    else n1++;
  }
  fill(dp[0][0],dp[n+1][0],-1);
  cout<<setprecision(10)<<rec(n1,n2,n3)<<'\n';
}

Measured memory_bytes: 227584