akhauriyash/Code-Regression huggingface dataset:
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define SORTD(a) sort(a.rbegin(), a.rend());
#define ll long long
#define INF 1000000000000000000
#define INT_MAX 2147483647

#include <iostream>
#include <vector>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <queue>
#include <set>
#include <utility>
#include <ios>
#include <iomanip>

using namespace std;

int main(){
    int N,A,B;
    int n=0,b=0;
    string S;
    cin >> N >> A >> B;
    cin >> S;
    REP(i, S.length()){
        switch (S[i])
        {
        case 'a':
            if(n<A+B){
                cout<<"Yes"<<endl;
                n++;
            }else{cout<<"No"<<endl;}
            break;
        case 'b':
            if(n<A+B && b<B){
                cout<<"Yes"<<endl;
                n++;
                b++;
            }else{cout<<"No"<<endl;}
            break;
        case 'c':
            cout<<"No"<<endl;
            break;
        default:
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1084
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct data{
	int x,y;
	data(){}
	data(int xx,int yy){
		x=xx;
		y=yy;
	}
	bool operator<(const data &d)const{
		return y<d.y;
	}
};

int n;
data pd[2];
data d[200002];
vector<int> xid;
const int n_=1<<19;
int lazy[1<<20];
int cnt[1<<20];

void lazy_eval(int k){
	cnt[k]=max(cnt[k],lazy[k]);
	if(k<n_-1){
		lazy[k*2+1]=max(lazy[k*2+1],lazy[k]);
		lazy[k*2+2]=max(lazy[k*2+2],lazy[k]);
	}
	lazy[k]=0;
}

void lazy_upd(int k){
	cnt[k]=max(cnt[k*2+1],cnt[k*2+2]);
}

void update(int a,int b,int x,int k=0,int l=0,int r=n_){
	lazy_eval(k);
	if(b<=l || r<=a)return;
	if(a<=l && r<=b){
		lazy[k]=max(lazy[k],x);
		lazy_eval(k);
		return;
	}
	update(a,b,x,k*2+1,l,(l+r)/2);
	update(a,b,x,k*2+2,(l+r)/2,r);
	lazy_upd(k);
}

int query(int a,int b,int k=0,int l=0,int r=n_){
	lazy_eval(k);
	if(b<=l || r<=a)return 0;
	if(a<=l && r<=b)return cnt[k];
	double vl=query(a,b,k*2+1,l,(l+r)/2);
	double vr=query(a,b,k*2+2,(l+r)/2,r);
	lazy_upd(k);
	return max(vl,vr);
}

ll labs(ll x){
	if(x<0)return -x;
	return x;
}

int main(void){
	scanf("%d%d%d%d",&pd[0].x,&pd[0].y,&pd[1].x,&pd[1].y);
	if(pd[0].y>pd[1].y){
		swap(pd[0],pd[1]);
	}
	xid.push_back(pd[0].x);
	xid.push_back(pd[1].x);
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d%d",&d[i].x,&d[i].y);
		xid.push_back(d[i].x);
	}
	if(pd[0].x==pd[1].x){
		ll cnt2=0;
		for(int i=0;i<n;i++){
			if(d[i].y>=pd[0].y && d[i].y<=pd[1].y){
				if(pd[0].x==d[i].x)cnt2++;
			}
		}
		ll cnt=pd[1].y-pd[0].y;
		double res=(10.0*M_PI-20.0)*(double)cnt2;
		printf("%.12f\n",(double)100LL*cnt+(double)res);
		return 0;
	}
	if(pd[0].y==pd[1].y){
		ll cnt2=0;
		if(pd[0].x>pd[1].x)swap(pd[0].x,pd[1].x);
		for(int i=0;i<n;i++){
			if(d[i].x>=pd[0].x && d[i].x<=pd[1].x){
				if(pd[0].y==d[i].y)cnt2++;
			}
		}
		ll cnt=abs(pd[0].x-pd[1].x);
		double res=(10.0*M_PI-20.0)*(double)cnt2;
		printf("%.12f\n",(double)100LL*cnt+(double)res);
		return 0;
	}
	xid.push_back(-1);
	xid.push_back(100000001);
	sort(d,d+n);
	sort(xid.begin(),xid.end());
	xid.erase(unique(xid.begin(),xid.end()),xid.end());
	pd[0].x=lower_bound(xid.begin(),xid.end(),pd[0].x)-xid.begin();
	pd[1].x=lower_bound(xid.begin(),xid.end(),pd[1].x)-xid.begin();
	int cns=0;
	for(int i=0;i<n;i++){
		d[i].x=lower_bound(xid.begin(),xid.end(),d[i].x)-xid.begin();
		if(d[i].y<pd[0].y || d[i].y>pd[1].y)continue;
		cns++;
		if(d[i].y==pd[0].y){
			update(d[i].x,d[i].x+1,1);
			continue;
		}
		if(pd[0].x>pd[1].x){
			int v=query(d[i].x,pd[0].x+1);
			update(d[i].x,d[i].x+1,v+1);
		}
		if(pd[0].x<pd[1].x){
			int v=query(pd[0].x,d[i].x);
			update(d[i].x,d[i].x+1,v+1);
		}
	}
	int maxi=0;
	if(pd[0].x<pd[1].x)maxi=query(pd[0].x,pd[1].x+1);
	else maxi=query(pd[1].x,pd[0].x+1);
	int cnt=pd[1].y-pd[0].y;
	long double res=(double)100.0*cnt-maxi*(20.0-M_PI*5.0);
	res+=(long double)100.0*abs(xid[pd[0].x]-xid[pd[1].x]);
	if((maxi-1)==min(cnt,abs(xid[pd[0].x]-xid[pd[1].x]))){
		res+=M_PI*5.0;
	}
	printf("%.12f\n",(double)res);
	return 0;
}

Measured memory_bytes: 9716
import java.awt.geom.*;
import java.io.*;
import java.util.*;

public class Main{
	int [] dp;
	int max = 1000;
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0) break;
			int [] value = new int[n];
			int [] number = new int[n];
			for(int i = 0; i < n; i++){
				value[i] = sc.nextInt();
				number[i] = sc.nextInt();
			}
			
			dp = new int[max + 1];
			for(int i = 0; i < n; i++){
				for(int k = max; k > 0; k--){
					if(dp[k] > 0){
						for(int j = 1; j <= number[i]; j++){
							int ind = value[i] * j + k;
							if(ind > max) continue;
							dp[ind] += dp[k];
						}
						
					}
				}
				
				for(int j = 1; j <= number[i]; j++){
					int ind = value[i] * j;
					if(ind > max) continue;
					dp[ind]++;
				}
			}
			
			int m = sc.nextInt();
			StringBuilder ans = new StringBuilder();
			while(m-- > 0){
				int input = sc.nextInt();
				ans.append(dp[input] + "\n");
			}
			System.out.print(ans.toString());
		}
	}
	
	private void debug(Object... o) { System.out.println("debug = " + Arrays.deepToString(o)); }

	public static void main(String[] args) {
		new Main().doit();
	}
}

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

int main() {
    int p,q,r;
    cin>>p>>q>>r;
    int sum1=p+q;
    int sum2=q+r;
    int sum3=p+r;
    int ans=min(sum1,sum2);
    ans=min(ans,sum3);
    cout<<ans<<endl;
}   

Measured memory_bytes: 256
void main() {
  problem();
}

void problem() {
  auto N = scan!int;

  string solve() {
    int hon, pon, bon;
    int n = N % 10;

    if (n == 3) {
      return "bon";
    }
    if (n == 0 || n == 1 || n == 6 || n == 8) {
      return "pon";
    }

    return "hon";
  }

  solve().writeln;
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

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


Measured memory_bytes: 2720
#include<bits/stdc++.h>
using namespace std;
int main(){
int w,h,x,y,r;
cin >>w>>h>>x>>y>>r;
if(0<=x-r&&x+r<=w&&0<=y-r&&y+r<=h){
cout <<"Yes"<<endl;
}

else{
cout <<"No"<<endl;
}

}


Measured memory_bytes: 3100
#include<stdio.h>
int main(){
  int W,H,x,y,r;
  scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
  if(x+r<=W&&y+r<=H&&x-r>=0&&y-r>=0){
    printf("Yes\n");
  }
  else {
    printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 584
#include <iostream>
using namespace std;
#define ll long long
ll N,x[1001],y[1001],ax,ay,dx,dy;
int main()
{
	cin >> N;
	
	for(int i=0; i<N; i++)
	{
		cin >> x[i] >> y[i];
		if(ax==0&&ay==0)
		ax=x[i],ay=y[i];
		else
		{
			ll px=x[i]/ax,py=y[i]/ay;
			if(ay%y[i])
			dy=ay/y[i]+1;
			else
			dy=ay/y[i];
			
			if(ax%x[i])
			dx=ax/x[i]+1;
			else
			dx=ax/x[i];
			
			ll d=max(dy,dx);
			
			if(px>=1&&py>=1)
			ax=x[i],ay=y[i];
			else if(px<1&&py>=1)
			{
				ax=d*x[i],ay=d*y[i];
			}
			else if(px>=1&&py<1)
			{
				ax=d*x[i],ay=d*y[i];
			}
			else
			{
				ax=d*x[i],ay=d*y[i];
			}
		}
	}
	cout << ax+ay;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] R = new int[n];
		for(int x=0;x<n;x++) {
			R[x] = sc.nextInt();
		}
		sc.close();
		//System.out.println(Arrays.toString(R));
		//int xx = compute_maxprofit(n,R);
		compute_maxprofit(n,R);
	}
	
	
	public static void compute_maxprofit(int n, int[] R) {
		int min = R[0];  //first number
		int max = Integer.MIN_VALUE;
		for(int x=1;x<n;x++) {
			/*if( R[x] - min> max) {
				max = R[x] - min;
			}*/
			max = Math.max(R[x] - min, max);
			if(R[x] < min) {
				min = R[x];
			}
		}
		System.out.println(max);
		//return max;
	}
}



Measured memory_bytes: 99924
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
using namespace std;
using llong = long long;
using vi    = vector<int>;
using vvi   = vector<vi >;
using vvvi  = vector<vvi >;
using pii   = pair<int,int>;
constexpr int    INF=1e9;
constexpr double EPS=1e-9;
constexpr int    MOD=1e9+7;
template<class Type>
void line(const Type &a){int cnt=0;for(const auto &elem:a){cerr<<(cnt++?' ':'>');cerr<<elem;}cerr<<endl;}

inline void YESNO(bool ans){cout<<(ans?"YES":"NO")<<endl;}
inline void YesNo(bool ans){cout<<(ans?"Yes":"No")<<endl;}
inline void yesno(bool ans){cout<<(ans?"yes":"no")<<endl;}

int main(){
	int n;
	cin>>n;
	
	int cnt=0;
	REP(i,n){
		int a,b;
		cin>>a>>b;
		
		if(a==b) cnt++;
		else cnt=0;
		
		if(cnt==3){
			YesNo(true);
			return 0;
		}
	}
	
	YesNo(false);
}

Measured memory_bytes: 3620
#include<iostream>
#include<fstream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<set>
#include<utility>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i <  n; i++) cin >> a[i];
  long long ans = 1, ko = 1;
  for(int i = 0; i < n; i++) if(a[i] > 1) ans *= 3;
  else ans *= 3;
  for(int i = 0; i < n; i++) {
    if(a[i] == 1) {
      ko *= 1;
    }
    else if(a[i] % 2 == 0) {
      ko *= 2;
    }
    else {
      ko *= 1;
    }
  }
  cout << ans - ko << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.nextLine());

        int nowX = 0;
        int nowY = 0;
        int nowT = 0;

        boolean isCan = false;

        for (int i = 0; i < N; i++) {
            String[] line = sc.nextLine().split(" ");
            int t = Integer.parseInt(line[0]);
            int x = Integer.parseInt(line[1]);
            int y = Integer.parseInt(line[2]);

            int dt = t - nowT;
            int dxy = Math.abs(x - nowX) + Math.abs(y - nowY);
            if (dt >= dxy && ((dt - dxy) % 2 == 0 || dt - dxy == 0)) {
                isCan = true;
                nowT = t;
                nowX = x;
                nowY = y;
            } else {
                isCan = false;
                break;
            }
        }

        if (isCan) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

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

using namespace std;

int main()
{
	int n, p[100];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> p[i];
	int ans = 0;
	for (int i = 1; i <= 100; i++)
	{
		int cnt = 0;
		for (int j = 0; j < n; j++)
			if (p[j] >= i)
				cnt++;
		if (i <= cnt)
			ans = i;
	}
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3084
void main() {
  problem();
}

void problem() {
  const N = scan!long;

  long solve() {
    long ans;
    foreach(i; 1..N+1) {
      if (i % 3 != 0 && i % 5 != 0) ans += i;
    }

    return ans;
  }

  solve().writeln;
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

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


Measured memory_bytes: 2716
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

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 (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

const int INF = 1e9;
const long long LINF = 1e18;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    while (A > 0 && C > 0) {
        C -= B;
        if (C <= 0) {
            cout << "Yes" << endl;
            return 0;
        }

        A -= D;
        if (A <= 0) {
            cout << "No" << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 3132
from inspect import currentframe


def debug_print(s):
    # print(s)
    return


def debug_key(*args):
    names = {id(v): k for k, v in currentframe().f_back.f_locals.items()}
    debug_print(', '.join(names.get(id(arg), '???')+' = '+repr(arg) for arg in args))


def solve(h, w):
    debug_print("\n-----solve-----")

    if h == 0:
        return 
    d0 = h * h + w * w
    ans = (10 ** 9, h, w)
    for w in range(2, 151):
        for heisght in range(1, w):
            d = heisght * heisght + w * w
            if (d, heisght, w) < (d0, h, w) or (heisght, w) == (h, w):
                continue
            ans = min(ans, (d, heisght, w))
            break
    print('{0} {1}'.format(ans[1], ans[2]))

    return


if __name__ == '__main__':

    while True:
        h_input, w_imput = map(int, input().split())
        if h_input == w_imput == 0:
            break
        solve(h_input, w_imput)




Measured memory_bytes: 7432
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type Set struct {
	before int
	after  int
}

func main() {
	s := wordScanner()
	n, a := scanNAndInts(s)

	var bmax, amax int
	l := make([]Set, n)
	for i := 1; i < n; i++ {
		bmax = max(a[i-1], bmax)
		amax = max(a[n-i], amax)
		l[i].before = bmax
		l[n-i-1].after = amax
	}

	for i := range a {
		fmt.Println(max(l[i].before, l[i].after))
	}
}

func wordScanner() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return s
}

func scanInts(s *bufio.Scanner, vals ...*int) {
	for i := range vals {
		s.Scan()
		n, _ := strconv.Atoi(s.Text())
		*vals[i] = n
	}
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}

func scanNAndInts(s *bufio.Scanner) (int, []int) {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	vals := make([]int, n)
	for i := 0; i < n; i++ {
		s.Scan()
		m, _ := strconv.Atoi(s.Text())
		vals[i] = m
	}
	return n, vals
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
int main()	{
  string s;
  cin>>s;
  int sum=s.size()-2;
  cout<<s[0]<<sum<<s[sum+1]<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi   = vec<int>;
using vvi  = vec<vi>;
using vvvi = vec<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n, m; cin >> n >> m;
  vi a(n); rep(i,n) cin >> a[i];
  priority_queue<double> q;
  rep(i,n) q.push(a[i]);
  rep(i,m){
    int price = q.top(); q.pop();
    q.push(price/2.0);
  }
  ll ret = 0;
  rep(i,n){
    ret += floor(q.top()); q.pop();
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 4616
#define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double EPS = 1e-8;

int main(){
	int r,c;
	while(~scanf("%d %d",&r,&c)){
		if(r==c && c==0) break;
		if(!(r % 2 == 1 && c % 2 ==1)) printf("yes\n");
		else printf("no\n");
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>

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

long long dp[100000];
long long INF = 1ll<<60;

int main(void){
    int n;
    std::cin >> n;

    std::vector<int> h(n);
    for(int i = 0; i < n; i++){
        std::cin >> h.at(i);
    }

    for(int i = 0; i < 100000; i++){
        dp[i] = INF;
    }

    dp[0] = 0;

    for(int i = 1; i < n; i++){
        chmin(dp[i], dp[i-1] + std::abs(h.at(i) - h.at(i-1)));
        if(i > 1){
            chmin(dp[i], dp[i-2] + std::abs(h.at(i) - h.at(i-2)));
        }
    }
    std::cout << dp[n-1] << std::endl;
    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s[0]==s[1] && s[1]==s[2]) cout << "Yes" << endl;
  else if(s[1]==s[2] && s[2]==s[3]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3616
n = int(input())
a = list(map(int, input().split()))
ne_num = 0

for i in range(n):
    if a[i] < 0:
        ne_num += 1
if ne_num % 2 == 0:
    print(sum(list(map(abs, a))))
    exit()

min_b = 10**9
for i in range(n):
    if abs(a[i]) < min_b:
        min_b = abs(a[i])
print(sum(list(map(abs, a))) - 2*min_b)

Measured memory_bytes: 14212
MAP_MAX = 10
# 入力値
N = int(input())

# 10*10の2次元リスト
data_list = [[0 for i in range(MAP_MAX)] for j in range(MAP_MAX)]

# 先頭の桁、末尾の値取得
def get_fN_eN(num):
    # 先頭の値取得
    tmp_N = num
    while(tmp_N >= 10):
        tmp_N = tmp_N // 10
    f_N = tmp_N
    # 末尾の値取得
    e_N = num % 10

    return [f_N, e_N]

# 1から順にチェック
for i in range(1, N+1):

    # 先頭、末尾の値取得
    get_f_e = get_fN_eN(i)
    
    # リストに格納
    data_list[get_f_e[0]][get_f_e[1]] += 1

# 個数を計算
# [[f_N][e_N] * [e_N][f_N]]の総和
sum_val = 0
for i in range(1, MAP_MAX):
    for j in range(1, MAP_MAX):
        sum_val += data_list[i][j] * data_list[j][i]

print(sum_val)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll t; cin >> t;
    while(t--){
        ll n, a, b, c, d, ans = 1e18;;
        cin >> n >> a >> b >> c >> d;
        
        // m倍する時のコスト
        vi cost(6);
        cost[2] = a, cost[3] = b, cost[5] = c;

        // que<v, num>; numの時のコスト
        priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> que;
        // 最小値（メモ）
        map<ll, ll> mp;

        // ansより大きかったら狩る
        // 既に通っている場合は、その時のコストより小さくないと狩る
        // 上記を除いてqueに加える
        auto insert = [&](ll v, ll n){
            if(v < ans && (!mp.count(n) || v < mp[n])){
                que.emplace(v, n);
                mp[n] = v;
            }
        };

        // 初期状態
        que.emplace(0, n);
        while(que.size()){
            auto p = que.top(); que.pop();
            ll v = p.first, num = p.second;
            // 優先度付き（昇順）なので、ansを超えた時点でbreak
            if(v >= ans) break;
            // ある地点から全て-1（コストd）で行けるなら試す
            if(num <= 2e18/d) chmin(ans, v+num*d);
            // 2, 3, 5倍を試す
            for(auto &mul: {2, 3, 5}){
                ll r = num%mul;
                ll vt = v + r*d + cost[mul];
                insert(vt, num/mul);
                vt = v + (mul-r)*d + cost[mul];
                insert(vt, num/mul+1);
            }
        }
        cout << ans << endl;
    }
}


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

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int n;
	cin>>n;
	string s;
	cin>>s;
	stack<char> stk;
	for(char c:s){
		if(stk.empty()) stk.push(c);
		else{
			if(c==')'&&stk.top()=='(') stk.pop();
			else stk.push(c);
		}
	}
	while(!stk.empty()&&stk.top()=='(') s+=')',stk.pop();
	while(!stk.empty()) s='('+s,stk.pop();
	cout<<s<<'\n';
}




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

using namespace std;
#define ll long long

const int N = 10000005, P = 1000000007;
int n, a, ans, fac[N], ifac[N];
int Pow(ll x, int y=P-2){
	int ans=1;
	for(; y; y>>=1, x=x*x%P) if(y&1) ans=ans*x%P;
	return ans;
}
int main() {
	scanf("%d%d", &n, &a);
	fac[0]=1;
	for(int i=1; i<=n; ++i) fac[i]=(ll)fac[i-1]*i%P;
	ifac[n]=Pow(fac[n]);
	for(int i=n; i; --i) ifac[i-1]=(ll)ifac[i]*i%P;
	for(int i=1; i<=a; ++i) for(int j=0; j<=i; ++j)
		ans=(ans+(j&1?P-1ll:1ll)*fac[i]%P*ifac[j]%P*ifac[i-j]%P*fac[n-(i<a)-j]%P*(i-j)%P*ifac[n-a+i-j]%P*fac[n-a+i-j-1])%P;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 81924
use proconio::*;
#[allow(unused_imports)]
use proconio::marker::*;

#[fastout]
#[allow(non_snake_case)]
fn main() {
    input! {
        N: usize,
        S: [String; N],
    }
    let mut ac = 0;
    let mut wa = 0;
    let mut tle = 0;
    let mut re = 0;
    for s in S {
        if s == "AC" {
            ac += 1;
        } else if s == "WA" {
            wa += 1;
        } else if s == "TLE" {
            tle += 1;
        } else {
            re += 1;
        }
    }
    println!("AC x {}", ac);
    println!("WA x {}", wa);
    println!("TLE x {}", tle);
    println!("RE x {}", re);
}


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

int main()
{
	int n;
	int i;
	int temp;

	cin >> n;

	int* p = new int[n];

	for (i = n - 1; i >= 0; i--) {
		cin >> p[i];
	}

	for (i = 0; i < n; i++) {
		if (i < n - 1) {
			cout << p[i] << " ";
		} else {
			cout << p[i] << endl;
		}
	}

	delete [] p;

	return 0;
}

Measured memory_bytes: 3104
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 1000000000;
const int mod = 1e9+7;
const int maxn = 2e5+5;
int main() {
	ll a,b,n;
	cin>>a>>b>>n;
	ll maxx = 0;
//	cout<<maxx<<endl;
	maxx = max((a*(min(b-1,n)))/b,maxx);
	cout<<maxx<<endl;
    return 0;
}

Measured memory_bytes: 3580
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <stdio.h>
#include <string>

using namespace std;

void solve(int N, int M) {
  int ans = 0;
  vector<int> food(M + 1, 0);
  for (int i = 0; i < N; i++) {
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int a;
      cin >> a;
      food[a] += 1;
    }
  }
  for (int x : food) {
    if (x == N) {
      ans += 1;
    }
  }
  printf("%d\n", ans);
}

int main() {
  int N, M;
  cin >> N >> M;
  solve(N, M);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int cnt[55];
int main(){
    int n,m;
    cin >> n >> m;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        cnt[a]++;
        cnt[b]++;
    }
    for(int i=1;i<=n;i++){
        cout << cnt[i] << endl;
    }



return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
    int N;
    char ch;
 
    while(cin >> N, N){
	bool found[26];
	map<char,map<string,int> > data;
	string str,word;
	set<string> st;
 
	cin.ignore();
	memset(found, false, sizeof(found));
	for(int i = 0 ; i < N ; i++){
	    getline(cin,str);
	    stringstream s(str);
	    while(s >> word){
		if(st.find(word) == st.end()){
		    st.insert(word);
		    data[word[0]][word] = 1;
		    found[word[0]-'a'] = true;
		}else{
		    ++data[word[0]][word];
		}
	    }
	}
	cin >> ch;
	if(!found[ch-'a']){
	    cout << "NA" << endl;
	}else{
	    bool space = false;
	    map<string,int> m = data[ch];
	    map<string,int>::iterator it;
	    vector<pair<int,string> > vec;
	    for(it = m.begin() ; it != m.end() ; ++it){
		vec.push_back(pair<int,string>(-it->second,it->first));
	    }
	    sort(vec.begin(),vec.end());
	    for(int i = 0 ; i < vec.size(); i++){
		if(i == 5) break;
		if(space) cout << " ";
		cout << vec[i].second;
		space = true;
	    }
	    cout << endl;
	}    
    }
    return 0;
}

Measured memory_bytes: 3232
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI(N);
  print(N * 800 - N / 15 * 200);
  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);
        String S = sc.next();
        sc.close();

        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < S.length(); i += 2) {
            ans.append(S.substring(i, i + 1));
        }

        System.out.println(ans);
	}
}


Measured memory_bytes: 26180
# coding: utf-8
# Your code here!
N, L = map(int,input().split())
minval = 10**6
minindex = 0
for i in range(1,N+1):
    if abs(L+i-1) < minval:
        minval = abs(L+i-1)
        minindex = i
ans = 0
for i in range(1,N+1):
    if i != minindex:
        ans += (L+i-1)
print(ans)




Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string a,b;
    cin>>a>>b;
    char c[2*n];
    for(int i=0;i<n;i++)
        c[2*i]=a[i];
    for(int i=0;i<=n;i++)
        c[2*i+1]=b[i];
    for(int i=0;i<2*n;i++)
        cout<<c[i];
    



}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();

    string s;
    cin >> s;

    int ans = 775533;
    for (int i = 2; i < s.size(); i++) {
        int temp = 100 * s[i - 2] + 10 * s[i - 1] + s[i] - 111 * '0';
        chmin(ans, abs(753 - temp));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())
n=0

for i in range(a+1):
    if 500 * i <= x:
        y=x - 500 * i
        for j in range(b+1):
            if j * 100 <= y:
                z=y - 100 * j
                for k in range(c+1):
                    if z - k * 50 == 0:
                        n += 1
print(n)

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007      //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

signed main()
{
    int N, K;
    cin >> N >> K;
    vector<int> D_list(K);
    vector<vector<int>> A(K, vector<int>(N));
    vector<int> Sunuke(N);
    REP(i, N)
    {
        Sunuke.at(i) = 0;
    }
    REP(i, K)
    {
        cin >> D_list.at(i);
        REP(j, D_list.at(i))
        {
            cin >> A.at(i).at(j);
            Sunuke.at(A.at(i).at(j) - 1) += 1;
        }
    }
    int count = 0;
    REP(i, N)
    {
        if (Sunuke.at(i) == 0)
        {
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	vector<vector<int>> a(3, vector<int>(3));
	rep(i, 3)rep(j, 3) cin >> a[i][j];
	int n; cin >> n;
	vector<int> b(n);
	rep(i, n) cin >> b[i];

	vector<vector<bool>> elf(3, vector<bool>(3, false));

	rep(k, n) {
		rep(i, 3)rep(j, 3) {
			if (a[i][j] == b[k]) elf[i][j] = true;
		}
	}

	bool ans = false;
	if (elf[0][0] && elf[1][0] && elf[2][0]) ans = true;
	if (elf[0][1] && elf[1][1] && elf[2][1]) ans = true;
	if (elf[0][2] && elf[1][2] && elf[2][2]) ans = true;
	if (elf[0][0] && elf[0][1] && elf[0][2]) ans = true;
	if (elf[1][0] && elf[1][1] && elf[1][2]) ans = true;
	if (elf[2][0] && elf[2][1] && elf[2][2]) ans = true;
	if (elf[0][0] && elf[1][1] && elf[2][2]) ans = true;
	if (elf[2][0] && elf[1][1] && elf[0][2]) ans = true;

	puts(ans ? "Yes" : "No");

	return 0;
}


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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

vector<vector<ll>> comb(ll n) {
  vector<vector<ll>> v(n+1, vector<ll>(n+1, 0));
  for (ll i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (ll j = 1; j < v.size(); j++) {
    for (ll k = 1; k < j; k++) {
      v[j][k] = (v[j-1][k-1] + v[j-1][k]);
    }
  }
  return v; // v[n][r];
}

int main() {
  ll n, p;
  cin >> n >> p;

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

  vector<vector<ll>> cb = comb(n);

  ll ki = 0;
  ll gu = 0;
  for (ll i = 0; i < n; ++i) {
    if (a[i]%2 == 0) gu++;
    else ki++;
  }

  ll ans = 0;
  if (p == 0) {
    for (ll i = 0; i <= ki; i+=2) {
      ans += cb[ki][i] * (1LL<<gu);
    }
  } else {
    for (ll i = 1; i <= ki; i+=2) {
      ans += cb[ki][i] * (1LL<<gu);
    }
  }
  cout << ans << endl;
  
  return 0;
}


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

int main() {
  int n;
  cin>>n;
  string s[n];
  for(int i=0;i<n;i++) cin>>s[i];
  int a[26];
  fill(a,a+26,100000);
  for(int i=0;i<26;i++){
    for(int j=0;j<n;j++){
      int temp=0;
      for(int k=0;k<s[j].size();k++){
        if(s[j][k]==char(i+'a')) temp++;
      }
      a[i]=min(a[i],temp);
    }
  }
  string ans="";
  for(int i=0;i<26;i++){
    if(a[i]==0 or a[i]==100000) continue;
    for(int j=0;j<a[i];j++) ans+=char(i+'a');
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();
        int a = s.length();
        int[] b = new int[a];
        int[] c = new int[a];
        int[] d = new int[a];
        int bb = a;
        int cc = a;
        for(int i = 0 ; i < a ; i++ ){
            b[i] = i % 2;
            c[i] = (i + 1) % 2;
            d[i] = s.charAt(i) - 48;
            if(b[i] == d[i]){
                bb--;
            }
            if(c[i] == d[i]){
                cc--;
            }
        }
        if(bb > cc){
            System.out.println(cc);
        }else{
            System.out.println(bb);
        }
    }
}

Measured memory_bytes: 40728
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<ll> s(n + 1);
  for (int i = 0; i < n; ++i) {
    s[i + 1] = s[i] + a[i];
  }
  ll ans = 1e18;
  for (int i = 1; i <= n - 1; ++i) {
    ans = min(ans, abs(s[i] - (s[n] - s[i])));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
	int x,h;
	while(cin >> x >> h && (x!=0&&h!=0)){
		printf("%f\n",x*x + ((2*(x*sqrt(x*x+4.*h*h)))/2));
	}
	return 0;
}

Measured memory_bytes: 0
import itertools

N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

p = sorted(list(itertools.permutations(P)))
q = sorted(list(itertools.permutations(Q)))

pi = 0
for i, a in enumerate(p):
    if a == tuple(P):
        pi = i
        break
qi = 0
for i, a in enumerate(q):
    if a == tuple(Q):
        qi = i
        break
print(abs(pi-qi))

Measured memory_bytes: 18832
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <string>
#include <cmath>
#include <complex>
#include <map>
using namespace std;
 
#define rep(i,n) for(int i=0;i<int(n);++i)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
 
static const double PI=6*asin(0.5);
typedef complex<double> P;
typedef long long ll;
 
int cou=0;
int x,y;
char t;
ll msum=0,nsum=0;
 
 
int main(){
    while(cin>>x>>t>>y){
        msum+=x*y;
        nsum+=y;
        cou++;
    }
    double res=(double)(nsum)/(double)(cou);
    //cout<<res<<endl;
    cout<<msum<<endl;
    cout<<(int)(res+0.5)<<endl;
    return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 10005
#define ba 47
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
    	if(c == '-') f = -1;
    	c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 +c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
    	out(x / 10);
    }
    putchar('0' + x % 10);
}
const int MOD = 1000003;

int pre[MOD + 5];
int mul(int a,int b) {
    return 1LL * a * b % MOD;
}
int inc(int a,int b) {
    return a + b >= MOD ? a + b - MOD : a + b;
}
int fpow(int x,int c) {
    int res = 1,t = x;
    while(c) {
        if(c & 1) res = mul(res,t);
        t = mul(t,t);
        c >>= 1;
    }
    return res;
}
void Solve() {
    pre[0] = 1;
    for(int i = 1 ; i < MOD ; ++i) pre[i] = mul(pre[i - 1],i);
    int Q,x,d,n;
    read(Q);
    for(int i = 1 ; i <= Q ; ++i) {
        read(x);read(d);read(n);
        if(d == 0) {out(fpow(x,n));enter;continue;}
        x = mul(x,fpow(d,MOD - 2));
        if(x + n - 1 >= MOD || x == 0) {puts("0");continue;}
        int res = mul(pre[x + n - 1],fpow(pre[x - 1],MOD - 2));
        res = mul(res,fpow(d,n));
        out(res);enter;
    }
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


Measured memory_bytes: 4736
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(void){
  long n;
  int a,s=0;
  cin >> n;
  a=(int)sqrt((double)n);
  while (n%a!=0) a--;
  n/=a;
  while (n>0){
    s++;
    n/=10;
  }
  cout << s << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    a, b = input().split()
    a = int(a)
    b0 = int(b[0])*100
    b1 = int(b[2])*10
    b2 = int(b[3])
    ans = (a*b0 + a*b1 + a*b2)//100
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9148
#include <bits/stdc++.h>
using namespace std;
int main()
{
  long long n, i;
  cin>>n;
  long long dp[100001]={0};
  long long arr[100001];
  for(i=0;i<n;i++)
    cin>>arr[i];
  dp[0]=0;
  dp[1]=abs(arr[1]-arr[0]);
  for(i=2;i<n;i++)
  {
    dp[i]=min(abs(arr[i]-arr[i-1])+dp[i-1], abs(arr[i]-arr[i-2])+dp[i-2]);
  }
  cout<<dp[n-1]<<" ";
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

bool isPrime(ll x){
  if(x<2)return false;
  for(ll i=2;i*i<=x;i++)
    if(x%i==0)return false;
  return true;
}

int n;
ll a[100005];
ll dp[100005][2];

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

  for(int i=1;i<=n;i++){
    
    if( isPrime(a[i]) ){
      if(a[i] > a[i-1] &&i-1>=0){
        dp[i][0]+=dp[i-1][0];
      }
      if(a[i] > a[i-2] &&i-2>=0){
        dp[i][0]+=dp[i-1][1];
      }
    }

    if( isPrime(a[i-1]) &&i-1>=0 ){
      if( a[i-1] > a[i-2] &&i-2>=0){
        dp[i][1]+=dp[i-2][0];
      }
      if( a[i-1] > a[i-3] &&i-3>=0){
        dp[i][1]+=dp[i-2][1];
      }
    }

    dp[i][0]%=mod;
    dp[i][1]%=mod;
  }
  
  cout<< (dp[n][0]+dp[n][1])   % mod <<endl;
  return 0;
}



Measured memory_bytes: 5452
object Main {
  def main(args: Array[String]): Unit = {
    val scanner = new java.util.Scanner(System.in)
    val a, b = scanner.nextDouble
    val ca = math.toRadians(scanner.nextDouble)

    val h = b * math.sin(ca)
    val s = a * h / 2
    val c = math.sqrt(a * a + b * b - 2 * a * b * math.cos(ca))
    println(f"$s%.5f")
    println(f"${a + b + c}%.5f")
    println(f"$h%.5f")
  }
}



Measured memory_bytes: 45928
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod = 1e9 + 7;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
	char pr; int n;
	cin >> n; bool st = 1;
	map<string, int> mp;
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		if(mp[s] != 0){
			st = false;
		}else{
			if(i > 0 && (pr != s[0])){
				st = false;
			}
		}
		mp[s]++;
		pr = s[s.size() - 1];
	}
	if(st) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int a,b;
    cin>>a>>b;
    cout<<100<<" "<<100<<endl;
    char c[100][100];
    rep(i,100) c[i][0]='#';
    rep(i,100) c[i][99]='.';
    rep(i,100){
        for(int j=1;j<99;j++){
            if(i%2==0) c[i][j]='#';
            else c[i][j]='.';
        }
    }

    a--;b--;
    // aが白　bが黒
    for(int i=1;i<50;i+=2){
        for(int j=2;j<90;j+=2){
            if(a>0){
                c[i][j]='#';
                a--;
            }
        }
    }

    for(int i=98;i>50;i-=2){
        for(int j=97;j>=5;j-=2){
            if(b>0){
                c[i][j]='.';
                b--;
            }
        }
    }

    rep(i,100){
        rep(j,100){
            cout<<c[i][j];
        }
        cout<<endl;
    }
    
}

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


void solve(long long N){
    cout<<(double)((N+1)/2) / (double)N<<endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    solve(N);
    return 0;
}


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

#define df(b, e) ((b) > (e))
#define fore(i, b, e) for(auto i = (b) - df(b, e); i != e - df(b, e); i += 1 - 2 * df(b, e))
#define sz(x) (int) x.size()
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back

typedef long long lli;
typedef long double ld;
typedef pair<int, int> ii;

template <class T>
struct rge { T b, e; };

template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
}

template <class T> auto dud(T *x) -> decltype(cerr << *x, 0);
template <class T> char dud(...);

struct debug {
#ifdef LOCAL
  ~debug() { cout << endl; }

  template <class T>
  typename enable_if<sizeof dud<T>(0) != 1, debug &>::type operator << (T i) {
    cout << boolalpha << i;
    return *this;
  }

  template <class T>
  typename enable_if<sizeof dud<T>(0) == 1, debug &>::type operator << (T i) {
    return *this << range(begin(i), end(i));
  }

  template <class A, class B>
  debug & operator << (pair<A, B> d) {
    return *this << "(" << d.first << ", " << d.second << ")";
  }

  template <class T>
  debug & operator << (rge<T> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
      *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
#else
  template <class T> 
  debug & operator << (const T&) {
    return *this; 
  }
#endif
};

#define deb(...) " " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " "

const int N = 1e5 + 5;

bitset<N> isp;
int sim[N];
int q, l, r;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  isp.set();
  isp[0] = isp[1] = 0;
  fore (i, 2, N) {
    if (isp[i]) {
      sim[i] += isp[(i + 1) / 2];
      if (1LL * i * i < N)
        for (int j = i * i; j < N; j += i)
          isp[j] = 0;
    }
    sim[i] += sim[i - 1];
  }
  cin >> q;
  while (cin >> l >> r) 
    cout << sim[r] - sim[l - 1] << '\n';
  return 0;
}


Measured memory_bytes: 1024