akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
pair<int,int> blue[105];
pair<int,int> red[105];
int vis[105];
int main()
{
    memset(vis,0,sizeof(vis));
    int ans=0;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&red[i].first,&red[i].second);
    }
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d",&blue[i].second,&blue[i].first);
    }
    sort(blue+1,blue+1+n);
    sort(red+1,red+1+n);
    for(int i=n;i>=1;i--)
    {
        int MIN=1e9;
        for(int j=1;j<=n;j++)
        {
            if(blue[j].first>red[i].second&&blue[j].second>red[i].first&&vis[j]==0)
            {
                vis[j]=1;
                ans++;
                break;
            }
        }
    }
    printf("%d\n",ans);
}


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

#define MAX 24414070

void insert(char []);
int kansu(char []);
int find(char []);

int hash[MAX];

int main(){
  int i, n;
  char str[15], cmd[10];
  
  for(i=0; i<MAX; i++) hash[i] = 0;
  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%s%s", cmd, str);
    if(cmd[0] == 'i') insert(str);
    else printf(find(str)?"yes\n":"no\n");
  }
  
  return 0;
}

void insert(char str[]){
  int num;
  num = kansu(str);
  hash[num] = 1;
}

int find(char str[]){
  int num;
  num = kansu(str);
  if(hash[num] == 1) return 1;
  return 0;
}

int kansu(char str[]){
  int i, sum = 0, code, x = 1;
  for(i=0; i<strlen(str); i++){
    switch(str[i]){
    case 'A':
      code = 1;
      break;
    case 'C':
      code = 2;
      break;
    case 'G':
      code = 3;
      break;
    case 'T':
      code = 4;
      break;
    }
    sum += code * x;
    x *= 5;
  }
  return sum;
}



Measured memory_bytes: 97152
package main

import (
	"bufio"
	"fmt"
	basicIO "io"
	"os"
	"strconv"
)

func main() {
	protagonist(os.Stdin, os.Stdout)
}

func protagonist(r basicIO.Reader, w basicIO.Writer) {
	io := NewIO(r, w)
	R, _ := io.nextInt()
	G, _ := io.nextInt()
	B, _ := io.nextInt()
	N, _ := io.nextInt()

	sol := 0
	for r := 0; r <= N/R; r++ {
		x := N - r*R
		for g := 0; g <= x/G; g++ {
			y := x - g*G
			if y%B == 0 {
				sol++
			}
		}
	}

	io.PutInt(sol)
}

type IO struct {
	Scanner *bufio.Scanner
	Writer  basicIO.Writer
}

func NewIO(r basicIO.Reader, w basicIO.Writer) *IO {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	return &IO{
		Scanner: s,
		Writer:  w,
	}
}

func (io *IO) nextString() string {
	io.Scanner.Scan()
	return io.Scanner.Text()
}

func (io *IO) nextInt() (int, error) {
	io.Scanner.Scan()
	i, err := strconv.Atoi(io.Scanner.Text())
	return i, err
}

func (io *IO) PutInt(v int) {
	fmt.Fprintf(io.Writer, "%d\n", v)
}

func (io *IO) PutString(s string) {
	fmt.Fprintf(io.Writer, "%s\n", s)
}


Measured memory_bytes: 640
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use proconio::{input, marker::*};
use superslice::*;
fn main() {
    input! {
        x: usize,
    }
    let mut m = 100;
    let mut count = 0;
    while m < x {
        count += 1;
        m = (m / 100) + m;
    }
    println!("{}", count);
}


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

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

int main(){
    string s;
    cin>>s;
    //int y,m,d
    //y=(int)s[0]*1000+(int)s[1]*100+
    string t="2019/04/30";
    if(s<=t)cout<<"Heisei";
    else cout<<"TBD";
    return 0;
}


Measured memory_bytes: 256
compress3 = lambda arr: list(map({e: i for i, e in enumerate(sorted(set(arr)))}.__getitem__, arr))
n = int(input())
a = [int(input()) for i in range(n)]
a = compress3(a)
odd = set()
even = set()

for i in range(n):
    if i % 2 == 0:
        even.add(a[i])
    else:
        odd.add(a[i])

ans = len(set([2*i for i in range(n//2)]) & odd)
ans = max(ans, len(set([2*i+1 for i in range(n//2)]) & even))
print(ans)


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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li a,b,n;

    cin>>a>>b>>n;

    li i=min(b-1,n);

    cout<<((a*i)/b)-(a*(i/b));   

    return 0;
}

Measured memory_bytes: 3592
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include <limits.h>
#define swap(type,a,b) do{type t=a;a=b;b=t;}while(0);
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define ll long long
#define INF 100000000
#define MOD 1000000007
#define SIZE 100005
#define FOR(i,a,n) for(i=(a);i<(n);i++)
int comp(const void* a,const void* b){
	return *(int*)a-*(int*)b;
}

int main(void)
{
	int n,m,t=1,p,i;
	scanf("%d%d",&n,&m);
	FOR(i,0,m) t*=2;
	p=100*(n-m)+1900*m;
	printf("%d\n",p*t);
	return 0;
}


Measured memory_bytes: 256
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

const int N = 1e6 + 10;
int F[N], G[N];

int64 comb(int n, int m) {
  if (n < m) return 0;
  return (int64)F[n] * G[m] % MOD * G[n - m] % MOD;
}

void init(int n) {
  static int inv[N];
  inv[1] = 1;
  for (int i = 2; i < n; ++i) {
    inv[i] = (MOD - MOD / i) * (int64)inv[MOD % i] % MOD;
  }
  F[0] = G[0] = 1;
  for (int i = 1; i < n; ++i) {
    F[i] = (int64)F[i - 1] * i % MOD;
    G[i] = (int64)G[i - 1] * inv[i] % MOD;
  }
}

int main() {
  init(N);
  int n, k;
  cin >> n >> k;
  k = min(k, n - 1);
  int64 ret = 0;
  for (int i = 0; i <= k; ++i) {
    ret += comb(n, i) * comb(i + n - i - 1, n - i - 1) % MOD;
    ret %= MOD;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 12032
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define s second
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define f first
const ll N=1e3+5;
ll bexpo(ll x,ll n){
    if(n==0)return 1;
    else if(n%2==0)return bexpo(x*x,n/2);
    else return x*bexpo(x*x,(n-1)/2);
}
ll gcd(ll a,ll b){if(!b)return a;return gcd(b,a%b);} 
int Arr[N];
void initialize()
{
    for(int i = 0;i<N;i++)
    Arr[ i ] = i ;
}
int root(int i)
{
    while(Arr[ i ] != i)       
    {
     i = Arr[ i ];
    }
    return i;
}

void unio(int A ,int B)
{
    int root_A = root(A);       
    int root_B = root(B);  
    if(root_A<root_B)
        Arr[ root_A ] = root_B ;    
    else
        Arr[root_B]=root_A;
}
bool find(int A,int B)
{
    if( root(A)==root(B) )    
    return true;
    else
    return false;
}
ll dp[N][N];
int main() {
FIO;
  ll n;
  cin>>n;
  double p[n];
  ll i,j;
  for(i=0;i<n;i++)
    cin>>p[i];
  double dp[n+1][n+1];
  dp[0][0]=1.0;
  for(i=0;i<=n;i++)
  {
     for(j=0;j<=n;j++)
     {
        if(i==0 && j==0)
          continue;
        if(i==0)
          dp[i][j]=0.0;
        else if(j==0)
          dp[i][j]=(1.0-p[i-1])*dp[i-1][j];
        else
          dp[i][j]=p[i-1]*dp[i-1][j-1]+(1.0-p[i-1])*dp[i-1][j];
        //cout<<dp[i][j]<<endl;
     }
  }
  double ans=0.0;
  for(i=n/2+1;i<=n;i++)
  {
     if(2*i>n)
      ans+=dp[n][i];
  }
   cout<<fixed<<setprecision(10);
  cout<<ans;
}

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

int main() {
    char b;
    cin >> b;

    map<char, char> mp;
    mp['A'] = 'T';
    mp['T'] = 'A';
    mp['C'] = 'G';
    mp['G'] = 'C';

    cout << mp[b] << endl;
}

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

typedef long long int ll;

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    
    int n;
    cin >> n;
    
    vector<int> a(n + 1), b(n);
    for (int i = 0; i < n + 1; ++i)
        cin >> a[i];
    for (int i = 0; i < n; ++i)
        cin >> b[i];
    
    ll res = 0;
    for (int i = 0; i < n; ++i)
    {
        if (b[i] < a[i])
        {
            res += (ll) b[i];
            a[i] -= b[i];
        }
        else
        {
            res += (ll) a[i];
            b[i] -= a[i];
            a[i] = 0;
            
            if (b[i] < a[i + 1])
            {
                res += (ll) b[i];
                a[i + 1] -= b[i];
            }
            else
            {
                res += (ll) a[i + 1];
                a[i + 1] = 0;
            }
        }
    }
    
    cout << res << "\n";

    return 0;
}


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

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  vector<string> A(H);
  for(auto& i: A) cin >> i;

  const int dy[] = {0, 0, 1, -1};
  const int dx[] = {1, -1, 0, 0};
  int sy, sx;
  for(auto i=0; i<H; ++i) for(auto j=0; j<W; ++j) if(A[i][j]=='S') sy= i, sx = j;

  auto res = H*W;

  using P = tuple<int, int, int>;
  queue<P> q;
  q.emplace(0, sy, sx);
  while(!q.empty()) {
    int d, y, x;
    tie(d, y, x) = q.front();
    q.pop();
    auto r = min({y, H-1-y, x, W-1-x});
    res = min(res, 1 + (r+K-1)/K);
    if(d == K) continue;
    for(auto i=0; i<4; ++i) {
      auto ny = y + dy[i];
      auto nx = x + dx[i];
      if(ny<0 || H<=ny) continue;
      if(nx<0 || W<=nx) continue;
      if(A[ny][nx]!='.') continue;
      A[ny][nx] = '#';
      q.emplace(d+1, ny, nx);
    }
  }

  cout << res << endl;
}


Measured memory_bytes: 1152
#include <math.h>
int main()
{
   long long int N, i, j, sum=0, sum2=0, flag;
    scanf("%lld", &N);// let's say N=50
    i=1;
    while( i<=sqrt(N)){
        if(N%i==0){
            j=N/i;

            sum = i + j; // at first sum is 5. then it becomes 27
            if(sum > sum2) //51>0. now sum is not bigger than sum2
                sum2 = sum; // now sum2 is 51
            else if(sum < sum2) //27 < 51
                sum2 = sum;// now sum2 becomes 27. after that sum2 becomes 15
        }
        i++;
    }
    printf("%lld", sum2-2);
    return 0;
}

Measured memory_bytes: 128
n, k = map(int, input().split())
v = list(map(int, input().split()))
ans = 0
for i in range(k+1):
  for j in range(k+1):
    if i+j > k or i+j > n:
      continue
    t = k-(i+j)
    s = v[:i] + v[(n-j):]
    s.sort()
    u = 0
    while u < t:
      u += 1
      if len(s) < 1:
        break
      if s[0] < 0:
        s.pop(0)
      else:
        break
    ans = max(ans, sum(s))
print (ans)

Measured memory_bytes: 9108
#include <iostream>
#include <vector>
#define BIG 1e9
using namespace std;

int main() {
	int N,A[200000];
	cin>>N;
	for(int i=0; i<N; i++)cin>>A[i];
	for(int i=N-1; i>0; i--){
		if(A[i-1]>A[i]){
			A[i-1]--;
		}
	}
	int f=0;
	for(int i=0; i<N-1; i++){
		if(A[i]>A[i+1]){
			f=1;
			break;
		}
	}
	if(f){
		cout<<"No"<<endl;
	}else{
		cout<<"Yes"<<endl;
	}
	return 0;
}

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

int main(void){
    int n, m; cin >> n >> m;
    int mod = 1000000007;
    vector<int> a(100010);
    for (int i = 0; i < m; i++)
    {
        cin >> a[i];
    }
    vector<int> dp(100010);
    dp[0] = 1;
    int now = 0;
    for (int i = 1; i <= n; i++)
    {
        if(a[now] == i){
            dp[i] = 0;
            now++;
        }
        else
        {
            if(i > 1){
                dp[i] = dp[i-1] + dp[i-2];
            }
            else{
                dp[i] = dp[i-1];
            }
        }
        dp[i] = dp[i] % mod;
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

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

  priority_queue<int,vector<int>,greater<int>> q1;
  priority_queue<int> q2;
  vector<int> dp1(n),dp2(n);
  for(int i = 0; i < n*2/3; i++){
    if(i < n/3){
      q1.push(a[i]);
      dp1[i] = a[i] + (i == 0 ? 0 : dp1[i-1]);
    }
    else {
      q1.push(a[i]);
      dp1[i] = dp1[i-1] + a[i] - q1.top(); q1.pop();
    }
  }
  for(int i = n-1; i >= n/3; i--){
    if(n*2/3 <= i){
      q2.push(a[i]);
      dp2[i] = a[i] + (i == n-1 ? 0 : dp2[i+1]);
    }
    else {
      q2.push(a[i]);
      dp2[i] = dp2[i+1] + a[i] - q2.top(); q2.pop();
    }
  }

  int ans = -(1LL << 60);
  for(int i = n/3-1; i < n*2/3; i++){
    ans = max(ans,dp1[i] - dp2[i+1]);
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 9588
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll, ll> 
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<pll, ll> > 
#define mll map<ll, ll> 
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define mp make_pair
#define all(v)  (v).begin(), (v).end()
#define fst first
#define sec second
#define ff first.first
#define fs first.second
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000001
#define MOD 1000000007
// #define MOD 998244353
#define endl "\n"
#define INF (ll)1e18
#define s(v) (ll)v.size()
#define e(v) v.empty()
#define bscount(x) __builtin_popcountll(x)
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
// using namespace __gnu_pbds;

ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll fexp(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%MOD; b/=2;a=a*a%MOD;}return ans;}
ll inverse(ll a, ll p){return fexp(a, p-2);} 
void ingraph(vvl& graph, ll m){ll x, y;rep(i, m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}
ll modify(ll n){ll res = n;res%=MOD;res+=MOD;res%=MOD;return res;}

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("../input.txt", "r", stdin);
    //     freopen("../output.txt", "w", stdout);
    // #endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll t;
    // cin>>t;
    t = 1;
    while(t--){
    	ll n;
    	cin>>n;
    	cout<<360/gcd(n, 360);
    }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define loopl(i,a,b) for(lli i=a;i<b;i++) 
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(v) v.begin(), v.end()
#define mod 998244353
#define mod2 1000000006
#define inf 1000000000000000000
#define lld long double
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<lli>
#define vii vector<int>
#define is indexed_set
#define eps 0.000001
#define endl '\n'
#define mo 998244353
#define pi 3.141592653589793
using namespace std ;
 
const lli dx4[] = {-1, 0, 1, 0};
const lli dy4[] = {0, 1, 0, -1};
const lli dx8[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const lli dy8[] = {0, 1, 0, -1, -1, 1, -1, 1};
 
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
 
#define N 1000005

void solve()
{
	lli a,b;
	cin>>a>>b;

	if(a<=0 && b>=0)
	{
		cout<<"Zero";
		return ;
	}

	if(a > 0)
	{
		cout<<"Positive";
		return ;
	}

	if((b - a+1)%2 )
		cout<<"Negative";

	else cout<<"Positive";
}
 
int main()
{
/////////////////////////////////////
    
    fastio;
    
/////////////////////////////////////  
 	
	lli t;
	t=1;
 
	while(t--)
		solve();
 
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cfloat>
#include <algorithm>
#define PB push_back
#define ll long long
#define ull unsigned long long
#define uint unsigned
#define PIE (3.14159265358979323846)
#define MOD 1000000007;
using namespace std;

void checkStream() {
    #ifndef _DEBUG
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
    #endif
}

int main() {
    // checkStream();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n {};
    cin >> n;
    if (n%2) {
        cout<<n/2 + 1<<endl;
    }
    else cout<<n/2<<endl;
    return 0;
}


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

int main()
{
    vector<int> a;
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        int cost;
        cin >> cost;
        a.push_back(cost);
    }
    sort(a.begin(), a.end());

    int ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

#define int long long

#if defined(__GNUC__)
#define __int32 __int32_t
#endif // __GNUC__

#define itn __int32
#define REP(i, n) for(itn (i) = 0; (i) < (n); (i)++)
#define REP2(i, x, n) for(itn (i) = x; (i) < (n); (i)++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define SORT(x) sort(ALL(x))
#define RSORT(x, T) sort(ALL(x), greater<(T)>())
#define REVERCE(x) reverce(ALL(x))

itn main() {
	ios::sync_with_stdio(false);

	int a, b;

	cin >> a >> b;

	if (a <= b * 2) {
		cout << 0;
		return 0;
	}

	cout << (a - (b * 2));

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin>>s;
	int n=s.size();
	int ans=0;
	for(int i=0; i<n; i++) {
		if(i==0)continue;
		if(i%2!=0) continue;
		if(s.substr(0,(n-i)/2)==s.substr((n-i)/2,(n-i)/2)) {
			ans=max(ans,n-i);
		}
	}
	cout<<ans<<endl;
}



Measured memory_bytes: 256
N = int(input())
abc = []
for n in range(N):
	a,b,c = map(int,input().split())
	abc.append((a,b,c))
#print(abc)

dp = [[0]*3 for _ in range(N)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for n in range(1,N):
	dp[n][0] = abc[n][0]+max(dp[n-1][1],dp[n-1][2])
	dp[n][1] = abc[n][1]+max(dp[n-1][2],dp[n-1][0])
	dp[n][2] = abc[n][2]+max(dp[n-1][0],dp[n-1][1])

ans = max(dp[N-1][0],dp[N-1][1],dp[N-1][2])
print(ans)


Measured memory_bytes: 75864
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
//#include <conio.h>
using namespace std;

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

#define rep(i,n)	for(ll i=0;i<(n);i++)
#define SZ(x) ((ll)x.size())
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define F first
#define S second
#define int ll
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll MOD = INT_MAX;
const double PI = acos(-1);

void openfile(){
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
}


signed main(){
	IOS
	int n,r;	cin >> n >> r;
	cout << r + 100 * (10 - min(10ll, n)) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  string S;
  cin>>S;
  if(S=="SSS"){
    cout<<0<<endl;
  }
  if(S=="SSR"){
    cout<<1<<endl;
  }
  if(S=="RSS"){
    cout<<1<<endl;
  }
  if(S=="SRS"){
    cout<<1<<endl;
  }
  if(S=="SRR"){
    cout<<2<<endl;
  }
  if(S=="RSR"){
    cout<<1<<endl;
  }
  if(S=="RRS"){
    cout<<2<<endl;
  }
  if(S=="RRR"){
    cout<<3<<endl;
  }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<long long>a(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	int ans=0;
	while(1){
		int l=0;
		for(int i=0;i<n;i++){				
			if(a[i]%2==1 || a[i]==0)
				break;
			a[i]=a[i]/2;
			ans+=1;
		}
		if(a[l]%2==1 || a[l]==0)
			break;
		l++;
	}
	cout<<(ans/n)<<endl;		
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 0001
#define rep(i, a, b) for(ll i=a; i<b; i++)
#define rer(i, a, b) for(ll i=a-1; i>=b; i--)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
vector< vector<int> > dp;

bool accessible(int x, vector<int> v){
    int m = dp[0].size()/2, n=v.size();
    rep(i, 0, dp.size()) rep(j, 0, dp[0].size()) dp[i][j] = 0;
    dp[0][m] = 1;

    rep(i, 0, n){
        rep(j, -m, m){
            if(j+m-v[i] < 0 && j+m+v[i] < dp[0].size()) dp[i+1][j+m] = dp[i][j+m+v[i]];
            else if(j+m-v[i] > 0 && j+m+v[i] > dp[0].size()) dp[i+1][j+m] = dp[i][j+m-v[i]];
            else dp[i+1][j+m] = dp[i][j+m-v[i]] || dp[i][j+m+v[i]];
        }
    }
    // rep(j, 0, 5){
    //     rep(i, 0, 30) cout << dp[j][i] << " ";
    //     cout << endl;
    // }
    if(dp[n][x+m]==1) return true;
    else return false;
}

signed main(){
    string s; cin >> s;
    int x, y; cin >> x >> y;
    vector<int> fx(1, 0), fy(0, 0);
    int n = s.size();
    int cnt = 0;
    rep(i, 0, n){
        if(s[i] == 'F'){
            if(cnt%2==0) fx[cnt/2]++;
            else fy[cnt/2]++;
        }else if(s[i] == 'T'){
            cnt++;
            if(cnt%2==0) fx.pb(0);
            else fy.pb(0);
        }
    }
    if(cnt==s.size() && (x != 0 || y != 0)){
        cout << "No" << endl;
        return 0;
    }
    // rep(i, 0, fx.size()) cout << fx[i] << endl;
    // rep(i, 0, fy.size()) cout << fy[i] << endl;
    dp = vector< vector<int> >(max(fx.size(), fy.size())+1, vector<int>(16001, 0));
    x -= fx[0];
    fx.erase(fx.begin());

    if(accessible(x, fx))
        if(accessible(y, fy)){
            cout << "Yes" << endl;
            return 0;
        }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 245248
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
//const ll INF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
//inline int in() { int x; scanf("%d",&x); return x;}
template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  int n, q;
  string s;
  cin >> n >> s >> q;
  vector<set<int>> is(26);
  rep(i,n) is[s[i]-'a'].insert(i);
  rep(qi,q) {
    int ty;
    cin >> ty;
    if (ty == 1) {
      int i; char c;
      cin >> i >> c;
      --i;
      is[s[i]-'a'].erase(i);
      s[i] = c;
      is[s[i]-'a'].insert(i);
    }
    else {
      int l, r;
      cin >> l >> r;
      --l;
      int ans = 0;
      rep(i,26) {
        auto it = is[i].lower_bound(l);
        if (it != is[i].end() && *it < r) ++ans;
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}

Measured memory_bytes: 24196
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

#define INF LLONG_MAX / 5
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define enld endl

signed main() {
	int N;
	cin >> N;
	vector<int>H(N);
	rep(i, N) {
		cin >> H[i];
	}
	vector<int>dp(N);
	rep(i, N) {
		if (i == 0) {
			dp[i] = 0;
		}
		else if (i == 1) {
			dp[i] = abs(H[i] - H[i - 1]);
		}
		else {
			dp[i] = min(dp[i - 1] + abs(H[i] - H[i - 1]), dp[i - 2] + abs(H[i] - H[i - 2]));
		}
	}
	cout << dp[N - 1] << enld;
}

Measured memory_bytes: 4784
import java.util.Arrays;

public class Main {
  private static void solve() {
    int n = ni();
    int k = ni();
    long[] h = new long[n + 1];
    for (int i = 0; i < n; i++) {
      h[i + 1] = nl();
    }

    long[][] dp2 = new long[n + 1][n + 1];
    for (long[] v : dp2)
      Arrays.fill(v, Long.MAX_VALUE / 10);
    dp2[0][0] = 0;

    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        for (int s = 0; s < i; s++) {
          dp2[i][j] = Math.min(dp2[i][j], dp2[s][j - 1] + Math.max(0, h[i] - h[s]));
        }
      }
    }

    long ret = Long.MAX_VALUE;
    for (int i = 0; i <= n; i++) {
      ret = Math.min(dp2[i][n - k], ret);
    }
    System.out.println(ret);
  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


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

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

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

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

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

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

bool sieve[1400000];

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

    cin >> skipws;

    for (int i = 1; i < 1400000; i++) sieve[i] = 1;
    sieve[1] = 0;
    for (int i = 2; i < 1400000; i++) {
        for (ll j = 1ll * i * i; j < 1400000; j += i) {
            sieve[j] = 0;
        }
    }

    for (;;) {
        int t; cin >> t;
        if (!t) break;

        if (sieve[t]) {
            cout << 0 << endl;
            continue;
        }
        int lo = t, hi = t;
        while (!sieve[lo]) lo--;
        while (!sieve[hi]) hi++;
        cout << hi-lo << endl;
    }
}


Measured memory_bytes: 4412
import itertools

h,w = map(int, input().split())

area = []
for i in range(h):
    array = list(input())
    area.append(array)

a = list(itertools.chain.from_iterable(area))

yoko = []
tate = []

for i in range(h):
    cnt = 0
    for j in range(w):
        if area[i][j] == '#':
            cnt += 1
    if cnt == 0:
        yoko.append(i)

for i in range(w):
    b = a[i::w]
    if len(set(b)) == 1 and '.' in set(b):
        tate.append(i)

for i in range(h):
    flg = False
    for j in range(w):
        if j in set(tate):
            continue
        elif i in set(yoko):
            flg = True
            continue
        else:
            print(area[i][j], end='')
    if flg == False:
        print()

Measured memory_bytes: 4596
#include<cstdio>
#include<algorithm>
using namespace std;
int n,a[102],num[102];
int ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]==a[i-1])
		{
			ans++;
			a[i]=0;
		}
	}
	printf("%d",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;

signed main(){
  int n,m;cin>>n>>m;
  string s[100],t[100];
  rep(i,n)cin>>s[i];
  rep(i,m)cin>>t[i];
  bool flag=false;
  rep(i,n-m+1){
    rep(j,n-m+1){
      bool po=true;
      rep(k,m){
        rep(l,m){
          if(s[i+k][j+l]!=t[k][l]){
            po=false;k=m,l=m;
          }
        }
      }
      if(po){
        flag=true;
        i=n,j=n;
      }
    }
  }
  if(flag)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n, a, b; cin >> n >> a >> b;
    cout << ((b - a) % 2 == 0 ? "Alice" : "Borys") << "\n";
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

fn main() {
    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let s: String = read(&mut stdin_lock, &mut buf, b'\n');
    let mut cs: Vec<char> = s.chars().collect();
    let mut ans = true;
    if cs[0] != 'A' {
        ans = false;
    } else {
        cs[0] = 'a';
    }
    let mut c_count = 0;
    for i in 2..(cs.len() - 1) {
        if cs[i] == 'C' {
            cs[i] = 'c';
            c_count += 1;
        }
    }
    if c_count != 1 {
        ans = false;
    }
    if cs
        .into_iter()
        .filter(|c| !c.is_lowercase())
        .collect::<Vec<char>>()
        .len()
        != 0
    {
        ans = false;
    }
    println!("{}", if ans { "AC" } else { "WA" });
}


Measured memory_bytes: 4352
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N, K = map(int, readline().split())
    l = list(map(int, readline().split()))

    l.sort(reverse=True)

    print(sum(l[:K]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 61924
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
using namespace std;


int main(){
	long long n, p, max=0;
    long long sum=0;
    cin >> n;
    for (int i = 0; i < n; i++){
        cin >> p;
        sum += p;
        if(max < p) max = p;
    }
    cout << sum - max / 2 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;

signed main(){
    cin.tie(0); 
    ios::sync_with_stdio(false);
    int a[10],b[10];
    int ans[10];
    for(int i=0;i<7;i++){
      cin>>a[i]>>b[i];
      ans[i]=abs(a[i]-b[i]);
    }
    for(int i=0;i<7;i++){
      cout<<ans[i]<<"\n";
    }
    
    return 0;
}




Measured memory_bytes: 3180
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
#define endl '\n';
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;



int main() {
    
    int h,w;
    cin>>h>>w;
    vs v(h);
    rep(i,h)cin>>v[i];
    bool ch=1;
    rep(i,h){
        rep(j,w){
            if(v[i][j]=='.')continue;
            int num=0;
            rep(k,4){
                int nextx=dx[k]+j;
                int nexty=dy[k]+i;
                if(nextx<0||nexty<0||nextx>=w||nexty>=h)continue;
                if(v[nexty][nextx]=='#')num++;
            }
            if(num==0)ch=0;
        }
    }
    Yn(ch);

}



Measured memory_bytes: 256
import sys

def main():

	N = int(input())
	AC = 0
	WA = 0
	TLE = 0
	RE = 0
	
	for _ in range(N):
		s = input()
		if s == "AC" :
			AC = AC+1
		elif s == "WA" :
			WA = WA+1
		elif s == "TLE" :
			TLE = TLE+1
		elif s == "RE" :
			RE = RE+1
		
	print("AC x " + str(AC))
	print("WA x " + str(WA))
	print("TLE x " + str(TLE))
	print("RE x " + str(RE))
		
	
if __name__ == "__main__":
    main()

Measured memory_bytes: 9220
#include<iostream>
#include<cstring>

using namespace std;

#define LEN 1000

int main(){
	char angou[LEN];
	int i, str;
	
	cin >> angou;
	str = strlen(angou);
	for(i = 0; i < str; i++){
		if(angou[i] < 'D'){
			angou[i] = angou[i] + 23;
		}
		else{
			angou[i] = angou[i] - 3;
		}
	}
	cout << angou << endl;

	return 0;
}

Measured memory_bytes: 3088
import math
while True:
    try:
        x1,y1,x2,y2,x3,y3,xp,yp = map(float, raw_input().split())
        a = math.sqrt((x1-x2)**2+(y1-y2)**2)
        b = math.sqrt((x1-x3)**2+(y1-y3)**2)
        c = math.sqrt((x2-x3)**2+(y2-y3)**2)
        xa = math.sqrt((x3-xp)**2+(y3-yp)**2)
        xb = math.sqrt((x2-xp)**2+(y2-yp)**2)
        xc = math.sqrt((x1-xp)**2+(y1-yp)**2)
        s = (a+b+c)/2
        sa = (a+xb+xc)/2
        sb = (b+xa+xc)/2
        sc = (c+xa+xb)/2
        ss = math.sqrt(s*(s-a)*(s-b)*(s-c))
        ssa = math.sqrt(sa*(sa-a)*(sa-xb)*(sa-xc))
        ssb = math.sqrt(sb*(sb-xa)*(sb-b)*(sb-xc))
        ssc = math.sqrt(sc*(sc-xa)*(sc-xb)*(sc-c))
        
        if ssa+ssb+ssc - ss > 0.0000001:
            print "NO"
        else:
            print "YES"
    except:
        break

Measured memory_bytes: 4468
#include<stdio.h>
#include<iostream>
#include<math.h>
#include<algorithm>
#include<string.h>
#define ll long long
using namespace std;
int A,B;
int main(){
	scanf("%d%d",&A,&B);
	if(A>8||B>8)printf(":(");
	else printf("Yay!");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const ll MOD = 1e9+7;


#define REP(i, N) for (ll i = 0; i < (N); i++)
#define REPP(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((ll)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<ll>>

using namespace std;


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

    int n;
    cin>> n;
    ll sum =0;
    for(ll i = 1; i < n+1;i++){
        if(i%5 == 0 || i%3 == 0){
        }else{
            sum+=i;
        }
    }
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3192
//ΔAGC032C
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 111111;
int n,m,x[N],y[N],a[N],s[N],f[N];
int fnd(int x){
	if(f[x]==x)
		return x;
	return f[x]=fnd(f[x]);
}
int main()
{
	int i,o;
	scanf("%d%d",&n,&m);
	for(i=1;i<=m;i=i+1){
		scanf("%d%d",x+i,y+i);
		a[x[i]]++,a[y[i]]++;
	}
	for(i=1;i<=n;i=i+1)
		s[a[i]]++;
	for(i=1;i<=m;i=i+2){
		if(s[i]){
			cout<<"No";
			return 0;
		}
	}
	if(s[2]+s[4]<n||s[4]>=3){
		cout<<"Yes";
		return 0;
	}
	if(s[4]<=1){
		cout<<"No";
		return 0;
	}
	for(i=1;i<=n;i=i+1)
		if(a[i]==4)
			o=i;
	for(i=1;i<=n;i=i+1)
		f[i]=i;
	for(i=1;i<=m;i=i+1){
		if(x[i]==o||y[i]==o)
			continue;
		f[fnd(x[i])]=fnd(y[i]);
	}
	memset(s,0,sizeof(s));
	for(i=1;i<=n;i=i+1)
		s[fnd(i)]++;
	o=0;
	for(i=1;i<=n;i=i+1)
		if(s[i])
			o++;
	if(o==3)
		cout<<"Yes";
	if(o==2)
		cout<<"No";
	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    int h[100100];
    for (int i=0; i<n; i++){
        cin>>h[i];
    }
    long long cost[100100];
    cost[0]=0;
    cost[1]=abs(h[1]-h[0]);
    if (n==2) cout<<cost[1]<<endl;
    else{
    for(int i=0; i<n-2; i++){
        cost[i+2]=min(cost[i+1]+abs(h[i+2]-h[i+1]),cost[i]+abs(h[i+2]-h[i]));
    }
    cout<<cost[n-1]<<endl;
    }
    return 0;
}

Measured memory_bytes: 4820
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        String s = "delicious";
        if (b - a > 0 && b - a <= x) {
            s = "safe";
        } else if (x < b - a) {
            s = "dangerous";
        }
        System.out.println(s);
    }
}


Measured memory_bytes: 21972
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}
int compw(const void *a, const void *b){return (*(int*)a>*(int*)b)-(*(int*)a<*(int*)b);}

uint32_t nextpint(void){ char c=getchar(); while(c<'0'||'9'<c) c=getchar(); uint_fast32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return x; }

inline int min2(const int a, const int b){return a>b?b:a;}
inline int dif2(const int a, const int b){return a>b?a-b:b-a;}

int getk(int a){
	int k=0;
	while(a>0){
		a/=2;
		k+=a;
	}
	return k;
}

int comb(int a, int b){
	return getk(a)==getk(b)+getk(a-b);
}

char a[1000000];
int main(void){
	int n=nextpint();
	int f=1;
	for(int i=0; i<n; i++){
		a[i]=getchar()-'1';
		if(a[i]==1) f=0;
	}
	if(f!=0){
		for(int i=0; i<n; i++){
			a[i]>>=1;
		}
	}
	int x=0;
	for(int i=0; i<n; i++){
		x+=comb(n-1,i)*a[i];
		x&=1;
	}
	if(f==0){
		putchar(x+'0');
	}else{
		putchar((x<<1)+'0');
	}
	putchar(10);
}


Measured memory_bytes: 1152