akhauriyash/Code-Regression huggingface dataset:
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <fstream>
#include <iostream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <ext/random>
#include <ext/rope>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using uint64 = unsigned long long;
using vi = std::vector<int>;
using vl = std::vector<int64>;
using pii = std::pair<int, int>;
using pii = std::pair<int, int>;
using pll = std::pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(_) (_).begin(), (_).end()
#define rall(_) (_).rbegin(), (_).rend()
#define print(_) std::cout << (_) << '\n'
#define debug(_) std::cerr << #_ << ": " << (_) << '\n'
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
template<typename T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  os << "{";
  for (size_t i = 0; i < vec.size(); ++i) {
    os << vec[i] << ",}"[i == vec.size() - 1];
  }
  return os;
}
template<typename T, typename U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << "{" << p.first << " " << p.second << "}";
}
// constant
const int INF = (1<<30) - 1;  // 1.073741823e9
const int64 INF64 = (1LL<<62) - 1;  // 4.611686018427387903e18
const int MOD = 1000000007;

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

  int n, k, q; cin >> n >> k >> q;
  map<int, int> mp;
  rep(i, q) {
    int a; cin >> a;
    ++mp[a];
  }

  for (int i = 1; i <= n; ++i) {
    if (k > q - mp[i]) {
      cout << "Yes" << '\n';
    } else {
      cout << "No" << '\n';
    }
  }

  return 0;
}

Measured memory_bytes: 5376
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <numeric>
#include <functional>
#include <cmath>
#include <cassert>
#include <string>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
#define PI (acos(-1))

ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}
vector<ll> divisor(ll n)
{
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

ll a[3];
ll solve()
{
    for(int i=0; i < 3; i++){
        cin >> a[i];
    }
    ll five = 0, s = 0;
    for (int i = 0; i < 3; i++)
    {
        if (a[i] == 5)
        {
            five++;
        }
        else if (a[i] == 7)
        {
            s++;
        }
    }
    if (five == 2 && s == 1)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

int main()
{
    //cout.precision(10);
    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();
}


Measured memory_bytes: 256
n, y = map(int,input().split())
y = y/1000
a = 0
b = -1
c = -1
f = False
while (y-n-9*a >=0):
    if (y-n-9*a)%4 == 0:
        b = int((y-n-9*a)//4)
        c = n - a - b
        if c>=0:
            f = True
            break
    a+=1
if f == False:
    a = -1
    b = -1
    c = -1
print(a, b, c)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;

int A;

int main(){
    cin >> A;
    int B = A / 100;
    int C = A % 100;
    if(1 <= B && B <= 12 && 1 <= C && C <= 12){
        cout << "AMBIGUOUS" << "\n";
    } else if(1 <= C && C <= 12){
        cout << "YYMM" << "\n";
    } else if(1 <= B && B <= 12){
        cout << "MMYY" << "\n";
    } else {
        cout << "NA" << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define N 100000
int main(void) {
  long A, B;
  int i;
  scanf("%ld %ld", &A, &B);

  for (i=1; i<N; i++) {
    if ((A * i) % B == 0) {
      printf("%ld\n", A * i);
      break;
    }
  }
  
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int
#define vec vector<ll>
#define mat vector<vec>

using namespace std;

const ll mod=1000000007;
const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

int main(){

  ll n;
  cin >> n;
  vector<char> s(n);
  for(ll i=0;i<n;i++)cin >> s[i];
  sort(s.begin(),s.end());
  s.erase(unique(s.begin(),s.end()),s.end());

  //cout << s.size() << endl;
  //for(ll i=0;i<4;i++)cout << s[i] << endl;

  if(s.size()==4)cout << "Four" << endl;
  else cout << " Three" << endl;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main(){
    int n,x,y,l; cin >> n;
    ll sum = 0, ans = 0;
    bool flag = true;
    vector<int> v(n,0);
    vector<vector<pair<int,int>>> a(n);

    rep(i,n){
        cin >> l;
        rep(j,l){
            cin >> x >> y;
            a[i].push_back(make_pair(x,y));
        }
    }

    for(int bit = 0; bit < (1 << n); ++ bit){

        rep(i,n) v[i] = 0;
        sum = 0;
        flag = true;

        for(int i = 0; i < n; ++i){
            if(bit & (1 << i)){
                v[i] = 1;
                sum ++;
            }
        }

        for(int i = 0; i < n; i ++){
            if(v[i] == 1){
                for(int j = 0; j < a[i].size(); j ++){
                    if(v[a[i][j].first-1] != a[i][j].second) flag = false;
                }
            }
        }

        if(flag) ans = max(sum,ans);
    }

    cout << ans;
    //bit全探索で矛盾が起こらない最大値を求める*/

}

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();
        int num = 0;
        for (int i = Math.min(a,b); i >= 1; i--) {
            if (a % i == 0 && b % i == 0)
                num++;
            if (num == k)
                System.out.println(i);
                if(num == k)
                    break;
        }
    }
}

Measured memory_bytes: 35680
#include <iostream>

using namespace std;

inline int max(int x, int y){
	return x > y ? x : y;
}

inline int min(int x, int y){
	return x < y ? x : y;
}

int main(){
	int n, x, sum23, count = 0;
	for(;;){
		cin >> n >> x;
		if(n == 0) return 0;
		count = 0;
		int sup = min(n, x/3-1);
		int inf = x - 2*n + 1;
		if(inf < 1) inf = 1;
		for(int i1 = inf; i1 <= sup; i1++){
			sum23 = x - i1;
			int d = (sum23-1)/2 - max(i1, sum23-n-1);
			if(d > 0) count += d;
		}
		cout << count << endl;
	}
}

Measured memory_bytes: 3080
#include <stdio.h>
#define M 100000
#define NUL -1

struct node{int x,y,z;};
struct node s[M];

int r[M];

void hyouzi(int i){
  int j,c;
  printf("node %d: parent = %d, depth = %d, ",i,s[i].x,r[i]);

  if(s[i].x==NUL) printf("root, ");
  else if(s[i].y==NUL) printf("leaf, ");
  else printf("internal node, ");

  printf("[");
  for(j=0,c=s[i].y;c!=NUL;j++,c=s[c].z){
    if(j>0) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

void deep(int i,int x) {
  r[i]=x;
  if(s[i].z!=NUL) deep(s[i].z,x);
  if(s[i].y!=NUL) deep(s[i].y,x+1);
}

int main()
{
  int a,i,j,k,y,z,num,ch;

  scanf("%d",&k);

  for(i=0;i<k;i++){
    s[i].x=s[i].y=s[i].z=-1;
  }

  for(i=0;i<k;i++){
    scanf("%d%d",&num,&ch);
    for(j=0;j<ch;j++){
      scanf("%d",&a);
      if(j==0) s[num].y=a;
      else s[y].z=a;
      y=a;
      s[a].x=num;
    }
  }

  for(i=0;i<k;i++){
    if(s[i].x==NUL) z=i;
  }

  deep(z,0);

  for(i=0;i<k;i++) hyouzi(i);
  
  return 0;
}




Measured memory_bytes: 6404
alp = "abcdefghijklmnopqrstuvwxyz"
s = input()
if len(s) < 26:
    for x in alp:
        if x not in s:
            print(s+x)
            break
elif s == alp[::-1]:
    print(-1)
else:
    # ここから
    for i in range(24,-1,-1):
        for j in range(25,i,-1):
            #print(i,j,s[i],s[j])
            if s[i] < s[j]:
                print(s[:i] + s[j])
                exit()


Measured memory_bytes: 3060
def main():
  n=int(input())
  s=input()
  E=s.count('E')
  e=[0]*n
  e[0]=1 if s[0]=='E' else 0
  ans=E-e[0]
  for i in range(1,n):
    e[i]=e[i-1] + (1 if s[i]=='E' else 0)
    x=E-e[i]+i-e[i-1]
    ans=ans if ans<=x else x
  print(ans)
if __name__=='__main__':
  main()

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

using namespace std;

int main() {
	char a, b, c;
	cin >> a >> b >> c;
	
	if (a == '7' || b == '7' || c == '7') {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	
	return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cout << v << " ";                                                          \
  }                                                                            \
  cout << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;
  print(N <= 999 ? "ABC" : "ABD");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int ans=0,n,k,x,y;
    cin>>n>>k>>x>>y;

    if(n<=k)
    {
        ans=x*n;
    }
    else {
        ans=x*k+y*(n-k);
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define i64 long long int
i64 M(i64 A, i64 B){
	return B/A * A * 2 + (B % A == 0 ? -A : M(B%A, A));
}
i64 calc(i64 N, i64 X){
	if(X + X == N)return 3 * X;
	if(X + X < N)return N + M(X, N-X);
	return N + M(N-X, X);
}
int main(){
	i64 N, X;
	cin >> N >> X;
	cout << calc(N, X) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n); std::vector<int> a(n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);

	std::vector<int> latte(30, 0);
	std::vector<int> vec(30, 0);
	for(int i = 0; i < n; i++) {
		for(int j = 0; j < 30; j++) if(a[i] >> j & 1) { vec[j]++; break; }
		for(int j = 0; j < 30; j++) if(a[i] >> j & 1) (latte[j] += 1) %= 2;
	}

	int ans = 0;
	for(int i = vec.size() - 1, tmp = 0; i >= 0; i--) {
		if(!vec[i] and (latte[i] ^ tmp)) {
			printf("-1\n");
			return 0;
		}
		
		if(latte[i] ^ tmp & 1) {
			tmp ^= 1;
			ans++;
		}
	}

	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 640
n = int(input())
h = list(map(int, input().split()))

dp = [10 ** 9] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, n):

    h1 = dp[i - 1] + abs(h[i] - h[i - 1])
    dp[i] = h1 if h1 < dp[i] else dp[i]

    h2 = dp[i - 2] + abs(h[i] - h[i - 2])
    dp[i] = h2 if h2 < dp[i] else dp[i]

print(dp[-1])

Measured memory_bytes: 13924
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>

using namespace std;
using ll =long long;
using vi = vector<int>; 
using vvi = vector<vi>; 
using vl = vector<ll>; 
using vvl = vector<vl>; 
using vs = vector<string>;
using vvs = vector<vs>; 
using vc = vector<char>;
using vvc = vector<vc>; 
using vb = vector<bool>;
using vvb = vector<vb>; 

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
typedef pair<int, int> PR;

#define rep(i,n) ;for( int i =0; i < n ; i ++)
#define all(a) a.begin(),a.end()
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define fr(i,a,b) for(int i=a;i<b;i++)
#define pri(a)  printf("%.14lf\n",a);
#define MOD 1000000007
bool is_int_lround(double x){
  return std::lround(x)==x;
}
ll keta(ll x){
  ll n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}

ll conbi(int n,int m){
  
  cin>>n>>m;
  vector<ll> a(100);
  a[0] =1;
  for(int i=0;i<14;i++){
    a[i+1]=a[i]*(i+1);
  }
  return a[n] /(a[m] *a[n-m]);
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;//繰り返し二乗法
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
ll kaijo(ll x){
  ll z=1;
  if(x==0){
    return 1;
  }
  while(x>0){
    z *=x;
    z %=MOD;
    x--;
  }
  return z;
}
ll yakusu_num(ll n){
  vl yakusu(n+1,1);
  for(ll i=2;i*i<=n;i++){ 
    while(n%i==0){
      n /=i;
      yakusu[i]++;
    }
  }
  if(n!=1)yakusu[n]++;
  ll num=1;
  for(ll i=0;i <=n;i++){
    num*=yakusu[i];
  }
  return num;
}

//cout<<""<<endl;
int main(){
  ll N;cin>>N;
  vl A(N);rep(i,N)cin>>A[i];
  vl lf(N),rg(N);
  lf[0]=A[0];rg[N-1]=A[N-1];
  rep(i,N-1){
    lf[i+1]=gcd(lf[i],A[i+1]);
    rg[N-i-2]=gcd(rg[N-i-1],A[N-i-2]);
  }
  ll ans=max(rg[1],lf[N-2]);
  for(ll i=1;i<N-1;i++){
   ans = max(ans, gcd(lf[i-1],rg[i+1]) );
  }
  cout<<ans<<endl;
}






Measured memory_bytes: 5628
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        s: chars
    }
    let n = s.len();
    let mut tab = vec![false; n + 1];
    tab[0] = true;
    tab[5] = str_match(&s, "dream") || str_match(&s, "erase");
    tab[6] = str_match(&s, "eraser");
    for i in 7..n + 1 {
        tab[i] |= tab[i - 5] && (str_match(&s[i-5..], "dream") || str_match(&s[i-5..], "erase"));
        tab[i] |= tab[i - 6] && str_match(&s[i-6..], "eraser");
        tab[i] |= tab[i - 7] && str_match(&s[i-7..], "dreamer");
    }
    println!("{}", if tab[n] {"YES"} else {"NO"});
}

fn str_match(s: &[char], h: &str) -> bool {
    let l = h.len();
    if s.len() < l {
        return false;
    }
    let (s1, _) = s.split_at(l);
    let mut ret = true;
    for (cs,ch) in s1.iter().zip(h.to_string().chars()) {
        ret &= *cs == ch;
    }
    ret
}


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

char ptn[8][8];

void rotate()
{
	char tmp[8][8];
	memcpy( tmp, ptn, sizeof( ptn ) );

	for( int i = 0; i != 8; ++i )
		for( int j = 0; j != 8; ++j )
			ptn[i][j] = tmp[7-j][i];
	
	return;
}

int main()
{
	for( int i = 0; i != 8; ++i )
		for( int j = 0; j != 8; ++j )
			std::cin >> ptn[i][j];

	for( int i = 1; i <= 3; ++i )
	{
		rotate();
		std::cout << i * 90 << std::endl;

		for( int j = 0; j != 8; ++j )
		{
			for( int k = 0; k != 8; ++k )
				std::cout << ptn[j][k];

			std::cout << std::endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1140
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
#include<bitset>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define pii(p)			pair<int,int> p
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

void solve() {
	int n;
	cin >> n;
	vector<int> a(n);
	bool ok = true;

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

	for (int i = 0; i < n; ++i) {
		if (a[i] % 2 == 0)
			if(!(a[i] % 3 == 0 || a[i] % 5 == 0))
				ok = false;
	}
	if (ok)
		cout << "APPROVED" << endl;
	else
		cout << "DENIED" << endl;
}

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

Measured memory_bytes: 256
#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>;

int main()
{
  int N, M;
  cin >> N >> M;
  
  vector<int> H(N);
  vector<bool> is_good(N, true);
  rep(i, N)
  {
    cin >> H[i];
  }
  
  rep(i, M)
  {
    int A, B;
    cin >> A >> B;
    A--;
    B--;
    
    if (H[A] <= H[B])
    {
      is_good[A] = false;
    }
    
    if (H[B] <= H[A])
    {
      is_good[B] = false;
    }
  }
  
  int num = 0;
  rep(i, N)
  {
    if (is_good[i])
    {
      num++;
    }
  }
  
  cout << num << endl;

  return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  maxn = 1e6 + 5;
const int N = 15;

ll n,m,x,a[N][N],c[N],b[N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>m>>x;
	for(int i=1;i<=n;i++){
		cin>>c[i];
		for(int j=1;j<=m;j++){
			cin>>a[i][j];
		}
	}
	ll ans=1e9,res=0;
	for(int i=0;i<(1<<n);i++){
		res=0;
		int tot=__builtin_popcount(i);
		memset(b,0,sizeof(b));
		for(int j=0;j<n;j++){
			if(i&(1<<j)){
				for(int k=1;k<=m;k++){
					b[k]+=a[j+1][k];
				}
				res+=c[j+1];
			}
		}
		// cout<<"res="<<res<<'\n';
		bool flag=true;
		for(int j=1;j<=m;j++){
			if(b[j]>=x) continue;
			flag=false;break;
		}
		if(flag){ans=min(ans,res);}
	}
	// cout<<"ans="<<ans<<'\n';
	if(ans<1e9) cout<<ans<<'\n';
	else cout<<-1<<'\n';
	return 0;
}

Measured memory_bytes: 3656
#include<stdio.h>
#define N 36
typedef struct{
  int value;
  char moji;
}C;
main()
{
  int i,j,n,flag=0,x,minj,count;
  char c;
  C C[N],M[N];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf(" %c%d",&C[i].moji,&C[i].value);
    M[i]=C[i];
  }
  flag=1;
  i=0;
  while(flag){
    flag=0;
    for(j=n-1;j>=i+1;j--){
      if(C[j].value<C[j-1].value){
	x = C[j].value;
	c = C[j].moji;
        C[j].value= C[j-1].value;
	C[j].moji= C[j-1].moji;
	C[j-1].value= x;
	C[j-1].moji= c;
        flag=1; 
	count++;     
      }   
    }
    i++;  
  }
  
  /*
    for(i=0;i<=n-1;i++){
    for(j=n-1;j>=i;j--){
    if(C[j].value<C[j-1].value){
    x = C[j].value;
    C[j].value=C[j+1].value;
    C[j+1].value=x;
    }
    }
    }*/
  for(i=0;i<n;i++){
    printf("%c%d",C[i].moji,C[i].value); 
  if(i==n-1)
      printf("\n");
    else
      printf(" ");
  }
  printf("Stable\n");
  
  /*
    for(i=0;i<=n-1;i++){
    minj=i;
    for(j=i;j<=n-1;j++){
    if(M[j].value<M[minj].value){
    minj=j;
    x=M[i].value;
    M[i]=M[minj];
    M[minj].value=x;
    }
    }
    }*/
  
  for(i=0;i<=n-1;i++){
    minj=i;
    flag=0;
    for(j=i;j<=n-1;j++){
      if(M[j].value<M[minj].value){
	minj=j;
	flag=1;
      }
    }
    if(flag==1){
    	x = M[i].value;
	c = M[i].moji;
        M[i].value= M[minj].value;
	M[i].moji= M[minj].moji;
	M[minj].value= x;
	M[minj].moji= c;
      count++;
    }
  }
  for(i=0;i<n;i++){
    printf("%c%d",M[i].moji,M[i].value);
    if(i!=n-1)
      printf(" ");
  }
  printf("\n");
  for(i=0;i<n;i++){
    if(C[i].moji!=M[i].moji)
      flag=1;
  }
  if(flag==1)
    printf("Not stable\n");
  else{
    printf("Stable\n");
  }
  return 0;
}

Measured memory_bytes: 612
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
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; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n, m;
    cin>>n>>m;
    vl as(m);
    cin>>as;

    ll s = 0;
    rep(i, m) s += as[i];
    if (s > n) cout<<-1<<endl;
    else cout<<n - s<<endl;
}

Measured memory_bytes: 3668
#include<iostream>
#include<string>
using namespace std;
string S; int a, b;
int main() {
	while (cin >> S) {
		a = 0; b = 0;
		if (S == "0") { break; }
		for (int i = 1; i < S.size(); i++) {
			if (S[i] == 'A') {
				a++;
			}
			else {
				b++;
			}
		}
		if (a > b) {
			a++;
		}
		else {
			b++;
		}
		cout << a << ' ' << b << endl;
	}
}

Measured memory_bytes: 1184
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	long long a, b, c, d = 1, e;
	cin >> a >> b;
	for (int h = 1; h <= b; h++) {
		d = d * 2;
	}
	cout << ((a - b) * 100 + b * 1900) * d << endl;;
	cin >> e;
}

Measured memory_bytes: 256
#!/usr/bin/env pypy
from __future__ import division, print_function

import os
import sys
from __builtin__ import xrange as range
from cStringIO import StringIO
from future_builtins import ascii, filter, hex, map, oct, zip
from io import IOBase

import __pypy__


def gcd(x, y):
    """greatest common divisor of x and y"""
    while y:
        x, y = y, x % y
    return x


lcm = lambda a, b: a * b // gcd(a, b)


def main():
    a, b, c, d = map(int, input().split())

    cnt = b - ((b // c) + (b // d) - (b // lcm(c, d)))
    a -= 1
    tmp = a - ((a // c) + (a // d) - (a // lcm(c, d)))
    print(cnt - tmp)


# region fastio

BUFSIZE = 8192


class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 29164
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
Scanner scan=new Scanner(System.in);
int a=scan.nextInt();
int b=scan.nextInt();
int c=scan.nextInt();
int max=a;
if(max<b){
max=b;
}
if(max<c){
max=c;
}
if(max==a){
a=0;
}
else if(max==b){
b=0;
}
else if(max==c){
c=0;
}
System.out.println(max*10+a+b+c);
}
}

Measured memory_bytes: 23380
import math
 
def is_prime(n):
    if n == 1: return False
 
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
 
    return True
 
X=int(input())
 
for i in range(X, 1000001):
  if is_prime(i):
    break
    
print(i)

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

#define int long long
#define double long double

const int INF=2147483647;
const int MOD=1000000007;
const int mod=998244353;
const double eps=1e-18;

using namespace std;

signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int a,b,c,d;
    int res;
    
    cin>>a>>b>>c>>d;
    res=-INF*INF;
    res=max(res,a*c);
    res=max(res,a*d);
    res=max(res,b*c);
    res=max(res,b*d);
    cout<<res<<endl;
    
    return 0;
}


Measured memory_bytes: 3648
a, b, c, d = map(int, input().split())
 
x_max = max(a, b)
x_min = min(a, b)
 
y_max = max(c, d)
y_min = min(c, d)
 
ans = max(x_max * y_max, x_max * y_min, x_min * y_max, x_min * y_min)
 
if (x_max >= 0 and x_min <= 0) or (y_max >= 0 and y_min <= 0):
  ans = max(ans, 0)
 
print(ans)

Measured memory_bytes: 9192
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
using namespace std;
typedef long long ll;
const int N=2e5+5;
ll p[N];
int pre[N],bk[N],ans[N];
int n;
char s[N];
int get(int x)
{
    int ans=0;
    while(x)
        x=x%__builtin_popcount(x),ans++;
    return ans;
}
void solve(int x,int sum)
{
    if(sum<=0) return;
    p[0]=1;for(int i=1;i<N;i++) p[i]=p[i-1]*2%sum;
    for(int i=1;i<=n;i++)
        pre[i]=(pre[i-1]+(s[i]=='1')*p[i-1])%sum;
    for(int i=n;i>=1;i--)
        bk[i]=(bk[i+1]+(s[i]=='1')*p[i-1])%sum;
    for(int i=1;i<=n;i++)
        if(x==1&&s[i]=='1')
    {
        int res=(pre[i-1]+bk[i+1])%sum;
        ans[i]=1+get(res);
    }
    else if(x==0&&s[i]=='0')
    {
        int res=(pre[i-1]+bk[i+1]+p[i-1])%sum;
        ans[i]=1+get(res);
    }
}
int main()
{
    scanf("%d%s",&n,s+1);
    reverse(s+1,s+1+n);
    int sum=0;
    for(int i=1;i<=n;i++) sum+=s[i]=='1';
    solve(1,sum-1);
    solve(0,sum+1);
    reverse(ans+1,ans+1+n);
    for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
}


Measured memory_bytes: 7864
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

ans = 0
for i in range(N):
    l = min(A[i], B[i])
    ans += l
    r = min(A[i+1], B[i]-l)
    ans += r
    A[i+1] -= r

print(ans)

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

using namespace std;
using ll = long long;

int main() {
    unordered_map<ll, ll> m;
    ll H , W;
    ll N;
    cin >> H >> W >> N;
    for(int i = 0; i < N; i++) {
        ll x, y;
        cin >> x >> y;
        for(ll h = 0; h < 3; h++) {
            for(ll w = 0; w < 3; w++) {
                m[((x + h) << 30) + (ll)(y + w)]++;
            }
        }
    }

    ll res[9] = {};
    ll s = 0;
    for(auto c : m) {
        int h = c.first >> 30;
        int w = c.first % (1 << 30);
        if(h > H || w > W || h < 3 || w < 3) continue;
        res[c.second - 1]++;
        s++;
    }
    cout << (H - 2) * (W - 2) - s << endl;
    for(int i = 0; i < 9; i++) {
        cout << res[i] << endl;
    }
}

Measured memory_bytes: 39512
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back

int main() {
  int h,w;
  cin >> h >> w;

  ll cost[10][10];
  int wall[h][w];

  rep(i,10)rep(j,10) cin >> cost[i][j];
  rep(i,h)rep(j,w) cin >> wall[i][j];

  rep(k,10)rep(i,10)rep(j,10) cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);

  ll ans = 0;
  rep(i,h)rep(j,w) {
    if (wall[i][j] == -1 or wall[i][j] == 1) continue;
    ans += cost[wall[i][j]][1];
  }

  cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
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; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int l = max(a, c), r = min(b, d);
  cout << max(r-l, 0) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int weight, n, v, w, dp[1050];
int main(){
    int t = 0;
    while(cin >> weight, weight){
	fill(dp, dp + 1050, 0);
	t++;
	cin >> n;
	for(int i = 0;i < n;i++){
	    scanf("%d,%d", &v, &w);
	    for(int j = 1000;j >= 0;j--){
		if(j - w >= 0)
		    dp[j] = max(dp[j], dp[j - w] + v);
	    }
	}
	int now = weight;
	for(int i = weight;i >= 0;i--){
	    if(dp[i] >= dp[now])now = i;
	}
	cout << "Case " << t << ":" << endl;
	cout << dp[now] << endl;
	cout << now << endl;
    }
    return 0;
}

Measured memory_bytes: 1244
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
r = 0
a = 0
for i in range(N):
    r += B[A[i]-1]
    if  A[i]-1 > len(C):
        continue
    elif A[i] == a+1 and A[i] != 1:
        r += C[a-1]
    a = A[i]
print(r)

Measured memory_bytes: 3064
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	string s;
	cin>>s;
	int l=s.length();
	if(s[0]==s[1]){
		cout<<0+1<<" "<<1+1<<endl;
		return 0;
	}
	FORQ(i,2,l){
		if(s[i]==s[i-1]){
			cout<<i<<" "<<i+1<<endl;
			return 0;
		}
		if(s[i]==s[i-2]){
			cout<<i-1<<" "<<i+1<<endl;
			return 0;
		}
	}
	cout<<-1<<" "<<-1<<endl;

    return 0;
}


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

#define LL long long
#define VI vector<int>
#define VL vector<long long>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v,x) (std::find(v.begin(), v.end(), x) != v.end())
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define EPS 1e-14

using namespace std;


LL solve(int N, vector<LL> v) {
    vector<LL> leftMax(3 * N, 0);
    vector<LL> rightMin(3 * N, 0);

    {
        priority_queue<LL, vector<LL>, greater<LL>> left;
        LL total = 0;
        FOR(i, 0, N) {
            left.push(v[i]);
            total += v[i];
        }
        leftMax[N - 1] = total;
        FOR(i, N, v.size()) {
            left.push(v[i]);
            total += v[i] - left.top();
            leftMax[i] = total;
            left.pop();
        }
    }

    priority_queue<LL> right;
    {
        LL total = 0;
        for(int i = v.size() - 1; i >= 2 * N; --i) {
            right.push(v[i]);
            total += v[i];
        }
        rightMin[2 * N] = total;
        for(int i = 2 * N - 1; i >= 0; --i) {
            right.push(v[i]);
            total += v[i] - right.top();
            rightMin[i] = total;
            right.pop();
        }
    }

    LL ans = LLONG_MIN;
    FOR(i, N - 1, 2 * N) {
        ans = max(ans, leftMax[i] - rightMin[i + 1]);
    }

    return ans;
}


int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<LL> v(3 * N, 0);
    LL x;
    FOR(i, 0, 3 * N) {
        cin >> x;
        v[i] = x;
    }
    std::cout << solve(N, v) << endl;
    
    return 0;
}


Measured memory_bytes: 11492
N, K = map(int,input().split())
h = list(map(int,input().split()))

dp = [float("inf")]*N
dp[0] = 0

for outer in range(N):
    for inter in range(outer+1,min(N,outer+K+1)):
        dp[inter] = dp[outer] + abs(h[inter] - h[outer]) if dp[inter] > dp[outer] + abs(h[inter] - h[outer]) else dp[inter]
print(dp[N-1])

Measured memory_bytes: 54880
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random
########################################################
bool=False
p=0
for _ in range(int(input())):
    a,b=INPUT()
    if a==b:
        p+=1
    else:
        p=0
    if p>=3:
        bool=True
if bool:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 76232
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes                \
    cout << "Yes" << endl; \
    return 0;
#define No                \
    cout << "No" << endl; \
    return 0;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template <typename T>
void print(const T &v);

int main()
{
    int R;
    cin >> R;
    cout << fixed << setprecision(10) << R * 2 * M_PI << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


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

#define int long long
#define test int t; cin >> t; while (t--)
#define deb(x) cerr << "[" << #x  << " : "<< x << "]\n";
#define debv(v) { cerr << #v << " : "; for (auto x : v) cerr << x << ' '; cerr << "\n"; }
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(),x.end()

string s, t;

int makeEqual (string str) {
	int ans = 0;
	
	for (int i = 0; i < (int)t.size(); i++) {
		if (str[i] != t[i]) {
			ans++;
		}
	}
	
	return ans;
}

signed main () {
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	cin >> s >> t;
	
	int ans = t.size();
	
	for (int i = 0; i < (int)s.size() - (int)t.size() + 1; i++) {
		string subStr = s.substr (i, (int)t.size());
		ans = min (ans, makeEqual (subStr));
	}
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back

class Eratosthenes{
  public:
    int n, sqlim;
    vector<bool> prime;
    vi p;
    Eratosthenes(int N, int lowlim, int s):n(N+1){
        sqlim=(int)ceil(sqrt(n));
        prime=vector<bool>(n,1);
        rep(i,lowlim) prime[i]=0;
        for(int i=2;i<=n;i++) if(prime[i]) { p.pb(i); for(int j=i*2;j<=n;j+=i) prime[j]=0; if(p.size()>s) break;}
    }
    vector<int> primeArray(int s=0){vi ret; for(int i=s;i<n;i++) if(prime[i]) ret.push_back(i); return ret;}
};


int main(){
	int m,n;
	while(cin>>m>>n,n){
		Eratosthenes e(7368791,m,n);
		cout<<e.p[n]<<endl;
	}
	return 0;
}

Measured memory_bytes: 7744
#include <iostream>
#include<string>
#include<cmath>
#include<ciso646>
#include<cstring>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<math.h>

using ll = long long;


using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	cout << 6 - a - b;
}

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

using namespace std;

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

    for (int i = 0; i < N.length() / 2; i++) {
        if (N[i] != N[N.length() - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
b = list(map(int, input().split()))
b.sort()
if n == 2:
    print(b[-1]-b[0])
    print(b[-1], b[0])
    exit()
if b[0] == 0 and b[-1] == 0:
    print(0)
    for i in range(n-1):
        print(0,0)
elif b[0] > 0 and b[-1] > 0:
    ans = sum(b) - 2*b[0]
    print(ans)
    print(b[1], b[0])
    left = b[1] - b[0]
    right = b[-1]
    for i in range(2, n-1):
        x = left
        y = b[i]
        print(x, y)
        left = x - y
    print(right, left)
elif b[0] < 0 and b[-1] < 0:
    ans = -sum(b) + 2*b[-1]
    print(ans)
    b = b[::-1]
    print(b[0], b[1])
    left = 0
    right = b[0] - b[1]
    for i in range(2, n):
        x = right
        y = b[i]
        print(x, y)
        right = x - y
else:
    ans = abs(sum(abs(i) for i in b))
    print(ans)
    now = 1
    left = b[0]
    right = b[-1]
    while b[now] < 0:
        x = right
        y = b[now]
        print(x, y)
        right = x - y
        now += 1
    for i in range(now, n-1):
        x = left
        y = b[i]
        print(x, y)
        left = x - y
    print(right, left)

Measured memory_bytes: 13968
#include<bits/stdc++.h>
using namespace std;
#define loop(i,l,r) for(int i=(l);i<=(r);i++)
typedef long long ll;
const int maxn=2e5+5;
struct node
{
    int a;
    int b;
}s[maxn];
bool cmp(node x,node y)
{
    if(x.b!=y.b) return x.b<y.b;
    else return x.a<y.a;
}
int main()
{
    int n;
    scanf("%d",&n);
    loop(i,0,n-1) scanf("%d %d",&s[i].a,&s[i].b);
    sort(s,s+n,cmp);
    ll st=0;
    loop(i,0,n-1)
    {
        if((st+s[i].a)>s[i].b)
        {
            st=0;
            break;
        }
        st+=s[i].a;
    }
    printf("%s\n",st>0?"Yes":"No");
}


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

int main(){
    long long int l,r,a,b,z,e=0;

    cin>>a>>b;

    for(int i=a;i<=b;i++){
        if(i%2019==0){
            e=1;
            break;
        }
    }

    if(e==1)
        cout<<0<<endl;

    else{
        int l=a%2019;
        int r=b%2019;
        int a=2019;
        int mn=min(l,r);
        int mx=max(l,r);

        for(int i=mn;i<=mx-1;i++){
            for(int j=mn+1;j<=mx;j++){
                a=min(a,(i*j)%2019);
            }
        }




        cout<<a%2019<<endl;
    } 
    
    return 0;







}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
#print(A)
a=[]
l=[]
for i in range(N):
    a.append([A[i],i+1])
a.sort(key=lambda x:x[0])
for i in range(N):
    l.append(a[i][1])
print(*l, sep=" ")


Measured memory_bytes: 74412
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int>p(n);
	vector<int>temp(n);
	rep(i, n) {
		cin >> p[i];
		temp[i] = p[i];
	}

	sort(temp.begin(), temp.end());
	bool ok = true;
	int cnt = 0;
	rep(i, n) {
		if (!(p[i] == temp[i])) {
			cnt++;
		}
	}
	if (cnt >= 3)ok = false;

	if (ok)cout << "YES" << endl;
	else cout << "NO" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
char a,b;
cin>>a>>b;
if(a=='H'){
if(b=='H')cout<<'H'<<endl;
else cout<<'D'<<endl;
}else{
if(b=='H')cout<<'D'<<endl;
else cout<<'H'<<endl;
}return 0;}

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


int main(){

int  N,ans;
cin>>N;
vector<int> a;
for(int i=0;i<N;i++){
int c;
cin>>c;
if(c!=i+1) ans++;
}

if(ans<=2) {
cout<<"YES";
return 0;
}
cout<<"NO";
return 0;

}

Measured memory_bytes: 256
# abc142_a.py
# https://atcoder.jp/contests/abc142/tasks/abc142_a

# A - Odds of Oddness /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 100点

# 問題文
# 整数 Nが与えられます。
# 高橋君は、N以下の正整数の中から等確率で 1 つを選んで aとします。
# このとき、aが奇数である確率を答えてください。

# 制約
#     1≤N≤100

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N

# 出力
# aが奇数である確率を出力せよ。 出力は、ジャッジの出力との絶対誤差または相対誤差が 10−6以下のとき正解と判定される。

# 入力例 1
# 4

# 出力例 1
# 0.5000000000

# 4以下の正整数は 1 , 2 , 3 , 4 の 4 つであり、そのうち奇数は 1 , 3 の 2 つです。以上より、答えは 24=0.5です。

# 入力例 2
# 5

# 出力例 2
# 0.6000000000

# 入力例 3
# 1

# 出力例 3
# 1.0000000000


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    result = (-(N//-2)) / N

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['4']
        lines_export = [0.5000000000]
    if pattern == 2:
        lines_input = ['5']
        lines_export = [0.6000000000]
    if pattern == 3:
        lines_input = ['1']
        lines_export = [1.0000000000]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


Measured memory_bytes: 9248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=(a); i<(b); i++)
const ll maxn=3e3+5, mod=998244353;
ll n,s,a[maxn],dp[maxn][maxn];
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>n>>s;
    rep(i,1,n+1) cin>>a[i];
    dp[0][0]=1;
    rep(i,1,n+1) {
        dp[i][0]=i+1;
        rep(j,1,s+1) {
            if(j<s) dp[i][j]=dp[i-1][j];
            if(a[i]<=j) dp[i][j]=(dp[i][j]+dp[i-1][j-a[i]])%mod;
        }
    }
    ll ans=0;
    rep(i,1,n+1) ans=(ans+dp[i][s]*(n-i+1))%mod;
    cout<<ans<<"\n";
}


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

int f(int a, int b, int c)
{
    return __gcd(a, __gcd(b, c));
}

int main()
{
    int K;
    cin >> K;
    long long sum = 0;
    for(int a = 1; a <= K; a++)
    {
        for(int b = 1; b <= K; b++)
        {
            for(int c = 1; c <= K; c++)
            {
                sum += f(a, b, c);
            }
        }
    }
    cout << sum;
    return 0;
}

Measured memory_bytes: 3596
A = input()
D = [0]*(26)
ans = 0
D[ord( A[0]) - ord("a")] = 1
for i, a in enumerate(A[1:]):
    ans += i + 1- D[ ord( a) - ord("a")]
    D[ ord( a) - ord("a")] += 1
print( ans + 1)


Measured memory_bytes: 3500
#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
	char r[5],a[5];
	int n1,n2;
	int hit, blow;
	
	while (cin >> r , cin >> a) {
		if ( *r == '0' && *a == '0' )	break;

		hit = 0;
		blow = 0;

		for ( int i = 0; i < 4; i++ ) {
			if ( r[i] == a[i] ) {
				hit++;
			}
			else {
				for ( int j = 0; j < 4; j++ ) {
					if ( r [i] == a[j] ){
						blow++;
					}
				}
			}
		}
		
		cout << hit << " " << blow << endl;
	}
	return 0;
}

Measured memory_bytes: 1140