akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {
	
	class C implements Comparable<C> {
		int startH;
		int startM;
		int startS;
		int endH;
		int endM;
		int endS;
		int S,E;
		
		public C(String start , String end){
			String [] input = start.split(":");
			startH = Integer.parseInt(input[0]);
			startM = Integer.parseInt(input[1]);
			startS = Integer.parseInt(input[2]);
			input = end.split(":");
			endH = Integer.parseInt(input[0]);
			endM = Integer.parseInt(input[1]);
			endS = Integer.parseInt(input[2]);
			this.S=startS+startM*60+startH*3600;
			this.E=endS+endM*60+endH*3600;
			
		}
		/*
		@Override
		public int compareTo(C arg0) {
			if(startH < arg0.startH){
				return -1;
			}
			if(startH > arg0.startH){
				return 1;
			}
			else{
				if(startM < arg0.startM){
					return -1;
				}
				if(startM > arg0.startM){
					return 1;
				}
				else{
					if(startS < arg0.startS){
						return -1;
					}
					if(startS > arg0.startS){
						return 1;
					}
				}
				
			}
			return 0;
		}
		*/
		@Override
		public String toString() {
			return "C [startH=" + startH + ", startM=" + startM + ", startS="
					+ startS + ", endH=" + endH + ", endM=" + endM + ", endS="
					+ endS + "]";
		}
		@Override
		public int compareTo(C o) {
			if(this.S<o.S)	return -1;
			if(this.S>o.S)	return 1;
			if(this.E<o.E)	return -1;
			if(this.E>o.E)	return 1;
			return 0;
		}
		
		
	}
	boolean comp(C start, C end){
		if(start.S < end.E)
			return true;
		else{
			return false;
		}
	}
	
	/*
	public boolean comp(C start, C end){
		if(start.startH < end.endH){
			return true;
		}
		else if(start.startH > end.endH){
			return false;
		}
		else{
			if(start.startM < end.endM){
				return true;
			}
			else if(start.startM > end.endM){
				return false;
			}
			else{
				if(start.startS < end.endS){
					return true;
				}
				else if(start.startS > end.endS){
					return false;
				}
				else{
					return true;
				}
			}
		}
		
	}
	*/
	private void doIt(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if( n == 0){
				break;
			}
			C [] data = new C[n];
			for(int i= 0; i < n ; i++){
				data[i] = new C(sc.next(), sc.next());
			}
			Arrays.sort(data);
			
			int max = 1;
			for(int i=1; i < n; i++){
				int count = 1;
				for(int j=i-1; j >= 0; j--){
					if(comp(data[i], data[j])){
						count++;
					}	
				}
				max = Math.max(max, count);
			}
			System.out.println(max);
		}
		
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doIt();
	}

}

Measured memory_bytes: 14000
#define taskname "test"

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)x.size()
#define fi first
#define se second

typedef long long lli;
typedef pair<int, int> pii;

int n;
string s;

void read_input()
{
    cin >> n >> s;
}

int calc()
{
    int i = 0, j = n - 1;
    int res = 0;
    while(i < j)
    {
        while(i < j && s[i] == 'R')
            ++i;
        while(j > i && s[j] == 'W')
            --j;
        if(i != j)
        {
            ++res;
            swap(s[i], s[j]);
        }
    }
    return res;
}

void solve()
{
    cout << calc() << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}



Measured memory_bytes: 3788
N, Y = map(int, input().split())
result = [-1, -1, -1]
for a in range(0, N+1):
    for b in range(0, N+1):
        c = N-a-b
        if c < 0:
            continue
        if Y == (10000*a + 5000*b + 1000*c):
            result[0] = a
            result[1] = b
            result[2] = c
print (" ".join(map(str, result)))

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  for (int i = 0; i < n; i++) cin >> h[i];
  
  sort(h.begin(), h.end());
  
  int res = 1 << 30;
  
  for (int i = 0; i + k - 1 < n; i++) {
	res = min(res, h[i+k-1] - h[i]);
  }
  
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
long long n,i,arr[1000004],final[1000004];
int main()
{
    scanf("%lld",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld",&arr[i]);
    }
    for(i=1;i<n;i++)
    {
        if(i==1)
        {
            final[i]=abs(arr[i]-arr[i-1]);
        }
        else if(i==2)
        {
            final[i]=min(final[i-1]+abs(arr[i]-arr[i-1]),final[i-2]+abs(arr[i]-arr[i-2]));
        }
        else
        {
            final[i]=min((final[i-1]+abs(arr[i]-arr[i-1])),(final[i-2]+abs(arr[i]-arr[i-2])));
        }
    }
    printf("%lld\n",final[n-1]);
}

Measured memory_bytes: 5120
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int x;
    cin >> x;
    vector<int> a(1e7+1, 0);
    a[1] = 1;
    for (int i = 2; i <= 1e7; ++i) {
        int idx = i;
        if (a[i] != 0) continue; 
        while(1) {
            if (idx >= 1e7) {
                break;
            }
            a[idx] = i;
            idx += i;
        }
    } 
    for (int i = x; i <= 1e7; ++i) {
        if (a[i] == i) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 42320
n = int(input())
s = list(input())
b = [0] * n
w = [0] * n
x,y = 0,0
ans = 0
for i in range(n):
    if s[i] == '#':
        x += 1
    else:
        y += 1
    b[i] = x
    w[i] = y

ans = float('inf')
for i in range(n):
    ans = min(ans, b[i] + w[n-1] - w[i])
print(min(ans, b[n-1], w[n-1]))

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

using namespace std;

#define int long long

typedef pair<int,int> ii;

int n;
int mx_r, mn_r = 1e9, mx_b, mn_b = 1e9; 
ii a[200001];

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

	cin >> n;
	for (int i=1;i<=n;i++)
	{
		cin >> a[i].first >> a[i].second;
		if (a[i].first > a[i].second) swap(a[i].first, a[i].second);
		mn_r = min(mn_r, a[i].first);
		mx_r = max(mx_r, a[i].first);
		mn_b = min(mn_b, a[i].second);
		mx_b = max(mx_b, a[i].second);
	}	
	int res = (mx_r - mn_r) * (mx_b - mn_b);
	mx_r = mx_b;		
	multiset<int> c;
	for (int i=1;i<=n;i++)
		c.insert(a[i].first);
	res = min(res, (mx_r - mn_r) * ((*c.rbegin()) - (*c.begin())));
	sort(a+1,a+1+n);
	for (int i=1;i<=n;i++)
	{
		c.erase(c.find(a[i].first));
		c.insert(a[i].second);
		res = min(res, (mx_r - mn_r) * ((*c.rbegin()) - (*c.begin())));
	}
	cout << res;
}

Measured memory_bytes: 12800
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let a = Int(readLine()!)!
    let b = Int(readLine()!)!
    
    if a != 1 && b != 1 {
        print(1)
        return
    }
    if a != 2 && b != 2 {
        print(2)
        return
    }
    if a != 3 && b != 3 {
        print(3)
        return
    }
}

main()


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

int main(){

	string s;
	
	cin>>s;
	
	if((s[2]==s[3])&&(s[4]==s[5])){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
	
	
	
	
	return 0;
}
	
	


Measured memory_bytes: 256
from collections import defaultdict
import bisect

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n,m,k = readInts()
a = readInts()
b = readInts()

a_s = [0]
for i in range(n):
	a_s.append(a_s[i]+a[i])
b_s = [0]
for i in range(m):
	b_s.append(b_s[i]+b[i])

ans = -1

#print(a_s)
#print(b_s)

for i in range(bisect.bisect_right(a_s,k)-1,-1,-1):
	sab = k-a_s[i]
	#print("sab",sab)
	tar = bisect.bisect_right(b_s,sab)-1
	#print(tar)
	for j in range(tar,-1,-1):
		if i+j <= ans:
			break
		if a_s[i]+b_s[j]<=k:
			ans = i+j
			#print(i,j)
			break


print(ans)

Measured memory_bytes: 47760
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using o_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) find_by_order(i)
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
using cd = complex<double>;
const double pi = acos(-1);
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1LL);


/*======================================================================*/
void solve(){
    int c1 = 0, c2 = 0, n;
    cin >> n;
    string s;
    cin >> s;
    int i = 0, j = n-1;
    int ans  = 0;
    while(i < j){
        while(i < n and s[i] == 'R')i++;
        while(j >= 0 and s[j] == 'W')j--;
        if(i < j)i++, j--, ans++;
    }
    cout << ans;
}
signed main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

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

int main() {
    int a,b;
    cin >> a >> b;
    if (a <= 9 && b <= 9) cout << a * b << endl;
    else cout << -1 << endl;
    return 0;
}

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

vector<int> vec(9);
 
int calc_med(int n, int x){
  if(n == 0){
    return vec[x-1];
  }
  else{
    int a = calc_med(n-1,x-1);
    int b = calc_med(n-1,x);
    int c = calc_med(n-1,x+1);
    return a+b+c - max({a,b,c}) - min({a,b,c});
  }
}

int main(){
  int N, x;
  cin >> N >> x;
  /*for(int i=0; i<2*N-1; i++){
    vec[i] = i+1;
  }
  vector<int> cnt(2*N-1);
  do{
    for(int i=0; i<2*N-1; i++){
      cout << vec[i] << " ";
    }
    if(cnt.at(calc_med(N-1,N)-1) == 0){
      for(int i=0; i<2*N-1; i++){
        cout << vec[i] << " ";
      }
      cout << "MED = " << calc_med(N-1,N) << endl;
    }
    cnt.at(calc_med(N-1,N)-1)++;
  }while(next_permutation(vec.begin(),vec.end()));
  for(int i=0; i<2*N-1; i++){
    cout << cnt[i] << endl;
  }*/
  
  if(x == 1 || x == 2*N-1){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
    deque<int> D;
    D.push_back(x);
    if(x == N){
      for(int i=N-1; i>0; i--){
        D.push_front(i);
      }
      for(int i=N+1; i<=2*N-1; i++){
        D.push_back(i);
      }
    }
    else if(x < N){
      D.push_front(x-1);
      for(int i=N; i>0; i--){
        if(i == x || i == x-1){
          continue;
        }
        D.push_front(i);
      }
      for(int i=N+1; i<=2*N-1; i++){
        D.push_back(i);
      }
    }
    else{
      D.push_back(x+1);
      for(int i=N-1; i>0; i--){
        D.push_front(i);
      }
      for(int i=N; i<=2*N-1; i++){
        if(i == x+1 || i == x){
          continue;
        }
        D.push_back(i);
      }
    }
    while(D.size()){
      cout << D.front() << endl;
      D.pop_front();
    }
  }
        
}

Measured memory_bytes: 2304
#include <bitset>
#include <algorithm>

using namespace std;

int main()
{
	const int MAX_VALUES = 101;
	bitset<MAX_VALUES> bits;
	bitset<MAX_VALUES> reversed;
	bits.flip();
	reversed.flip();
	int x, n, t;
    scanf("%d %d", &x, &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &t);
		bits.reset(t);
		reversed.reset(MAX_VALUES - 1 - t);
	}
	if (n == 0 || bits[x]) {
        printf("%d", x);
		exit(0);
	}
	int rV = bits._Find_next(x);
	int lV = MAX_VALUES - 1 - reversed._Find_next(MAX_VALUES - 1 - x);
 	int d1 = abs(rV - x);
	int d2 = abs(lV - x);
	if (d1 < d2) {
        printf("%d", rV);
	}
	else if (d2 < d1) {
		printf("%d", lV);
	}
	else {
		printf("%d", min(rV, lV));
	}
	return 0;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
int main(void){
  //yheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
    float a, b;
    cin >> a >> b;
    int c = ceil((a+b)/2);
    cout << c << endl;
}


Measured memory_bytes: 3672
#include <cstdio>
#include <functional>
#include <vector>
#include <queue>

int main(){
  int Q;
  scanf("%d", &Q);

  std::priority_queue<long> ls;
  std::priority_queue<long, std::vector<long>, std::greater<long>> rs;
  long qs,a,b;
  scanf("%ld%ld%ld", &qs, &a, &b);
  ls.push(a);
  rs.push(a);
  long min_val = b;
  for(int qi = 0; qi < Q-1; qi++){
    scanf("%ld", &qs);
    if(qs == 1){
      scanf("%ld%ld", &a, &b);
      auto lend = ls.top();
      auto rbegin = rs.top();
      if(a < lend){
        ls.pop();
        rs.push(lend);
        ls.push(a); ls.push(a);
        min_val += lend-a+b;
      }else if(a > rbegin){
        rs.pop();
        ls.push(rbegin);
        rs.push(a); rs.push(a);
        min_val += a-rbegin+b;
      }else{
        ls.push(a); rs.push(a);
        min_val += b;
      }
    }else{
      printf("%ld %ld\n", ls.top(), min_val);
    }
  }

  return 0;
}



Measured memory_bytes: 4588
while True :
    n,x=map(int,input().split())
    
    if n==0:
        break
    else :
        s=0
        
        for i in range(1,n-1):
            for j in range(i+1,n):
                for k in range(j+1,n+1) :
                    if i+j+ k==x :
                        s+= 1
                        
        print(s)



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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

constexpr static int MOD = 1000000000 + 7;
constexpr static int inf = INT_MAX / 2;
constexpr static llong INF = 1LL << 31;
constexpr static int dx[] = {1, 0, -1, 0};
constexpr static int dy[] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, p;
    cin >> a >> p;
    cout << (a * 3 + p) / 2 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    string s, t;
    cin >> s >> t;
    int ans= t.size();
    for (int i=0;i< s.size()- t.size()+ 1;i++) {
        int cnt =0;
        for (int j=0; j< t.size();j++) {
            if (s[i+ j]!= t[j]) cnt++;
        }
        ans= min(cnt, ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3572
#include <bits/stdc++.h> 
#define rep(i,n) for(int i=0; i<(n); ++i)
#define cout(x) cout<<x<<endl
#define all(v) v.begin(), v.end()
using namespace std;
//型エイリアス
using vi = vector<int>;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
const ll inf = 1e18;
const int N = 2e5 + 10;


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

    ll ans=1;
    ll x = 1e9 + 7;
    for(int i=1; i<=n; ++i){
        ans =  (i*ans)%x;
    }
    cout(ans);
    return 0;
}

Measured memory_bytes: 256
readline = open(0).readline
write = open(1, 'w').write

H, W, N = map(int, readline().split())

Y = [W+1]*(H+1)
P = [[] for i in range(W+1)]
for i in range(N):
    x, y = map(int, readline().split())
    if x < y:
        continue
    Y[x-y] = min(Y[x-y], y-1)
    P[y-1].append(x-1)
base = 0
ans = H
for y in range(W):
    while Y[base] == y:
        base += 1
    xmin = y + base
    for x in P[y]:
        if xmin <= x:
            ans = min(x, ans)
write("%d\n" % ans)

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define mod 1000000007LL
#define IN freopen("C.in","r",stdin)
#define OUT freopen("output.txt","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define ln 17
#define off 2

using namespace __gnu_pbds;
using namespace std ;

typedef tree< i64, null_type, less<i64>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef pair<i64, i64> pii;

#define maxn 1000005

i64 a[maxn] ;

int main()
{
    int n ;

    scanf("%d",&n) ;

    for(int i=1; i<=n ; i++) scanf("%lld",&a[i]) ;
    for(int i=1 ; i<=n ; i++) a[i] += a[i-1] ;

    i64 ans = a[n] ;

    for(int i=1 ; i<n ; i++)
    {
        ans = min( ans , abs(a[i] - ( a[n]-a[i] ) ) ) ;
    }

    printf("%lld\n",ans) ;

    return 0 ;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main()
{
    int n; cin>>n;
	P p[200020];
	for(int i=0; i<n; i++){
		ll a, b; cin>>a>>b;
		p[i]=P(b, a);
	}
	sort(p, p+n);
	ll s=0;
	for(int i=0; i<n; i++){
		s+=p[i].second;
		if(s>p[i].first){
			cout<<"No"<<endl; return 0;
		}
	}
	cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define Mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f 
#define MEM(x,y) memset(x,y,sizeof(x))
#define Maxn 100005
#define P pair<int,int>
using namespace std;
int main()
{
	char a[15];
	scanf("%s", &a);
	int q = 1 << (strlen(a) - 1);
	ll sum = 0;
	
	for (int i = 0; i < q; i++)
	{
		ll temp = a[0] - '0';
		for (int j = 0; j < strlen(a); j++)
		{
			if (i >> j & 1)
			{
				temp = temp * 10 + a[j + 1] - '0';
			}
			else
			{
				sum += temp;
				temp = a[j + 1] - '0';
			}
		}
	}
	cout << sum;
}

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

// template {{{
#define  range(i, l, r) for (int i = (int)(l); i < (int)(r); (i) += 1)
#define rrange(i, l, r) for (int i = (int)(r) - 1; i >= (int)(l); (i) -= 1)

#define  whole(f, x, ...) ([&](decltype((x)) container) { return (f)(  begin(container),  end(container), ## __VA_ARGS__); })(x)
#define rwhole(f, x, ...) ([&](decltype((x)) container) { return (f)( rbegin(container), rend(container), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;

// constexpr i32 mod   = 998244353;
constexpr i32 mod   = 1e9 + 7;
constexpr i32 inf   = 1001001001;
constexpr i64 infll = 1001001001001001001ll;

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

struct IoSetup { IoSetup(int x = 15){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(x); cerr << fixed << setprecision(x); } } iosetup;

template <typename T = i64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }

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

template <typename T> vector<T> make_vector(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_vector(size_t a, Ts... ts) { return vector<decltype(make_vector(ts...))>(a, make_vector(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// }}}

void solver() {
    int a = input(), b = input();
    if (a <= 8 && b <= 8) {
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }
}

signed main(int argc, char *argv[]) {
    solver();
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

int main(){
  int N; cin >> N;
    set<int> se; // 3200 以下で登場する色の種類数
    int over_num = 0; // 3200 以上の人数
    for (int i = 0; i < N; ++i) {
        int a; cin >> a;
        if (a >= 3200) ++over_num;
        else se.insert(a/400);
    }
        
    int Max = (int)se.size() + over_num;
    int Min = 0;
    if (se.size() == 0) Min = 1;
    else Min = (int)se.size();
        
    cout << Min << " " << Max << endl;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef long double ldb;

int main(void)
{
	ll a,b,c;
	scanf("%lld%lld%lld",&a,&b,&c);
	if(a + b + 2*sqrtl(a*b) < c) printf("Yes");
	else printf("No");
	return 0;
}

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

using namespace std;

template <class T>
using lim = numeric_limits<T>;

typedef long long ll;
typedef long double ld;

const int maxN = 50;
ll burger[maxN+1];
ll patty[maxN+1];

ll solve(int n, ll x){
	if (x == 0){
		return 0;
		}
	else if (x == burger[n]){
		return patty[n];
		}
	else if (x == burger[n-1]+1){
		return patty[n-1];
		}
	else if (x == burger[n-1]+2){
		return patty[n-1]+1;
		}
	else if (x < burger[n-1]+2){
		return solve(n-1,x-1);
		}
	else{
		return patty[n-1]+1+solve(n-1, x-burger[n-1]-2);
		}
	}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	ll x;
	cin >> n >> x;
	
	// # of level 0 burger and patty
	burger[0] = 1;
	patty[0] = 1;
	
	// compute until level n burger
	for (int i = 1; i <= n; i++){
		burger[i] = 2*burger[i-1]+3;
		patty[i] = 2*patty[i-1]+1;
		}
	
	cout << solve(n, x) << endl;
	}
	


Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    k,a,b=map(int,input().split())
    if b-a<=2 or k<=a:
        print(k+1)
    else:
        print(a+(b-a)*((k-a+1)//2)+(k-a+1)%2)

if __name__=='__main__':
    main()

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int q = sc.nextInt();
		boolean hanten = false;
		StringBuilder sb = new StringBuilder(100000);
		StringBuilder sb2 = new StringBuilder(100000);
		sb2.append(s);
		for (int i = 0; i < q; i++) {
			int t = sc.nextInt();
			if (t == 1) {
				hanten = !hanten;
			} else {
				int f = sc.nextInt();
				String c = sc.next();
				if (f == 1) {
					if (hanten) {
						sb2.append(c);
					} else {
						sb.append(c);
					}
				} else {
					if (hanten) {
						sb.append(c);
					} else {
						sb2.append(c);
					}
				}
			}
		}
		sb.reverse();
		sb.append(sb2.toString());
		if (hanten) {
			sb.reverse();
		}
		System.out.println(sb.toString());
		sc.close();
	}
}


Measured memory_bytes: 137992
a,b,c,k = map(int,(input().split()))
temp = k
k = k - a
if k == 0:
    print(a)
    exit()
elif k < 0:
    print(temp)
    exit()
else:
    k = k - b
    if k <= 0:
        print(a)
        exit()
    else:
        print(a-k)


Measured memory_bytes: 9168
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <cassert>
//#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


void solve()
{
    int K, a, b;
    scanf("%d%d%d", &K, &a, &b);
    b = b / K * K;
    if (b >= a) {
        printf("OK\n");
    }
    else {
        printf("NG\n");
    }


    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}



Measured memory_bytes: 1644
N,M,R=gets.split.map(&:to_i)
r = gets.split.map{|w|w.to_i-1}
edge = N.times.map{[]}
dist = N.times.map{Array.new(N, 1000000000)}
N.times{|i| dist[i][i] = 0}
M.times.map{
  a,b,c = gets.split.map(&:to_i)
  edge[a-1]<<b-1
  edge[b-1]<<a-1
  dist[a-1][b-1] = c
  dist[b-1][a-1] = c
}

N.times{|k|N.times{|i|N.times{|j|dist[i][j] = dist[i][k]+dist[k][j] if dist[i][j] > dist[i][k]+dist[k][j]}}}

min = 1000000000
r.permutation(R){|t|
  cost = 0
  (t.size-1).times{|i|
    cost += dist[t[i]][t[i+1]]
  }
  min = cost if min>cost
}

puts min

Measured memory_bytes: 3964
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        //入力受付
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] xi = new int[n];
        int[] yi = new int[n];
        int[] hi = new int[n];
        for(int i = 0; i < n; i++) {
            xi[i] = scanner.nextInt();
            yi[i] = scanner.nextInt();
            hi[i] = scanner.nextInt();
        }
        //高度が0より大きい場合、データを格納
        int x = 0, y = 0, h = 0;
        for(int i = 0; i < n; i++) {
            if(hi[i] > 0) {
                x = xi[i];
                y = yi[i];
                h = hi[i];
                break;
            }
        }
        //全探索
        for(int cx = 0; cx <= 100; cx++) {
            for(int cy = 0; cy <= 100; cy++) {
                int H = h + Math.abs(x - cx) + Math.abs(y - cy);
                boolean check = true;
                for(int i = 0; i < n; i++) {
                    if(hi[i] != Math.max(0, H - Math.abs(xi[i] - cx) - Math.abs(yi[i] - cy))) {
                        check = false;
                        break;
                    }
                }
                //出力
                if(check) {
                    System.out.println(cx + " " + cy + " " + H);
                    return;
                }
            }
        }
    }
}

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

int main() {
  string a,b,c; cin>>a>>b>>c;
  vector<char> va,vb,vc;
  rep(i,a.size())va.push_back(a.at(i));
  rep(i,b.size())vb.push_back(b.at(i));
  rep(i,c.size())vc.push_back(c.at(i));
  
  char t='a',win;
  while(true){
    if(t=='a'&&va.size()==0) {win='A';break;}
    else if(t=='a'){t=va.at(0);va.erase(va.begin());}
  
    if(t=='b'&&vb.size()==0) {win='B';break;}
    else if(t=='b'){t=vb.at(0);vb.erase(vb.begin());}
  
    if(t=='c'&&vc.size()==0) {win='C';break;}
    else if(t=='c'){t=vc.at(0);vc.erase(vc.begin());}
  }
  cout<<win;
}



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

int main(){
    int n;
    cin>>n;
    int p1=0, p2=0;
    string a, b;
    for(int i=0;i<n;i++){
        
        cin>>a >>b;
        if(a>b){
            
            p1+=3;
        }else if(a<b){
            
            p2+=3;
        }else{
            
            p1++;
            p2++;
        }
    }
    
    cout<<p1<<" "<<p2<<endl;
}



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

int main()
{
   long long n;
   cin>>n;
   long long counter=99999999999999999;

   for(int i=1;i<=sqrt(n);i++)
   {
       if(n%i==0)
       {
           long long a= i-1;
           long long b = (n/i)-1;
           counter=min(counter,a+b);
       }
   }
   cout<<counter<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	vector<int> a(3);
	cin >> a[0] >> a[1] >> a[2];

	sort(a.begin(), a.end());

	int min_ops = 0;
	while (a[1] + 2 <= a[2]) {
		++min_ops;
		a[1] += 2;
	}

	while (a[0] + 2 <= a[2]) {
		++min_ops;
		a[0] += 2;
	}

	if ((a[0] == a[2] && a[1] != a[2]) || (a[1] == a[2] && a[0] != a[2])) {
		min_ops += 2;
	} 
	else if (a[0] != a[2] && a[1] != a[2]) {
		++min_ops;
	}

	cout << min_ops << "\n";

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int n,m,x;
    cin >> n >> m >> x;
    int memo = 0;
    rep(i,m){
        int a;
        cin >> a;
        if(x < a){
            memo++;
        }
    }
    cout << min(memo,m-memo) << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
n,a,b=map(int,input().split())
mod=pow(10,9)+7
ans=pow(2,n,mod)-1

# 場合の数をmodで割った余り nCr % mod
def ncr_mod(n,r,mod):
  a,b=1,1
  for i in range(r):
    a*=n-i
    a%=mod
    b*=i+1
    b%=mod
  return (a*pow(b,mod-2,mod))%mod
ans-=ncr_mod(n,a,mod)
ans-=ncr_mod(n,b,mod)
print(ans%mod)

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


int main(){
    int a;
    cin >> a;
    cout << a + a*a + a*a*a << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10 , OO = 0x3f3f3f3f ;
const int mod = 1e9 + 7;
 
#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define xloop(i,a,b) for(int i = int(a);i <= int(b);i++)
#define range(vec) for(auto &x : vec) cin >> x;
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

int n;

int main()
{
   // startTime = (double)clock();
    #ifndef ONLINE_JUDGE
        //freopen("in.in", "r", stdin);
        //freopen("out.in", "w", stdout);
    #endif
	//ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    
    scanf("%d" , &n);
    vector < ll > a(n);
    bool ok = 1;
    for(int i = 0 ; i < n ; ++i){
        scanf("%lld" , &a[i]);
        if(a[i] == 0)
            ok = 0;
    }

    if(!ok)
        return puts("0") , 0;

    const ll mx = 1000000000000000000;
    ll mul = 1;
    for(int i = 0 ; i < n ; ++i){ // (prod * a[i] <= 10^18) = a[i] <= 10^18 / prod 
        if(a[i] <= mx / mul)
            mul *= a[i];
        else
            return puts("-1") , 0;
    }
    
    printf("%lld\n" , mul);

    return 0;
}

Measured memory_bytes: 4024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

typedef long long ll;

namespace Knap2
{
#define SUM_V 100001
	int N, W;
	ll ws[101];
	ll vs[101];
	ll dp[101][SUM_V];

	void solve()
	{
		cin >> N >> W;
		memset(ws, 0, sizeof(ws));
		memset(vs, 0, sizeof(vs));
		for (int i = 1; i <= N; ++i) {
			cin >> ws[i] >> vs[i];
		}
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < SUM_V; ++j) {
				dp[i][j] = 1LL << 60;
			}
		}
		dp[0][0] = 0;
		//i番目までから選ぶ重量を求める
		for (int i = 1; i <= N; ++i) {
			//vの結果を全てを記録する
			for (int v = 0; v <= SUM_V; ++v) {
				if (vs[i] <= v) {
					//i番目を選ぶ場合と選ばない場合で、軽い方を選択する
					dp[i][v] = min(dp[i - 1][v], dp[i - 1][v - vs[i]] + ws[i]);
				}
				else {
					//商品を選べないとき
					dp[i][v] = dp[i - 1][v];
				}
			}
		}

		ll ans = 0;
		for (int v = 0; v < SUM_V; ++v) {
			if (dp[N][v] <= W) ans = v;
		}


		cout << ans << endl;
	}
}

int main()
{
	Knap2::solve();
}


Measured memory_bytes: 79232
#include <bits/stdc++.h>
#define SIZE 105
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

char str[SIZE];
P get_input()
{
	scanf("%s",&str);
	int n=strlen(str);
	ll now=0;
	int a=0,b=0;
	bool up=false;
	for(int i=0;i<n;i++)
	{
		if(str[i]=='.') up=true;
		else
		{
			now*=10;
			now+=str[i]-'0';
			if(up) a--,b--;
		}
	}
	while(now%2==0) now/=2,a++;
	while(now%5==0) now/=5,b++;
	return P(a,b);
}
int main()
{
	int n;
	scanf("%d",&n);
	map <P,int> mp;
	map <P,int>::iterator it,its;
	for(int i=0;i<n;i++)
	{
		P p=get_input();
		mp[p]++;
	}
	ll ret=0;
	for(it=mp.begin();it!=mp.end();it++)
	{
		P p=it->first;
		if(p.first>=0&&p.second>=0) ret+=(ll) it->second*(it->second-1)/2;
		its=it;
		while(1)
		{
			its++;
			if(its==mp.end()) break;
			P q=its->first;
			if(p.first+q.first>=0&&p.second+q.second>=0) ret+=(ll) it->second*its->second;
		}
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 3792
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>

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

int main() {

	int N;
	vector<int> A, B;

	scanf("%d", &N);

	A.resize(N);
	B.resize(N);

	rep(i, N) scanf("%d %d", &A[i], &B[i]);

	rep(i, N) {
		if (A[i] != B[i]) break;
		if (i == N - 1 && A[i] == B[i]) {
			printf("0\n");
			return 0;
		}
	}

	ll sum = 0;
	rep(i, N) sum += A[i];

	vector<int> b;
	b.reserve(N);

	rep(i, N) if (A[i] > B[i]) b.push_back(B[i]);

	int minimum = 2123456789;
	rep(i, b.size()) {
		if (b[i] < minimum) minimum = b[i];
	}

	printf("%lld\n", sum - minimum);

	return 0;
}


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

int insertionSort(int A[], int N, int g)
{
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        int v = A[i];
        int j = i - g;
        while (j >= 0 and A[j] > v) {
            A[j+g] = A[j];
            j -= g;
            cnt++;
        }
        A[j+g] = v;
    }

    return cnt;
}

void shellSort(int A[], int N)
{
    int cnt = 0;
    int m;
    int G[13]; // (3^14 - 1) / 2 > 1,000,000
    G[0] = 1;
    for (m = 1; G[m - 1] * 3 + 1 < N; m++) {
        G[m] = G[m - 1] * 3 + 1;
    }
    cout << m << "\n";
    for (int i = m - 1; i > 0; i--) {
        cout << G[i] << " ";
    }
    cout << G[0] << "\n";

    for (int i = m - 1; i >= 0; i--) {
        cnt += insertionSort(A, N, G[i]);
    }

    cout << cnt << "\n";
    for (int i = 0; i < N - 1; i++)
    {
        cout << A[i] << "\n";
    }
    cout << A[N - 1] << endl;
}

int main()
{
    int N;
    int A[1000000];
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    shellSort(A, N);
    return 0;
}


Measured memory_bytes: 6988
#include<bits/stdc++.h>
#define ll long long
#define eps 1e-8
#define INF 0x3f3f3f3f
#define pb push_back
#define endl '\n'
#define IO ios::sync_with_stdio(false)
using namespace std;
const ll maxn = 1e6 + 5;
const ll mod = 1e9 + 7;
int a,b,c,n,m,t,k,num[maxn];
int q,mp[maxn];
string str;
int main(){
    IO;
    ll ans = 0;
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> m,mp[m]++,ans += m;
    cin >> q;
    while(q--){
        cin >> a >> b;
        ans += (b - a) * mp[a];
        cout << ans << endl;
        mp[b] += mp[a];
        mp[a] = 0;
    }
    return 0;
}


Measured memory_bytes: 4008
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#include <bitset>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;



int main(){
    ll N;
    cin >> N;
    cout<<N*(N-1)/2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{ long long a,b,n,x,i, c;
	scanf("%lld",&n);a=-1000000;b=1000000;c=0;
	for(i=0;i<n;i++){
	scanf("%lld",&x);
	if(x<b){b=x;};
	if(x>a){a=x;};
	c=c+x;
	};
	printf("%lld %lld %lld\n",b,a,c);
	
	
	return 0;
}



Measured memory_bytes: 2100
#include <iostream>
#include <cmath>
using namespace std;
long long f(long long  n){
	long long count=0;
	for(long long i = 1; i <= (double)sqrt((double)n); i++){
		if(n%i==0){
			count+=2;
			if(i==n/i)count--;
		}
	}
	return count;
}
int main(){
	long long  n;
	cin >> n;
	if(n==2){
		cout << 1 << endl;
		exit(0);
	}
	long long count=0;
	count+=f(n-1)-1;
	for(long long i = 2; i <= (double)sqrt((double)n); i++){
		if(n%i!=0)continue;
		long long m = n;
		while(m%i==0)m/=i;
		if(m%i==1)count++;
		m=n;
		if(i==n/i)continue;
		while(m%(n/i)==0)m/=(n/i);
		if(m%(n/i)==1)count++;
	}
	count++;
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort
#include <math.h>

#define DEBUG 0

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll mod = 1000000007;
static const ll INF = 1000000000000000000LL;
                    //999999997000000003
                    //1000000000000000000

using namespace std;

int main(){
#if DEBUG
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
    double A,B;
    cin >> A >> B;
    double P, Q ,R;
    cin >> P >> Q >> R;
    double res;

    //+A

    // y = Qx
    // y = -Rx + B*P

    //B分時点の距離をもとめる

    double squB = (B-A) * Q;
    double e86B = (B) * P;

    //(R+Q)が何分で距離をつめるか

    res = (e86B-squB) / (R+Q);
    res += B;

    //cout << res << endl;
    printf("%.12f\n", res);
    return 0;
}



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

int main(){
    using namespace std;
    unsigned long N, H;
    cin >> H >> N;
    for(unsigned long i{0}, A, S{0}; i < N; ++i){
        cin >> A;
        if((S += A) >= H)return 0 & puts("Yes");
    }
    puts("No");
    return 0;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    cout << (n-1)*(m-1) << endl;
    return 0;
}


Measured memory_bytes: 256
n,yen = map(int,input().split())
key = False
for x in range(n+1):
    if key == True:
        break
    for y in range(n+1):
        z = n - x - y
        if z >= 0:
            if 10000*x + 5000*y + 1000*z == yen:
                print(x,y,z)
                key = True
                break
                
if key == False:
    print(-1,-1,-1)

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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

const int mod = 1000000007;
int n;
int freq[128];

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		char c;
		scanf(" %c", &c);
		freq[c]++;
	}
	
	int ans = 1;
	for(int i = 'a'; i <= 'z'; i++){
		ans = 1LL * ans * (1 + freq[i]) % mod;
	}
	ans = (ans + mod - 1) % mod;
	printf("%d\n", ans);
	return 0;
}

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

int main(void) {
  long long H, W;
  cin >> H >> W;

  // 縦に分割
  long long r1 = (W % 3 != 0) * H;
  long long r2 = (H % 3 != 0) * W;

  long long r3, r4;
  r3 = r4 = 1e18;
  for (int h = 1; h < H; h++) {
    long long s1 = W * h;
    long long s2 = (W / 2) * (H - h);
    long long s3 = (W / 2 + W % 2) * (H - h);
    long long max_s = max({s1, s2, s3});
    long long min_s = min({s1, s2, s3});
    r3 = min(r3, max_s - min_s);
    // cerr << min_s << " " << max_s << endl;
  }
  swap(H, W);
  for (int h = 1; h < H; h++) {
    long long s1 = W * h;
    long long s2 = (W / 2) * (H - h);
    long long s3 = (W / 2 + W % 2) * (H - h);
    long long max_s = max({s1, s2, s3});
    long long min_s = min({s1, s2, s3});
    r4 = min(r4, max_s - min_s);
    // cerr << min_s << " " << max_s << endl;
  }
  cout << min({r1, r2, r3, r4}) << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
using ll = long long;
int main(void){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(1){
        c-=b;
        if(c<=0){
            cout<<"Yes"<<endl;
            return 0;
        }
        a-=d;
        if(a<=0){
            cout<<"No"<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3672
#include <iostream>
#include <string>

using namespace std;

int main()
{
	int A, B;
	string S, T, U;
	cin >> S >> T >> A >> B >> U;
	if (S == U)
	{
		A--;
	}
	else
	{
		B--;
	}
	cout << A << " " << B << endl;
}

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

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit);

    int n, m; cin >> n >> m;
    cout << (n * (n - 1) / 2) + (m * (m - 1) / 2) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stack>
#include<map>

using namespace std;

int main(){
  int w, h;

  while(cin >> w >> h, !(w == 0 && h == 0)){
    char tiles[h+2][w+2];
    pair<int, int> start;

    for(int i = 0; i < h+2; i++){
      for(int j = 0; j < w+2; j++){
        if(i == 0 || j == 0 || i == h+1 || j == w+1){
          tiles[i][j] = '#';
        }else{
          cin >> tiles[i][j];
          if(tiles[i][j] == '@') start = make_pair(i, j);
        }
      }
    }

    /*for(int i = 0; i < h+2; i++){
      for(int j = 0; j < w+2; j++){

        cout << tiles[i][j];
      }
      cout << endl;
    }
    cout << "start is (" << start.first << start.second << ")" << endl;
*/
    int dh[4] = {-1,  0, 1, 0};
    int dw[4] = { 0, -1, 0, 1};

    int cnt = 0;
    stack< pair<int, int> > s;
    s.push(start);
    pair<int, int> cur;

    while(!s.empty()){
      cur = s.top();
      s.pop();
      cnt++;

      for(int i = 0; i < 4; i++){
        if(tiles[cur.first + dh[i]][cur.second + dw[i]] == '.'){
          tiles[cur.first + dh[i]][cur.second + dw[i]] = '#';
          pair<int, int> next = make_pair(cur.first + dh[i], cur.second + dw[i]);
          s.push(next);
        }
      }
    }
    cout << cnt << endl;
  }
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define loop(i, a, b) for(int i = a; i < b; i++)
#define pool(i, a, b) for(int i = a; i > b; i--)
#define pb push_back

const int maxn = 1e5+5;
const int Mod=1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e=exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

void min_self(int& a, int b)
{
  if(a > b)
    a = b;
}
int modulous(int a, int b)
{
  int x = a - b;
  if(x > 0)
    return x;
  else
    return x * (-1);
}


int main()
{
  int n;
  cin >> n;
  int v[n];
  loop(i, 0, n)
    cin >> v[i];
  vector<int> dp(n + 5, INF);

  dp[0] = 0;
  loop(i, 1, n)
  {
    loop(j, 1, 3)
    {
      if(i >= j)
        min_self(dp[i], dp[i - j] + modulous(v[i - j], v[i]));
    }
  }
  cout << dp[n - 1];
  return 0;
}

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

int main(){
	
	int W, H, x, y, r;
cin >> W >> H >> x >> y >> r;

	if(x - r < 0 || x + r > W){
	cout << "No" << endl;
	}
		else if ( y - r < 0 || y + r > H){
			cout << "No" << endl;
			}
			else{
				cout << "Yes"<< endl;
}


return 0;
}

Measured memory_bytes: 3100