akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;

int main(void) {
    int n;
    cin >>n;
    int t[n],v[n];
    rep(i,n)cin>>t[i];
    rep(i,n)cin>>v[i];
    int minutes_=0;
    rep(i,n)minutes_+=t[i];
    int speed[minutes_+1][2]={};
    int sp_now=0,time=0;
    rep(i,n){
        rep(j,t[i]){
            if(sp_now<v[i]){
                sp_now++;
            }else{
                sp_now=v[i];
            }
            time++;
            speed[time][0]=sp_now;
        }
    }
    sp_now=0;
    time = minutes_;
    for(int i=n-1;i>=0;i--){
        rep(j,t[i]){
            if(sp_now<v[i]){
                sp_now++;
            }else{
                sp_now=v[i];
            }
            time--;
            speed[time][1]=sp_now;
        }
    }
    long double res=0;
    int cnt_cross=0;
    sp_now=0;
    int sp_next=0;
    rep(i,minutes_+1){
        if(i==0)continue;
        sp_now=sp_next;
        sp_next=min(speed[i][0],speed[i][1]);
        res+=(sp_now+sp_next);
        if(speed[i-1][0]<speed[i-1][1]&&speed[i][0]>speed[i][1])cnt_cross++;
    }
    res /= 2.0;
    res += cnt_cross/4.0;
    printf("%Lf\n",res);
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void){
  int H, W;
  int i, j;


  while ( scanf("%d %d", &H, &W) != EOF){
    if( H == 0){
      if( W == 0){
       
	break;
      }else{
	for(i = 1; i <= H; i++){
	  for (j = 1; j <= W; j++)
	    putchar('#');
	  putchar('\n');
	}
		printf("\n");
      }
    }
    else{
	for(i = 1; i <= H; i++){
	  for (j = 1; j <= W; j++)
	    putchar('#');
	  putchar('\n');
	}
		printf("\n");
  }
    }
  return 0;
}



Measured memory_bytes: 1904
//Harlequin 

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define YN(flag) (flag?"Yes":"No")
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    nvarep(n,a);
    bool flag=false;
    rep(i,0,n)if(a[i]%2)flag=true;
    cout<<(flag?"first":"second")<<nnn;
    return 0;
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
#include <limits.h>
#include <algorithm>  
#include <numeric>
#include <sys/resource.h>
 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define endl '\n'
using ll = long long;
 
const int precision = 15;
const int modulo =  1000000007; // 10^9 + 7
const ll lmodulo =  1000000007; // 10^9 + 7
 
const double EPS = 1e-9;
const ll inf = 1e18;


void increaseStack() {
	const rlim_t kStackSize = 50 * 1024 * 1024;   // min stack size = 50 MB
	struct rlimit rl;
	int result;

	result = getrlimit(RLIMIT_STACK, &rl);
	if (result == 0) {
		if (rl.rlim_cur < kStackSize) {
			rl.rlim_cur = kStackSize;
		    result = setrlimit(RLIMIT_STACK, &rl);
		    if (result != 0) {
		    	fprintf(stderr, "setrlimit returned result = %d\n", result);
		    }
		}
	}
}

void solve2n() {
	int n, k; cin >> n >> k;
	auto adj = vector<vector<int>>(n, vector<int>(n));
	for (auto u = 0; u < n; ++u) {
		for (auto v = 0; v < n; ++v) {
			cin >> adj[u][v];
		}
	}

	vector<ll> dp(n, 1);
	for (auto i = 0; i < k; ++i) {
		vector<ll> tmpDp(n);
		for (auto u = 0; u < n; ++u) {
			for (auto v = 0; v < n; ++v) {
				if (!adj[u][v]) continue;
				tmpDp[v] += dp[u];
				if (tmpDp[v] >= lmodulo) {
					tmpDp[v] -= lmodulo;
				}
			}
		}

		swap(dp, tmpDp);
	}

	ll ans = 0;
	for (auto u = 0; u < n; ++u) {
		ans += dp[u];
		if (ans >= lmodulo) ans -= lmodulo;
	}

	cout << ans;
}

class MatrixSq {
private:
		ll n;
		vector<vector<ll>> a;
public : 
	MatrixSq(ll n, bool ident) {
		this->n = n;
		a = vector<vector<ll>>(n, vector<ll>(n));
		if (ident) {
			for (auto i = 0; i < n; ++i) {
				a[i][i] = 1l;
			}
		}
	}

	MatrixSq(ll n, vector<vector<ll>> a) {
		this->n = n;
		this->a = a;
	}

	MatrixSq operator*(const MatrixSq & b) {
		MatrixSq ret(n, false);
		for (auto i = 0; i < n; ++i) {
			for (auto j = 0; j < n; ++j) {
				for (auto k = 0; k < n; ++k) {
					ret.a[i][k] += (a[i][j] * b.a[j][k]) % lmodulo;
					if (ret.a[i][k] >= lmodulo) ret.a[i][k] -= lmodulo;
				}
			}
		}
		return ret;
	}

	ll getAcc () {
		ll total = 0;
		for (auto r : a) {
			for (auto c : r) {
				total += c;
				if (total >= lmodulo) total -= lmodulo;
			}
		}
		return total;
	}	

	void print() {
		for (auto r : a) {
			for (auto c : r) {
				cout << c << " ";
			}
			cout << endl;
		}
		cout << endl;
	}
};
void solve() {
	ll n, k; cin >> n >> k;
	auto adj = vector<vector<ll>>(n, vector<ll>(n));
	for (auto u = 0; u < n; ++u) {
		for (auto v = 0; v < n; ++v) {
			cin >> adj[u][v];
		}
	}

	MatrixSq ans (n, true);
	MatrixSq m (n, adj);

	while (k) {
		if (k % 2l) {
			ans = ans * m;
		}

		m = m * m;
		k /= 2l;
	}

	
	cout << ans.getAcc();
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(precision);
  cout.setf(ios_base::fixed);
  solve();
  return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

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

const ll M = 1e9+7;
const ll INF = 1e9+7;

string s, t;
ll m, n;
vector<ll> c_id[30];
ll ans;

void binary_search(ll c) {
  ll l = 0, r = c_id[c].size(), mid;
  if (r == 0) {
    cout << -1 << endl;
    exit(0);
  }
  while (l < r) {
    mid = (l + r) / 2;
    if (c_id[c][mid] >= ans%m)
      r = mid;
    else
      l = mid + 1;
  }
  if (l != c_id[c].size()) ans = ans/m*m + c_id[c][l]+1;
  else ans = ans/m*m+m + c_id[c][0]+1;
}

int main() {
  cin >> s >> t;
  m = s.length();
  n = t.length();
  
  for (ll i = 0; i < m; i++) {
    c_id[s[i]-'a'].push_back(i);
  }
  
  for (ll i = 0; i < n; i++) {
    binary_search(t[i]-'a');
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1724
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<set>

using namespace std;


int main(){
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    vector<int> a(m-1);
    for(int i=0;i<m;i++) cin >> x[i];
    sort(x.begin(),x.end());
    for(int i=0;i<m-1;i++){
        a[i]=abs(x[i+1]-x[i]);
    }
    sort(a.begin(),a.end());
    int sum=0;
    for(int i=0;i<m-n;i++) sum+=a[i];
    cout<< sum <<endl;
}


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

#define pb              push_back
#define pi              acos(-1.0)
#define loop(i,a,n)     for(int i=a;i<n;i++)
#define rloop(i,n,a)    for(int i=n;i>=a;i--)
#define ll              long long int
#define ff              first
#define ss              second
#define pii             pair<ll,ll>
#define sc1(a)          scanf("%d",&a)
#define sc2(a,b)        scanf("%d %d",&a,&b)
#define sc3(a,b,c)      scanf("%d %d %d",&a,&b,&c)
#define all(v)          v.begin(),v.end()
#define ms(a,b)         memset(a,b,sizeof a)
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define fileout         freopen("output.txt","w",stdout)
#define filein          freopen("input.txt","r",stdin)
#define inf             2e9+5
#define Q               int q;cin>>q;while(q--)
#define check           cout<<"HI"<<endl;

//int x[]= {-1,0,0,1};
//int y[]= {0,-1,1,0};

using namespace std;

int main()
{
    int n,m=0;
    cin >> n;
    string s;
    map<string, int> mp;
    map<string, int> :: iterator it;
    loop(i,0,n)
    {
        cin >> s;
        mp[s]++;
        if(mp[s]>m)m=mp[s];
    }

    for(it=mp.begin();it!=mp.end();++it)
    {
        if(it->ss==m)cout<<it->ff<<endl;
    }
}













Measured memory_bytes: 19184
n = input()

INFTY = 10000000

color = [0 for i in xrange(n)]
M = [[INFTY for i in xrange(n)] for i in xrange(n)]
d = [INFTY for i in xrange(n)]
p = [-1 for i in xrange(n)]

def MST():
  d[0] = 0

  while True:
    cost = INFTY
    for i in xrange(n):
      if color[i] != 2 and d[i] < cost:
        cost = d[i]
        u = i

    if cost == INFTY:
      break
    
    color[u] = 2

    for v in xrange(n):
      if color[v] != 2 and M[u][v] != INFTY and M[u][v] < d[v]:
        d[v] = M[u][v]
        p[v] = u
        color[v] = 1

  sum = 0
  for i in xrange(n):
    if p[i] != -1:
      sum += M[i][p[i]]
  return sum

for i in xrange(n):
  G = map(int, raw_input().split())
  for j in range(n):
   if G[j] != -1:
     M[i][j] = G[j]

print MST()

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;

#define rep(idx, N) for (i64 idx = 0; idx < N; idx++)

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

  i32 max = 0;
  vector<i32> a;

  rep(i, n) {
    i32 ai;
    cin >> ai;
    a.push_back(ai);
    if (i - 1 >= 0 && (ai - a[i - 1]) > max)
      max = ai - a[i - 1];
  }

  i32 ai = k - a[n - 1] + a[0];
  if (ai > max)
    max = ai;

  cout << k - max;

  return 0;
}


Measured memory_bytes: 4312
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        val: [(String, i64); n],
    }

    let mut val_list = Vec::new();
    for (n, elem) in val.iter().enumerate() {
        val_list.push((elem.0.clone(), -elem.1, n + 1));
    }
    val_list.sort_by(|a, b| {
        if a.0 == b.0 {
            a.1.cmp(&b.1)
        } else {
            a.0.cmp(&b.0)
        }
    });

    for elem in val_list {
        println!("{}", elem.2);
    }
}

Measured memory_bytes: 2168
#include <iostream>
using namespace std;
 
int main(){
int a,b,c,t;
cin >>a>>b>>c;
 
if (a>b){t=a; a=b; b=t;}
if (b>c){t=b; b=c; c=t;}
if (a>b){t=a; a=b; b=t;}
 
cout<<a<<" "<<b<<" "<<c<<endl;
 
return 0;
}

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

long long A[100005];

int main()
{
	int N;
	cin>>N;
	
	int x;
	cin>>x;
	int i;
	for (i=1;i<=N;i++)
	cin>>A[i];
	
	long long ans=0;
	for (i=1;i<=N;i++)
	{
		if((A[i]+A[i+1])>x)
		{
			int rem=(A[i]+A[i+1])-x;
			if(rem>=A[i+1])
			A[i+1]=0;
			
			
			else A[i+1]-=rem;
		//	cout<<i<<" "<<rem<<endl;
			ans+=rem;
		}
		

		
	}
	
	cout<<ans;
}

Measured memory_bytes: 1024
n = int(input())
A = [int(i) for i in input().split()]

ans = 0
cnt = 0
for i in range(n):
    if i % 2 == 0:
        if cnt + A[i] < 0:
            cnt += A[i]
        else:
            ans += abs(cnt + A[i] - (-1))
            cnt = -1
    else:
        if cnt + A[i] > 0:
            cnt += A[i]
        else:
            ans += abs(cnt + A[i] - 1)
            cnt = 1
            
ans2 = 0
cnt2 = 0
for i in range(n):
    if i % 2 == 1:
        if cnt2 + A[i] < 0:
            cnt2 += A[i]
        else:
            ans2 += abs(cnt2 + A[i] - (-1))
            cnt2 = -1
    else:
        if cnt2 + A[i] > 0:
            cnt2 += A[i]
        else:
            ans2 += abs(cnt2 + A[i] - 1)
            cnt2 = 1
                
print(min(ans, ans2))

Measured memory_bytes: 14468
{-
HOME- ITP1-ITP1_4-A
Discussion Solution Statistics Submit
 
Computation - A / B Problem
Time Limit : 1 sec, Memory Limit : 65536 KB
?????????

???????????´??° a ??¨ b ?????????????????§?????\?????????????¨??????????????????°?????????????????????????????????

    a ?? b ??? d (??´??°)
    a ?? b ????????? ??? r (??´??°)
    a ?? b ??? f (???????°???°?????°)

Constraints

Constraints (??¶?´?)??????????????§?????§????????????????????¨???????????\???????????????????????????????????±????????????????????????????????°????????§?????¨???????????°??????????????¶??´????????¢?????´?????????????§£?????????????¨??¨??????????????????±???????????????????????????????????¢????????¶?´??????\??????????????¨???????????????

    1 ??? a, b ??? 109

Input

1?????????????????´??° a, b ????????????????????????
Output

d, r, f ????????????????????§????????£????????????????????????????????????f??????????????????0.00001??\????????????????????£????????????????????¨????????????
Sample Input

3 2

Sample Output

1 1 1.50000

Note
      ?§£??¬      
 
-}
import Data.List.Split
import Text.Printf
import Text.Regex
main = do
  s <- getLine
  putStrLn $ aux s

aux :: String -> String
aux s = printf "%d %d %.5f"  (a `div` b) (a `mod` b) c :: String
    where
    [a,b] = map (\x -> read x :: Int) $ splitRegex (mkRegex " +") s
    c = (realToFrac(a)/realToFrac(b))::Double

Measured memory_bytes: 4196
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int q=sc.nextInt();
		int r=1;
		int t;
		int f;
		char c;
		StringBuffer head=new StringBuffer();
		StringBuffer tail=new StringBuffer();
		for(int i=0;i<q;i++){
			t= sc.nextInt();
			if(t==1){
				r=r*(-1);
			}else{
				f=sc.nextInt();
				c=sc.next().toCharArray()[0];
				if(r*(f*2-3)==1){
					tail.append(c);
				}else{
					head.append(c);
				}
			}
		}
		head.reverse();
		StringBuffer str=new StringBuffer();
		str.append(head);
		str.append(s);
		str.append(tail);
		if(r==-1){
			str.reverse();
		}
		System.out.println(str);
	}
}

Measured memory_bytes: 124376
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	for(int i=0;i<(int)s.length();i++)
	{
		if(s[i]=='1') s[i]='9';
		else if(s[i]=='9') s[i]='1';
	}
	cout<<s;
}

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

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<int, List<int>>();
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        for (int i = 0; i < n; i++)
            if (d.ContainsKey(a[i])) d[a[i]].Add(i);
            else d[a[i]] = new List<int> { i };
        var q = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < q; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            var b = int.Parse(line[0]);
            var e = int.Parse(line[1]);
            var k = int.Parse(line[2]);
            if (!d.ContainsKey(k)) { Console.WriteLine(0); continue; }
            else
            {
                var ret = d[k].Count(x => x >= b && x < e);
                Console.WriteLine(ret);
            }
        }
    }
}




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

using namespace std;

using ll = long long;

const int N = 2e5 + 5;
const int M = 1e6 + 5;
int n;
int a[N], d[M];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
		if (!d[a[i]]) {
			for (int j = a[i]; j <= 1e6; j += a[i]) d[j]++;
		}
		else {
			d[a[i]]++;
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) if (d[a[i]] == 1) ans++;
	printf("%d\n", ans);
}

Measured memory_bytes: 8448
#include<iostream>

using namespace std;

int main(){

  int a,b,c;
 
  cin >> a >> b >>c;

  if(a==5&&b==5&&c==7){
    cout << "YES" << endl;
  }else if(a==7&&b==5&&c==5){
    cout << "YES" << endl;
  }else if(a==5&&b==7&&c==5){
    cout << "YES" << endl;
  }else{
    cout << "NO" << endl;
  }
  



  return 0;
}
 


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	ans := 1
	for i := 0; i < n; i++ {
		if ans*2 < ans+k {
			ans *= 2
		} else {
			ans += k
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
  int i,j,n,a1[100],a2[100],ans;
  while(1){
    cin >> n;
    if(n == 0) break;
    for(i=0;i<100;i++){
      a1[i] = i * i * i;
      a2[i] = i * (i+1) * (i+2) / 6;
    }

    ans = 0;
    for(i=0;i<100;i++){
      if(a1[i] <= n){
	for(j=0;j<100;j++){
	  int c = a1[i] + a2[j];
	  if(c <= n) ans = max(ans,c);
	}
      }
    }

    cout << ans << endl;

  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
typedef long long ll;

vector<int> gp[2009];
int n;
int x,y;

int main() {
	fastio;
	cin>>n;
	cin>>x>>y;
	x--,y--;
	gp[x].push_back(y);
	gp[y].push_back(x);
	for(ll i=0;i<n-1;i++){
		gp[i].push_back(i+1);
		gp[i+1].push_back(i);
	}
	vector<ll> res[n+1];
	vector<bool> mvis(n,false);
	for(ll i=0;i<n;i++){
		mvis[i] = true;
		vector<bool> vis(n,false);
		queue< pair<ll,ll> > q;
		q.push(make_pair(0,i));
		
		while(!q.empty()){
		    
			ll t = q.front().second;
			ll ln = q.front().first;
			//cout<<"("<<ln<<","<<t<<") ";
			q.pop();
			if(!mvis[t]){
			    res[ln].push_back(t);
			}
			
			for(auto it : gp[t]){
				if(!vis[it]){
					vis[it] = true;
					//if(!mvis[it]){
						q.push(make_pair(ln+1,it));
						
					//}
				
				}
			}
			
			
		}
		//	cout<<"\n";
	}
	for(ll i=1;i<=n-1;i++){
		cout<<res[i].size()<<"\n";
	}
	
	
}

Measured memory_bytes: 23936
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

bool isprime[10000001];

int main(){
	vector<int> cand;
	memset(isprime, true, sizeof(isprime));
	
	isprime[0] = false;
	isprime[1] = false;
	for(int i=2;i<=10000000;i++){
		if(isprime[i]){
			if(i >= 6 && isprime[i-2] && isprime[i-6] && isprime[i-8]){
				cand.push_back(i);
			}
			for(int j=2;i*j<=10000000;j++) isprime[i*j] = false;
		}
	}
	int n;
	while(cin >> n && n){
		cout << *(upper_bound(cand.begin(), cand.end(), n)-1) << endl;
	}
}

Measured memory_bytes: 10000
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n;
	cin >> n;

	for (int x = 1; x < 50000; x++) {
		if ((int)(x * 1.08) == n) {
			cout << x << endl;
			return 0;
		}
	}

	cout << ":(" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;

int main(){
  int N;
  cin >> N;
  vector<ll>arr[3];
  for(int i = 0 ; i < 3 ; i++){
    for(int j = 0 ; j < N ; j++){
      ll a;
      cin >> a;
      arr[i].push_back(a);
    }
    sort(arr[i].begin(),arr[i].end());
  }

  ll sum[N];
  for(int i = 0 ; i < N ; i++){
    int pos = lower_bound(arr[0].begin(), arr[0].end(), arr[1][i]) - arr[0].begin();
    if(i == 0){
      sum[i] = pos;
    }
    else{
      sum[i] = pos + sum[i-1];
    }
  }
  ll res = 0;
  for(int i = 0 ; i < N ; i++){
    ll pos = lower_bound(arr[1].begin(), arr[1].end(), arr[2][i]) - arr[1].begin();
    if(pos == 0)continue;
    res += sum[pos-1];
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3572
#include <stdio.h>
#define MAX 110
#define INFTY 10000000
#define BLACK 0
#define GRAY 1
#define WHITE 2

int N;
int G[MAX][MAX];
int d[MAX];
int p[MAX];
int color[MAX];
int sum[MAX];

void dijk()
{
	int i, j, k, u, v, c;
	for (i = 0; i < N; i++) {
		color[i] = WHITE;
		d[i] = INFTY;
		p[i] = -1;
	}
	d[0] = 0;

	while (1)
	{
		int minCost = INFTY;
		for (i = 0; i < N; i++) {
			if (color[i] != BLACK && d[i] < minCost) {
				minCost = d[i];
				u = i;
			}
		}

		if (minCost == INFTY) {
			break;
		}

		color[u] = BLACK;
		
		for (i = 0; i < N; i++) {
			if (G[u][i] != INFTY && color[i] != BLACK) {
				if (d[u] + G[u][i] < d[i]) {
					color[i] = GRAY;
					d[i] = d[u] + G[u][i];
					p[i] = u;
				}
			}			
		}
	}
}


int main()
{
	int i, j, k, u, v, c;
	scanf("%d", &N);
	for (i = 0; i < N; i++)
		for (j = 0; j < N; j++)
			G[i][j] = INFTY;

	for (i = 0; i < N; i++) {
		scanf("%d", &u);
		scanf("%d", &k);
		for (j = 0; j < k; j++) {
			scanf("%d %d", &v, &c);
			G[u][v] = c;
		}
	}

	dijk();

	for (i = 0; i < N; i++) {
		printf("%d %d\n", i, d[i]);
	}

	return 0;
}

Measured memory_bytes: 640
// Aizu 1115: Multi-column List
// 2017.9.15 bal4u@uu

#include <stdio.h>
#include <stdlib.h>

char buf[505][1005]; int len;
char pag[102][52];

static int ln, ii, ff;
int nxchar()   // return -1: eol, -2: null line, -3: eof
{
	int c;

	if (len == 0 || ff) return -3;
	c = buf[ln][ii];
	if (c < ' ') {
		if (++ln >= len) ff = 1;
		if (ii == 0) return -2;
		ii = 0;
		return -1;
	} else ii++;
	return c;
}

int main()
{
	int p, n, w, s, pw;
	int i, j, r, c, cc, m, f;
	char t[15];

	while (1) {
		fgets(t, 10, stdin); p = atoi(t); if (!p) break;
		fgets(t, 10, stdin); n = atoi(t);
		fgets(t, 10, stdin); w = atoi(t);
		fgets(t, 10, stdin); s = atoi(t);
		pw = n*w + s*(n-1);
		for (len = 0; ; len++) {
			fgets(buf[len], 1002, stdin);
			if (buf[len][0] == '?') break;
		}
		for (ln = ii = ff = 0, f = 0; ; ) {
			for (r = 0; r < p; r++) {
				for (c = 0; c < pw; c++) pag[r][c] = '.';
				pag[r][c] = 0;
			}
			for (cc = 0, i = 0; i < n; i++, cc += w+s) {
				for (r = 0; r < p; r++) {
					for (j = 0; j < w; ) {
						c = cc + j;
						m = nxchar();
						if (m == -1) {
							if (j > 0) break; else continue;
						} else if (m == -2) break;
						else if (m == -3) {	f = 1; goto Done; }
						pag[r][c] = m, j++;
					}
				}
			}
Done:		
			if (f && i == 0 && r == 0 && j == 0) break;
			for (r = 0; r < p; r++) puts(pag[r]);
			puts("#");
			if (f) break;
		}
		puts("?");
    }
	return 0;
}

Measured memory_bytes: 1840
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
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 int MOD = 1e9+7;
const ll LINF = 1e18;

vector<int> eratosthenes(int n) {
  vector<int> primes(n+1);
  for(int i=2; i<=n; i++) {
    if(primes[i] >= 0) {
      for(int j=2*i; j<=n; j+=i) primes[j] = -1;
      primes[i] = 1;
    }
  }
  return primes;
}

int main() {
  IOS;
  int q; cin >> q;
  const int N = 100005;

  vector<int> primes = eratosthenes(N);
  vector<int> s(N,0);
  REP(i,100001) {
    s[i+1] = s[i];
    if (primes[i] > 0 && primes[(i+1)/2] > 0) {
      s[i+1]++;
    }
  }
  REP(i,q) {
    int l,r;
    cin >> l >> r;
    COUT( s[r+1] - s[l] );
  }
  return 0;
}

Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9+7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

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

Measured memory_bytes: 3636
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
#include <iomanip>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 2;
const int MOD = 1000000007;
typedef vector<ll> vl;
typedef vector<vl> vvl;

int main() {
	string s;
	cin >> s;
	int sl = s.length();

	REP(i, sl - 1) {
		if (s[i] == s[i + 1]) {
			cout << i+1 << " " << i+2 << endl;
			return 0;
		}
	}

	REP(i, sl - 2) {
		if (s[i] == s[i + 2]) {
			cout << i+1 << " " << i+3 << endl;
			return 0;
		}
	}

	cout << "-1 -1" << endl;
	return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

int main() {
  int r, d, x; cin >> r >> d >> x;

  for (int i = 0; i < 10; i++) {
    x = (r * x) - d;
    cout << x << endl;
  }
  return 0;
}


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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        long K = Long.parseLong(sc.next());
        int Q = Integer.parseInt(sc.next());

        int[] A = new int[Q];
        for (int i = 0; i < Q; i++) {
            A[i] = Integer.parseInt(sc.next());
        }

        solve(N, Q, K, A);
    }

    public static void solve(int n, int q, long k, int[] a) {
        long[] dp = new long[n];
        for (int i = 0; i < q; i++) {
            int winner = a[i];
            dp[winner - 1] = dp[winner - 1] + 1;
        }

        PrintWriter out = new PrintWriter(System.out);
        for (long element : dp) {
            if (q - k >= element)
                out.println("No");
            else
                out.println("Yes");
        }
        out.flush();
    }
}

Measured memory_bytes: 50736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll n;
  cin >> n;

  ll ans = 1LL<<60;

  for (ll i = 1; i*i <= n+1000; i++) {
    if (n % i == 0) {
      cmin(ans, i-1+n/i-1);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>

int main(){
    int n,k;
    std::cin >> n >> k;
    int h[n];
    
    for(int i=0;i<n;++i){
        std::cin >> h[i];
    }
    
    int sum=0;
    
    for(int i=0;i<n;++i){
        if(h[i]>=k){
            sum++;
        }
    }
    
    std::cout << sum << std::endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f(i,x,n) for(int i=x;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=200005,INF=1<<30;
int dp[13][203];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N;cin>>N;
        //if(N+M==0) break;
        
        vector<int> A(N);
        
        for(int i=0;i<N;i++) cin>>A[i];
        
        vector<int> deta(1000);
        
        for(int i=0;i<N;i++) deta[A[i]]++;
        for(int i=1;i<N;i++) deta[A[i-1]*10+A[i]]++;
        for(int i=2;i<N;i++) deta[A[i-2]*100+A[i-1]*10+A[i]]++;
        
        for(int i=0;;i++){
            if(deta[i]==0){
                cout<<i<<endl;
                return 0;
            }
        }
        
        return 0;
        
    }
}



Measured memory_bytes: 3232
Imports System

Module Program
    Sub Main(args As String())

        Dim DTS() As Integer = Console.ReadLine().Split(" ").Select(Function(x) Integer.Parse(x)).ToArray()

        If DTS(0) <= DTS(1) * DTS(2) Then
            Console.WriteLine("Yes")
        Else
            Console.WriteLine("No")
        End If

    End Sub

End Module


Measured memory_bytes: 28268
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

class Procon {
    static void Main (string[] agrs) {
        int N = Int ();
        int[] L = Ints ();

        Array.Sort (L);

        long ret = 0;
        for (int i = 0; i < N; i++) {
            for (int j = i + 1; j < N; j++) {
                int max = BinarySearch (L, L[i] + L[j]);
                int min = Math.Max (i, j);

                if (max - min - 1 > 0) {
                    ret += max - min - 1;
                }
            }
        }

        Console.WriteLine (ret);
    }

    static int BinarySearch (int[] a, int b) {
        int index = Array.BinarySearch (a, b);
        if (index < 0) {
            return ~index;
        }
        int tmp = a[index];
        while (tmp == a[index - 1]) {
            index--;
        }

        return index;
    }

    static string String () => Scanner.nextString ();
    static int Int () => int.Parse (Scanner.nextString ());
    static long Long () => long.Parse (Scanner.nextString ());
    static double Double () => double.Parse (Scanner.nextString ());
    static char[] Chars () => String ().ToCharArray ();
    static string[] Strings () => Console.ReadLine ().Split (' ');
    static int[] Ints () => Strings ().Select (v => int.Parse (v)).ToArray ();
    static long[] Longs () => Strings ().Select (v => long.Parse (v)).ToArray ();
    static double[] Doubles () => Strings ().Select (v => double.Parse (v)).ToArray ();
    const int M = 1000000007;
}

class PriorityQueue<T> where T : IComparable<T> {
    public T[] heap;
    public int size;
    public int sign;
    public PriorityQueue (int N, bool descend = false) {
        heap = new T[N];
        sign = 1;
        if (descend) sign = -1;
    }
    public int Compare (T x, T y) {
        return x.CompareTo (y) * sign;
    }
    public void Push (T x) {
        int i = size++;
        while (i > 0) {
            int p = (i - 1) / 2;
            if (Compare (x, heap[p]) >= 0) {
                break;
            }
            heap[i] = heap[p];
            i = p;
        }
        heap[i] = x;
    }
    public T Pop () {
        T ret = heap[0];
        T x = heap[--size];
        int i = 0;
        while (i * 2 + 1 < size) {
            int a = i * 2 + 1;
            int b = i * 2 + 2;
            if (b < size && Compare (heap[a], heap[b]) > 0) {
                a = b;
            }
            if (Compare (heap[a], x) >= 0) {
                break;
            }
            heap[i] = heap[a];
            i = a;
        }
        heap[i] = x;
        return ret;
    }
    public int Count () {
        return size;
    }
}

class Scanner {
    static string[] s = new string[0];
    static int i = 0;
    static int max_i = 0;
    static public string nextString () {
        if (i >= s.Length) {
            s = Console.ReadLine ().Split (' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0) {
                return "";
            }
            return s[i++];
        }
        return s[i++];
    }
}

Measured memory_bytes: 13420
#include<stdio.h>
#define N 10000
#define Q 500

int main(){

  int i,j,x,y;
  int s[N],t[Q],a=0;

  scanf("%d",&x);

  for(i=0;i<x;i++){
    scanf("%d",&s[i]);
  }

  scanf("%d",&y);

  for(j=0;j<y;j++){
    scanf("%d",&t[j]);
  }

  for(j=0;j<y;j++){
    for(i=0;i<x;i++){
      if(s[i]==t[j]){
	a++;
      break;
      }
    }
  }
  printf("%d\n",a);
  return 0;
}

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


int main(){
    ll n,k;
    cin >> n >> k;
    ll a = n/k;
    if(k%2==1){
        cout << a*a*a << endl;
        return 0;
    }
    else{
        ll b = n/(k/2);
        b-=a;
        cout << (a*a*a)+(b*b*b) << endl;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 384
n=int(input())
ABC= [list(map(int,input().split())) for i in range(n)]
#ABC[i][j]はi回目にj=0,1,2でabcの点数が出る。
A=[0]*n
B=[0]*n
C=[0]*n
A[0],B[0],C[0]=ABC[0]
for i in range(1,n):
    A[i]=max(B[i-1],C[i-1])+ABC[i][0]
    B[i]=max(A[i-1],C[i-1])+ABC[i][1]
    C[i]=max(B[i-1],A[i-1])+ABC[i][2]
print(max(A[n-1], B[n-1],C[n-1]))

Measured memory_bytes: 42484
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
ll a,b;
ll gcd(ll m,ll n)
{
    if(m==0)return n;
    if(n==0)return m;
    return gcd(n,m%n);
}
int main()
{
    while(~scanf("%lld%lld",&a,&b))
    {
        ll ans1=gcd(a,b);
        ll ans2=a*b/ans1;
        printf("%lld %lld\n",ans1,ans2);
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

ll tot, a, b, nr;

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

    cin>>a>>b;
    tot=1;
    while (tot<b)
    {
        tot--;
        tot+=a;
        nr++;
    }
    cout<<nr;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>

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

using namespace std;

typedef long long ll;

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

ll M;

const int N_MAX=91;

template<class T>
void mul(int n,const T A[N_MAX][N_MAX],const T x[N_MAX],T y[N_MAX]){
	static T z[N_MAX];
	rep(i,n){
		z[i]=0;
		rep(j,n) z[i]=(z[i]+A[i][j]*x[j])%M;
	}
	rep(i,n) y[i]=z[i];
}

template<class T>
void mul(int n,const T A[N_MAX][N_MAX],const T B[N_MAX][N_MAX],T C[N_MAX][N_MAX]){
	static T tmp[N_MAX][N_MAX];
	rep(i,n) rep(j,n) {
		tmp[i][j]=0;
		rep(k,n) tmp[i][j]=(tmp[i][j]+A[i][k]*B[k][j])%M;
	}
	rep(i,n) rep(j,n) C[i][j]=tmp[i][j];
}

template<class T>
void pow(int n,const T A[N_MAX][N_MAX],ll m,T B[N_MAX][N_MAX]){
	static T tmp[N_MAX][N_MAX];
	rep(i,n) rep(j,n) {
		tmp[i][j]=A[i][j];
		B[i][j]=(i==j?1:0);
	}
	for(int t=0;m>0;t++){
		if(m&(1LL<<t)){
			mul(n,B,tmp,B);
			m-=1LL<<t;
		}
		mul(n,tmp,tmp,tmp);
	}
}

int main(){
	int buf1[20][20],*buf2[20],buf3[20][20],*buf4[20];
	rep(i,20){
		buf2[i]=buf1[i]+10;
		buf4[i]=buf3[i]+10;
	}
	int **ini=buf2+10;
	int **idx=buf4+10;

	for(int cas=1,n,L;scanf("%d%lld%d",&n,&M,&L),n;cas++){
		for(int i=9;i>=-10;i--) for(int j=-10;j<10;j++) idx[i][j]=-1;

		int N=0;
		for(int i=n-1;i>=0;i--) for(int j= -n+1 ;j<n-i;j++) scanf("%d",ini[i]+j), idx[i][j]=N++;
		for(int i= -1;i>-n;i--) for(int j=-n-i+1;j< n ;j++) scanf("%d",ini[i]+j), idx[i][j]=N++;

		ll A[N_MAX][N_MAX]={},x[N_MAX]={};
		for(int i=9;i>=-10;i--) for(int j=-10;j<10;j++) if(idx[i][j]!=-1) {
			x[idx[i][j]]=ini[i][j];
			A[idx[i][j]][idx[i][j]]=1;
			rep(k,6){
				int y=i+dy[k],x=j+dx[k];
				if(idx[y][x]!=-1){
					A[idx[i][j]][idx[y][x]]=1;
				}
			}
		}
		pow(N,A,L,A);
		mul(N,A,x,x);

		ll ans=0;
		rep(i,N) ans+=x[i];
		printf("Case %d: %lld\n",cas,ans);
	}

	return 0;
}

Measured memory_bytes: 1232
#include<stdio.h>
int main(void)
{
	long long int n,m,sum=0;
	scanf("%lld %lld",&n,&m);
	if(n>=m/2){
		sum=m/2;
	}
	else {
		sum+=n;
		m-=2*n;
		sum+=m/4;
	}
	printf("%lld\n",sum);
	return 0;
}
	

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

static const ll INF = 1e15;

int N;
vector<ll> v;
ll dp[2][3005][3005];

ll solve(int p, int i, int j){
  if(dp[p][i][j] != -INF) return dp[p][i][j];
  if(i==j) return dp[p][i][j] = ((p==0)?1:-1) * v[i];
  if(p == 0){
    if(solve(1-p,i+1,j) + v[i] < solve(1-p,i,j-1) + v[j]){
      return dp[p][i][j] = solve(1-p,i,j-1) + v[j];
    }else{
      return dp[p][i][j] = solve(1-p,i+1,j) + v[i];
    }
  }else{
    if(solve(1-p,i+1,j) - v[i] < solve(1-p,i,j-1) - v[j]){
      return dp[p][i][j] = solve(1-p,i+1,j) - v[i];
    }else{
      return dp[p][i][j] = solve(1-p,i,j-1) - v[j];
    }    
  }
}

int main(){
  cin >> N;
  rep(i,N){
    ll a;
    cin >> a;
    v.push_back(a);
  }

  rep(p,2) rep(i,3005) rep(j,3005) dp[p][i][j] = -INF;
  
  cout << solve(0, 0, N-1) << endl;
  
  return 0;
}


Measured memory_bytes: 141568
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); i++)
#define per(i, a, b) for(int i = (a); i >= (b); i--)
using namespace std;
const int mod = 1e9 + 7;
const int N = 300010;
int ch[20][2];
int f[20], g[20];
char s[N]; int n;

int main() {
	scanf("%s", s + 1), n = strlen(s + 1);
	ch[0][0] = 1, ch[0][1] = 2;
	ch[1][0] = 3, ch[1][1] = 4;
	ch[2][0] = 5, ch[2][1] = 7; // end
	ch[3][0] = 1, ch[3][1] = 1;
	ch[4][0] = 1, ch[4][1] = 2;
	ch[5][0] = 6, ch[5][1] = 2;
	ch[6][0] = 5, ch[6][1] = 5;
	ch[7][0] = 7, ch[7][1] = 7; // end
	f[0] = 1;
	rep(i, 1, n) {
		rep(j, 0, 7) g[j] = 0;
		if(s[i] == '0' || s[i] == '?') {
			rep(j, 0, 7) g[ch[j][0]] = (g[ch[j][0]] + f[j]) % mod;
		}
		if(s[i] == '1' || s[i] == '?') {
			rep(j, 0, 7) g[ch[j][1]] = (g[ch[j][1]] + f[j]) % mod;
		}
		swap(g, f);
	}
	printf("%d\n", (f[2] + f[7]) % mod);
	return 0;
}

Measured memory_bytes: 512
N,M = map(int, input().split())
# List to store grades
apb = [[] for i in range(10 ** 5)]

# num and apb convert to type dict
for i in range(M):
    n, a = input().split()
    apb[int(n)] += [a]
    if a == 'AC':
      continue

apb_new = list(filter(lambda a: a != [], apb))

# count
penalty = 0
correct_answer = 0
for words in apb_new:
  if 'AC' in words:
    correct_answer += 1
    for word in words:
      if word == 'WA':
        penalty += 1
      else:
        break


print(correct_answer, penalty)


Measured memory_bytes: 21216
from itertools import accumulate

Q=int(input())
N=10**5+2
prime=[1]*N
prime[0]=0
prime[1]=0
for i in range(N):
    if not prime[i]:
        continue
    for j in range(i*2,N,i):
        prime[j]=0
like=[0]*N
for i in range(1,N,2):
    if prime[i] and prime[(i+1)//2]:
        like[i]=1
a=list(accumulate(like))

for i in range(Q):
    l,r=map(int,input().split())
    print(a[r]-a[l-1])


Measured memory_bytes: 54720
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 100005
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;

#define ARRAY_MAX 505

int main(){

    ll h,w,n;
    cin >> h >> w >> n;
    ll a,b;
    map<pair<ll,ll>,ll> mp;
    vector<ll> cnt(10,0);

    REP(i,n){
        cin >> a >> b;
        for(ll y = a;y <= a+2;y++){
            for(ll x = b;x <= b+2;x++){
                if(y-2 >= 1 && x-2 >= 1 && y <= h && x <= w){
                    mp[P(y,x)]++;
                }
            }
        }
    }

    ll sum = 0;
    for(auto itr:mp){
        cnt[itr.second]++;
    }

    for(int i = 1;i < 10;i++){
        sum += cnt[i];
    }

    cnt[0] = (h-2)*(w-2)-sum;

    REP(i,10){
        cout << cnt[i] << endl;
    }



    return 0;
}

Measured memory_bytes: 56448
/**

  @@@@@@@  @@@@  @@@@  @@@@  @@@@  @
  @  @  @  @  @  @  @  @  @  @  @  @
  @  @  @  @  @  @  @  @  @  @  @  @
  @  @  @  @  @  @  @  @  @  @  @  @
  @  @  @  @@@@  @@@@  @@@@  @  @  @

**/
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define db double
#define ld long double
#define str string
#define pi pair
#define tup tuple
#define vec vector
#define temp template
#define tn typename

#define ff first
#define ss second
#define SZ(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rsz resize
#define ins insert
#define fr front
#define bc back
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mk make_pair

#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define ROF(i, a, b) for (ll i = (a); i >= (b); i--)
#define trav(a, x) for (auto &a : x)
#define popcount __builtin_popcountll
#define ctz __builtin_ctzll
#define clz __builtin_clzll
#define gcd __gcd

#define max(a, b) max((ll) a, (ll) b)
#define min(a, b) min((ll) a, (ll) b)

// DEBUG
#define ts to_string
temp<tn A, tn B> str ts(pi<A, B> p);
temp<tn A, tn B, tn C> str ts(tup<A, B, C> p);
str ts(const str& s) { return '"' + s + '"'; }
str ts(const char* s) { return ts((str) s); }
str ts(bool b) { return (b ? "true" : "false"); }
str ts(vec<bool> v) { bool f = true; str res = "{";
FOR(i, 0, static_cast<ll>(v.size()) - 1)
{ if (!f) res += ", "; res += ts(v[i]);
f = false; } res += "}"; return res; }
temp<size_t N> str ts(bitset<N> v) { str res = "";
trav(a, v) { res += (char) ('0' + a); } return res; }
temp<tn A> str ts(A v) { bool f = true; str res = "{";
trav(x, v) { if (!f) res += ", "; res += ts(x);
f = false; } res += "}"; return res; }
temp<tn A, tn B> str ts(pi<A, B> p) {
  return "(" + ts(p.ff) + ", " + ts(p.ss) + ")"; }
temp<tn A, tn B, tn C> str ts(tup<A, B, C> t) {
  return "(" + ts(get<0>(t)) + ", " + ts(get<1>(t)) + ", " + ts(get<2>(t)) + ")"; }
void DBG() { cerr << endl; }
temp<tn H, tn... T> void DBG(H h, T... t) { cerr << " " << ts(h); DBG(t...); }
#ifdef LOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", DBG(__VA_ARGS__);
#else
#define dbg(...) 42
#endif

// INPUT AND OUTPUT
temp<tn T> void re(T& x) { cin >> x; };
temp<tn H, tn... T> void re(H& h, T&... t) { re(h); re(t...); }
temp<tn T> void pr(T x) { cout << x; };
temp<tn H, tn... T> void pr(H h, T... t) { pr(h); pr(t...); }
temp<tn T> void pri(T x) { cout << x; cout << endl; }; // used for interactives
temp<tn H, tn... T> void pri(H h, T... t) { pri(h); pri(t...); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  vec<ll> a(5);
  FOR(i, 0, 4) {
  	re(a[i]);
  	if (a[i] == 0) {
  		pr(i + 1, '\n');
  		return 0;
		}
	}
  return 0;
}




Measured memory_bytes: 3612
// =================================
//   author: memset0
//   date: 2019.03.20 22:54:35
//   website: https://memset0.cn/
// =================================
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define debug(...) ((void)0)
#ifndef debug
#define debug(...) fprintf(stderr,__VA_ARGS__)
#endif
namespace ringo {
template <class T> inline void read(T &x) {
	x = 0; register char c = getchar(); register bool f = 0;
	while (!isdigit(c)) f ^= c == '-', c = getchar();
	while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
	if (f) x = -x;
}
template <class T> inline void print(T x) {
	if (x < 0) putchar('-'), x = -x;
	if (x > 9) print(x / 10);
	putchar('0' + x % 10);
}
template <class T> inline void print(T x, char c) { print(x), putchar(c); }

const int N = 1e5 + 10;
int n, m, k, ans, a[N], f[N];

struct seg {
	int min[N << 2];
	void modify(int u, int k, int v, int l = 0, int r = n) {
		// printf("modify %d %d %d %d %d\n", u, k, v, l, r);
		if (l == r) { min[u] = v; return; }
		int mid = (l + r) >> 1;
		if (k <= mid) modify(u << 1, k, v, l, mid);
		else modify(u << 1 | 1, k, v, mid + 1, r);
		min[u] = std::min(min[u << 1], min[u << 1 | 1]);
	}
	int query(int u, int ql, int qr, int l = 0, int r = n) {
		// printf("query %d %d %d %d %d : %d\n", u, ql, qr, l, r, min[u]);
		if (ql > qr) return f[N - 1];
		if (ql == l && qr == r) return min[u];
		int mid = (l + r) >> 1;
		if (qr <= mid) return query(u << 1, ql, qr, l, mid);
		if (ql > mid) return query(u << 1 | 1, ql, qr, mid + 1, r);
		return std::min(query(u << 1, ql, mid, l, mid), query(u << 1 | 1, mid + 1, qr, mid + 1, r));
	}
} s[2];

void main() {
	memset(f, 0x3f, sizeof(f));
	memset(s[0].min, 0x3f, sizeof(s[0].min));
	memset(s[1].min, 0x3f, sizeof(s[1].min));
	read(n), read(m), read(k);
	for (int i = 1; i <= n; i++) read(a[i]);
	f[0] = 0;
	s[0].modify(1, 0, -2 * a[1]);
	s[1].modify(1, 0, 0);
	for (int i = 1, from; i <= n; i++) {
		int j = std::lower_bound(a, a + i, (a[i] * 2 - k + 1) >> 1) - a - 1;
		f[i] = std::min(f[i], 3 * a[i] + s[0].query(1, std::max((int)0, (int)0), std::min(n, j - 1)));
		f[i] = std::min(f[i], a[i] + k + s[1].query(1, std::max((int)0, (int)j), std::min(n, i - 1)));
		s[0].modify(1, i, f[i] - a[i] - 2 * a[i + 1]);
		s[1].modify(1, i, f[i] - a[i]);
		// printf("[%d %d] %d %d | [%d %d] %d %d\n",
		// 	0, j - 1, 3 * a[i], s[0].query(1, 0, j - 1),
		// 	j, i - 1, a[i] + k, s[1].query(1, j, i - 1));
	}
	ans = f[n] + m - a[n];
	print(ans, '\n');
}

} signed main() { return ringo::main(), 0; }

Measured memory_bytes: 8064
#include<stdio.h>
int main(){
 
int a,b,c;
 
scanf("%d %d %d",&a,&b,&c);
 
if(a < b && b < c){
 
    printf("Yes\n");
 
}
 
else{
 
    printf("No\n");
 
}
 
return 0;
 
}

Measured memory_bytes: 1812
// AtCoder ABC054 D - Mixing Experiment
// 2020.1.24 bal4u

#include <stdio.h>
#include <string.h>

#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif

int in() {   // 非負整数の入力
	int n = 0; int c = gc();
	do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
	return n;
}

#define MAX 230000
#define SFT 9
#define MSK 511
#define INF 0x5ffffff
int dp[MAX+5];
int N;

int main()
{
	int i, Ma, Mb;
	int ma, ans;
	
	N = in(), Ma = in(), Mb = in();
	ans = INF, ma = 0;
	for (i = 0; i < MAX; ++i) dp[i] = INF;
	dp[0] = 0;
	while (N--) {
		int a = in(), b = in(), c = in();
		for (i = ma; i >= 0; --i) if (dp[i] < INF) {
			int x = dp[i] + c;
			int aa = (i >> SFT) + a, bb = (i & MSK) + b;
			if (aa*Mb == bb*Ma && ans > x) ans = x;
			int k = (aa << SFT) | bb;
			if (k > ma) ma = k;
			if (dp[k] > x) dp[k] = x;
		}
	}
	if (ans < INF) printf("%d\n", ans);
	else puts("-1");
	return 0;
}


Measured memory_bytes: 1024