akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <stack>
#include <deque>
#include <ctime>
#include <random>
#include <cassert>
#include <cmath>
#include <climits>
#include <queue>
#include <cstring>
#include <bitset>
#include <iomanip>
#include <chrono>

/*
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("popcnt")
#pragma GCC target("avx2")
*/


#ifdef LOCAL
	#define dbg(x) //cout << #x << " : " << x << endl;
#else 
	#define dbg(x)
#endif

#define int long long
#define fi(a,b) for (int i=a;i<b;i++)
#define fj(a,b) for (int j=a;j<b;j++)
#define fk(a,b) for (int k=a;k<b;k++)
#define fi1(a,b) for (int i=a-1;i>=b;i--)
#define fj1(a,b) for (int j=a-1;j>=b;j--)
#define fk1(a,b) for (int k=a-1;k>=b;k--)
#define fx(x,a) for (auto& x : a)
#define rep(i, a, b) for (int i = a; i < b; ++i)
#define rep1(i, a, b) for (int i = a - 1; i >= b; --i)
#define siz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

using namespace std;

template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }

ostream& operator << (ostream &a, const vector<int> &b) {
    for (auto k : b) cout << k << ' ';
    return a;
}


typedef long long ll;
typedef unsigned long long ull;
typedef char ch;
typedef string str;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<vpii> vvpii;
typedef vector<ch> vch;
typedef vector<vch> vvch;
typedef vector<str> vs;



const int MOD = 1000000007;
const int INF = 1000000050;
const long long BIG = (long long)2e18 + 50;
const int MX = 200010;
const double EPS = 1e-9;


mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int a, b;
    cin >> a >> b;
    fi(1, 10000) {
        if (i * 2 / 25 == a && i / 10 == b) {
            cout << i << '\n';
            return 0;
        }
    }
    cout << "-1\n";
}


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

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


int main(void){
    ll n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    
    ll ans = 0;
    rep(i,n-1){
        if(s[i]==s[i+1])ans++;
    }
    ans += 2*k;
    cout << min(n-1,ans)<<'\n';
    return 0;
    
}

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

int main(){
  string s;
  cin >> s;
  while(!s.empty()){
    int len = s.length();

    int dream_id = s.rfind("dream");
    int dreamer_id = s.rfind("dreamer");
    int erase_id = s.rfind("erase");
    int eraser_id = s.rfind("eraser");
            // cout << dream_id << endl
            // << dreamer_id << endl
            // << erase_id << endl
            // << eraser_id << endl;
    if(dream_id == len - 5){
      s.erase(dream_id);
    }else if(dreamer_id == len - 7 && len >= 7){
      s.erase(dreamer_id);
    }else if(erase_id == len - 5){
      s.erase(erase_id);
    }else if(eraser_id == len - 6 && len >= 6){
      s.erase(eraser_id);
    }else{
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 640
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

ll n, a, b;
vector<ll> h;

void solve() {
    ll s = 0, e = inf;
    while (e - s > 1) {
        ll t = (e + s) / 2;
        ll temp = 0;
        rep(i, n) {
            if (h[i] - b * t > 0) temp += (ll(ceil((h[i] - b * t) / double(a - b))));
        }
        if (t >= temp) e = t;
        else s = t;
    }
    cout << e << endl;
}

int main() {
    cin >> n >> a >> b;
    h.resize(n);
    rep(i, n) cin >> h[i];
    solve();
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main() {
	int M[3][3], O[3][3];
	int bingo = 0;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			scanf("%d", &M[i][j]);
		}
	}
	int N, X;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		scanf("%d", &X);
	    for (int i = 0; i < 3; i++) {
		    for (int j = 0; j < 3; j++) {
		        if (M[i][j] == X) {
		        	O[i][j] = 1;
	            }
            }
		}
	}
	
	if (O[0][0] + O[1][1] + O[2][2] == 3 || O[0][2] + O[1][1] + O[2][0] == 3) {
		printf ("Yes\n");
		return 0;
	}
	for (int i = 0; i < 3; i++) {
		if (O[i][0] + O[i][1] + O[i][2] == 3 || O[0][i] + O[1][i] + O[2][i] == 3) {
			printf ("Yes\n");
			return 0;
		}
	}
	printf ("No\n");
	return 0;
}

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

const int64_t MOD= 1000000007;
const int Nfac= 2000007;
#define MEMORY 0 // 1/0: 階乗を配列に格納をする前処理をする/しない
/* 剰余環 Z/nZ */
struct mint{ // Z/nZ に関する演算(n:素数の場合は除算も)をサポートする構造体
  int64_t rep; // 出力すべき代表元 rep \in {0,1,..,MOD- 1}
  mint(int64_t x=0): rep(((x%MOD)+ MOD)% MOD){}
  mint operator-() const { return mint(-rep);}
  mint& operator+=(const mint& x){
    rep+= x.rep; 
    if(rep>= MOD) rep-= MOD;
    return *this;
  }
  mint& operator-=(const mint& x){
    rep-= x.rep;
    if(rep< 0) rep+= MOD;
    return *this;
  }
  mint& operator*=(const mint& x){
    rep*= x.rep; rep%= MOD;
    return *this;
  }
  mint operator+(const mint x) const {
    mint ans(*this);
    ans+= x;
    return ans;
  }
  mint operator-(const mint x) const {
    mint ans(*this);
    ans-= x;
    return ans;
  }
  mint operator*(const mint x) const {
    mint ans(*this);
    ans*= x;
    return ans;
  }

  mint pow(int64_t d) const{ // d \geq 0
    if(d==0) return 1;
    else{
      mint ans= pow(d>>1);
      ans*= ans;
      if(d&1){ ans*= *this; }

      return ans;
    }
  }

  friend ostream& operator << (ostream &os, const mint& x) noexcept{
      return os << x.rep;
  }
  // MOD が素数(<=> Z/nZ が体)のとき
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint& x){
    *this *= x.inv();
    return *this;
  }
  mint operator/(const mint x) const {
    mint ans(*this);
    ans/= x;
    return ans;
  }
};

/* 階乗,二項係数 */
#if (MEMORY==1)
// 前処理として,階乗を配列に格納をするver.
vector<mint> mfac(Nfac+1), ifac(Nfac+1);
void fact_modp_init(int N= Nfac){
  mfac.at(0)= 1;
  mint buf;
  for(int i=1; i<=N; i++){
    buf= i;
    mfac.at(i)= mfac.at(i-1)* buf;
  }

  ifac.at(N)= mfac.at(N).inv();
  for(int i=N; i>0; i--){
    buf= i;
    ifac.at(i-1)= ifac.at(i)* buf;
  }
}
#else
// 前処理を回避するver.
void fact_modp_init(int N= Nfac){}
mint mfac(int N){
  mint ans= 1;
  mint buf;
  for(int i=1; i<=N; i++){
    buf= i;
    ans*= buf;
  }

  return ans;
}
#endif
// ^^^ テンプレここまで ^^^
mint binom_modp(int n, int k){ // nが大きくmfac(n)の計算量が膨大だが, kは十分小さい場合
  k= min(k, n-k);
  if(n < 0 || k < 0) return 0;
  
  mint ans= 1;
  for(int i=1; i<=k; i++){
    mint num= n-i+1;
    ans*= num;
  }
  ans/= mfac(k);

  return ans;
}

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

  mint t= 2;
  
  cout << t.pow(N)- 1- binom_modp(N, a)- binom_modp(N, b) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, s=0;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  vector<int> C(N-1);
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  for(int i = 0; i < N; i++){
    cin >> B[i];
  }
  for(int i = 0; i < N-1; i++){
    cin >> C[i];
  }
  for(int i = 0; i < N-1; i++){
    s += B[i];
    if(A[i+1]==A[i]+1){
      s+=C[A[i]-1];
    }
  }
  s += B[N-1];
  cout << s << endl;
}

Measured memory_bytes: 256
//*********Abhay is awesome *************\

#include<bits/stdc++.h>


#define pb push_back
#define popb pop_back
#define mt make_tuple 
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define piii pair<int,pii>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define repc(i,a,n) for(int i=a;i<n;++i)
#define  repd(i,a,n) for(int i=a;i>n;--i)

using namespace std;
using ll = long long;
const ll N = 3*1e5 +5 ;
const ll mod = 1e9+7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;

typedef vector<ll> vi;


void solve(){
	ll x,y,a,b,c;
	cin>>x>>y>>a>>b>>c;
	vi p(a),q(b),r(c);
	vector<pii> v1;
	//db1(x+y);
	rep(i,a)cin>>p[i];
	rep(i,b)cin>>q[i];
	rep(i,c)cin>>r[i];
	sort(p.begin(),p.end());
	sort(q.begin(),q.end());
	sort(r.begin(),r.end());
	//rep(i,a)cout<<p[i];
	rep(i,a)v1.pb(mp(p[i],1));
	rep(i,b)v1.pb(mp(q[i],2));
	rep(i,c)v1.pb(mp(r[i],3));
	sort(v1.begin(), v1.end()); 
	ll sum=0,countx=0,county=0,count=0;
	for(int i= a+b+c-1;;i--){
		if(countx+county+count==x+y)break;
		
		if(v1[i].second==1&&countx<x){countx++;sum+=v1[i].first;}
		if(v1[i].second==2&&county<y){sum+=v1[i].first;county++;}
		if(v1[i].second==3){count++;sum+=v1[i].first;}
	}
	cout<<sum;



	return;
}
	
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	//#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    //freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    //freopen("output1.txt", "w", stdout);
	//#endif
	solve(); 
	return  0;
}



/////////////

// Hello, this is a snippet.

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

const int mod = 1e9+7;

void solve() {
	int n; scanf("%d", &n);
	long long ans = 1;
	for (int i = 1; i <= n; ++i) {
		(ans *= i) %= mod;
	}
	printf("%lld", ans);
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
<?php
 
fscanf(STDIN, '%d', $count);
$num_arr = array_map("intval", explode(" ", trim(fgets(STDIN))));
$min = 0;
$countup = 0;
$flag = 0;
for ($i = 0; $i < $count-1; $i++) {
    $min = $i;
    for ($j = $i+1; $j < $count; $j++) {
        if ($num_arr[$j] < $num_arr[$min]) {
            $min = $j;
            $flag = 1;
        }
    }
    if ($flag) {
        $tmp = $num_arr[$i];
        $num_arr[$i] = $num_arr[$min];
        $num_arr[$min] = $tmp;
        $countup++;
        $flag = 0;
    }
}

echo implode(" ", $num_arr)."\n";
echo $countup."\n";
?>


Measured memory_bytes: 9324
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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

static const double EPS = 1e-8;

int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};

int cost[30][30][30][30];
int visited[30][30];
int W,H;

int main()
{
	while(~scanf("%d %d",&W,&H)){
		if(W==H && H==0) break;
		memset(cost,0,sizeof(cost));
		memset(visited,0x3f,sizeof(visited));

		for(int y=0;y<2*H-1;y++){
			if(y%2==0){
				for(int x=0;x<W-1;x++){
					int n;
					scanf("%d",&n);
					cost[y/2][x][y/2][x+1] = n;
					cost[y/2][x+1][y/2][x] = n;
				}
			}
			else{
				for(int x=0;x<W;x++){
					int n;
					scanf("%d",&n);
					cost[y/2][x][y/2+1][x] = n;
					cost[y/2+1][x][y/2][x] = n;
				}
			}
		}

		priority_queue<PP,vector<PP>,greater<PP> > que;
		que.push(PP(0,P(0,0)));

		visited[0][0] = 0;
		while(!que.empty()){
			int d = que.top().first;
			int x = que.top().second.first;
			int y = que.top().second.second;
			que.pop();

			for(int i=0;i<4;i++){
				int dx = x + tx[i];
				int dy = y + ty[i];
				if(dx < 0 || dx >= W || dy < 0 || dy >= H) continue;
				if(cost[y][x][dy][dx]==1) continue;
				if(visited[dy][dx] <= d+1) continue;

				visited[dy][dx] = d+1;
				que.push(PP(d+1,P(dx,dy)));
			}
		}

		printf("%d\n",visited[H-1][W-1] == 0x3f3f3f3f ? 0 : visited[H-1][W-1] + 1);
	}
}

Measured memory_bytes: 4096
#include "bits/stdc++.h"
using namespace std;

int n, s, res[10][330] = { 0 };
bool num[10] = { 0 };
void combinations(int c, int sum) {
	if (c == 11) return ;
	for (int i = 0; i < 10; i++) {
		if (num[i]) continue;
		num[i] = 1;
		++res[c + 1][sum + i * (c + 1)];
		combinations(c + 1, sum + i * (c + 1));
		num[i] = 0;
	}
}

int main() {
	combinations(0, 0);
	while (cin >> n) {
		cin >> s;
		if (s > 330) {
			n = 0;
			s = 0;
		}
		cout << res[n][s] << endl;
	}
	return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ll n,s=0;
  cin>>n;
  for(ll i=1;i<=n;i++)
  {
    if((i%3!=0)&&(i%5!=0)){
       s+=i;}
   }
  cout<<s;
  return 0;
}

Measured memory_bytes: 3624
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())

a, b = nm()

if a >= 13:
    print(b)
elif 6 <= a <= 12:
    print(b // 2)
else:
    print(0)

Measured memory_bytes: 3316
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>
#include <numeric>

using namespace std;

#define mod 1000000007

int main()
{
	string s;
	cin >> s;
	for(int i = 0; i < 3; i++){
		if(s[i] == s[i + 1]){
			cout << "Bad" << endl;
			return 0;
		}
	}
	cout << "Good" << endl;
}

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

const long long MOD = 1000000007;

const int MAX = 2000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    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 COM(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(){
    int N, K;
    cin >> N >> K;

    COMinit();

    for (int i = 1; i <= K; ++i) {
        long long ans;
        if (i > N - K + 1) ans = 0;
        else ans = (COM(N-K+1, i) * COM(K-1, i-1)) % MOD;
        cout << ans << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  int h[3];
  repr(i, 0, 3) {
    h[i] = n % 60;
    n /= 60;
  }

  printf("%d:%d:%d\n", h[0], h[1], h[2]);
}



Measured memory_bytes: 3184
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<algorithm>
#include<iostream>

using namespace std;

struct Vec{
	int ind;
	int val;
};

bool valDesc( const Vec& left, const Vec& right ) {
    return left.val == right.val  ? left.val> right.val: left.val > right.val;
}

bool valAsc( const Vec& left, const Vec& right ) {
    return left.val == right.val  ? left.val <  right.val: left.val < right.val;
}
int main(void){
	int w;
	
	string S;
	vector<int> stable;
	cin >> S;
	scanf("%d",&w);
	for (int i;i<(S.length()+w-1)/w;i++){
		printf("%c",S[i*w]);
	}
	printf("\n");
	fflush(stdout);

	return 0;
}

Measured memory_bytes: 256
s = list(input())
t = int(input())
answer=0

def classify(s):
    ans=0
    for i in range(len(s)-1):
        if s[i] == s[i+1]:
            s[i+1] = '0'
            ans +=1
    return ans

if t == 1:
    print(classify(s))
else:
    s2 = s*2
    s21 = s*2 + list(s[0])
    t2 = t//2
    t2a = t%2
    c1 = classify(s)
    c2 = classify(s2)
    c21 = classify(s21)
    
    if c1*2 == c2:
        answer = c1 * t
    elif c2 == c21:
        #iii type
        answer = c2 * t2 + c1 * t2a
    else:
        answer = c1 * t + t - 1
         
    print(answer)


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

int main()
{
	int a,b,c,d,e,f,g,h;
	cin>>a>>b>>c>>d;
	cin>>e>>f>>g>>h;
	
	int s=a+b+c+d;
	int t=e+f+g+h;
	if(s>t)
	cout<<s<<endl;
	
	else if(s<t)
	cout<<t<<endl;
	
	else if(s==t)
	cout<<s<<endl;
	
	return 0;
}

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

ll r[101010];

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

	int n, p;
	cin >> n >> p;

	vector<ll> w(n), v(n);
	for (int i = 0; i < n; ++i) cin >> w[i] >> v[i];

	int m = 0;
	for (int i = 0; i < n; ++i) m += v[i];

	for (int i = 1; i <= m; ++i) r[i] = 1e18;
	for (int i = 0; i < n; ++i) {
		for (int u = m; u >= v[i]; --u) {
			r[u] = min(r[u], r[u - v[i]] + w[i]);
		}
	}
	for (int i = m; i >= 0; --i) {
		if (r[i] <= p) {
			cout << i << '\n';
			break;
		}
	}
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define sync ios_base::sync_with_stdio(NULL);cin.tie(0);cout.tie(0);
using namespace std;
const int N = 1e5 * 2 + 1;
const int inf = 1e9 + 7;
const int MOD = 1e9 + 7;
const int P = 1e5 + 3;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int bpow(int x, int n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        int k = bpow(x, n / 2);
        return k * k % MOD;
    }
    return bpow(x, n - 1) * x % MOD;
}
int C(int n, int k) {
    int f = 1;
    for (int i = n; i > n - k; i--) {
        f *= i;
        f %= MOD;
    }
    int fk = 1;
    for (int i = 1; i <= k; i++) {
        fk *= i;
        fk %= MOD;
    }
    f = (f * bpow(fk, MOD - 2)) % MOD;
    return f;
}
int f[N], b[N];
signed main() {
    sync;
#ifdef varex
    freopen("test.in", "r", stdin);
    // freopen("test.out", "w", stdout);
#endif
    int n, a, b;
    cin >> n >> a >> b;
    int all = (bpow(2, n) + MOD) % MOD;
    int bad = (C(n, a) + C(n, b) + 1) % MOD;
    int ans = (all - bad + MOD) % MOD;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  char a,b,c;
  cin>>a>>b>>c;
  if(a=='1') cout<<'9';
  else cout<<'1';
  if(b=='1') cout<<'9';
  else cout<<'1';
  if(c=='1') cout<<'9';
  else cout<<'1';
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String s1 = sc.next();
		int n = s.length();
		int n1 = s1.length();
		if(n != n1) {
			System.out.println("NO");
			return;
		}
		for(int i = 0 ; i < n ; i++) {
			if(s.charAt(i) != s1.charAt(n1 - 1 - i)) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}


Measured memory_bytes: 24916
import sys
n = int(input())
s1 = list(input())
s2 = list(input())

li = []
tmp = 1
if n == 1:
    print(3)
    sys.exit()
for i,s in enumerate(s1):
    
    if i == len(s1) - 1:
        break
    #縦
    if s != s1[i+1]:
        li.append(tmp)
        tmp = 1
    #横
    else:
        tmp = 2
# print(li)
# [1, 2, 2, 1, 1, 1, 2, 2, 1, 2, 
#  2, 2, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2]
#print(li)
if s1[-1] == s1[-2]:
    li.append(2)
else:
    li.append(1)
#print(li)
#print(sum(li))
all_count = 1
for j,l in enumerate(li):
    if j == 0:
        if li[0] == 2: 
            all_count *= 6
        else:
            all_count *= 3
        continue
    if l == 2 and li[j-1] == 2:
        all_count *= 3
    elif l == 1 and li[j-1] == 2:
        all_count *= 1
    else:
        all_count *= 2
print(all_count%1000000007)
#print(958681902)




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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    string S;
    cin >> S;
    
    vector<int> A;

    //ベクターnを構成
    for(auto a : S){
        A.push_back(a-'0');
    }
    ll N = S.size();  //nの長さ

    ll dp[12][2][2][2][2][2][2];
    /*
    dp[i][smaller][l][m][n]
    i : 調べている桁
    smaller : 対象の数字未満であることが確定しているならば1、そうでなければ0
    l: 既に3が出ている
    m: 既に5が出ている
    n: 既に7が出ている
    ABC007D参照
    */
    Fill(dp, 0);
    dp[0][0][0][0][0][0][0] = 1;

    for(int i = 0; i < N; i++){
        for(int smaller = 0; smaller < 2; smaller++){
            for(int l = 0; l < 2; l++){
                for(int m = 0; m < 2; m++){
                    for(int n = 0; n < 2; n++){
                        for(int p = 0; p < 2; p++){
                            for(int q = 0; q < 2; q++){
                                for(int x = 0; x <= (smaller ? 9 : A[i]); x++){
                                    if(q==1){
                                        dp[i + 1][smaller || x < A[i]][l || x == 3][m || x == 5][n || x == 7][p || (x!=3 && x!=5 && x!=7)][q || x>0] += dp[i][smaller][l][m][n][p][q]; 
                                    }
                                    else{
                                        dp[i + 1][smaller || x < A[i]][l || x == 3][m || x == 5][n || x == 7][p || (x!=0 && x!=3 && x!=5 && x!=7)][q || x>0] += dp[i][smaller][l][m][n][p][q];
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    ll ans = 0;
    // for(ll i=1; i<=N; i++){
    //     ans += dp[i][0][1][1][1][0][1];
    //     ans += dp[i][1][1][1][1][0][1];
    //     cout << ans << endl;
    // }
    ans += dp[N][0][1][1][1][0][1] + dp[N][1][1][1][1][0][1] + dp[N][0][1][1][1][0][0] + dp[N][1][1][1][1][0][0];
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int mod = 1e9 + 7;
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

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


	int N;
	cin >> N;

	int tmp[100001];
	tmp[0] = 1;
	rep1(i, N) tmp[i] = ll(tmp[i - 1]) * i % mod;
	ll fac = tmp[N - 1];
	ll ifac = modpow(tmp[N], mod - 2);
	for (int i = N; i > 0; i--) {
		tmp[i] = tmp[i - 1] * ifac % mod;
		ifac = ifac * i % mod;
	}

	int kei = 0;
	ll kotae = 0;
	int mae;
	cin >> mae;
	rep1(i, N - 1) {
		int tugi;
		cin >> tugi;
		ll X = tugi - mae;
		kei = (kei + tmp[i]) % mod;
		kotae += kei * X % mod;
		mae = tugi;
	}

	co(kotae % mod * fac % mod);



	Would you please return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

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

	map<int, int> m;

	int T = 0;
	for (int i = 0 ; i < n ; i++) {
		int S;
		cin >> S;
		m[S] += 1;
		T += S;
	}

	if (T % 10 == 0) {
		for (auto it = m.begin() ; it != m.end() ; it++) {
			if (it->first % 10 != 0) {
				T -= it->first;
				break;
			}
		}
		if (T % 10 == 0) {
			T = 0;
		}
	}

	cout << T << endl;

	return 0;
}


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

int main(void)
{
    char str[21];
    char t;
    int l;
    int i;
    
    scanf("%s", str);
    l = strlen(str);
    
    for (i = 0; i < l / 2; i++) {
        t = str[i];
        str[i] = str[l - 1 - i];
        str[l - 1 - i] = t;
    }
    
    printf("%s\n", str);
    
    return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

#if __has_include("debugger.cpp")
  #include "debugger.cpp"
#else
void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) > 0) cout << " ";
  print(std::forward<Tail>(tail)...);
}
# endif

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

int main() {
  ll input(a);
  REP(i, 8) {
    if (a < 400 + (i + 1) * 200) {
      print(8 - i);
      break;
    }
  }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define sayyes cout<<"Yes"<<endl;
#define sayno cout<<"No"<<endl;
using namespace std;
typedef long long ll;
const double PI=acos(-1);
typedef pair<ll,ll>P;
const int mod =1e9+7;

int main()
{
    int n;
    cin>>n;
    vector<P> ab(n);
    rep(i,n)cin>>ab[i].first>>ab[i].second;
    
    map<P,int> c;
    rep(i,n)
    {
        rep(j,n)
        {
            if(i==j)continue;
            ll x=ab[j].first-ab[i].first;
            ll y=ab[j].second-ab[i].second;
            c[P(x,y)]++;
        }
    }
    int maxc=0;
    for(auto v: c)
    {
        maxc=max(maxc,v.second);
    }
    cout<<n-maxc;
    
 
 
}

Measured memory_bytes: 384
#include <stdio.h>
#include <algorithm>

#pragma warning(disable : 4996)

using namespace std;

int n, a[100000]; long long s[200001];

long long sum(int l, int r)
{
	return s[r] - s[l];
}

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

	for (int i = 0; i < n; i++) scanf("%d", &a[i]);

	s[0] = 0; for (int i = 1; i <= 2 * n; i++) s[i] = s[i - 1] + a[(i - 1) % n];

	long long ret = 0, sums = s[n];

	for (int i = 0; i < n; i++)
	{
		int posr1 = lower_bound(s, s + 2 * n + 1, s[i] + sums / 3) - s;
		int posl1 = posr1 - 1;
		int posr2 = lower_bound(s, s + 2 * n + 1, s[i] + sums * 2 / 3) - s;
		int posl2 = posr1 - 1;

		ret = max(ret, min({ sum(i, posl1), sum(posl1, posl2), sum(posl2, i + n) }));
		ret = max(ret, min({ sum(i, posr1), sum(posr1, posl2), sum(posl2, i + n) }));
		ret = max(ret, min({ sum(i, posl1), sum(posl1, posr2), sum(posr2, i + n) }));
		ret = max(ret, min({ sum(i, posr1), sum(posr1, posr2), sum(posr2, i + n) }));
	}

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

	return 0;
}

Measured memory_bytes: 4640
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
double E(int p) {
	double ret = 0.0;
	rep(i, p) {
		ret += i + 1;
	}
	return ret / p;
}
signed main() {
	cin >> N >> K;
	vector< int > P(N);
	rep(i, N) cin >> P[i];
	queue< double > q;
	double ans = 0;
	double tmp = 0;
	rep(i, N) {
		double e = E(P[i]);
		tmp += e;
		q.push(e);
		if (q.size() >= K) {
			chmax(ans, tmp);
			tmp -= q.front();
			q.pop();
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3456
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
using namespace std;
int main() {
	string str;
	string w[3] = { "the","this",  "that" };
	while (getline(cin, str)) {
		if (str == "")break;
		while (true) {
			if (str.find("this") == string::npos &&
				str.find("the") == string::npos &&
				str.find("that") == string::npos ) {

				for (char &c : str) {
					if (c != ' ' && c != '.') {
						c = (c - 'a' + 1) % 26 + 'a';
					}
				}

			}
			else {
				break;
			}
		}
		cout << str << endl;
	}
}

Measured memory_bytes: 2964
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int N,M,C,count,ans;
    cin>>N>>M>>C;
    ans=0;
    int B[M];
    for(int i=0;i<M;i++){
        cin>>B[i];
    }
    int A[N][M];
    for(int i=0;i<N;i++){
        for(int j=0;j<M;j++){
            cin>>A[i][j];
        }
    }
    for(int i=0;i<N;i++){
        count=0;
        for(int j=0;j<M;j++){
            count+=A[i][j]*B[j];
        }
        if(count+C>0){
            ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
n=int(input())
s=input()
ans=0
for i in range(1,n-1):
    X=s[:i]
    Y=s[i:]
    c=0
    a=list(set(X))
    #print(a,X,Y)
    for j in range(len(a)):
        if a[j] in Y:
            c+=1
    if c>ans:
        ans=c
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;

int N, M;
int a[200000];
int b[200000];

int main() {
    vector<int> islands;
    scanf("%d %d", &N, &M);
    for (int i = 0; i < M; i ++) {
        scanf("%d %d", &a[i], &b[i]);
        if (a[i] > b[i]) swap(a[i], b[i]);
        if (a[i] == 1) {
            islands.push_back(b[i]);
        }
    }
    sort(islands.begin(), islands.end());
    for (int i = 0; i < M; i ++) {
        if (b[i] == N) {
            if (binary_search(islands.begin(), islands.end(), a[i])) {
                printf("POSSIBLE\n");
                return 0;
            }
        }
    }
    printf("IMPOSSIBLE\n");
    return 0;
}

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

int main() {
	map<long long, int> mp;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		long long x;
		cin >> x;
		mp[x]++;
	}
	long long a = 0, b = 0;
	for (auto it = mp.rbegin(); it != mp.rend(); it++) {
		if (it->second > 1) {
			if (a == 0) {
				a = it->first;
				it->second -= 2;
			}
			if (b == 0 && it->second > 1) {
				b = it->first;
				break;
			}
		}
	}
	cout << a * b;
	return 0;
}

Measured memory_bytes: 9756
import bisect

N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
sum1=[0]
sum2=[0]
for i in range(N):
    sum1.append(sum1[-1]+A[i])
for i in range(M):
    sum2.append(sum2[-1]+B[i])

ans=0
for i in range(N+1):
    if sum1[i]>K:
        break
    ans=max(ans,i+bisect.bisect_right(sum2,K-sum1[i])-1)
print(ans)


Measured memory_bytes: 47492
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
ll int MOD=998244353;
#define INF (ll)1e16
#define N 310000
 
using namespace std;
string alphabet("abcdefghijklmnopqrstuvwxyz");

ll int power(int a,int b){
    ll int ans=1;
    rep(i,b){
        ans*=a;
        ans%=MOD;
    }
    return ans;
}
main(){
    int n;
    cin>>n;
    int a[300][2];
    rep(i,n){
        cin>>a[i][0]>>a[i][1];
    }
    ll int ans=0;
    rep(i,n-1){
        rep2(j,i+1,n){
            int count=2;
            bool flag=false;
            int x1=a[i][0],x2=a[j][0],y1=a[i][1],y2=a[j][1];
            rep(k,n){
                if(k==i||k==j)continue;
                if(y1*(x2-x1)+(y2-y1)*(a[k][0]-x1)==a[k][1]*(x2-x1)){
                    if(k<j) flag=true;
                    else count++;
                }
            }
            if(flag)continue;
            ans-=(power(2,count)-count*(count-1)/2-count-1);
            ans%=MOD;
        }
    }
    ans+=(power(2,n)-n*(n-1)/2-n-1);
    ans%=MOD;
    cout<<ans;

    return 0;
}

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

a = [list(map(str, input().split())) for _ in range(N)]
lst = []
for i, (x, y) in enumerate(a):
    lst.append([i + 1, x, int(y)])

lst.sort(key=lambda x:(x[1], -x[2]))
for i, x, y in lst:
    print(i)

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

int main() {
  int K, N;
  cin >> K >> N;

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

  vector<int> distance(N);
  for (int i = 1; i < N; ++i) {
    distance[i-1] = a[i] - a[i-1];
  }
  distance[N-1] = a[0] + K - a[N-1];

  int max = *max_element(distance.begin(), distance.end());
  int answer = K - max;
  cout << answer << endl;

  return 0;
}


Measured memory_bytes: 1792
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    S = I()
    
    if N==S:
        print(N+1)
        return 

    def check(N,b):
        res = 0
        while N:
            res += N%b
            N//=b
        return res == S


    for b in range(2,int(sqrt(N)+1)):
        if check(N,b):
            print(b)
            return
    for p in range(1,int(sqrt(N)+1))[::-1]:
        b = (N-S+p)//p
        if b>=2 and check(N,b):
            print(b)
            return
    print(-1)

if __name__ == '__main__':
    main()

Measured memory_bytes: 66136
import Data.Array
import Data.List

main :: IO ()
main = do
  getLine
  ls <- map read . words <$> getLine
  print $ solve ls

-- |
-- >>> solve [4, 4, 9, 7, 5]
-- 5
--
-- >>> solve [4, 5, 4, 3, 3, 5]
-- 8
--
-- >>> solve [9, 4, 6, 1, 9, 6, 10, 6, 6, 8]
-- 39
--
-- >>> solve [1, 1]
-- 0
--
-- prop> solve xs >= 0
--
-- prop> solve xs == solve (reverse xs)
--
-- prop> solve xs == solve (sort xs)
--
solve :: [Int] -> Int
solve ls = length [ (i,j,k) 
                  | i <- [1..n]
                  , j <- [i+1..n]
                  , k <- [j+1..n]
                  , let [a,b,c] = sort [ary!i, ary!j, ary!k]
                  , a < b
                  , b < c
                  , a + b > c
                  ]
 where
  n = length ls
  ary = listArray (1, n) ls


Measured memory_bytes: 4984
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cstdio>
#define DIF 5000
#define all(n) n.begin(),n.end()
using namespace std;

void draw(vector<vector<bool> >& graph,int sx,int sy,int ex,int ey)
{
  for(int i=sy;i<ey;i++)
    for(int j=sx;j<ex;j++)
      graph[i][j] = true;
}

int main()
{
  int n,NARI = 1;
  while(cin >> n,n)
    {      
      vector<double> X,Y,X1,X2,Y1,Y2;
      vector<vector<bool> > graph;
      graph.resize(310);

      for(int i=0;i<310;i++)
	{
	  graph[i].resize(310);
	  for(int j=0;j<310;j++)
	    graph[i][j] = false;
	}

      for(int i=0;i<n;i++)
	{
	  double x,y,r;
	  cin >> x >> y >> r;
	  X.push_back(x+r),X.push_back(x-r);
	  Y.push_back(y+r),Y.push_back(y-r);
	  X1.push_back(x-r),Y1.push_back(y-r);
	  X2.push_back(x+r),Y2.push_back(y+r);
	}

      sort(all(X));
      sort(all(Y));
      X.erase(unique(all(X)),X.end());
      Y.erase(unique(all(Y)),Y.end());

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

	  X1[i] = find(all(X),X1[i]) - X.begin();
	  Y1[i] = find(all(Y),Y1[i]) - Y.begin();

	  X2[i] = find(all(X),X2[i]) - X.begin();
	  Y2[i] = find(all(Y),Y2[i]) - Y.begin();

	}

      for(int i=0;i<n;i++)
	  draw(graph,X1[i],Y1[i],X2[i],Y2[i]);

      double ans = 0;
      for(int i=0;i<Y.size()-1;i++)
	for(int j=0;j<X.size()-1;j++)
	  if(graph[i][j])
	      ans += (X[j+1]-X[j])*(Y[i+1]-Y[i]);
	    
      cout << NARI++ << setiosflags(ios::fixed) << setprecision(2)<< " " << ans << endl;
      
    }
  return 0;
}

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

#define int long long
#define mod 1000000007
#define p pair<int,int>
#define MAX 1000010

using namespace std;

int a[MAX],b[MAX];
bool vis[MAX];

vector <int> v;
vector <p> vp;
set <int> s;
set <p> sp;
map <int,int> mm;
unordered_map <int,int> um;
queue <int> bq;

int32_t main()
{
    um.reserve(1<<15);
    um.max_load_factor(0.25);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,m,x,y;
    cin >> n >> m >> x >> y;

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

    for(int i=0;i<m;i++)
    {
        cin >> b[i];
    }

    sort(a,a+n);
    sort(b,b+m);

    for(int i=x+1;i<=y;i++)
    {
        if(i > a[n-1] && i <= b[0])
        {
            cout << "No War\n";
            return 0;
        }
    }

    cout << "War\n";

    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#define N 10000
#define M 500
int main(){
  int a,b,kosuu=0,i,j;
  int suuretu[N],suuretu2[M];

  //ins
  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d",&suuretu[i]);
  }
  scanf("%d",&b);
  for(j=0;j<b;j++){
    scanf("%d",&suuretu2[j]);
  }

  //search
  for(j=0;j<b;j++){
    for(i=0;i<a;i++){
      if(suuretu[i]==suuretu2[j]){
	kosuu++;
	break;
      }
    }
  }
  printf("%d\n",kosuu);  
  return 0;
}
    

Measured memory_bytes: 640
def two_count(x):
	if int(str(x)[-1]) % 2 == 0:
		return 1 + two_count(x//2)
	else:
		return 0

n = int(input())
n_list = [int(n) for n in input().split(" ")]

n_two_count_list = [two_count(n) for n in n_list]

print(min(n_two_count_list))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i > 0; i++)
const int MOD =1e9+7;
using ll=long long;

int main(){
  ll n, m;
  cin >> n >> m;
  ll ans = 0;
  if(2*n >= m) ans = m/2;
  else{
    ans += n;
    m -= 2*n;
    ans += m/4;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
  static InputReader in;
  static PrintWriter out;

  static class Solution {
    void solve() throws IOException {
      int n = in.nextInt();
      int m =  in.nextInt();
      
      int[][] a = new int[n + 1][m + 1];
      int[] b = new int[m + 1];
      int[] c = new int[n + 1];

      for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
          a[i][j] = in.nextInt();
        }
      }
      
      for (int i = 1; i <= m; i++) {
        b[i] = in.nextInt();
      }
      
      for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++)
        c[i] += a[i][j]* b[j];
      }
      
      for (int i = 1; i <= n; i++) {
        out.println(c[i]);
      }
      
//      End solve()
    }
//    End Solution
}

  public static void main(String[] args) throws IOException {
    in = new InputReader(System.in);
    out = new PrintWriter(System.out);
    Solution solver = new Solution();
    solver.solve();
    out.close();
}

  static class InputReader {
    public BufferedReader br;
    public StringTokenizer st;

    public InputReader(InputStream stream) {
      br = new BufferedReader(new InputStreamReader(stream));
    }

    public int nextInt() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Integer.parseInt(st.nextToken());
    }

    public long nextLong() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Long.parseLong(st.nextToken());
    }

    public String next() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return st.nextToken();
    }

    public double nextDouble() throws IOException {
      while (st == null || !st.hasMoreTokens()) {
        st = new StringTokenizer(br.readLine());
      }
      return Double.parseDouble(st.nextToken());
    }


  }

}

Measured memory_bytes: 27500
package main

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

func main() {
	K := getStdinInt64()
	//initmul(K)
	var i int64 = 0
	var temp int64 = 0
	for i = 0; i < 1000000; i++ {
		temp = (temp*10 + 7) % K
		if temp == 0 {
			fmt.Printf("%d\n", i+1)
			return
		}
	}
	fmt.Printf("%d\n", -1)
}

/*
func isMultiple(s string, K int64) bool {
	var temp int64 = 0
	var i int64 = 0
	for i = 0; i < int64(len(s)); i++ {
		temp = (temp*10 + 7) % K
	}
	if temp == 0 {
		return true
	}
	return false
}
*/

/*
var mod7toK int64 = 0
var mod7 = make([]int64, 0)

func initmul(K int64) {
	mod7toK = 7 % K
	var pow int64 = 1
	var i int64 = 0
	for i = 0; i < 100; i++ {
		mod7 = append(mod7, mod7toK*pow%K)
		pow *= 10
	}
}

func isMultiple(s string) bool {
	var temp int64 = 0
	var i int64 = 0
	for i = 0; i < int64(len(s)); i++ {
		temp = mod7[i] + mod7toK
	}
	if temp == 0 {
		return true
	}
	return false
}
*/

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinInt() int {
	str := getStdin()
	rtn, _ := strconv.Atoi(str)
	return rtn
}
func getStdinInt2() (int, int) {
	list := getStdinIntArr()
	return list[0], list[1]
}
func getStdinInt3() (int, int, int) {
	list := getStdinIntArr()
	return list[0], list[1], list[2]
}
func getStdinInt64() int64 {
	str := getStdin()
	rtn, _ := strconv.ParseInt(str, 10, 64)
	return rtn
}
func getStdinInt64_2() (int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1]
}
func getStdinInt64_3() (int64, int64, int64) {
	list := getStdinIntArr64()
	return list[0], list[1], list[2]
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}
func getStdinIntArr64() []int64 {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int64, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.ParseInt(val, 10, 64)
	}
	return rtn
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func min64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}
func max64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}
func abs64(n int64) int64 {
	if n < 0 {
		return -n
	}
	return n
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 2180
import java.util.*;
public class Main
{
    private static final long MOD = (long) 1e9 + 7;

    public static void main(String [] args)
    {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt(); long k = sc.nextInt(); long ans = 0;
        for (long i = k; i <= n + 1; i++) {
            long temp1 = (n * (n + 1)) / 2;
            long temp2 = ((n - i) * (n - i + 1)) / 2;
            long temp3 = (i * (i - 1)) / 2;
            long temp4 = temp1 - temp2 - temp3 + 1;
            ans = (ans + (temp4))%MOD;
        }
        System.out.println(ans);
    }


}

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

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if (a % 3 == 0) {
		cout << "Possible" << endl;
	}
	else if (b % 3 == 0) {
		cout << "Possible" << endl;
	}
	else if ((a + b) % 3 == 0) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int A1[101],A2[101];
int Sf1[102],Sb2[102],maxx=0;
int main()
{
  int N;
  cin>>N;
  for (int i=0;i<N;i++)
  {
    cin>>A1[i];
  }
  for (int i=0;i<N;i++)
  {
    cin>>A2[i];
  }
  for (int i=1;i<=N;i++)
  {
    Sf1[i]=Sf1[i-1]+A1[i-1];
    Sb2[i]=Sb2[i-1]+A2[N-i];
  }
  for (int i=1;i<=N;i++)
  {
    maxx=max(maxx,Sf1[i]+Sb2[N+1-i]);
  }
  cout<<maxx<<endl;
  //system("pause");
  return 0;
}

Measured memory_bytes: 256