akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
// using namespace __gnu_pbds;
using namespace std;
 
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef long double ld;
typedef pair <long long,long long> ii;
// typedef complex<long double> point;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll a,b;
	cin >> a >> b;
	cout << max(ll(0),a-2*b) << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main() {
    ll n, k; cin >> n >> k;
    ll zero[61]={0}, one[61]={0};
    ll kkk[61] = {0};
    rep(j,60){
        if((k>>j)&1) kkk[j]++;
    }
    rep(i, n){
        ll A;
        cin >> A;
        rep(j,60){
            if((A>>j)&1) one[j]++;
            else zero[j]++;
        }
    }
    bool miman = false;
    ll ans = 0;
    for(int j=60;j>=0;j--) {
        if(!miman && one[j] == 0 && kkk[j] == 0) continue;
        if(miman) {
            ans += (1ll<<j)*max(zero[j],one[j]);
        } else {
            if(kkk[j] && one[j] > zero[j]) {
                miman = true;
                ans += (1ll<<j)*max(zero[j],one[j]);
            } else {
                if(kkk[j] == 0) {
                    ans += (1ll<<j)*one[j];
                } else {
                    ans += (1ll<<j)*zero[j];
                }
            }
        }
        //cout << ans << endl;
    }
    cout << ans;
}


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

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    string s;
    cin >> s;
    REP(i,s.length()-1){
        if (s.substr(i,2) == "AC") {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#define N 200005
#define LL long long
#define re register
#define inv_2 500000004
using namespace std;
const int Mod=1e9+7,base=2002,Maxn=8000;
int n,a[N],b[N];
LL f[4010][4010],fac[Maxn+10],inv_fac[Maxn+10],ans=0;
LL power(LL x,int P){
	LL ans=1;
    for(;P;P>>=1,x=1ll*x*x%Mod) if(P&1) ans=1ll*ans*x%Mod;
    return ans;
}
void get_fac(){
	fac[0]=1; for(re int i=1;i<=Maxn;++i) fac[i]=1ll*fac[i-1]*i%Mod;
	inv_fac[Maxn]=power(fac[Maxn],Mod-2);for(re int i=Maxn-1;~i;--i) inv_fac[i]=1ll*inv_fac[i+1]*(i+1)%Mod;
}
inline LL C(int x,int y){ return fac[y]*inv_fac[x]%Mod*inv_fac[y-x]%Mod; }
int main(){
	scanf("%d",&n);get_fac();
	for(re int i=1;i<=n;++i) scanf("%d%d",&a[i],&b[i]),++f[base-a[i]][base-b[i]];
	for(re int i=1;i<=4002;++i)
	for(re int j=1;j<=4002;++j)
	f[i][j]=(f[i][j]+(f[i-1][j]+f[i][j-1])%Mod)%Mod;
	for(re int i=1;i<=n;++i) (ans+=f[base+a[i]][base+b[i]])%=Mod,(ans-=C(2*a[i],2*a[i]+2*b[i]))%=Mod;
	(ans+=Mod)%=Mod;(ans*=inv_2)%=Mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 127488
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<stack>
#include<map>
#include<cstdint>
#include<unordered_map>
#include<boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < ( int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define Cin cin>>a;

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

int main(void){
	int n, k;
	cin >> n >> k;
	string s;
	cin >> s;
	s[k - 1] += 32;
	cout << s << endl;
}


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

int main(){
  int N;
  cin>>N;
  vector<int>a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  for(int i=0;i<N;i++){
    a.push_back(a.at(i)+1);
    a.push_back(a.at(i)-1);
  }
  
  sort(a.begin(),a.end());
  
  int res=1;
  int count=1;
  int n=a.size();
  
  for(int i=0;i<n;i++){
    if(i==n-1){
      res=max(count,res);
    }
    
    else{
      if(a.at(i)==a.at(i+1))
        count++;
      else{
        res=max(res,count);
        count=1;
      }
    }
  }
  
  cout<<res<<endl;
  
  //for(int i=0;i<n;i++)
   // cout<<a.at(i)<<endl;
  
}

Measured memory_bytes: 1784
from fractions import gcd
def main():
    n = int(input())
    a = list(map(int,input().split()))
    lg = [a[0]]
    rg = [a[-1]]
    for i in range(n-1):
        lg.append(gcd(lg[-1],a[i+1]))
        rg.append(gcd(rg[-1],a[-i-2]))
    rg.reverse()
    ans = 0
    for i in range(n):
        if i == 0:
            ans = rg[i+1]
        elif i == n-1:
            ans = max(ans,lg[i-1])
        else:
            ans = max(ans,gcd(lg[i-1],rg[i+1]))

    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 16124
#include <iostream>
#include <vector>

using namespace std;

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

    int best = 0;
    for (int i = 0; i < n.length(); i++) {
        best += n[i] - '0';
    }

    for (int i = 0; i < n.length(); i++) {
        if (n[i] != '0') {
            int s = 0;
            for (int j = 0; j < i; j++) {
                s += n[j] - '0';
            }
            s += n[i] - '0' - 1;
            s += 9 * (n.length() - i - 1);
            best = max(best, s);
        }
    }

    cout << best << endl;

    return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n,m,now=0;
	string ic[257]={""},out,log[2]={"Opened by ","Closed by "};
	for(cin>>n;n>0;n--)cin>>ic[n];
	for(cin>>m;m>0;m--){
		bool kawa=0;
		cin>>out;
		for(int j=1;j<255&&!kawa;j++)if(ic[j]==out)kawa=1;
		if(kawa)cout<<log[now]+out<<endl;
		else cout<<"Unknown "+out<<endl;
		now=(now+kawa)%2;
	}
}

Measured memory_bytes: 1224
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    X = il()

    ret = MAX
    for n in range(N - K + 1):
        ret = min(ret, abs(X[n]) + abs(X[n] - X[n+K-1]), abs(X[n+K-1]) + abs(X[n] - X[n+K-1]))
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 20020
def main():
    s = list(input())
    s.append("0")
    s.append("0")

    now = s[0]
    for i in range(1,len(s)-2):
        if now == s[i]:
            print(i,end=" ")
            print(i+1)
            exit()
        elif now == s[i+1]:
            print(i, end=" ")
            print(i+2)
            exit()
        else:
            now = s[i]
    print(-1,end=" ")
    print(-1)
if __name__ == "__main__":
    main()

Measured memory_bytes: 50160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb  push_back
#define ppb pop_back
#define mp  make_pair
int main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// #endif
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	string str1,str2;
	cin>>str1>>str2;
	cout<<str2+str1<<endl;

}

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

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

    bool flg = false;

    for(int a=0; a<=50; ++a){
        for(int b=0; b<=25; ++b){
            if(((a + b) == X) && ((2*a + 4*b) == Y)){
                flg = true;
                break;
            }
        }
    if(flg) break;
    }

    if(flg) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
    int N;
    cin >> N;
    vector<int> X(N);
    for (int i=0; i<N; i++) cin >> X.at(i);
    sort(X.begin(), X.end());
    int p_range_max = X.at(N-1);
    int p_range_min = X.at(0);
    vector<int> distances(N);
    vector<int> strengths(p_range_max-p_range_min+1, 0);
    int str_ind = 0;
    for (int p=p_range_min; p<p_range_max+1; p++) {
        for (int i=0; i<N; i++) distances.at(i) = X.at(i) - p;
        for (auto dist: distances) strengths.at(str_ind) += pow(dist, 2);
        str_ind ++;
    }
    sort(strengths.begin(), strengths.end());
    cout << strengths.at(0) << endl;
}

Measured memory_bytes: 256
# 入力
monster_hp, quantity_of_skills = map(int, input().split())
skills = map(int, input().split())
skills_list = list(skills)

# 処理
total_damages = 0
for i in skills_list:
    total_damages += i

if monster_hp <= total_damages:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 20584
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef  long long ll;


int main(){
  
int N;
ll Y;

cin >> N >> Y;

for(int i = 0; i <= N; i++){
  for(int j = 0; j <= N-i; j++){
    ll sum = i*10000+j*5000+(N-i-j)*1000;
    if(sum == Y){
      cout << i << " " << j << " " << N-i-j << endl;
      return 0;
    }
  }
}

cout << "-1 -1 -1\n";

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>

#define ll long long
#define mem(a) (memset(a,0,sizeof(a)))
const int maxn=10000+5;

using namespace std;


int main() {
    char s[20];
    ll ans=0;
    cin>>s;
    long n=strlen(s);
    for(int i=0;i<(1<<(n-1));i++){
        ll t=s[0]-'0';
        for(int j=0;j<n;j++){
            if(i&1<<j||j==n-1){
                ans+=t;
                t=0;
                if(j==n-1)break;
            }
            t*=10;
            t+=s[j+1]-'0';
        }
    }
    printf("%lld\n",ans);

    return 0;
}

Measured memory_bytes: 256
/*input
10
3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820

*/
 
/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)
 
*/
 
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>

using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;
 
#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 
#define out(container) for (auto it : container) cout << it << " "; cout << endl;
 
 
template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  string str;
  cin >> str;
  int n = str.size();
  int ans = 0;
  for (int i = 0; i < n / 2; i++) {
    ans += (str[i] != str[n - i - 1]);
  }
  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
#define MAX 1000000000
typedef long long ll;
int main(){
    ll N,K,S;
    scanf("%lld %lld %lld",&N,&K,&S);
    ll max = MAX;
    if(S==MAX) max--;
    ll ans[100002];
    for(ll i=0;i<K;i++)
        ans[i] = S;
    for(ll i=K;i<N;i++)
        ans[i] = max;
    for(ll i=0;i<N;i++)
        printf("%lld ",ans[i]);
}


Measured memory_bytes: 2516
package main

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

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func readInt() int {
	i, _ := strconv.Atoi(read())
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := readInt()
	m := readInt()

	if m == 2 || n == 2 {
		fmt.Println("0")
		return
	}
	if m == 1 && n == 1 {
		fmt.Println("1")
		return
	}
	if m == 1 || n == 1 {
		fmt.Println(n*m - 2)
		return
	}

	fmt.Println(m*n - ((2*m + 2*n) - 4))
}


Measured memory_bytes: 640
def func(rl_str):
    r_n = rl_str.count('R')
    l_n = rl_str.count('L')
    res = []
    for _ in range(r_n - 1):
        res.append(0)
    res.append((r_n-1)//2 + 1 + l_n//2)
    res.append(r_n//2 + (l_n-1)//2 + 1)
    for _ in range(l_n - 1):
        res.append(0)
    return res

if __name__ == '__main__':
    S = input()
    lst = []
    n_st = 0
    str_lst = []
    for n_en, (i_1, i_2) in enumerate(zip(S[:-1], S[1:])):
        n_en += 1
        if i_1 == 'L' and i_2 == 'R':
            lst.append(n_en)
            str_lst.append(S[n_st:n_en])
            n_st = n_en
    str_lst.append(S[n_st:])

    result = []
    for _str in str_lst:
        res_tmp = func(_str)
        result += res_tmp
    print(*result)


Measured memory_bytes: 16176
fn main() {
    read::<u32>();
    let arr: Vec<u32> = read_as_vec();
    read::<u32>();
    let keys: Vec<u32> = read_as_vec();
    let mut result: u32 = 0;
    for key in keys {
        result += if search(&arr, key) { 1 } else { 0 };
    }
    println!("{}", result);
}

fn search(arr: &[u32], key: u32) -> bool {
    let mut s = 0;
    let mut e = arr.len();
    while s < e {
        let pivot = (s + e) / 2;
        if key < arr[pivot]  {
            e = pivot;
        } else if key > arr[pivot] {
            s = pivot + 1;
        } else {
            return true;
        }
    }
    false
}

fn read<T: std::str::FromStr>() -> T {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().parse::<T>().ok().unwrap()
}

fn read_as_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| { e.parse().ok().unwrap() })
        .collect()
}


Measured memory_bytes: 5032
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int t = n;
    int s = 0;
    while(n>0){
        s+=n%10;
        n/=10;
    }
    if(t%s==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
from functools import reduce

n, m = map(int, input().split())

mod = 1000000007

def factorial(n):
    return reduce(lambda x, y: x*y%mod, range(1, n+1))

if n==m:
    print(2*factorial(n)*factorial(m)%mod)
elif abs(n-m)<=1:
    print(factorial(n)*factorial(m)%mod)
else:
    print(0)

Measured memory_bytes: 3828
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <stdio.h>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能
//n個のgcd,lcmは一つずつみて更新していく
//大きな数を扱うときは素因数分解した形で持っておく
// (l/a[i]) = l*powmod(a[i],MOD-2)%MOD;
//auto itr=lower_bound(ALL(a),key) a[itr-a.begin()]
const ll MOD = 1000000007;

signed main(){
    int n; cin >> n;
    int num[n+1];
    rep(i,n+1) num[i]=i;
    rep(i,n+1){
        for(int j=1;j<=7;j++){
            int k=pow(6,j);
            if(i+k<=n) chmin(num[i+k],num[i]+1);
        }
    }
    rep(i,n+1){
        for(int j=1;j<=7;j++){
            int k=pow(9,j);
            if(i+k<=n) chmin(num[i+k],num[i]+1);
        }
    }
    cout << num[n] << endl;
}


Measured memory_bytes: 640
W,H,N = map(int, input().split())
l = []
for i in range (N):
    x,y,a = map(int,input().split())
    l.append([x,y,a])
y1 = 0
y2 = H
x1 = 0
x2 = W
for j in range (N):
    if (l[j][2] == 1) & (x1 < l[j][0]):
        x1 = l[j][0]
    elif (l[j][2] == 2) & (x2 > l[j][0]):
        x2 = l[j][0]
    elif (l[j][2] == 3) & (y1 < l[j][1]):
        y1 = l[j][1]
    elif (l[j][2] == 4) & (y2 > l[j][1]):
        y2 = l[j][1]
S = (x2 - x1)*(y2 - y1)
if (x2 > x1) & (y2 > y1):
    print(S)
else:
    print(0)

Measured memory_bytes: 3064
s=list(input())
count = 0
Max = 0
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'T' or s[i] == 'G' or s[i] == 'C':
        count += 1
    else:
        Max = max(Max, count)
        count = 0
print(max(Max, count))


Measured memory_bytes: 2940
N = int(input())
S = input()

left = 0
right = S[1:].count('E')
result = left + right

for i in range(1, N):
	if S[i - 1] == "W":
		left += 1
	if S[i] == "E":
		right -= 1
	result = min(result, left + right)
print(result)

Measured memory_bytes: 3700
#include<iostream>
#include<string>
#include<vector>
using namespace std;

int main(){
  int h,w;
  cin >> h >> w;
  vector<string> low(h);
  for(int i=0;i<h;++i) cin >> low[i];

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

  for(int i=0;i<h;++i){
    for(int j=0;j<w;++j){
      if(low[i][j] == '#') continue;

      int num = 0;
      for(int d=0;d<8;++d){
        const int ni = i+dx[d];
        const int nj = j+dy[d];

        if(ni<0 or h<=ni) continue;
        if(nj<0 or w<=nj) continue;
        if(low[ni][nj] == '#') num++;
      }

      low[i][j] = char(num+'0');
    }
  }
  for(auto a:low) cout << a << endl;

  return 0;
}

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


int main(void)
{
	int n, s[1000],i,max=0,min=1000,sum=0;

	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}

		sum = 0;
		max = 0;
		min = 1000;

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

		for (i = 0; i < n; i++){
			if (max <= s[i]){
				max = s[i];
			}
		}

			for (i = 0; i < n; i++){
				if (min >= s[i]){
					min = s[i];
				}
			}

			printf("%d\n",(sum - max - min)/(n-2));
		}
	
	return 0;
}

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

int main(void){
    int n;
    double ave = 0;
    cin >> n;
    vector<int> a(n);
    vector<double> b(n);
    for(int i = 0;i < n;i++){
        cin >> a[i];
        ave += a[i];
    }
    double min = ave;int ans = 0;
    ave /= n;
    for(int i = 0;i < n;i++){
        b[i] = fabs(a[i] - ave);
        if(b[i] < min){
            min = b[i];
            ans = i;
        }
    }
    cout << ans ;
}

Measured memory_bytes: 256
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n
# def zeros(n): return np.zeros(n, dtype=np.longlong)
def zeros2(n, m): return [zeros(m) for i in range(n)] # obsoleted zeros((n, m))で代替

INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x

def prob():  # 例題も解けない
    d = Debug()
    d.off()
    N = 6
    dist = zeros(N)
    for i in range(6):
        dist[i] = int(input())
    d.dmp((dist),'dist')
    K = dist[5]
    d.dmp((K),'K')
    for i in range(4):
        if dist[i+1]-dist[i] > K:
            return ':('
    if dist[4]-dist[0] > K:
        return ':('
    return 'Yay!'
    

ans = prob()
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define sp putchar(' ')
#define en putchar('\n')
const int MAXN = 1000005 ;
using namespace std ;
using VI = vector<int64_t> ;
int n, m, T, u, v, a, b ;

int main()
{
    ios::sync_with_stdio(false) ;
    while(cin >> n) {
        int cnt = 0 ;
        bool isok = false ;
        for(int i = 1;i <= n; ++ i) {
            cin >> u >> v ;
            if(u == v) {
                ++ cnt ;
                if(cnt >= 3) {
                    isok = true ;
                }
            } else cnt = 0 ;
        }
        cout << (isok?"Yes":"No") << endl ;
    }
}


Measured memory_bytes: 3656
#include<iostream>

using namespace std;

const int MAX_N=1e5+5;
const int MOD=1e9+7;
int a[MAX_N];
int dp[MAX_N];
int main(){
  int n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++)cin>>a[i];
  int cnt=0;
  dp[0]=1;
  for(int i=1;i<=n;i++){
    if(a[cnt]==i){
      cnt++;
      continue;
    }
    else{
      if(i>1)dp[i]=(dp[i-1]+dp[i-2])%MOD;
      else dp[i]=1;
    }
  }
  cout<<dp[n]<<endl;
}


Measured memory_bytes: 896
n,l = map(int, input().split())
flavour = []

for i in range(n):
  flavour.append(l+i)
  
if flavour[0]<=0:
  if flavour[n-1]<=0:
  	print(sum(flavour)-flavour[n-1])
  else:
    print(sum(flavour))
else:
  print(sum(flavour)-flavour[0])

Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
int a , b;
int main(){
    cin >> a >> b;
    if(a <= 0 && b >= 0){
        printf("Zero\n");
    }
    else if(a > 0){
        printf("Positive\n");
    }
    else{
        int num = b - a + 1;
        if(num & 1){
            printf("Negative\n");
        }
        else{
            printf("Positive\n");
        }
    }
}

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

int main(){
  int n;
  cin >> n;
  
  vector<int> b(n);
  for(int i=0;i<n;++i){
    cin >> b.at(i);
    b.at(i)--;
  }
  int count, cu;
  for(;;){
  	if(cu==1){
      cout << count << endl;
      return 0;
    }
    if(count>=n){
      cout << -1 << endl;
      return 0;
    }
    count++;
    //cout << cu << " -> " << b.at(cu) << endl;
    cu = b.at(cu);
  }
}

Measured memory_bytes: 640
import java.util.*;

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

        if (String.valueOf(N.charAt(0)).equals("7") || String.valueOf(N.charAt(1)).equals("7")
                || String.valueOf(N.charAt(2)).equals("7")) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}


Measured memory_bytes: 35672
#!/usr/bin/env python3

def main():
    s = input()
    n = len(s)
    for i in range(n - 1):
        if is_unstable(s[i:i + 2]):
            print(i + 1, i + 2)
            return
    for i in range(n - 2):
        if is_unstable(s[i:i + 3]):
            print(i + 1, i + 3)
            return
    print("-1 -1")

def is_unstable(s):
    assert len(s) in [2, 3]
    return s[0] == s[-1]

main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,a[1005],b[1005],S,ret;
void honshitsu(){
	bool dp[1005]={}; dp[0] = 1;
	for(int i=1;i<=n;i++){
		if(a[i] == *max_element(a+1,a+n+1)) continue;
		for(int j=1000;j>=0;j--){
			if(j >= a[i] && dp[j-a[i]]){
				dp[j] = 1;
			}
			if(j >= a[i]+b[i] && dp[j-a[i]-b[i]]){
				dp[j] = 1;
			}
		}
	}
	int j = 0;
	for(int i=*max_element(a+1,a+n+1);i>=0;i--){
		if(!dp[i]){
			j++; continue;
		}
		cout << ret+j << endl;
		return;
	}
}
int main(){
	while(1){
		cin >> n; if(!n) return 0;
		S = 0,ret = 0;
		for(int i=1;i<=n;i++){
			cin >> a[i] >> b[i];
			S += a[i]; ret += a[i]+b[i];
		}
		bool x = 0;
		for(int i=1;i<=n;i++){
			if(a[i] * 2 > S){
				honshitsu(); x = 1; break;
			}
		}
		if(!x) cout << ret << endl;
	}
}

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

int main()
{
    int K, A, B;
    cin >> K >> A >> B;

    for (int i = A; i <= B; i++)
    {
        if (i % K == 0)
        {
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>

int main(){
	int h,w;
	while(1){
		scanf("%d %d",&h,&w);
		if(h==0&&w==0){break;}
		
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				printf("%c",(i==0||i==h-1||j==0||j==w-1)?'#':'.');
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

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

int main() {
  int n;
  vector<ll> cnt(MX);
  cin >> n;
  rep(i, n) {
    int a;
    cin >> a;
    cnt[a] += 1;
  }
  ll total;
  rep(i, MX) total += i * cnt[i];

  int q;
  cin >> q;
  rep(i, q) {
    int b, c;
    cin >> b >> c;
    total -= b * cnt[b];
    total += c * cnt[b];
    cnt[c] += cnt[b];
    cnt[b] = 0;
    cout << total << '\n';
  }
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i,n) cin >> d[i];
    sort(d.begin(),d.end());
    int x = d[n/2];
    int y = d[n/2 - 1];
    cout << x - y << endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin>>n;
  if(n%2==0){
    cout<<n/2;
  }
  else
  {
    {
      cout<<(n/2)+1;
    }
  }
}

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

int main(){
  char t[10];

  scanf("%s", t);

  if(t[0] == 'S') printf("Cloudy\n");

  else if(t[0] == 'C') printf("Rainy\n");

  else printf("Sunny\n");

  return 0;
}


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

int main() {
  vector<vector<int>> c(3,vector<int>(3,0));
  for (int i = 0; i < 3; i++){
    for (int j = 0; j < 3; j++){
      cin >> c.at(i).at(j);
    }
  }
  
  int n;
  cin >> n;
  
  vector<int> b(n);
  for (int i = 0; i < n; i++){
    cin >> b.at(i);
  }
  
  vector<vector<bool>> ans(3,vector<bool>(3,false));
  
  for (int i = 0; i < 3; i++){
    for (int j = 0; j < 3; j++){
      for (int k = 0; k < n; k++){
        if (c.at(i).at(j) == b.at(k)){
          ans.at(i).at(j) = true;
        }
      }
    }
  }
    if (ans.at(0).at(0) && ans.at(1).at(1) && ans.at(2).at(2)){
      cout << "Yes" << endl;
    }
    else if (ans.at(0).at(2) && ans.at(1).at(1) && ans.at(2).at(0)){
      cout << "Yes" << endl;
    }
    else if (ans.at(0).at(0) && ans.at(0).at(1) && ans.at(0).at(2)){
      cout << "Yes" << endl;
    }
    else if (ans.at(1).at(0) && ans.at(1).at(1) && ans.at(1).at(2)){
      cout << "Yes" << endl;
    }
    else if (ans.at(2).at(0) && ans.at(2).at(1) && ans.at(2).at(2)){
      cout << "Yes" << endl;
    }
    else if (ans.at(0).at(0) && ans.at(1).at(0) && ans.at(2).at(0)){
      cout << "Yes" << endl;
    }
    else if (ans.at(0).at(1) && ans.at(1).at(1) && ans.at(2).at(1)){
      cout << "Yes" << endl;
    }
    else if (ans.at(0).at(2) && ans.at(1).at(2) && ans.at(2).at(2)){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int m,f,r;
	char grd;
	
	while(1==1){
		scanf(" %d %d %d",&m,&f,&r);
		if(m==-1 && f==-1 && r==-1) break;
		if(m==-1 || f==-1) grd='F';
		else{
			if(m+f>=80) grd='A';
			else if(m+f>=65) grd='B';
			else if(m+f>=50) grd='C';
			else if(m+f>=30 && r>=50) grd='C';
			else if(m+f>=30) grd='D';
			else grd='F';
		}
	
		printf("%c\n",grd);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const ll INF = 1e18;
const int N = 1e5 + 10;
VI e[N];
int visit[N], group[N];

void dfs(int now, int g){
    visit[now] = 1;
    group[now] = g;
    for (int next : e[now]){
        if (visit[next]) continue;
        dfs(next, g);
    }
}

ll calc(int n, int p, VL &a, VVL &cost, int r){
    vector<PL> cand;
    priority_queue<ll, vector<ll>, greater<ll> > que;
    REP(i,n){
        if (group[i] != r){
            cand.push_back(PL(a[i], group[i]));
        }else{
            que.push(a[i]);
        }
    }

    sort(ALL(cand));

    ll ans = 0;
    VI in(p);
    in[r] = 1;
    for (PL p : cand){
        ll c = p.first, g = p.second;
        // cout << c << " " << g << endl;
        if (in[g]) continue;
        if (que.empty()){
            return INF;
        }
        in[g] = 1;
        ans += c + que.top();
        que.pop();
        // for (ll x : cost[g]) que.push(x);
        FOR(i,1,cost[g].size()-1) que.push(cost[g][i]);
    }

    return ans;
}

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

    srand((unsigned) time(NULL));
    VL a(n);
    REP(i,n) scanf("%lld", &a[i]);
    REP(i,m){
        int u, v;
        scanf("%d %d", &u, &v);
        e[u].push_back(v);
        e[v].push_back(u);
    }

    int p = 0;
    REP(i,n){
        if (visit[i]) continue;
        dfs(i, p);
        p++;
    }

    if (p == 1){
        cout << 0 << endl;
        return 0;
    }

    VVL cost(p);
    REP(i,n){
        cost[group[i]].push_back(a[i]);
    }

    // REP(i,n) cout << group[i] << endl;

    REP(i,p) sort(ALL(cost[i]));

    ll ans = INF;
    REP(_,100) ans = min(ans, calc(n, p, a, cost, rand() % p));

    if (ans == INF) cout << "Impossible" << endl;
    else cout << ans << endl;

    return 0;
}


Measured memory_bytes: 15316
# Python 3

def PrintI(i):
	print(" ", i)
	return i + 1

if __name__ == "__main__":
	n = input()
	n = int(n)
	s = ""
	for i in range(1, n + 1):
		if i % 3 == 0:
			s += " " + str(i)
		elif "3" in str(i):
			s += " " + str(i)
	print(s)

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

#define fast ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define fl(i,a,n) for(int i=a; i<n; i++)
#define ll long long 
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define test()  int tt;  cin>>tt;  while(tt--)
#define nl  cout<<"\n"
#define pii pair<int,int>
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)    {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}
const int mod=1e9+7;
int dist(int x,int y)   {
    return abs(x-y);
}
void solve()    {
    int n,x,y;  cin>>n>>x>>y;
    map<int,int> distance;
    fl(i,1,n) {
        fl(j,i+1,n+1)   {
            int temp=min(dist(i,j),min(dist(i,x)+1+dist(y,j),dist(i,y)+1+dist(x,j)));
            distance[temp]++;
        }
    }
    
    fl(i,1,n)   {
        cout<<distance[i]<<"\n";
    }
}
/*  Integer Overflow  */
int main()  {
    fast;
    //test()
        solve();
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define st first
#define nd second

using ll = long long ;
using namespace std;
using pii = pair<int,int>;
const int N = 2e5 + 10;
int a[N], b[N];
int main(){
	int  n, k;
	scanf("%d %d", &n, &k);
	for(int i = 1; i <= n; i++){
		scanf("%d", &a[i]);
	}
	for(int kk = 1; kk <= k; kk++){
		for(int i = 1; i <= n + 2; i++) b[i] = 0;
		for(int i = 1; i <= n; i++){
			b[max(1, i - a[i])]++;
			b[min(n, i + a[i]) + 1]--;
		}
		bool io = true;
		for(int i = 1; i <= n; i++){
			b[i] += b[i - 1];
			a[i] = b[i];
			if(a[i] != n) io = false;
		}
		if(io){
			break;
		}
	}
	for(int i = 1; i <= n; i++){
		printf("%d ", a[i]);
	}


}

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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

#ifdef DEBUG
#define debug(...) fprintf(stderr, __VA_ARGS__)
#else
#define debug(...)
#endif

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define eb  emplace_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

#define PQ(T) priority_queue<T>
#define RPQ(T) priority_queue<T,vector<T>,greater<T>>

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

inline ll square(ll x) { return x * x; }
// ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
inline ll gcd(ll a, ll b) { while(a) swap(a, b%=a); return b; }
template <typename T>
inline T mod(T a, T b) { return ((a % b) + b) % b; }


class UnionFind {
 public:
  vector<int> data;
  int count;
 public:
  UnionFind(int size) : data(size, -1), count(size) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
      --count;
    }
    return x != y;
  }
  bool findSet(int x, int y) { return root(x) == root(y); }
  int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
  int size(int x) { return -data[root(x)]; }
};


int solve(int N, vi& x, vi& y) {
    set<ii> ps;

    repC2(i,j,N){
        int p = x[j] - x[i], q = y[j] - y[i];
        ps.insert(ii(p, q));
    }

    int best = N;
    for (ii pq: ps) { // 1250
        int p=pq.first, q=pq.second;
        UnionFind uf(N);
        int il = N;
        rep(i,N) {
            rep(j,N) {
                if (i==j) continue;
                if (x[j]-x[i] == p && y[j]-y[i] == q){
                    uf.unionSet(i,j);
                    --il;
                }
            }
        }
        best = min(best, il);
    }
    return best;
 }

int main() {
    int N; cin >> N;
    vi x(N), y(N);
    rep(i,N) cin >> x[i] >> y[i];
    cout << solve(N,x,y) << endl;
    return 0;
}


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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

int H, W;
vector<string> S;

bool used[405][405];

int dy[] = {-1, 0, 1, 0}, dx[] = {0, -1, 0, 1};
ll bfs(int sy, int sx) {
    queue<P> q;
    q.push(P(sy, sx));

    int b = 0, w = 0;
    used[sy][sx] = true;

    while (!q.empty()) {
        P p = q.front(); q.pop();
        int y = p.first, x = p.second;
        if (S[y][x] == '.') w++;
        else b++;
        rep(i, 4) {
            int ny = y + dy[i], nx = x + dx[i];
            if (0 <= ny && ny < H && 0 <= nx && nx < W && !used[ny][nx] && S[ny][nx] != S[y][x]) {
                q.push(P(ny, nx));
                used[ny][nx] = true;
            }
        }
    }
    return (ll)b * w;
}

int main(){
    cin >> H >> W;

    S = vector<string>(H);
    rep(i, H) cin >> S[i];

    ll ans = 0;
    rep(i, H) {
        rep(j, W) {
            if (!used[i][j]) ans += bfs(i, j);
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<ctype.h>
#include<algorithm>
typedef long long int ll;
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#ifndef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {X;}
#define TF(f) {f;}
#define END {}
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,a) for (int i=1;i<=(a);i++)
const ll MOD = (10*10*10*10*10*10*10*10*10+7);

    string A,B,C;
    int N,M,K,X,Y,W,H;
    int ans;
    string S;
    int temp[100]={0};
    bool f=true;
    bool fir=true;

int main(){
    cin>>N;
    cout<<N*800-(N/15)*200;

}
/*A.size()!=0&&B.size()!=0&&C.size()!=0*/


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

int main(int argc, char const *argv[])
{
	int x, y, z; cin >> x >> y >> z;
	swap(x, y); swap(x, z);
	cout << x << " " << y << " " << z << endl;
	return 0;
}


Measured memory_bytes: 3524
#include<iostream>
using namespace std;
pair <long long int,long long int> p[105];
long long int dp[100005];
int main()
{
	long long int n,w,sum=0;
	cin >> n >> w;
	for(long long int i=0;i<n;i++) {
		long long int w1,v1;
		cin >> w1 >> v1;
		p[i]=make_pair(w1,v1);
		sum+=v1;
	}
	for(long long int i=0;i<=sum;i++) dp[i]=1000000001;
	dp[0]=0;
	for(long long int i=0;i<n;i++) {
		for(long long int j=sum;j>=0;j--) {
            //cout <<j<<" "<<p[i].second<<endl;
			if(j - p[i].second >= 0 && (j-p[i].second == 0 ||  dp[j-p[i].second]!=1000000001)) {
                dp[j]=min(dp[j],p[i].first+dp[j-p[i].second]);
                //cout <<j<<" "<<p[i].second<<endl;
                //cout <<"a "<<p[i].first+dp[j-p[i].second]<<endl;
            }
		}
	}
	//cout <<dp[18]<<endl;
	long long int maxi=0;
	for(long long int i=0;i<=sum;i++) {
        //cout <<dp[i]<<" ";
		//if(dp[i]!=1000000001 && dp[i]>w) break;
		if(dp[i]!=1000000001 && dp[i]<=w) maxi=max(maxi,i);
		//cout <<maxi<<endl;
	}
	cout <<maxi;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

    template <class T, class... Args>
    void impl(T&& v, Args&&... args)
    {
        cout << std::forward<T>(v) << ' ';
        impl(std::forward<Args>(args)...);
    }
    template <class T>
    void impl(T&& v)
    {
        cout << std::forward<T>(v);
    }

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class... Args>
    void operator()(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
        cout << '\n';
    }
    template <class... Args>
    void noreturn(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
        cout << '\n';
    }
};

void prog()
{
    input in;
    output out;
    auto n = in.read<int>();
    auto p = in.read<int>(n);

    int m = 1e7;
    int res = 0;
    for (int x : p) {
        if (x <= m) ++res;
        m = std::min(m, x);
    }
    out(res);
}

int main()
{
    prog();
    return 0;
}


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

int main() {
	int n, m, ans = 0, h[100010], eval[100010] = { 0 };
	cin >> n >> m;
	rep(i, n) {
		cin >> h[i];
	}
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		if (h[a] <= h[b]) eval[a] = 1;
		if (h[b] <= h[a]) eval[b] = 1;
	}
	rep(i, n) {
		if (eval[i] == 0) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4424
# n=int(input())
# a,b=map(int,input().split())
# l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
s = list(input())
l = [int(s[0]), int(s[1]), int(s[2]), int(s[3])]

for i in range(2**3):
    opt = ['+', '+', '+']
    for j in range(3):
        if ((i >> j) & 1):
            opt[j] = '-'
    test = l[0]
    for k in range(3):
        if opt[k] == '+':
            test += l[k+1]
        else:
            test -= l[k+1]
    if test == 7 :
        break
printstr=str(l[0])
for i in range(3):
    printstr+=opt[i]+str(l[i+1])
print(printstr+'=7')

Measured memory_bytes: 9172
#include <bits/stdc++.h>
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
using namespace std;

#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

bool flag = true;
int col[100000];
vector<int> G[100000];

void dfs(int v){
	for(int to : G[v]){
		if(col[to] == -1){
			col[to] = (col[v] + 1) % 2;
			dfs(to);
		}
		else if(col[to] == col[v]) flag = false;
	}
}

signed main(){
	int n,m;
	cin >> n >> m;
	for(int i = 0;i < n;i++) col[i] = -1;
	for(int i = 0;i < m;i++){
		int a,b;
		cin >> a >> b; a--;b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	col[0] = 0;
	dfs(0);
	if(flag){
		int one = 0;
		for(int i = 0;i < n;i++) one += col[i];
		cout << n * (n - 1) / 2 - m - one * (one - 1) / 2 - (n - one) * (n - one - 1) / 2 << endl;
	}else cout << n * (n - 1) / 2 - m << endl;
	return 0;
}

Measured memory_bytes: 7552
n, k = map(int, input().split())
a = [list(map(int, input().split())) for i in range(2*k)]
ans = [0]*n
for i in range(k):
    for j in range(a[i*2][0]):
        s = a[i*2+1][j]
        ans[s-1] = 1
S = n - sum(ans)
print(S)

Measured memory_bytes: 68004
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define EQ(a,b) (abs((a)-(b))<EPS)
// 1 taro 2 hanako
int card[201];
int f=0;
int n;
int p[3];
int t,h;
void turn(int s)
{
	bool flag=false;
	for(int i=f+1;i<=2*n;i++)
	{
		if(card[i]==s)
		{
			f=i;
			card[i]=0;
			p[s]--;
			return;
		}
	}
	if(!(flag))
	{
		f=0;
		return;
	}
}
int main()
{
	while(1)
	{
		memset(card,0,sizeof(card));
		f=0;
		t=0;
		h=0;
		cin >> n;
		if(n==0)break;
		p[1]=n;p[2]=n;
		for(int i=0;i<n;i++)
		{
			int k;
			cin >> k;
			card[k]=1;
		}
		for(int i=1;i<=2*n;i++)
		{
			if(card[i]!=1)
			{
				card[i]=2;
			}
		}
		for(int i=0;;i++)
		{
			turn((i%2)+1);
			if(p[1]==0||p[2]==0)break;
		}
		t=p[2];
		h=p[1];
		cout << t << endl;
		cout << h << endl;
	}
	return 0;
}

Measured memory_bytes: 1160