akhauriyash/Code-Regression huggingface dataset:
// SmartCoder
#include <bits/stdc++.h>

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

using namespace __gnu_pbds;
using namespace std;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define minei(x) min_element(x.begin(), x.end()) - (x).begin()
#define maxei(x) max_element(x.begin(), x.end()) - (x).begin()
#define LSOne(S) (S & (-S))

#define uns(v) sort((v).begin(), (v).end()), v.erase(unique(v.begin(), v.end()), v.end())
#define acusum(x) accumulate(x.begin(), x.end(), 0)
#define acumul(x) accumulate(x.begin(), x.end(), 1, multiplies<int>());
#define bits(x) __builtin_popcount(x)
#define oo INT_MAX
#define inf 1000000000
#define MAXN 1000007
#define MOD 1000000007

const double pi = acos(-1.0);
const double eps = 1e-11;

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

int main() {
    std::ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    n %= 10;
    if (n == 3)
        cout << "bon\n";
    else if (n == 0 || n == 1 || n == 6 || n == 8)
        cout << "pon\n";
    else
        cout << "hon\n";
    return 0;
}


Measured memory_bytes: 3612
# @author 

import sys

class HGrid1:
    def solve(self):
        MOD = 10 ** 9 + 7
        h, w = [int(_) for _ in input().split()]
        a = []
        for i in range(h):
            a.append(list(input()))

        dp = [[0] * (w + 1) for _ in range(h + 1)]
        for j in range(w):
            if a[0][j] == '#':
                break
            dp[0][j] = 1
        for i in range(h):
            if a[i][0] == '#':
                break
            dp[i][0] = 1
        for i in range(1, h):
            for j in range(1, w):
                if a[i][j] == '.':
                    if a[i - 1][j] == '.':
                        dp[i][j] += dp[i - 1][j]
                    if a[i][j - 1] == '.':
                        dp[i][j] += dp[i][j - 1]
                dp[i][j] %= MOD

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

solver = HGrid1()
input = sys.stdin.readline

solver.solve()


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

int main()
{
	int F[45],n;
	F[0] = F[1] = 1;
	for (int i = 2; i <= 44; i++)
		F[i] = F[i - 1] + F[i - 2];
	scanf("%d", &n);
	printf("%d\n", F[n]);
	return 0;
}

Measured memory_bytes: 3220
N=int(input())
flag=False
for i in range(1,3501):
    if flag==True:
        break
    for j in range(1,3501):
        if 4*i*j-N*i-N*j>0:
            w=N*i*j/(4*i*j-N*i-N*j)
            if w%1==0:
                print(*[i,j,int(w)])
                flag=True
                break

Measured memory_bytes: 3060
inpl = lambda: list(map(int,input().split()))
import numpy as np
class ParityTree:
    def __init__(self,N):
        self.parent = [-1]*int(N)
        self.parity = [0]*int(N)

    def root(self, n):
        if self.parent[n] < 0:
            return n, 0
        else:
            m, p = self.root(self.parent[n])
            self.parent[n] = m
            self.parity[n] = (p + self.parity[n]) % 2
            return m, self.parity[n]

    def merge(self, m, n, parity):
        rm, pm = self.root(m)
        rn, pn = self.root(n)
        if rm != rn:
            if -self.parent[rm] < -self.parent[rn]:
                rm, rn = rn, rm
            self.parent[rm] += self.parent[rn]
            self.parent[rn] = rm
            self.parity[rn] = (pm + pn + parity) % 2

    def size(self, n):
        return -self.parent[self.root(n)]
    
    def aresame(self, m, n):
        return self.root(m) == self.root(n)

N, M = inpl()
pt = ParityTree(N)
for i in range(M):
    X, Y, Z = inpl()
    pt.merge(X-1,Y-1,Z)

print(len(np.where(np.array(pt.parent)<0)[0]))

Measured memory_bytes: 16072
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep1n(i,n) for(int i=1; i<=(n); ++i)
#define repxn(i,x,n) for(int i=x; i<=(n); ++i)
#define sort_u(x) sort((x).begin(),(x).end())
#define sort_d(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
#define INF 1001001001  // 浮動小数点型
#define INF_L 1001001001001001001  // 浮動小数点型
#define bit(n,m)(((n)>>(m))&1)  // nのmビット目が1
#define MOD 1000000007
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};
 
mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}
 
mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}
 
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  mint ans = f(n);
  ans -= 1;
  ans -= choose(n,a);
  ans -= choose(n,b);
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 3524
/*   _/                _/                 _/_/_/   _/
  _/_/_/_/   _/_/   _/_/_/_/   _/_/    _/       _/_/
   _/     _/    _/   _/     _/    _/  _/_/_/     _/
  _/     _/    _/   _/     _/    _/  _/    _/   _/
   _/_/   _/_/       _/_/   _/_/      _/_/     _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<set>
#include<map>
#include<queue>
#include<vector>
using namespace std;
using ll=long long;
const int MOD=1e9+7;
const double pi=3.14159265358979323846;
const int inf=2e9;
const ll INF=1e18;
using P=pair<int,int>;
int main() {
  cin.tie(0),cout.tie(0);
  ios::sync_with_stdio(false);
  int m1,d1,m2,d2;
  cin >> m1 >> d1 >> m2 >> d2;
  cout << (m1!=m2?1:0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef double  dbl;
typedef long long int lld;
#define PI 3.14159265358979323
#define foi(i,n) for(i = 0; i < n; i+=1)
#define fod(i,n) for(i=n-1; i >=0; i-=1)
#define MAX std::numeric_limits<lld>::max()
#define MIN std::numeric_limits<lld>::min()
#define FastIO  ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int main ()
{
	FastIO
	lld n, i;
	cin >> n;
	lld A[n];
	foi(i, n)
	{
		cin >> A[i];
	}
	lld s =0;
	foi(i, n)
	{
		for(lld j = i+1; j < n; j+=1)
		{
			s += (A[i]*A[j]);
 		}
	}
	cout <<s;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

   class Main{
      public static void main(String args[]){
       Scanner scan = new Scanner(System.in);

       int n =scan.nextInt();
       int numt =0;
       int numh =0;

        for(int i=0;i<n;i++){

           String tarou = scan.next();
           String hanako = scan.next();
           boolean a = true;

          for(int i2 =0;i2<Math.min(tarou.length(),hanako.length());i2++){

             int x =(int)tarou.charAt(i2);
             int y =(int)hanako.charAt(i2);

                if(x>y){

                   numt+=3;
                   a = false;
                   break;

                }else if(x<y){

                   numh+=3;
                   a = false;
                   break;

                }

          }

                if(a){

                   if(tarou.length()>hanako.length()){

                      numt+=3;

                   } else if(hanako.length()>tarou.length()){

                      numh+=3;

                   } else {

                      numt++;
                      numh++;

                   }

                }

        }

           System.out.println(numt+" "+numh);

       }
   }


Measured memory_bytes: 28984
import sys
import decimal # 10進法に変換，正確な計算

def input():
    return sys.stdin.readline().strip()

def main():
    s = input()
    t = input()
    count = 0
    for i in range(3):
        if s[i] == t[i]:
            count += 1
    print(count)    
    
main()


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

using namespace std;

int main(){

	int a, b, c, d, e;

	cin>>a>>b>>c>>d>>e;

	if( a <40 ) a = 40;

	if( b <40 ) b = 40;

	if( c <40 ) c = 40;

	if( d <40 ) d = 40;
 
	if( e <40 ) e = 40;

        cout<<(a+b+c+d+e)/5<<endl;

	return 0;

	}  


Measured memory_bytes: 3084
n = int(input())
val = {}
c = []
for i in range(n):
    a,b = input().split()
    if a in val:
         val[a].append(int(b))
         c.append(int(b))
    else : 
        val[a] = [int(b)]
        c.append(int(b))

val_1 = sorted(val.items(),key= lambda x:x[0])

d = []
for i in range(len(val_1)):
    if len(val_1[i]) == 1 :
        d.append(val_1[i][1][0])
    else:
        val_1[i][1].sort(reverse= True)
        for h in val_1[i][1]:
            d.append(h)


for i in d :
    for j in range(n):
        if i == c[j]:
            print("{}".format(j+1))

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

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

Measured memory_bytes: 4052
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
#define REP(i,m,n) for(LL i=(m);i<(n);i++)
	//i=m -> n-1(昇順)
#define RREP(i,m,n) for(LL i=(m);i>=(n);i--)
	//i=m -> n(降順)

int main(){
  LL x,count=0,money=100;
  cin >> x;
  
  while(money < x){
    money += money/100;
    count++;
  }
  
  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
using pii = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1 << 29;
const int N =  1e5 + 10;
 
struct IOsetup{
  IOsetup(){
   ios_base::sync_with_stdio(false);
   cin.tie(nullptr);
   cout.tie(nullptr);
   cout << fixed << setprecision(8);
  }
}IO;

int go(int n){
 if (n <= 0) return 0;
 return 1 + 2 * go(n >> 1);
}

int32_t main(){
 int n;
 cin >> n;
 cout << go(n) << endl;
}



Measured memory_bytes: 256
n = int(raw_input())

deglist = []
for i in range(n):
	deglist.append(int(raw_input()))

min = 10**9
max_profit = -(10**9)
for j in range(1,len(deglist)):
	if min > deglist[j-1]:
		min = deglist[j-1]
	if max_profit < deglist[j] - min:
		max_profit = deglist[j] - min
	#print("*{:}".format(max_profit))

print max_profit

Measured memory_bytes: 18980
s,t=list(input()),list(input())
for i in reversed(range(len(s)-len(t)+1)):
	flag=1
	for j in range(i,i+len(t)):
		if s[j]!='?' and s[j]!=t[j-i]:
			flag=0
			break
	if flag:
		ans=""
		for j in range(len(s)):
			if j in range(i,i+len(t)):
				ans+=t[j-i]
			elif s[j]=='?':
				ans+="a"
			else:
				ans+=s[j]
		print(ans)
		break
else:
	print("UNRESTORABLE")

Measured memory_bytes: 38384
using System;
using System.Linq;

public class Program
{
	public static void Main()
	{
		int N = int.Parse(Console.ReadLine());
		var A = Console.ReadLine().Split().Select(int.Parse);
		int odd = A.Count(item => item % 2 == 1);
		Console.WriteLine(odd % 2 == 0 ? "YES" : "NO");
	}
}

Measured memory_bytes: 11992
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;

//INSERT ABOVE HERE
signed main(){
  Int n,a,b,c,d;
  cin>>n>>a>>b>>c>>d;
  a--;b--;c--;d--;
  string s;
  cin>>s;
  s+="##";

  auto NG=[](){cout<<"No"<<endl;exit(0);};  
  if(c<d){
    while(b<d){
      if(s[b+1]!='#') b++;
      else if(s[b+2]!='#') b+=2;
      else break;
    }
    if(b!=d) NG();
    while(a<c){
      if(s[a+1]!='#') a++;
      else if(s[a+2]!='#') a+=2;
      else break;
    }
    if(a!=c) NG();
    cout<<"Yes"<<endl;
  }else{    
    while(s[b-1]=='#'||s[b+1]=='#'){
      if(s[b+1]!='#') b++;
      else if(s[b+2]!='#') b+=2;
      else break;
    }
    if(s[b-1]=='#'||s[b+1]=='#') NG();    
    while(a+1<b){
      if(s[a+1]!='#') a++;
      else if(s[a+2]!='#') a+=2;
      else break;
    }
    if(a+1!=b) NG();
    a+=2;
    while(a<c){
      if(s[a+1]!='#') a++;
      else if(s[a+2]!='#') a+=2;
      else break;
    }
    if(a!=c) NG();
    while(b<d){
      if(s[b+1]!='#') b++;
      else if(s[b+2]!='#') b+=2;
      else break;
    }
    if(b!=d) NG();
    cout<<"Yes"<<endl;
  }  
  return 0;
}


Measured memory_bytes: 592
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int nx[4]={0,1,-1,0};
int ny[4]={1,0,0,-1};
int main(){
  ll n;
  string s;
  cin>>s;
  n=sz(s);
  vll a(6*100000);
  for(int i=1;i<sz(a);i++){
    a[i]=i+a[i-1];
  }
  ll cu=0;
  ll ccuu=0;
  ll ans=0;
  rep(i,n-1){
    if(s[i]=='<'&&s[i+1]=='<'){
      cu++;
    }
    else if(s[i]=='<'&&s[i+1]=='>'){
      cu++;
    }
    else if(s[i]=='>'&&s[i+1]=='>'){
      ccuu++;
    }
    else if(s[i]=='>'&&s[i+1]=='<'){
      ccuu++;
      ll k=max(cu,ccuu);
      ans+=a[k];
      ll j=min(cu,ccuu);
      if(j==0) j=1;
      ans+=a[j-1];
      cu=0;
      ccuu=0;
    }
  }
  if(s[n-1]=='<'){
    cu++;
    ans+=a[cu];
  }
  else{
    ccuu++;
    ll k=max(cu,ccuu);
      ans+=a[k];
      ll j=min(cu,ccuu);
      if(j==0) j=1;
      ans+=a[j-1];
  }
  COUT(ans);
}


Measured memory_bytes: 5508
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define endl '\n'
int main()
{
    int x, y;
    cin >> x >> y;
    string h;
    cin >> h;
    string ans;
    for (int i = 0; i < x; i++)
    {
        if (i == y - 1)
            ans +=tolower(h[i]);
            else
            {
                ans+=h[i];
            }
            
    }
cout<<ans<<endl;
    return 0;
}

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

int main(){

  ll n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(),a.end());
  bool check = true;

  if (n%2 == 0) {//n:even
    for (int i = 0; i < n; i = i + 2) {
      if (!(i + 1 == a.at(i) && i + 1 == a.at(i+1))) {
        check = false;
        break;
      }
    }
  } else {//n:odd
    for (int i = 1; i < n; i = i + 2) {
      if (a.at(1) == 0 || a.at(0) != 0) {//0は1こまでou最初は0
        check = false;
        break;
      }

      if ((i + 1 == a.at(i) && i == a.at(i+1))) {
        check = false;
        break;
      }
    }
  }

  if (check) {
    ll ans = 1;
  	for (long i = 1; i <= n / 2; i++) {
  		ans = (ans * 2) % 1000000007;
  	}
  	cout << ans << endl;
     } else {
    cout << "0" << endl;
  }
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	cout<<(n%k?1:0)<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <math.h>


void koch(double start_x, double start_y, double end_x, double end_y, int n){
    
    if (n==0) {
        return;
    }
   
    double s_x = (end_x + start_x*2)/3;
    double t_x = (end_x*2 + start_x)/3;
    
    double s_y = (end_y + start_y*2)/3;
    double t_y = (end_y*2 + start_y)/3;
    
    double u_x = (t_x - s_x) / 2 - (t_y - s_y) * sqrt(3) / 2   + s_x;
    double u_y = (t_x - s_x) * sqrt(3) / 2 + (t_y - s_y) / 2   + s_y;
    
    koch(start_x, start_y, s_x, s_y, n-1);
    printf("%f %f\n", s_x, s_y);
    
    koch(s_x, s_y, u_x, u_y, n-1);
    printf("%f %f\n", u_x, u_y);
    
    koch(u_x, u_y, t_x, t_y, n-1);
    printf("%f %f\n", t_x, t_y);
    
    koch(t_x, t_y, end_x, end_y, n-1);

    return;
}

int main( ){
    
    int n;
    
    scanf("%d", &n);
    
    printf("0.00000000 0.00000000\n");
    koch(0.0, 0.0, 100.0, 0.0, n);
    printf("100.00000000 0.00000000\n");
    
    
    return 0;
}

Measured memory_bytes: 644
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
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;
}
int main(){
    ll h,w,k;cin >> h >> w >> k;
    vector<string> g(h);rep(i,h)cin >> g[i];
    ll black=0;
    rep(i,h)rep(j,w)if(g[i][j]=='#')black++;
    ll ans=0;
    rep(bit,1<<h){
        rep(cit,1<<w){
            ll res=0;
            rep(i,h){
                rep(j,w){
                    if((bit&(1<<i))||(cit&(1<<j))){
                        if(g[i][j]=='#')res++;
                    }
                }
            }
            if(black-res==k)ans++;
        }
    }
    cout << ans <<endl;
}   

Measured memory_bytes: 3624
var
	n,k,ans,now,i,j,x,y:Longint;
	c:Char;
	w:array[0..4000,0..4000]of Longint;
function f(u,v:Longint):Longint;
begin
	f:=w[u+k,v+k]-w[u,v+k]-w[u+k,v]+w[u,v];
end;
begin
	read(n,k);
	for i:=1 to n do begin
		read(x,y,c,c);
		if c='B' then inc(x,k);
		x:=x mod(2*k);
		y:=y mod(2*k);
		inc(w[x+1+k,y+1+k]);
	end;
	for i:=1 to 4*k do for j:=1 to 4*k do inc(w[i,j],w[i-1,j]+w[i,j-1]-w[i-1,j-1]);
	for i:=0 to k-1 do for j:=0 to k-1 do begin
		now:=f(i,j)+f(i+k,j+k)+f(i+2*k,j)+f(i,j+2*k)+f(i+2*k,j+2*k);
		if now>ans then ans:=now;
		now:=f(i+k,j)+f(i,j+k)+f(i+2*k,j+k)+f(i+k,j+2*k);
		if now>ans then ans:=now;
	end;
	writeln(ans);
end.


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

int main(){
    string s; int q;
    cin>>s>>q;
    deque<char>dq;
    rep(i,s.size()){
        dq.push_back(s[i]);
    }
    bool mirror=false;
    rep(i,q){
        int t; cin>>t;
        if(t==1){
            mirror=!mirror;
        }
        else{
            int f; char c; cin>>f>>c;
            if(mirror==false){
                if(f==1)dq.push_front(c);
                else dq.push_back(c);
            }
            else{
                if(f==2)dq.push_front(c);
                else dq.push_back(c);
            }
        }
    }
    if(!mirror){
        rep(i,dq.size()){
            cout<<dq[i];
        }
    }
    else{
        for(int i=dq.size()-1; i>=0; --i){
            cout<<dq[i];
        }
    }
}

Measured memory_bytes: 896
numberOfToorists = int(input())

minimumCapacity = 10.0**16

for i in range(5):
	vehicleCapacity = int(input())
	minimumCapacity = min(minimumCapacity, vehicleCapacity)

bottleNeckTime = int(numberOfToorists / minimumCapacity)

if numberOfToorists % minimumCapacity > 0:
	bottleNeckTime += 1

requiredTime = bottleNeckTime + 4

print(requiredTime)

Measured memory_bytes: 3188
N = int(input())
A = [int(i) for i in input().split(' ')] 
B = [int(i) for i in input().split(' ')]
C = [int(i) for i in input().split(' ')]

s = 0
last = -2
for j in range(N):
    s += B[A[j]-1]
    if A[j] == last+1:
      s += C[last-1]
    last = A[j]
    
print(s)

Measured memory_bytes: 3064
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	static Scanner scanner;
	public static void main(String[] args) {
	    scanner = new Scanner(System.in);


	    int N=gi();
	    long[] A=new long[N+1];
	    long[] mp=new long[N+1];
	    long[] pm=new long[N+1];
	    long mpw=0;
	    long pmw=0;

        for (int i=1; i<=N; i++) {
            A[i]=gi();
        }

        for (int i=1; i<=N; i++) {
            if(i%2==1) {
            	if(mpw + A[i]>=0) {
            		mp[i]=mp[i-1]+ mpw+A[i]+1;
            		mpw=-1;
            	} else {
            		mp[i]=mp[i-1];
            		mpw=mpw + A[i];
            	}

            	if(pmw + A[i]<=0) {
            		pm[i]=pm[i-1]+ Math.abs(pmw+A[i])+1;
            		pmw=1;
            	} else {
            		pm[i]=pm[i-1];
            		pmw=pmw + A[i];
            	}
            } else {
            	if(mpw + A[i]<=0) {
            		mp[i]=mp[i-1]+ Math.abs(mpw+A[i])+1;
            		mpw=1;
            	} else {
            		mp[i]=mp[i-1];
            		mpw=mpw + A[i];
            	}

            	if(pmw + A[i]>=0) {
            		pm[i]=pm[i-1]+ pmw+A[i]+1;
            		pmw=-1;
            	} else {
            		pm[i]=pm[i-1];
            		pmw=pmw + A[i];
            	}
            }
        }

        System.out.println(Math.min(mp[N], pm[N]));

//        if(ans==0) {
//
//		    System.out.println("Yes");
//        } else {
//        	System.out.println("No");
//
//        }
	}

	public static List<Integer> insuB(int n) {
		List<Integer> l=new ArrayList<Integer>();
		int i=2;
		while(n!=1) {
			if (n%i==0) {
				l.add(i);
				n/=i;
			} else {
				i++;
			}
		}
		return l;
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 62500
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		long a=sc.nextLong(),b=sc.nextLong(),x=sc.nextLong();
		System.out.println(a%x==0?b/x-a/x+1:b/x-a/x);
		sc.close();
	}
}

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

int main() {
  int n, x, t;
  cin >> n >> x >> t;
  cout << (n + x - 1) / x * t << endl;
}

Measured memory_bytes: 3620
K = int(input())
A = [1,2,3,4,5,6,7,8,9]
for i in range(len(A)):
    if A[i] != 9:
        for j in range(-1,2):
            a = int(str(A[i]) + str(A[i]+j))
            A.append(a)
    else:
        A.append(98)
        A.append(99)
A.append(100)
A.append(101)
L1 = len(A.copy())
for i in range(10,L1):
    B = A[i]
    if B % 10 == 0:
        A.append(int(str(B) + '0'))
        A.append(int(str(B) + '1'))
    elif B % 10 == 9:
        A.append(int(str(B) + '8'))
        A.append(int(str(B) + '9'))
    else:
        for j in range(-1, 2):
            a = int(str(B) + str((B % 10) + j))
            A.append(a)
L2 = len(A.copy())
for i in range(L1,L2):
    B = A[i]
    if B % 10 == 0:
        A.append(int(str(B) + '0'))
        A.append(int(str(B) + '1'))
    elif B % 10 == 9:
        A.append(int(str(B) + '8'))
        A.append(int(str(B) + '9'))
    else:
        for j in range(-1, 2):
            a = int(str(B) + str((B%10) + j))
            A.append(a)
L3 = len(A.copy())
for i in range(L2,L3):
    B = A[i]
    if B % 10 == 0:
        A.append(int(str(B) + '0'))
        A.append(int(str(B) + '1'))
    elif B % 10 == 9:
        A.append(int(str(B) + '8'))
        A.append(int(str(B) + '9'))
    else:
        for j in range(-1, 2):
            a = int(str(B) + str((B % 10) + j))
            A.append(a)
L4 = len(A.copy())
for i in range(L3,L4):
    B = A[i]
    if B % 10 == 0:
        A.append(int(str(B) + '0'))
        A.append(int(str(B) + '1'))
    elif B % 10 == 9:
        A.append(int(str(B) + '8'))
        A.append(int(str(B) + '9'))
    else:
        for j in range(-1, 2):
            a = int(str(B) + str((B % 10) + j))
            A.append(a)
L5 = len(A.copy())
for i in range(L4,L5):
    B = A[i]
    if B % 10 == 0:
        A.append(int(str(B) + '0'))
        A.append(int(str(B) + '1'))
    elif B % 10 == 9:
        A.append(int(str(B) + '8'))
        A.append(int(str(B) + '9'))
    else:
        for j in range(-1, 2):
            a = int(str(B) + str((B % 10) + j))
            A.append(a)
L6 = len(A.copy())
for i in range(L5,L6):
    B = A[i]
    if B % 10 == 0:
        A.append(int(str(B) + '0'))
        A.append(int(str(B) + '1'))
    elif B % 10 == 9:
        A.append(int(str(B) + '8'))
        A.append(int(str(B) + '9'))
    else:
        for j in range(-1, 2):
            a = int(str(B) + str((B % 10) + j))
            A.append(a)
L7 = len(A.copy())
for i in range(L6,L7):
    B = A[i]
    if B % 10 == 0:
        A.append(int(str(B) + '0'))
        A.append(int(str(B) + '1'))
    elif B % 10 == 9:
        A.append(int(str(B) + '8'))
        A.append(int(str(B) + '9'))
    else:
        for j in range(-1, 2):
            a = int(str(B) + str((B % 10) + j))
            A.append(a)
L8 = len(A.copy())
for i in range(L7,L8):
    B = A[i]
    if B % 10 == 0:
        A.append(int(str(B) + '0'))
        A.append(int(str(B) + '1'))
    elif B % 10 == 9:
        A.append(int(str(B) + '8'))
        A.append(int(str(B) + '9'))
    else:
        for j in range(-1, 2):
            a = int(str(B) + str((B % 10) + j))
            A.append(a)
A = sorted(A)
# print(A)
print(A[K-1])



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

int main(){
  long long int N,A,min=100000000000000;
  cin >>N;
  for(long long int i=1;i<=sqrt(N);i++){
    
    if(N%i==0){
      A=i+(N/i)-2;
      if(min>A)
	min=A;

    }
  }

  cout <<A<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
typedef stringstream SS;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
SS ss;
#define debug ss
#endif

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n);i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<=(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define X second
#define Y first
#define p_queue(n) priority_queue<n,vector<n>,greater<n> >
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

int dp[3010][3010];
int n,t,s;
int a[3010],b[3010];

int main() {
	cin>>n>>t>>s;
	rep(i,n)cin>>a[i+1]>>b[i+1];
	rep(i,t+1)rep(j,n+1){
		if(j==0)dp[i][j]=0;
		else if(i<b[j])dp[i][j]=dp[i][j-1];
		else if(i-b[j]<s&&s<i)dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
		else dp[i][j]=max(dp[i-b[j]][j-1]+a[j],dp[i][j-1]);
	}
	cout<<dp[t][n]<<endl;
	return 0;
}

Measured memory_bytes: 35000
#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;


int main() {
#ifndef ONLINE_JUDGE
	freopen("inp.txt", "r", stdin);		freopen("outp.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);

	ll n;	cin >> n;

	ll ans = 0;

	vector <pair <ll, ll>> v(n);

	vector <vector <ll>> dp(n + 2, vector <ll> (n + 2, 0));

	for (ll i = 0; i < n; i++) {
		ll temp;	cin >> temp;

		v.push_back({temp, i});
	}

	sort (v.begin(), v.end(), greater <pair <ll, ll>> ());

	for (ll i = 0; i < n; i++) {

		ll pos = v[i].ss, val = v[i].ff;

		for (ll j = 0; j <= i; j++) {

			ll x = j, y = i - j;

			dp[x + 1][y] = max(dp[x + 1][y], dp[x][y] + val * abs(x - pos));
			dp[x][y + 1] = max(dp[x][y + 1], dp[x][y] + val * abs(n - 1 - y - pos));

		}	

	}

	for (ll i = 0; i < n; i++) {
		ans = max(ans, dp[i][n - i]);
	}

	cout << ans << endl;

	return 0;
}

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

int main(){
      int n;cin >> n;
      vector<int> v;
      for(int i = 0;i < n;i++){
            int ans = 0;
            int t;cin >> t;
            if(t & 1)return cout << 0, 0;
            while(!(t & 1)){
                  ans++;
                  t = t >> 1;
            }
            v.push_back(ans);
      }
      cout << *min_element(v.begin(), v.end());
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int read()
{
	int ret=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') ret=(ret<<3)+(ret<<1)+ch-'0',ch=getchar();
	return ret*f;
}
int main()
{
    int k=read(),s=read(),h=0;
    for(int a=0;a<=k;a++)
    {
    	if(a>s) break;
    	for(int b=0;b<=k;b++)
    	{
    		if(a+b>s) break;
    		if(s-a-b>=0&&s-a-b<=k) h++;
    	}
    }
    printf("%d",h);
    return 0;
}

Measured memory_bytes: 256
n = int(input())

connect_list = [ [] for i in range(n) ]
distance_list = [ -1 for i in range(n) ]
color_list = [ "Gray" for i in range(n) ]
distance_list[0] = 0

for i in range(n-1):
	u, v, w = [ int(v) for v in input().split() ]
	w %= 2
	connect_list[u-1].append((v-1,w))
	connect_list[v-1].append((u-1,w))
	

search_list = [0]


while search_list != []:
	s = search_list[0]
	for i in connect_list[s]:
		if distance_list[i[0]] == -1:
			distance_list[i[0]] = (distance_list[s] + i[1]) % 2
			search_list.append(i[0])
	del search_list[0]

for i in distance_list:
	print(i)

Measured memory_bytes: 36376
package main

import "fmt"

func sumDigists(n int) int {
	sum := 0;
	if n < 10 {
		return n
	} else {
		for n > 0 {
			sum += n % 10
			n /= 10
		}
	}
	return sum
}

func main() {
	var N, A, B int
	fmt.Scan(&N, &A, &B)
	var result int
	for i:=0; i <= N; i++ {
		if A <= sumDigists(i) && sumDigists(i) <= B {
			result += i
		}
	}

	fmt.Println(result)
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
int E,Y;
cin >> E >> Y;
if(E==0){
if(1868<=Y&&Y<=1911){
Y=1911-Y;
Y=44-Y;
cout << "M" << Y << endl;
}else if(1912<=Y&&Y<=1925){
Y=1925-Y;
Y=14-Y;
cout << "T" << Y << endl;
}else if(1926<=Y&&Y<=1988){
Y=1988-Y;
Y=63-Y;
cout << "S" << Y << endl;
}else if(1989<=Y&&Y<=2016){
Y=2016-Y;
Y=28-Y;
cout << "H" << Y << endl;
}
}else if(E==1){
Y=1868+Y-1;
cout << Y << endl;
}else if(E==2){
Y=1912+Y-1;
cout << Y << endl;
}else if(E==3){
Y=1926+Y-1;
cout << Y << endl;
}else if(E==4){
Y=1989+Y-1;
cout << Y << endl;
}
return(0);
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> V;
#define rep(cnt,e) for(ll cnt=0;cnt<e;cnt++ )
#define allsort(X) sort(X.begin(),X.end())

typedef pair<ll,ll> P;
const ll mod = 1e9+7;
const ll INF = INT64_MAX;






ll i,j,k;


int main(){
   ll X,N;
   cin>>X>>N;
   V p(N);
   rep(i,N)cin>>p[i];
   
   set<ll> kazu;
   rep(i,N)kazu.insert(p[i]);
   ll ans=10000000;
   for(ll i=-101;i<=101;i++){
       if(!kazu.count(i)){
           if(abs(i-X)<abs(ans-X))ans=i;
       }

   }
   cout<<ans<<endl;

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
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; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;
ll const MOD = 998244353;
const ll MAX = 400001;
ll fac[MAX], finv[MAX], inv[MAX];

ll mod_pow(ll a, ll n, ll p) {
  if (n == 0) return 1;
  if (n == 1) return a % p;
  if (n % 2 == 1) return (mod_pow(a, 1, p) * mod_pow(a, n-1, p)) % p;
  ll t = mod_pow(a, n / 2, p);
  return (t * t) % p;
}

void comb_init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long comb(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll n, m, k;
  cin >> n >> m >> k;

  comb_init();
  ll ans = 0;
  rep(i, k+1) {
    ll tmp = mod_pow(m-1, n-1-i, MOD) % MOD;
    tmp = tmp * comb(n-1, i) % MOD;

    ans += tmp;
    ans %= MOD;
  }

  cout << ans * m % MOD << endl;

  return 0;
}


Measured memory_bytes: 13008
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int W = sc.nextInt(), H = sc.nextInt(), x = sc.nextInt(), y = sc.nextInt(), r = sc.nextInt();
        
        if (x <= W-r && x >= r && y <= H-r && y >= r) System.out.println("Yes");
        else System.out.println("No");
    }
}


Measured memory_bytes: 26324
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

plus, minus = 0, 0
for i in range(N):
  if a[i]-b[i] >= 0:
    minus += a[i]-b[i]
  else:
    m = b[i]-a[i]
    plus += (m+1) // 2
    if m%2 == 1:
      minus += 1
    
if plus >= minus:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 10584
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;

#define EPS (1e-7)
#define INF (1e12)
#define PI (acos(-1))

#define amari(x) ((x) % 1000000007)

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end());
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>());
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin();
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin();

#define rep(i,n) for(int i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

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

  long n, a, b, c, d, e;

  cin >> n>>a >> b >> c>> d>>e;

  cout << min(n+4, (n / min(a, min(b, min(c, min(d, e))))) + 5) << endl;

  return 0;
}


Measured memory_bytes: 888
from collections import deque

N = int(input())

q = deque()
for i in range(1, 10):
    q.append(i)

for i in range(N):
    a = q.popleft()
    d = a % 10
    if d > 0:
        q.append(10*a + d - 1)
    q.append(10*a + d)
    if d < 9:
        q.append(10*a + d + 1)

print(a)

Measured memory_bytes: 11968
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <ctime>


#ifndef _USEFUL_MACROS_
#define _USEFUL_MACROS_
#define INF 99999999
#define N_PRIME 1000000007
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define OUTPUT_DEBUG
#ifdef OUTPUT_DEBUG
#define debug(x) cout<<#x<<": "<<x<<endl
#else
#define debug(x) do{}while(false)
#endif
#endif 

using namespace std;

int main(void){
    int n;
    int m = 40000;
    cin >> n;
    vector<bool> table(m);
    vector<int> primes;
    
    REP(i,m)table[i]=true;
    table[0] = false;
    table[1] = false;
    
    FOR(i,2,m){
        if( table[i] ){
            primes.push_back(i);
            for(int j = 0 ; j < m ; j += i )
                table[j] = false;
        }
    }
    
    
    cout << n << ":";
    REP(i,primes.size()){
        int p = primes[i];
        while( n % p == 0 ){
            cout << " " << p;
            n/=p;
        }
    }
    
    if( n != 1 ){
        cout <<" " << n;
    }
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 3224
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int a[240];

int main(){
  int n,l;
  cin >> n >> l;
  int sum = 0;
  bool f = false;
  rep(i,n){
    a[i] = l + i;
    sum += a[i];
    if(a[i] == 0) f = true;
  }
  if(f) cout << sum << endl;
  else{
    if(l > 0) cout << sum -a[0] << endl;
    else cout << sum - a[n-1] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


int main() {
    double l;
    cin >> l;

    l /= 3.0;

    double ans = l*l*l;

    printf("%.10f", ans);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<functional>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
typedef long long int ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<signed(n);i++)
#define EREP(i,n) for(int i=1;i<=signed(n);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
//#define EVEL 1
#ifdef EVEL
#define DEB(X) cout << #X <<":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const ll MOD = 1000000007;
const ll INF = 9e14;
typedef std::pair<ll,ll> P;
struct edge{ int to,cost; };
#define VMAX 100000

ll N,M,X;
ll A,B,C;
string S;
ll ans;
int main(){

    cin>>N>>A;

    cout<<N*N-A<<endl;

}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
#define SORTPairSecond(v, n) sort(v, v+n, pairCompareSecond);
#define int long long    // %d=>%lld, 1<<n  => 1LL<<n
#define pb push_back

using namespace std;
typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
bool pairCompareSecond(const pii& firstEl, const pii& secondEl) {
    return firstEl.second > secondEl.second;
}

const ll MOD = 1000000007;
const int INF = 1000000007;
// const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
// const ll LLINF = 1LL << 50;
const double PI = acos(-1);
const double EPS = 0.000000001;


string s;

signed main(){
    ios::sync_with_stdio(0);
    cin >> s;

    for(int i = 0;i < s.length()-8;i++){
        cout<< s[i];
    }
    cout<< endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
//#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const long long linf = 4523372036854775807;
const int inf = 1500000000;
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	int from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
int fact(int i) {
	ll sum = 1;
	for (int j = 2; j <= i; j++)
		sum = (sum* j) % Mod;
	return sum;
}//階乗(正）
 //---------------------------------------------------
 //+++++++++++++++++++++++++++++++++++++++++++++++++++
vector<int>a[2];
bool dp[2][50000];
string s;
int x, y, n;
bool solve(int x,int y) {
	for (int i = 0; i < 50000; i++)
		dp[0][i] = 0;
	dp[0][25000] = 1;
	int d = 0, t = 1;
	for (int i = 0; i < a[x].size(); i++) {
		for (int j = 0; j < 50000; j++)
			dp[t][j] = 0;
		for (int j = 0; j < 50000; j++) {
			if (dp[d][j]) {
				dp[t][j + a[x][i]] = 1;
				if (!(x == 0 && i == 0) || s[0] == 'T')
					dp[t][j - a[x][i]] = 1;
			}
		}
		swap(d, t);
	}
	if (dp[d][25000 + y])
		return 1;
	else
		return 0;
}
signed main() {
	cin >> s >> x >> y;
	n = s.size();
	int d = 0, t = 1;
	for (int i = 0; i < n; ) {
		if (s[i] == 'T') {
			swap(d, t);
			i++;
		}
		else {
			int j = i;
			while (j < n && s[j] != 'T')
				j++;
			a[d].push_back(j - i);
			i = j;
		}
	}
	if (solve(0, x) && solve(1, y)) {
		cout << "Yes\n";
	}
	else {
		cout << "No\n";
	}
	getchar(); getchar();
}

Measured memory_bytes: 384
N, A, B = map(int, input().split())
count = 0
for i in range(1,N+1):
    n = list(k for k in str(i))
    S_n = 0
    for j in n:
        S_n += int(j)
    if A <= S_n <= B:
        count += i
print(count)

Measured memory_bytes: 9104
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H, W;
  int a[500][500];
  cin >> H >> W;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> a[i][j];
      a[i][j]%=2;
    }
  }
  int ans[H * W][4];
  int count = 0;
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(a[i][j] == 1){
        if(j == W - 1 && i != H - 1){
          ans[count][0] = i + 1;
          ans[count][1] = j + 1;
          ans[count][2] = i + 2;
          ans[count][3] = j + 1;
          count++;
          a[i][j] = 0;
          a[i + 1][j] = (a[i + 1][j] + 1) % 2;
        }else if(j != W - 1){
          ans[count][0] = i + 1;
          ans[count][1] = j + 1;
          ans[count][2] = i + 1;
          ans[count][3] = j + 2;
          count++;
          a[i][j] = 0;
          a[i][j + 1] = (a[i][j + 1] + 1) % 2;
        }
      }
    }
  }
  cout << count << endl;
  for(int i = 0; i < count; i++){
    cout << ans[i][0] << " " << ans[i][1] << " " << ans[i][2] << " " << ans[i][3] << endl;
  }
}

Measured memory_bytes: 6912