akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int mp[3005][3005];
long long dp[3005][3005][4];
int main(){
	int R,C,K;
	cin>>R>>C>>K;
	int r,c,v;
	for(int i=1;i<=K;i++){
		cin>>r>>c>>v;
		mp[r][c]=v;
	}
	for(int i=1;i<=R;i++){
		for(int j=1;j<=C;j++){
			for(int k=0;k<=3;k++){
				dp[i][j][0]=max(dp[i][j][0],dp[i-1][j][k]);
				dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][k]+mp[i][j]);
			}
				dp[i][j][1]=max(dp[i][j][1],dp[i][j-1][1]);
				dp[i][j][1]=max(dp[i][j][1],dp[i][j-1][0]+mp[i][j]);
				dp[i][j][2]=max(dp[i][j-1][2],dp[i][j-1][1]+mp[i][j]);
				dp[i][j][3]=max(dp[i][j-1][3],dp[i][j-1][2]+mp[i][j]);
//				printf("i:%d j:%d\n",i,j);
//				cout<<dp[i][j][0]<<endl<<dp[i][j][1]<<endl<<dp[i][j][2]<<endl<<dp[i][j][3]<<endl;
		}
	}
	long long ans=0;
	for(int i=0;i<=3;i++){
			ans=max(ans,dp[R][C][i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 320444
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<utility>
#include<map>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 100000000
#define MOD 100000007
#define SIZE 100005
#define PI 	3.14159265358979323846

int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    ll n;
    cin >> n;
    if(a>=b&&a>=c)a = a*pow(2,n);
    if(b>=a&&b>=c)b = b*pow(2,n);
    if(c>=b&&c>=a)c = c*pow(2,n);
    //cout << a << endl;
    //cout << b << endl;
    //cout << c << endl;
    cout << a+b+c << endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

N = INT()
AB = [LIST() for _ in range(N)]
AB.sort(key = lambda x: x[0])
print(AB[-1][0] + AB[-1][1])

Measured memory_bytes: 30056
<?php
$n = trim(fgets(STDIN));
$array = [];
for ($x = 1;$x < 99;++$x) {
    for ($y = 1;$y < 99;++$y) {
        for ($z = 1;$z < 99;++$z) {
            $ans = $x ** 2 + $y ** 2 + $z ** 2 + $x * $y + $x * $z + $y * $z;
            if ($ans <= 10000) {
                @++$array[$ans];
            }
        }
    }
}

for ($i = 1;$i <= $n;++$i) {
    if (array_key_exists($i,$array)) {
        echo @$array[$i].PHP_EOL;
    } else {
        echo "0".PHP_EOL;
    }
}

Measured memory_bytes: 17160
# ICPC Score Totalizer Software

ans = []

while True:
    n = int(input())
    if n == 0:
        break
    point = [int(input()) for i in range(n)]
    ans.append((sum(point) - max(point) - min(point)) // (n - 2))

for i in range(len(ans)):
    print(ans[i])



Measured memory_bytes: 5604
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("NO")
else:
  	print("YES")


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

int main(void){
    int N, K, R, S, P;
    string T;
    cin >> N >> K;
    cin >> R >> S >> P;
    cin >> T;

    //string te;
    vector<char> te(N+1);
    long long int ans = 0;
    for(int i = 0; i < N; i++){
        te[i] = 0;
        if(i-K >= 0){
            if(te[i-K] != T[i]){ // K回前が同じ手でないとき
                if(T[i] == 'r') ans += P;
                if(T[i] == 's') ans += R;
                if(T[i] == 'p') ans += S;

                te[i] = T[i];
            }else if(i-2*K >= 0){
                if(te[i-K] == te[i-2*K]){ // K回前が同じ手かつK*2回前が同じ手のとき
                    if(T[i] == 'r') ans += P;
                    if(T[i] == 's') ans += R;
                    if(T[i] == 'p') ans += S;

                    te[i] = T[i];
                }
            }
        }else{
            if(T[i] == 'r') ans += P;
            if(T[i] == 's') ans += R;
            if(T[i] == 'p') ans += S;

            te[i] = T[i];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1},
};

fn main() {
   input! {a:Chars}
   let mut b = a[0].to_uppercase();
   let mut c = b.next().unwrap();
   if c == a[0] {
      println!("A");
   } else {
      println!("a");
   }
}


Measured memory_bytes: 2168
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

l = [A, B, C, D, E]
r = [dish % 10 for dish in l]
m = 10
i = 0
for j in range(5):
  if (r[j] != 0) & (r[j] < m):
    m = r[j]
    i = j
    
t = 0
for j in range(5):
  if i == j or r[j] == 0:
    t += l[j]
  else:
    t += ((l[j] // 10) + 1) * 10
    
print(t)


Measured memory_bytes: 3064
n = int(input())
s = input()
ans = ""
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(s)):
    #print(alpha.find(s[i]))
    ans += alpha[alpha.find(s[i]) + n]

print(ans)

Measured memory_bytes: 3060
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef map<char,int> mci;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<pair<int,int>> vii;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define in insert
#define sz(v) v.size()
#define mina(a,b) (a)=min((a),(b));
#define maxa(a,b) (a)=max((a),(b));
const int INF = 1e9 + 5;
vvi v;
vi val;
vll ans;
void f(int b,ll cnt){
    cnt+=val[b];
    ans[b]=cnt;
    for(int i: v[b]){
        f(i,cnt);
    }
}
void solve(){
    int n, q;  cin>>n>>q;
    v = vvi(n+1,vi());
    val = vi(n+1,0);
    ans = vll(n+1);
    for(int i = 1; i < n; i++){
        int a,b; cin>>a>>b;
        v[a].pb(b);
    }
    for(int i = 0; i < q; i++){
        int p,x; cin>>p>>x;
        val[p]+=x;
    }
    f(1,0);
    for(int i = 1 ; i<=n ; i++) cout<<ans[i]<<" ";
}
int main(){
    int T=1;
    //cin>>T;
    for(int i = 0; i < T; i++) solve(); 
}

Measured memory_bytes: 21888
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,k;
  cin >> h >> w >> k;
  int d=1;
  int y=0;
  char s[h][w];
  bool q[h];
  for(int i=0;i<h;i++){
    q[i]=false;
    for(int j=0;j<w;j++){
      cin >> s[i][j];
      if(s[i][j]=='#'){
        q[i]=true;
      }
    }
  }
  int c[w];
  for(int i=0;i<w;i++){
    c[i]=0;
  }
  int p=0;
  for(int i=0;i<h;i++){
    if(q[i]==false&&c[0]!=0){
      for(int j=0;j<w;j++){
        cout << c[j] << " ";
      }
    }
    else if(q[i]==false&&c[0]==0){
      p++;
    }
    else{
      for(int j=0;j<w;j++){
        if(s[i][j]=='#'&&y==0){
          y=1;
          cout << d << endl;
          c[j]=d;
        }
        else if(s[i][j]=='#'&y==1){
          d++;
          cout << d << " ";
          c[j]=d;
        }
        else{
          cout << d << " ";
          c[j]=d;
        }
      }
      cout << endl;
      d++;
      y=0;
      for(int z=0;z<p;z++){
        for(int j=0;j<w;j++){
          cout << c[j] << " ";
          if(z==p-1){
            cout << endl;
          }
        }
      }
      p=0;
    }
  }
}


Measured memory_bytes: 896
#include<stdio.h>

int main(){
	int i,rb,lb,cnt;
	char s[64];
	while(1){
		scanf("%s",s);
		if(s[0]=='#')break;
		i=0;cnt=0;rb=1;lb=1;
		while(s[i]!='\0'){
			if((s[i]>='a'&&s[i]<='g')||(s[i]>='q'&&s[i]<='z'&&s[i]!='u'&&s[i]!='y')){
				if(!lb)cnt++;
				rb=0;lb=1;
			}else{
				if(!rb)cnt++;
				rb=1;lb=0;
			}
			i++;
		}
		printf("%d\n",cnt);
		
	}
	return 0;
}

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

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

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

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

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vi p(n);
    rep(i,n){
        int a; cin>>a;
        p[a-1]++;
    }
    sort(all(p));
    vi sum(n+1,0);
    rep(i,n) sum[i+1]=sum[i]+p[i];
    FOR(k,1,n){
        int l=0, r=n/k+1; //L OK, R NG
        while(r-l>1){
            int mid = (l+r)/2;
            int itr = lower_bound(all(p),mid)-p.begin();
            ll val = sum[itr]+(n-itr)*mid;
            if (val>=mid*k){
                l = mid;
            }else{
                r = mid;
            }
        }
        cout<<l<<endl;
    }
    return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn = 2e5 + 10;
const int inf = 0x3f3f3f;

typedef long long ll;

int n;

struct node
{
	int a, b;
};

node da[maxn];

int read()
{
	int x;
	scanf("%d", &x);
	return x;
}

bool cmp(node x, node y)
{
	if(x.b != y.b)return x.b < y.b;
	else return x.a < y.a;
}

int main()
{
	n = read();
	for(int i = 1; i <= n; i ++)
	{
		da[i].a = read();
		da[i].b = read();
	}
	
	sort(da + 1, da + n + 1, cmp);
	/*
	for(int i = 1; i <= n; i ++)
	{
		cout << da[i].a << " " << da[i].b << endl;
	}
	*/
	int time = 0;
	
	for(int i = 1; i <= n; i ++)
	{
		if(time + da[i].a <= da[i].b)time += da[i].a;
		else 
		{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

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

int main(){
  int N, K;

  while(std::cin >> N >> K){
    std::vector<int64_t> A(N);
    for(int i = 0; i < N; ++i) std::cin >> A[i];

    auto check =
      [&](double t){
        int64_t m = 0;

        for(auto L : A){
          m += (int64_t)std::ceil(L / t) - 1;
        }
        
        return m <= K;
      };


    double lb = 0.1, ub = 1e9;
    for(int i = 0; i < 100; ++i){
      double mid = (lb + ub) / 2;

      if(check(mid)){
        ub = mid;
      }else{
        lb = mid;
      }
    }

    int ans = std::ceil(lb);

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

  return 0;
}


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

int main(){
    long double W,H,x,y; cin>>W>>H>>x>>y;
    if(x==W/2&&y==H/2){
        cout<<W*H/2<<" "<<1;
    }
    else{
        cout<<W*H/2<<" "<<0;
    }
    return 0;
}

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

int main() {
  int X, A;
   
  cin >> X >> A;

  // ここにプログラムを追記
  if (X < A){
    cout << 0 << endl;
  }
  
  else {
    cout << 10 << endl;
  }
  
 
  }


Measured memory_bytes: 256
#include<stdio.h>

void tra(int A[],int N);
void insertionSort(int A[],int N);

int main(){
  int N,i,j;
  int A[100];

  scanf("%d",&N);
  for(i=0;i<N;i++)scanf("%d",&A[i]);

  tra(A,N);
  insertionSort(A,N);

  return 0;
}


void tra(int A[],int N){
  int i;
  for(i=0;i<N;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
}

void insertionSort(int A[],int N){
  int j,i,v;
  for(i=1;i<=N-1;i++){
    v=A[i];
    j=i-1;
    while(j>=0&&A[j]>v){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=v;
    tra(A,N);
  }

  
}



Measured memory_bytes: 2140
n,m = map(int,input().split())
c = list(range(n+1))
k = n
a = []
for i in range(n+1):
  a.append([i])
  
#print(a)
for i in range(m):
    x,y,z = map(int,input().split())
    t = c[x]
    s = c[y]
    if t == s:
        continue
    
    if len(a[s]) > len(a[t]):
        t,s = s,t
    a[t] += a[s]
    for z in a[s]:
        c[z] = t
    a[s] = []
    k -= 1
    
print(k)    
    
    
  
  


Measured memory_bytes: 22772
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,m,f[100009],g[100009],ff[100009],gg[100009],pas,i,j,zx,xc;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b>>m;
	for(i=1; i<=a; i++){
		cin>>f[i];
		ff[i]=f[i];
	}
	sort(ff+1,ff+a+1);
	for(i=1; i<=b; i++){
		cin>>g[i];
		gg[i]=g[i];
	}
	sort(gg+1,gg+b+1);
	pas=ff[1]+gg[1];
	for(i=1; i<=m; i++){
		cin>>d>>e>>c;
		zx=f[d]+g[e]-c;
		if(pas>zx) pas=zx;
	}
	cout<<pas;
	return 0;
}

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

int main() {
    int n, sum = 0;
    cin >> n;
    int l[n];
    for(int i = 0; i < n; i++) cin >> l[i];
    sort(l, l + n);
    for(int i = 0; i < n - 1; i++) sum += l[i];
    if(l[n-1] < sum) cout << "Yes" << "\n";
    else cout << "No" << "\n";
}


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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  string s; cin >> s;
  int n = s.size();
  if (n == 2) {
    if (s[0] != s[1]) { printf("-1 -1\n"); }
    else { printf("1 2\n"); }
    return 0;
  }
  vector<vector<int>> freqs(n + 5, vector<int>(26, 0));
  for (int i = 1; i <= n; ++i) {
    ++freqs[i][s[i - 1] - 'a'];
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 26; ++j) {
      freqs[i][j] += freqs[i - 1][j];
    }
  }
  int start = -1, end = -1;
  for (int i = 1; i + 2 <= n; ++i) {
    bool found = false;
    for (int c = 0; c < 26; ++c) {
      if (freqs[i + 2][c] - freqs[i - 1][c] >= 2) {
        found = true;
        start = i;
        end = i + 2;
        break;
      }
    }
    if (found) {
      break;
    }
  }
  // if (start != -1) {
  //   fprintf(stderr, "DEBUG: %s\n", s.substr(start - 1, 3).c_str());
  // }
  printf("%d %d\n", start, end);
  return 0;
}


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

using namespace std;
bool cmp(char a,char b)
{
    return a>b;
}
int main()
{
    string s,t;cin>>s>>t;
    string tmps=s,tmpt=t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end(),cmp);
    if(s<t)
    {
        cout<<"Yes"<<endl;

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


Measured memory_bytes: 256
#include <stdio.h>
#define N 100

int main(void){

    int i, j, arr[N], n;
    int temp, min, count = 0;

    // input
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
    }

    // sort
    for (i = 0; i < n-1; i++) {
        min = i;
        for (j = i; j < n; j++) {
            if(arr[j] < arr[min]) min = j;
        }
        temp = arr[i];
        arr[i] = arr[min];
        arr[min] = temp;
        if(i != min) count++;
    }


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

    return 0;
}

Measured memory_bytes: 600
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int count = 0;
		String t;
		
		for(int i = 1; i <= s.length(); i++) {
			t = s.substring(i-1,i);
			if(t.equals(String.valueOf(i % 2))) {
				count ++;
			}
		}
			System.out.println(Math.min(count, s.length() - count));
	}
}

Measured memory_bytes: 35916
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	ll N,K,ret=0; cin>>N>>K;
	for (int b=1; b<=N; b++)
		ret+=(N/b) * max(0LL,b-K) + max(0LL,(N%b)-K+1) - !K;
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){
    int l,a,b,c,d;
    cin>>l>>a>>b>>c>>d;
    cout<<max(0,l-max((a+c-1)/c,(b+d-1)/d))<<endl;
}


/*
abcdea

/root
a.txt
bunp.html
/desktop
r.txt
fsharp.cs
dp.cpp
/users
bison.txt

root r.txt
users r.txt
users a.txt

desktop/r.txt
../r.txt
../../a.txt
*/



Measured memory_bytes: 3084
s=int(input())

cnt = 1
dic = {}
dic[s] = True
while(1):
    cnt += 1
    if(s%2==0):
        s = s//2
    else:
        s=3*s+1
    if(s in dic.keys()):
        print(cnt)
        exit()
    dic[s] = True


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
int f[10001][101][2];
char a[10001];
int main()
{
	int K,D,i,j,k;
	scanf("%s",a);
	//cin>>a;
	scanf("%d",&D);
	//cin>>D;
	K=strlen(a);
	f[0][0][1]=1;
	for(i=0;i<K;i++)
	{
		for(j=0;j<D;j++)
		{
			for(k=0;k<=9;k++)
			{
				f[i+1][(j+k)%D][0]=(f[i+1][(j+k)%D][0]+f[i][j][0])%1000000007;
			}
			for(k=0;k<=a[i]-'0';k++)
			{
				if(k==a[i]-'0')
					f[i+1][(j+k)%D][1]=(f[i+1][(j+k)%D][1]+f[i][j][1])%1000000007;
				else
					f[i+1][(j+k)%D][0]=(f[i+1][(j+k)%D][0]+f[i][j][1])%1000000007;
			}
		}
	}
	printf("%d",(f[K][0][0]+f[K][0][1]-1+1000000007)%1000000007);
	return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
#define y1 __zzd001
using namespace std;
typedef long long LL;
LL read(){
	LL x=0;
	char ch=getchar();
	while (!isdigit(ch))
		ch=getchar();
	while (isdigit(ch))
		x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	return x;
}
const int N=100005;
int n,sg[N];
vector <int> e[N];
void solve(int x,int pre){
	sg[x]=0;
	for (auto y : e[x])
		if (y!=pre){
			solve(y,x);
			sg[x]^=sg[y]+1;
		}
}
int main(){
	n=read();
	for (int i=1;i<n;i++){
		int x=read(),y=read();
		e[x].push_back(y);
		e[y].push_back(x);
	}
	solve(1,0);
	puts(sg[1]?"Alice":"Bob");
	return 0;
}

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

int main() {

  char a;
  cin>>a;
  
  if(a=='a'){cout<<'b'<<endl;}
  if(a=='b'){cout<<'c'<<endl;}
  if(a=='c'){cout<<'d'<<endl;}
  if(a=='d'){cout<<'e'<<endl;}
  if(a=='e'){cout<<'f'<<endl;}
  if(a=='f'){cout<<'g'<<endl;}
  if(a=='g'){cout<<'h'<<endl;}
  if(a=='h'){cout<<'i'<<endl;}
  if(a=='i'){cout<<'j'<<endl;}
  if(a=='j'){cout<<'k'<<endl;}
  if(a=='k'){cout<<'l'<<endl;}
  if(a=='l'){cout<<'m'<<endl;}
  if(a=='m'){cout<<'n'<<endl;}
  if(a=='n'){cout<<'o'<<endl;}
  if(a=='o'){cout<<'p'<<endl;}
  if(a=='p'){cout<<'q'<<endl;}
  if(a=='q'){cout<<'r'<<endl;}
  if(a=='r'){cout<<'s'<<endl;}
  if(a=='s'){cout<<'t'<<endl;}
  if(a=='t'){cout<<'u'<<endl;}
  if(a=='u'){cout<<'v'<<endl;}
  if(a=='v'){cout<<'w'<<endl;}
  if(a=='w'){cout<<'x'<<endl;}
  if(a=='x'){cout<<'y'<<endl;}
  if(a=='y'){cout<<'z'<<endl;}
 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define teto(a, b) (((a)+(b)-1)/(b))
#define all(x) x.begin(), x.end()
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define dbg(msg, var) cerr << msg << " " << var << endl;

using namespace std;

const int MAX = 100010;
const int MOD = 123456789;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const ld EPS = 1e-7;

// End Template //

ll dp1[100010], dp2[100010];

int main()
{sws;

    ll n, c, x, v;
    cin >> n >> c;

    vector<pair<ll, ll>> vet;
    for(int i=0;i<n;i++){
        cin >> x >> v;
        vet.pb({x, v});
    }

    ll ans = 0;

    ll best=0, now=0, lst=0;
    for(int i=0;i<n;i++){
        x = vet[i].ff;
        v = vet[i].ss;
        now+=v-(x-lst);
        lst=x;
        dp1[i] = best = max(best, now);
    }

    ans = max(ans, best);

    best=0; now=0; lst=c;
    for(int i=n-1;i>=0;i--){
        x = vet[i].ff;
        v = vet[i].ss;
        now+=v-(lst-x);
        lst = x;
        dp2[n-i-1] = best = max(best, now);
    }

    ans = max(ans, best);

    // for(int i=0;i<n;i++)
    //     cout << dp1[i] << " ";
    // cout << endl;

    // for(int i=0;i<n;i++)
    //     cout << dp2[i] << " ";
    // cout << endl;

    ll sum=0;
    for(int i=0;i<n-1;i++){
        x = vet[i].ff;
        v = vet[i].ss;
        sum+=v;
        ans = max(ans, sum-2*x + dp2[n-1-i - 1]);
    }


    sum=0;
    for(int i=0;i<n-1;i++){
        x = vet[n-1-i].ff;
        v = vet[n-1-i].ss;
        sum+=v;
        ans = max(ans, sum-2*(c-x) + dp1[n-1-i - 1]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 6296
import math
N,K=map(int,input().split())
count=0
for i in range(1,N+1):
  if i<K:
    a=math.ceil((math.log2(K)-math.log2(i)))
    count+=(1/N)*(1/2)**a
  else:
    count+=1/N
print(count)

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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; }

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

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

    // 上から白く塗られたマスを並べ、
    int A, B;
    cin >> A >> B;

    int G[110][110];

    for(int i = 0; i < 110; i++){
        for(int j = 0; j < 110; j++){
            G[i][j] = 0;
        }
    }

    int cnt_w, cnt_b;
    cnt_w = 0;
    cnt_b = 0;
    int ind_i = 0;
    for(int i = 0; i < 100; i++){
        for(int j = 0; j < 100; j++){
            if((cnt_w < (A-1) && j%2==0) && i%2==0){
                G[i][j] = 1;
                cnt_w++;
            }else{
                G[i][j] = 2;
            }
        }
        if(cnt_w == (A-1)){
            ind_i = i;
            break;
        }
    }
    ind_i++;

    for(int j = 0; j < 100; j++){
        G[ind_i][j] = 2; // 黒く塗る
    }
    ind_i++;
    for(int j = 0; j < 100; j++){
        G[ind_i][j] = 1; // 白く塗る
    }
    ind_i++;

    for(int i = ind_i; i < 100; i++){
        for(int j = 0; j < 100; j++){
            if((cnt_b < (B-1) && j%2==0) && i%2 == 0){
                G[i][j] = 2;
                cnt_b++;
            }else{
                G[i][j] = 1;
            }
        }
        if(cnt_b==(B-1)){
            ind_i = i;
            break;
        }
    }

    cout << (ind_i+1) << " " << 100 << endl;

    for(int i = 0; i < 100; i++){
        for(int j = 0; j < 100; j++){
            if(G[i][j] == 1) cout << ".";
            if(G[i][j] == 2) cout << "#";
        }
        cout << endl;
    }

    return 0;
}



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

class Program
{
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static long mod = 1000000007;

    static object process(TextReader input) {
        var spl   = input.ReadLine().Split(' ');
        var n     = int.Parse(spl[0]);
        var m     = int.Parse(spl[1]);

        var aa = new HashSet<int>();
        for(int i=0; i<m; i++) {
            aa.Add(int.Parse(input.ReadLine()));
        }

        var counts = new long[n+1];
        counts[0] = 1;
        counts[1] = aa.Contains(1) ? 0 : 1;

        for(int i=2; i<=n; i++) {
            if (aa.Contains(i)) {
                counts[i] = 0;
            } else {
                counts[i] = counts[i - 1] + counts[i - 2];
                counts[i] %= mod;
            }
        }

        return counts.Last();
    }
}


Measured memory_bytes: 19808
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++) //for文マクロ
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P; //ペア　タイプでふ
int main()
{
    string c;
    cin >> c;
    if (c == "A")
    {
        cout << "T";
    }
    else if (c == "C")
    {
        cout << "G";
    }
    else if (c == "G")
    {
        cout << "C";
    }
    else if (c == "T")
    {
        cout << "A";
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<limits>
#include<bitset>
#include<functional>
#include<type_traits>
#include<queue>
#include<stack>
#include<array>
#include<random>
#include<utility>
#include<cstdlib>
#include<ctime>

using namespace std;

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;}

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

long long INF = 1LL<<60;
long long dp[100010];
int h[100010];
int n,m;
bool connect[55][55];
int a[55],b[55];
vector<bool>visited(55);

void dfs(int x){
    visited.at(x)=true;
    for(int i=1;i<=n;i++){
        if(connect[i][x]==false)continue;
        if(visited.at(i))continue;
            dfs(i);
    }
}
int main(){
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        cin>>a[i]>>b[i];
        connect[a[i]][b[i]]=connect[b[i]][a[i]]=true;
    }
    int count=0;
    for(int i=1;i<=m;i++){
            connect[a[i]][b[i]]=connect[b[i]][a[i]]=false;
            rep(k,n)visited.at(k+1)=false;
            dfs(1);
            bool bridge = false;
            rep(l,n)if(visited.at(l+1)==false)bridge=true;
            if(bridge){count++;}
            connect[a[i]][b[i]]=connect[b[i]][a[i]]=true;
        }
    cout<<count<<endl;
    return 0;
}



Measured memory_bytes: 256
function Main(input) {
  "use strict";
  const lines = input.split("\n");
  const line1 = lines[0].split(" ");
  const line2 = lines[1].split(" ");

  const N = parseInt(line1[0], 10);
  const As = line2.map(s => parseInt(s, 10))
  As.sort((a,b) => b - a)

  var t_a = 0;
  var t_b = 0;
  for (var i = 0; i < N; i++) {
    if (i%2==0) {
      t_a += As[i]
    } else {
      t_b += As[i]
    }
  }
  console.log(t_a - t_b)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main(){

for(;;){
int x,y;
cin>>x>>y;
if(x==0 && y==0)break;
	for(int i=0;i<x;i++){
		for(int g=0;g<y;g++){
		if (g==0||g==y-1||i==0||i==x-1){cout<<"#";}
		else{cout<<".";}
		}
		cout<<endl;
		}
cout<<endl;
}
return 0;
}


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

using ll = long long;

int N, A;
int x[111];
ll dp[111][111][5555];

int main() {
   cin >> N >> A;
   for (int i = 0; i < N; i++) cin >> x[i];

   dp[0][0][0] = 1;
   for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
         for (int k = 0; k <= 5000; k++) {
            // 選ばない
            dp[i+1][j][k] += dp[i][j][k];
            // 選ぶ
            if (k >= x[i]) {
               dp[i+1][j+1][k] += dp[i][j][k-x[i]];
            }
         }
      }
   }

   ll ans = 0;
   for (int j = 1; j <= N; j++) {
      ans += dp[N][j][j*A];
   }
   cout << ans << endl;

   return 0;
}

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


public class Main{
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        TreeMap<String, Integer> map = new TreeMap<>();
        for(int i=0;i<n;i++){
            String tmp = sc.next();
            if(map.keySet().contains(tmp)){
                map.put(tmp, map.get(tmp) + 1);
            }
            else{
                map.put(tmp, 1);
            }
        }
        int M = 0;
        ArrayList<String> res = new ArrayList<>();
        for(String key : map.keySet()){
            if(M<=map.get(key)){
                if(M<map.get(key)) res.clear();
                res.add(key);
                M = map.get(key);
            }
        }
        for(String l : res){
            out.println(l);
        }

        out.flush();
    }

}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


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

int main(){
	int N,K;
	cin>>N>>K;
	int l[N];
	for(int i=0;i<N;++i){
		cin>>l[i];
	}
	sort(l,l+N,greater<int>());
	int ans=0;
	for(int i=0;i<K;++i){
		ans+=l[i];
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
from bisect import bisect_right

n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

a_ac=[0]
for i in range(1,n+1):
  a_ac.append(a_ac[i-1]+a[i-1])

b_ac=[0]
for i in range(1,m+1):
  b_ac.append(b_ac[i-1]+b[i-1])

#print(a_ac)
#print(b_ac)

ans=0
for i in range(n+1):
  remain=k-a_ac[i]
  if remain<0:
    continue
  t_ans=i
  t_ans+=bisect_right(b_ac,remain)-1
  ans=max(ans,t_ans)

print(ans)

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

using namespace std;

int const maxn = 2e5 + 5;
int a[maxn], b[maxn], c[maxn];
int inf = 1e9;

main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, ans = 0;
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 1; i <= n; ++i) cin >> b[i];
    for (int i = 0; i <= 28; ++i) {
        for (int j = 1; j <= n; ++j) c[j] = (b[j]&((1 << (i + 1)) - 1));
        sort(c + 1, c + n + 1);
        int ok = 0;
        for (int j = 1; j <= n; ++j) {
            int x = (a[j]&((1 << (i + 1)) - 1));
            int l = max(0, (1 << i) - x), r = (1 << (i + 1)) - 1 - x;
            int add = 0;
            add += (upper_bound(c + 1, c + n + 1, r) - c);
            add -= (lower_bound(c + 1, c + n + 1, l) - c);
            add = max(add, 0);
            ok = (ok + add) % 2;
            l = (1 << (i + 1)) + (1 << i) - x, r = inf;
            add = 0;
            add += (upper_bound(c + 1, c + n + 1, r) - c);
            add -= (lower_bound(c + 1, c + n + 1, l) - c);
            add = max(add, 0);
            ok = (ok + add) % 2;
        }
        ans += ok * (1 << i);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 5940
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

//macro
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define EPS (1e-8)
#define equals(a,b)(fabs((a)-(b))<EPS)

using ll = long long;
using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvll = vector<vll>;
//func
template<typename A, typename T>void assign2d(A&arr, ll H, ll W, T t) { arr.resize(H); REP(i, H) arr[i].assign(W, t); }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); REP(i, n)os << v[i] << (i == n - 1 ? "" : " "); return os; }
template <class T = int> inline T IN() { T x; cin >> x; return x; }
template<class T> inline void OUT(const T &x) { cout << x << "\n"; }
void YESNO(bool c) { OUT(c ? "YES" : "NO"); };
void YesNo(bool c) { OUT(c ? "Yes" : "No"); };
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); /*cout << fixed << setprecision(6);*/ } } pre__;

int main() {
	string S;
	cin >> S;
	cout << S.front();
	cout << S.size() - 2;
	cout << S.back() << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 1000

int N,num_query;
vector<int> V[NUM];

int main(){

	scanf("%d %d",&N,&num_query);

	int command,A,B;

	for(int loop = 0; loop < num_query; loop++){

		scanf("%d",&command);

		switch(command){
		case 0:

			scanf("%d %d",&A,&B);
			V[A].push_back(B);
			break;

		case 1:

			scanf("%d",&A);
			if(V[A].size() == 0){

				printf("\n");

			}else{

				printf("%d",V[A][0]);

				for(int i = 1; i < V[A].size(); i++){
					printf(" %d",V[A][i]);
				}
				printf("\n");
			}

			break;
		case 2:
			scanf("%d",&A);
			V[A].clear();
			break;
		}
	}

	return 0;
}



Measured memory_bytes: 5816
#include <stdio.h>

int main(void) {
  int a, b, c, d, e, k;
  scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &k);

  if ( e - a <= k )
    printf("Yay!");
  else {
    printf(":(");  
  }
}

Measured memory_bytes: 128
#include <iostream>
#include <utility>

using namespace std;

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

    pair<string, int> p[100010];
    int h = 0, t = 0, tt = 0;

    while (n--) {
        string k;
        int ttt;
        cin >> k >> ttt;
        pair<string, int> pp = make_pair(k, ttt);
        p[t++] = pp;
    }

    while (h != t) {
        pair<string, int> pp = p[h++];
        if (pp.second <= q) {
            tt += pp.second;
            cout << pp.first << " " << tt << endl;
        } else {
            int ttt = pp.second - q;
            pp.second = ttt;
            tt += q;
            p[t++] = pp;
        }
        if (h == 100010) {
            h = 0;
        }
        if (t == 100010) {
            t = 0;
        }
    }

    return 0;
}


Measured memory_bytes: 6968
#include<iostream>

using namespace std;

int main(){
    long long int N, M, A, sum = 0;
    cin >> N >> M;
    for(int i=0; i<M; i++) {
        cin >> A;
        sum += A;
    }
    cout << ((N - sum < 0) ? -1 : N - sum) << endl;
    return 0;
}

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

int main(){
    string S;
    cin >> S;
    /*
    int black_pos = 0;
    for(size_t i = 0; i < S.size(); i++){
        if(S[i] == 'B') black_pos += i;
    }
    sort(S.rbegin(), S.rend());
    int new_black_pos = 0;
    for(size_t i = 0; i < S.size(); i++){
        if(S[i] == 'B') new_black_pos += i;
    }
    cout << new_black_pos - black_pos << endl;
    */
    long long white_num = 0;
    long long count = 0;
    for(int i = 0; i < (int)S.size(); i++){
        if(S[i] == 'W'){
            count += i - white_num;
            white_num++;
        }
    }
    cout << count << endl;

}

Measured memory_bytes: 3736
using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;

class Program
{
    static void Main(string[] args)
    {
        var sc = new Scanner();

        int a = sc.nextInt();
        int b = sc.nextInt();

        Console.WriteLine(Math.Max(a - 2 * b, 0));
    }
}

// chokudai's Scanner
class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11092
use itertools::iterate;
use proconio::input;

trait IntoIntegerIndexedVec {
    type Output;
    #[warn(dead_code)]
    fn into_i32_indexed_vec(self, offset: usize) -> IntegerIndexedVec<Self::Output>;
}
impl<T> std::ops::IndexMut<i32> for IntegerIndexedVec<T> {
    #[warn(dead_code)]
    fn index_mut(&mut self, index: i32) -> &mut T {
        let actual_index = index + (self.offset as i32);
        &mut self.v[actual_index as usize]
    }
}
impl<T> std::ops::Index<i32> for IntegerIndexedVec<T> {
    type Output = T;
    #[warn(dead_code)]
    fn index(&self, index: i32) -> &Self::Output {
        let actual_index = index + (self.offset as i32);
        &self.v[actual_index as usize]
    }
}
impl<T> IntoIterator for IntegerIndexedVec<T> {
    type Item = T;
    type IntoIter = std::vec::IntoIter<T>;
    #[warn(dead_code)]
    fn into_iter(self) -> std::vec::IntoIter<T> {
        self.v.into_iter()
    }
}
impl<T> IntegerIndexedVec<T> {
    fn new(v: Vec<T>, offset: usize) -> Self {
        IntegerIndexedVec { v, offset }
    }
    #[allow(dead_code)]
    fn iter(&self) -> std::slice::Iter<T> {
        self.v.iter()
    }
}
#[derive(Debug, Clone)]
struct IntegerIndexedVec<T> {
    v: Vec<T>,
    offset: usize,
}
impl<T> IntoIntegerIndexedVec for Vec<T> {
    type Output = T;
    #[warn(dead_code)]
    fn into_i32_indexed_vec(self, offset: usize) -> IntegerIndexedVec<T> {
        IntegerIndexedVec::new(self, offset)
    }
}

fn sieves(n: i32) -> IntegerIndexedVec<bool> {
    let mut s = vec![true; (n + 1) as usize].into_i32_indexed_vec(0);
    s[0] = false;
    s[1] = false;
    for i in iterate(2, |&i| i + 1).take_while(|&i| i * i <= n) {
        if s[i] {
            for j in ((i * 2)..=n).step_by(i as usize) {
                s[j] = false;
            }
        }
    }
    s
}

fn solve(_q: usize, lr: &[(i32, i32)]) -> Vec<usize> {
    const N: i32 = 100000;
    let s = sieves(N);
    let mut r = vec![false; (N + 1) as usize].into_i32_indexed_vec(0);
    for i in 0..=N {
        if i % 2 != 0 && s[i] && s[(i + 1) / 2] {
            r[i] = true;
        }
    }
    let mut c = vec![0; (N + 1) as usize].into_i32_indexed_vec(0);
    for i in 1..=N {
        c[i] = c[i - 1] + r[i] as usize;
    }
    lr.iter().map(|&(l, r)| c[r] - c[l - 1]).collect::<Vec<_>>()
}

fn main() {
    input! {
        q: usize,
        lr: [(i32, i32); q],
    }
    let r = solve(q, &lr);
    for x in r {
        println!("{}", x);
    }
}


Measured memory_bytes: 5784
#include<bits/stdc++.h>
#define re register
#define int long long
#define ll long long
#define M 1000000007
using namespace std;
inline int read() {
	re int t=0;
	re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0') {
		t=(t<<3)+(t<<1)+v-48;
		v=getchar();
	}
	return t;
}
inline int ksm(re int x,re int y,re int z){
	int sum=1;
	while(y){
		if(y&1)sum*=x,sum%=z;
		x*=x,x%=z;
		y>>=1;
	}
	return sum;
}
int work(int n,int m) {
	int ans=1;
	for(int i=1; i<=m; ++i)ans=ans*(n-m+i)%M*ksm(i,M-2,M)%M;
	return ans;
}
long long n,k,ans,a,b;
signed main() {
	n=read();
	a=read();
	b=read();
	printf("%lld",((ksm(2,n,M)-1-work(n,a)-work(n,b))%M+M)%M);
}



Measured memory_bytes: 256
from operator import itemgetter

N = int(input())
Red = [list(map(int,input().split())) for _ in range(N)] #赤
Blue = [list(map(int,input().split())) for _ in range(N)] #青

Red1 = sorted(Red, key=itemgetter(1),reverse = True)
Blue1 = sorted(Blue, key=itemgetter(0)) #ここが違った
cnt = 0

for i in range(N): 
    for j in range(N):
        if (Blue1[i][0] > Red1[j][0]) and (Blue1[i][1] > Red1[j][1]):
            cnt+=1
            Red1[j] = [500,500] #これがなかった
            #print(B1[i],A1[j])
            break #これがなかった
print(cnt)

Measured memory_bytes: 3064
import java.util.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		String s = sc.next();
		boolean ans = true;
		for (int i = a; i < Math.max(c, d); i++) {
			if (s.charAt(i) == '#' && s.charAt(i + 1) == '#') {
				ans = false;
			}
		}
		if (c < d) {
			if (ans) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		} else {
			boolean jump = false;
			for (int i = b - 2; i <= d - 2; i++) {
				if (s.charAt(i) == '.' && s.charAt(i + 1) == '.' && s.charAt(i + 2) == '.') {
					jump = true;
				}
			}
			if (ans && jump) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}
}


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

int main() {
	int a, b;
	cin >> a;
	cin >> b;

	int x, y;
	if (a >= b) {
		x = b;
		y = a;
	}else {
		x = a;
		y = b;
	}

	for (int i = 0; i < y; i++) {
		cout << x;
	}

	return 0;
}

Measured memory_bytes: 256
N = int(input())
i = 0
j = 0
count = 0
flag = 0

for i in range(1, N + 1, 2):
    count = 0
    for j in range(1,i + 1):
        if i % j == 0:
            count += 1
    else:
        if count == 8:
            flag += 1
else:
    print(flag)


Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <cstdlib>
 
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FFOR(i,a,b) for(int i=(a);i<=(b);i++)
#define REP(i,b) FOR(i,0,b)
#define RREP(i,b) FFOR(i,1,b)
#define PB push_back
#define F first
#define S second
#define BE(c) c.begin(),c.end()
using namespace std;
typedef long long LL;
typedef LL ut;
typedef long double ld;
typedef pair<ut,ut> pr;
typedef vector<pr> Vpr;
typedef vector<ut> VI;
typedef pair<ut,pr> ppr;
typedef priority_queue<pr,Vpr, greater<pr> > PQ;
const int SIZE=1e+5 + 1;
const ut INF=1<<29;
const ld eps=1e-6;
const LL mod=1e+6 + 3;

string base;

bool check(string& s){
    for(unsigned int i = 0; i < s.size(); ++i){
        if(s[i] != base[0])
                continue;
        for(unsigned int j = i + 1; j < s.size(); ++j){
            if(s[j] != base[1])
                    continue;
            int l = 2;
            for(unsigned int k = j + (j - i); k < s.size(); k += (j - i)){
                   if(s[k] != base[l])
                        break;
                   l++;
                   if(l == (int)base.size())
                       return true;
            }
        }
    }
    return false;
}

int main() {
    int n;
    string s;
    cin >> n >> base;
    int ans = 0;
    REP(i,n){
        cin >> s;
        if(check(s))
            ans++;
    }
    cout << ans << endl;
 	return 0;
}

Measured memory_bytes: 1208
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long intS
#define rep(i,n) for(int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    int n;
    
    cin >> n;
    
    if (n%2 == 0){
    
    cout << n << endl;
    
    }else {
    
    cout << n*2 << endl;
    
    }
    
    
    
//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256