akhauriyash/Code-Regression huggingface dataset:
# include<bits/stdc++.h>
using namespace std;
# define lowbit(x) ((x)&(-x))
# define pi acos(-1.0)
# define eps 1e-8
# define MOD 1000000007
# define INF 1000000000
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(register int i=a; i<=n; ++i)
# define FDR(i,a,n) for(register int i=a; i>=n; --i)
# define AU(i,x)    for(auto i=x.begin(); i!=x.end(); ++i)
# define ALL(A) A.begin(),A.end()
# define bug puts("H");
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mp make_pair
# define pb push_back
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long LL;
const int N=100005;
///Code begin..................................................................
inline LL Scan() {
    LL x=0;int f=1; char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
    return x*f;
}

int a[N], b[N];
VI v;

int main()
{
    int n, H;
    scanf("%d%d",&n,&H);
    FOR(i,1,n) scanf("%d%d",a+i,b+i);
    int p, M1=0, M2=INF;
    FOR(i,1,n) {
        if (M1<a[i]) {
            p=i; M1=a[i]; M2=b[i];
        }
        else if (M1==a[i]&&M2>b[i]) {
            p=i; M1=a[i]; M2=b[i];
        }
    }
    FOR(i,1,n) {
        if (i==p) continue;
        if (b[i]>a[p]) v.pb(b[i]);
    }
    sort(v.begin(),v.end());
    int siz=v.size();
    int ans=0;
    FDR(i,siz-1,0) {
        if (H<=0) {printf("%d\n",ans); return 0;}
        if (b[p]>=H) {printf("%d\n",ans+1); return 0;}
        H-=v[i];
        ++ans;
    }
    if (b[p]<=a[p]) printf("%d\n",ans+(H+a[p]-1)/a[p]);
    else {
        H-=(b[p]-a[p]);
        if (H<=0) printf("%d\n",ans+1);
        else printf("%d\n",ans+(H+a[p]-1)/a[p]);
    }
    return 0;
}


Measured memory_bytes: 1660
#![allow(
  non_snake_case,
  unused_variables,
  unused_assignments,
  unused_mut,
  unused_imports,
  dead_code
)]
use proconio::fastout;
use proconio::input;
use proconio::marker::*;
use std::cmp::*;
use std::collections::*;
//use std::collections::VecDeque;

macro_rules! debug {
  ($($a:expr),* $(,)*) => {
      #[cfg(debug_assertions)]
      eprintln!(concat!($("| ", stringify!($a), "={:?} "),*, "|"), $(&$a),*);
  };
}

#[fastout]
fn main() {
  input! {
     N:usize,
     XYP:[(i64,i64,i64);N]
  }
  let N: usize = N;
  let mut XYP: Vec<(i64, i64, i64)> = XYP;
  let inf = std::i64::MAX;
  let mut xkyori = vec![vec![inf; N]; 2usize.pow(N as u32)];
  let mut ykyori = vec![vec![inf; N]; 2usize.pow(N as u32)];

  for pat_i in 0..2usize.pow(N as u32) {
    // 組み合わせの作成
    for i in 0..N {
      if pat_i >> i & 1 == 1 {
        // 都市 i に鉄道が引かれている場合の距離は0。
        xkyori[pat_i][i] = 0;
        ykyori[pat_i][i] = 0;
      } else {
        // そうでない場合、すべての路線への距離の最小値を求める。
        let (x, y, p) = XYP[i];
        xkyori[pat_i][i] = x.abs();
        ykyori[pat_i][i] = y.abs();
        for j in 0..N {
          if pat_i >> j & 1 == 1 {
            xkyori[pat_i][i] = min(xkyori[pat_i][i], (x - XYP[j].0).abs());
            ykyori[pat_i][i] = min(ykyori[pat_i][i], (y - XYP[j].1).abs());
          }
        }
        xkyori[pat_i][i] *= p;
        ykyori[pat_i][i] *= p;
      }
      debug!(pat_i, i, xkyori[pat_i]);
    }
  }
  debug!(xkyori);
  debug!(ykyori);
  // ここまでで前処理。xkyoriとykyoriが計算できた。
  let mut ans = vec![inf; N + 1];
  // 3進数を計算。0=線路なし,1=X路線, 2=Y路線
  for pat_i in 0..3usize.pow(N as u32) {
    // pat_xとpat_yの作成
    let mut k = 0;
    let mut pat = pat_i;
    let mut pat_x = 0;
    let mut pat_y = 0;
    for i in 0..N {
      match pat % 3 {
        1 => {
          pat_x += 2usize.pow(i as u32);
          k += 1;
        }
        2 => {
          pat_y += 2usize.pow(i as u32);
          k += 1;
        }
        _ => (),
      }
      pat = pat / 3;
    }
    let mut t_ans = 0;
    for i in 0..N {
      t_ans += min(xkyori[pat_x][i], ykyori[pat_y][i]);
    }
    ans[k] = min(ans[k], t_ans);
  }
  for a in ans {
    println!("{}", a);
  }
}


Measured memory_bytes: 11824
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

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

ll M = 1000000007;
typedef pair<int, int> P;

int main()
{
   int n,m;
   cin>>n>>m;
   
   priority_queue<int>que;
   rep(i,n){
       int a;
       cin>>a;
       que.push(a);
   }
   rep(i,m){
       int t=que.top();
       que.pop();
       t/=2;
       que.push(t);
   }
   ll sum=0;
   rep(i,n){
       sum+=que.top();
       que.pop();
   }
   cout<<sum<<endl;

}


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

bool dp[100010];
int a[110];

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N,K; cin >> N >> K;
    for(int i=0;i<N;++i) cin >> a[i];
    dp[0] = false;
    for(int j=1;j<=K;++j){
        for(int i=0;i<N;++i){
            dp[j] |= j>=a[i] && !dp[j-a[i]];
        }
    }
    cout << (dp[K] ? "First" : "Second") << endl;
    return 0;
}

Measured memory_bytes: 384
import java.util.Comparator;
import java.util.Scanner;

public class Main
{
	public static void main(String[] args) 
	{
		Scanner in=new Scanner(System.in);
		while(in.hasNext())
		{
			Point2 p[]=new Point2[4];
			for(int i=0;i<4;i++)
				p[i]=new Point2(in.nextDouble(), in.nextDouble());
			boolean judge=false;
			if((Point2.ccw(p[0],p[1],p[3])>0&&Point2.ccw(p[1],p[2],p[3])>0&&Point2.ccw(p[2],p[0],p[3])>0)
					||(Point2.ccw(p[0],p[1],p[3])<0&&Point2.ccw(p[1],p[2],p[3])<0&&Point2.ccw(p[2],p[0],p[3])<0))
				judge=true;
			System.out.println(judge ? "YES":"NO");
		}
	}
}
class Point2
{
	double x;
	double y;
	Point2(double x,double y)
	{
		this.x=x;
		this.y=y;
	}
	
	 //counterClockWise p1->p3->p2が時計周りなら正 反時計周りなら負を返す 
	 static double ccw(Point2 p1,Point2 p2,Point2 p3)
	{
		double res=(p3.y-p1.y)*(p2.x-p1.x)-(p2.y-p1.y)*(p3.x-p1.x);
		return res;
	}
}

Measured memory_bytes: 21236
#include <iostream>

using namespace std;

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

    if((a + b) == c || (b + c) == a || (c + a) == b){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    } 
    return 0;
}

Measured memory_bytes: 256
/*
 *    author: Tran Minh Khoa
 *    created: 14.05.2019 08:12:13
 *    Ho Chi Minh University of Science
 */

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);
  cout.precision(10); 
  cout << fixed;
#ifdef KM777
  freopen("in", "r", stdin);
#endif
  long long n;
  cin >> n;
  long long result = 0;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      long long m = (n / i) - 1;
      if (m <= i) {
        continue;
      }
      result += m;
    }
  }
  cout << result << "\n";
  return 0;
}


Measured memory_bytes: 256
n, a, b, c, d = [ int(v)-1 for v in input().split() ]
n += 1
s = input()

def can_go(instr,l,r):
    s1 = instr[l:r+1]
    res =  all([ len(i) < 2 for i in s1.split(".") if i != ""])
    return res

def can_swap(instr,l,r):
    s1 = instr[l:r+1]
    res = any([ len(i) >= 3 for i in s1.split("#") if i != ""])
    return res

ans = "No"
if can_go(s,a,c) and can_go(s,b,d):
    if c < d:
        ans = "Yes"
    else:
        if can_swap(s,b-1,d+1):
            ans = "Yes"
print(ans)

Measured memory_bytes: 48892
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

void show(vector<int> &v) {
	for (int i = 0; i < v.size(); i++) {
		if (i > 0) {
			cout << " ";
		}
		cout << v[i];
	}
	cout << endl;
}

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

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


	vector<int> v;
	v = a;
	for (int i = 0; i < k; i++) {
		vector<int> w;
		w.assign(n + 1, 0);

		for (int j = 0; j < n; j++) {
			int l = max(0, j - v[j]);
			int r = min(n, j + v[j] + 1);

			w[l]++;
			w[r]--;
		}

		v.assign(n, 0);
		v[0] = w[0];
		for (int j = 0; j < n; j++) {
			v[j] = v[j-1] + w[j];
		}

		if(all_of(v.begin(), v.end(), [&n](const int &x){return x == n;})) {
			break;
		}

	}
	show(v);
	return 0;
}


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

#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int MN = 1e5 + 5, LN = 17, MOD = 1e9 + 7, INF = 0x3f3f3f3f;

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n; cin >> n;
    vector<pii> v;
    for (int i = 1; i <= n; i++) {
        int a; cin >> a;
        v.emplace_back(a, i);
    }
    sort(all(v));
    for (auto i : v) cout << i.second << " ";
    return 0;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define N 223456
using namespace std;
typedef long long ll;
ll dp[100];
int main()
{
//    freopen("in.txt","r",stdin);
    ll n,a;
    ll sum=0LL;
    map<ll,ll>m;
    cin>>n;
    for(ll i=0;i<n;i++)
    {
        cin>>a;
        sum+=a;
        m[a]++;
    }
    ll q,b,c;
    cin>>q;
    while(q--)
    {
        cin>>b>>c;
        if(m[b]>0)
        {
            sum += m[b]*(c-b);
            m[c]+=m[b];
            m[b]=0;
        }
        cout<<sum<<endl;
    }
    return 0;
}


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

int main(void){
    long long n, k, ma=0, sum=0, a[100010];
    cin >> n >> k;
    for(long long i=0;i<n;++i){
        cin >> a[i];
    }
    for(int i=0;i<50;++i){
        long long b=1;
        b <<= i;
        if(k <= b){
            ma = i;
            break;
        }
    }
    long long ans = 0;
    for(int i=ma;i>=0;--i){
        long long tmp = 1;
        tmp <<= i;
        if((ans + tmp) > k){
            continue;
        }
        long long cnt=0;
        for(int j=0;j<n;++j){
            if((a[j]&tmp)!=0) ++cnt;
        }
        if(cnt <= n/2){
            ans |= tmp;
        }
    }
    for(int i=0;i<n;++i){
        sum += (a[i]^ans);
    }
    cout << sum << endl;
}

Measured memory_bytes: 1024
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
total = sum(A)

for i in range(n):
    b = max(B[i] - A[i], 0)
    A[i] = max(A[i]-B[i], 0)
    A[i+1] = max(A[i+1]-b, 0)

print(total-sum(A))


Measured memory_bytes: 19156
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=998244353;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
ll f[3010];
int a[100010];
int n;
int s;
ll quick_pow(ll a,ll k){
	ll ret=1;
	while(k){
		if(k&1){
			ret=(ret*a)%mod;
		}
		k>>=1;
		a=a*a%mod; 
	}
	return ret;
} 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n>>s;
    rep(i,1,n+1) cin>>a[i];
    ll inv2=quick_pow(2,mod-2);
    f[0]=quick_pow(2,n);
    rep(i,1,n+1){
    	per(j,s,a[i]){
    		f[j]=(f[j]+f[j-a[i]]*inv2)%mod;
		}
	}
	cout<<f[s]<<endl;
    
    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
using namespace std;
const int maxd=1000000007,N=100000;
const double pi=acos(-1.0);
typedef long long ll;
int n,cnt=0,l[100100],r[100100];

int read()
{
	int x=0,f=1;char ch=getchar();
	while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
	while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
	return x*f;
}

int main()
{
	n=read();
	int i,j,sum=n+(n%2==0);
	for (i=1;i<=n;i++)
	{
		for (j=i+1;j<=n;j++)
		{
			if (i+j==sum) continue;
			l[++cnt]=i;r[cnt]=j;
		}
	}
	printf("%d\n",cnt);
	for (i=1;i<=cnt;i++) printf("%d %d\n",l[i],r[i]);
	return 0;
}


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

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

	int n;
	cin >> n;

	int sum = 0;
	for (uint i = 1; i <= n; ++i) {
		for (uint j = 1; j <= n; ++j) {
			for (uint k = 1; k <= n; ++k) {
				sum += __gcd(i, __gcd(j, k));
			}
		}
	}
	cout << sum;
}


Measured memory_bytes: 3648
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto x = RD;
	auto a = RDR.ARR;
	long ans;
	foreach (i; 0..N-1)
	{
		auto y = a[i] + a[i+1];
		auto z = y - x;
		if (z > 0)
		{
			auto s  = min(a[i+1], z);
			a[i+1] -= s;
			a[i]   -= z - s;
			ans    += z;
		}
	}
	
	writeln(ans);
	stdout.flush();
	//readln();
}

Measured memory_bytes: 4180
#include<stdio.h>
#include<math.h>

struct Point
{
    double x,y;
};

void koch(int n, struct Point a, struct Point b)
{
    if(n == 0) return;

    struct Point s,t,u;

    double th = M_PI * 60.0/180.0;

    s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
    s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
    t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
    t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(n-1,a,s);
    printf("%.8f %.8f\n",s.x,s.y);
    koch(n-1, s, u);
    printf("%.8f %.8f\n", u.x, u.y);
    koch(n-1, u, t);
    printf("%.8f %.8f\n", t.x, t.y);
    koch(n-1, t, b);
}

int main()
{
    struct Point a,b;
    int n;

    scanf("%d",&n);

    a.x = 0;
    a.y = 0;
    b.x = 100;
    b.y = 0;

    printf("%.8f %.8f\n", a.x, a.y);
    koch(n, a, b);
    printf("%.8f %.8f\n", b.x, b.y);

    return 0;
}


Measured memory_bytes: 2080
N, M = map(int,input().split())
S = []
for i in range(M):
    s = tuple(map(int,input().split()))
    S.append(s)
ans = [-1 for _ in range(N)]

for x in S:
    if ans[x[0]-1] == -1 or ans[x[0]-1] == x[1]:
        ans[x[0]-1] = x[1]
    else:
        print(-1)
        exit()
if N > 1 and ans[0] == 0:
    print(-1)
    exit()
if N == 1 and M == 0:
    print(0)
    exit()

for i in range(N):
    if ans[i] == -1:    
        if i == 0:
            print('1',end='')
        else:
            print('0',end='')
    else:
        print(ans[i],end='')
print()




Measured memory_bytes: 3064
#include<cstdio>

int main(){
	int n,a,b,c,d;
	while(~scanf("%d",&n)){
		a=n/1000;
		b=(n/100)%10;
		c=(n%100)/10;
		d=n%10;
		if((a+b+c+d)==7)    	
			printf("%d+%d+%d+%d=%d\n",a,b,c,d,a+b+c+d);
		else if((a+b+c-d)==7)
			printf("%d+%d+%d-%d=%d\n",a,b,c,d,a+b+c-d);
		else if((a+b-c-d)==7)
			printf("%d+%d-%d-%d=%d\n",a,b,c,d,a+b-c-d);
		else if((a-b-c-d)==7)
			printf("%d-%d-%d-%d=%d\n",a,b,c,d,a-b-c-d);
		else if((a-b+c+d)==7)
			printf("%d-%d+%d+%d=%d\n",a,b,c,d,a-b+c+d);
		else if((a+b-c+d)==7)
			printf("%d+%d-%d+%d=%d\n",a,b,c,d,a+b-c+d);
		else if((a-b+c-d)==7)
			printf("%d-%d+%d-%d=%d\n",a,b,c,d,a-b+c-d);
		else if((a-b-c+d)==7)
			printf("%d-%d-%d+%d=%d\n",a,b,c,d,a-b-c+d);	
			}
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!

	int N,M;
	cin>>N>>M;
	V<int> c(M);
	rep(i,N){
		int K;
		cin>>K;
		rep(j,K){
			int x;
			cin>>x;
			x--;
			c[x]++;
		}
	}
	int ans = 0;
	rep(i,M) if(c[i]==N) ans++;
	cout<<ans<<endl;
}


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

using namespace std;

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

const int SIZE = 10;
int tile[SIZE][SIZE];
int flip[SIZE][SIZE];

int get(int x, int y)
{
    int c = tile[x][y];

    for (int d = 0; d < 5; ++d) {
        int x2 = x + dx[d];
        int y2 = y + dy[d];

        if (0 <= x2 && x2 < SIZE && 0 <= y2 && y2 < SIZE)
            c += flip[x2][y2];
    }

    return c % 2;
}

bool calc()
{
    for (int i = 1; i < SIZE; ++i) 
        for (int j = 0; j < SIZE; j++) 
            if (get(i - 1, j) != 0) 
                flip[i][j] = 1;

    for (int j = 0; j < SIZE; ++j)
        if (get(SIZE - 1, j) != 0)
            return false;

    return true;
}

void solve()
{
    for (int i = 0; i < 1 << SIZE; ++i) {
        memset(flip, 0, sizeof(flip));
        for (int j = 0; j < SIZE; ++j) 
            flip[0][SIZE - j - 1] = i >> j & 1;

        if(calc())
            break;
    }

    for (int i = 0; i < SIZE; ++i)
        for (int j = 0; j < SIZE; ++j) 
            cout << flip[i][j] << ((j == SIZE - 1) ? '\n' : ' ');
}

int main()
{
    int n;
    
    cin >> n;
    while (n--) {
        for (int i = 0; i < SIZE; ++i)
            for (int j = 0; j < SIZE; ++j)
                cin >> tile[i][j];
        solve();
    }

    return 0;
}

Measured memory_bytes: 1160
import sys
N,M = map(int,input().split())
ans = [0]*N
dict1 = {}
if  N > 1:
    ans[0] = 1
for x in range(M):
    a,b = map(int,input().split())
    if((a in dict1) != True):
        dict1[a] = b
    elif(a in dict1 and dict1[a] != b):
        print(-1)
        sys.exit()
for k, v in dict1.items():
    ans[k-1] = v
    if(k == 1 and v == 0 and N >= 2):
        print(-1)
        sys.exit()
#print(ans)
l = "".join([str(n) for n in ans])
int_l = int(l)
print(int_l)
#len_l = len(str(int_l))
#print(int_l)

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

int main()
{
	int r;
	int g;
	int b;

	cin >> r;
	cin >> g;
	cin >> b;

	while ((g * 10 + b * 1)%4== 0){
		cout << "YES" << endl; 
		break;
	} 
	while ((g * 10 + b * 1)%4!=0) {
		cout << "NO" << endl; 
		break;
	}
}

Measured memory_bytes: 256
import sys
import itertools
for line in sys.stdin:
	p, q = map(int, line.split())
	p, r = p / q, p % q * 10
	visited = {r: 0}
	res = ''
	for i in itertools.count(1):
		p, r = r / q, r % q * 10
		res += str(p)
		if r == 0:
			print res
			break
		elif r in visited:
			print res
			n = visited[r]
			print ' ' * n + '^' * (i - n)
			break
		visited[r] = i

Measured memory_bytes: 4376
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()
    print(3*n**2)
    return

#B
def B():
    n,d = LI()
    f = [1]*(n+2*d+2)
    ans = 0
    for i in range(n):
        if f[i]:
            for j in range(i,i+2*d+1):
                f[j] = 0
            ans += 1
    print(ans)
    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#Solve
if __name__ == "__main__":
    B()


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

int main() {
	long long k;
	cin >> k;
	long long a = 0, z = 1, ans = -1;
	for (int i = 1; i <= k; i++) {
		a = (a + 7*z%k) % k;
		z = z * 10 % k;
		if (a == 0) {
			ans = i;
			break;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3192
from collections import deque

def sliding_minima(a, k):
    dq = deque()
    l = r = 0
    ret = []
    for i, item in enumerate(a):
        while(dq and a[dq[-1]] >= a[i]):
            dq.pop()
        dq.append(i)
        if i < k - 1:
            continue
        if dq[0] == i - k:
            dq.popleft()
        ret.append(a[dq[0]])
    return ret

def sliding_maxima(a, k):
    dq = deque()
    l = r = 0
    ret = []
    for i, item in enumerate(a):
        while(dq and a[dq[-1]] <= a[i]):
            dq.pop()
        dq.append(i)
        if i < k - 1:
            continue
        if dq[0] == i - k:
            dq.popleft()
        ret.append(a[dq[0]])
    return ret

def is_increasing(a, k):
    increasing = [0] * len(a)
    for i, (a1, a2) in enumerate(zip(a, a[1:])):
        if a1 < a2:
            increasing[i+1] = 1
    ret = [0] * (len(a) - k + 1)
    val = sum(increasing[1:k])
    if val == k-1:
        ret[0] = 1
    for i in range(len(a) - k):
        val += increasing[i + k]
        val -= increasing[i + 1]
        if val == k-1:
            ret[i+1] = 1
        else:
            ret[i+1] = 0
    return ret

n, k = [int(item) for item in input().split()]
a = [int(item) for item in input().split()]

minima = sliding_minima(a, k)
maxima = sliding_maxima(a, k)
increasing = is_increasing(a, k)

ans = n - k + 1
if increasing[0]:
    ans -= 1
for l, r, minima, maxima, inc in zip(a, a[k:], minima[1:], maxima, increasing[1:]):
    if (l < minima and r > maxima) or inc:
        ans -= 1
if sum(increasing) > 0:
    ans += 1
print(ans)

Measured memory_bytes: 24992
#include<iostream>
using namespace std;
int main ()
{
    int c[505],s[505],f[505];
    int q,n,u,ans;
        cin>>n;
        for(int i= 0;i<n-1;i++)
            cin>>c[i]>>s[i]>>f[i];
        for(int i = 0;i<n-1;i++)
        {
            ans =c[i]+s[i];
            for(int j = i+1;j<n-1;j++)
            {
                if(ans>=s[j])
                {
                    if(ans%f[j]==0)
                        ans+=c[j];
                    else
                        ans+=c[j]+f[j]-(ans%f[j]);
                }
                else
                {

                    ans=c[j]+s[j];
                }
            }
            cout<<ans<<endl;
        }
        cout<<0<<endl;

}


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

public class Main {
	static long[] fact = new long[300000];
	static long mod = (long) 1e9 + 7;

	static long pow(long base, long pow) {
		if (pow == 1)
			return base;
		long half = pow(base, pow / 2);
		half %= mod;
		half *= half;
		half %= mod;
		if (pow % 2 == 1)
			half *= base;
		half %= mod;
		return half;
	}

	static long C(int n, int r) {
		long f = fact[n];
		f *= pow(fact[r], mod - 2);
		f %= mod;
		f *= pow(fact[n - r], mod - 2);
		f %= mod;
		return f;
	}

	public static void main(String[] args) {
		InputReader r = new InputReader(System.in);
		fact[0] = 1;
		for (int i = 1; i < fact.length; i++) {
			fact[i] = fact[i - 1] * i;
			fact[i] %= mod;
		}
		long h = r.nextLong();
		long w = r.nextLong();
		long a = r.nextLong();
		long b = r.nextLong();
		long res = 0;
		for (long i = 1; i <= h - a; i++) {
			long way1 = C((int) (b - 1 + i - 1), (int) b - 1);
			way1 *= C((int) (w - b - 1 + h - i), (int) (h - i));
			way1 %= mod;
			res += way1;
			res %= mod;
		}
		System.out.println(res);
	}

	static class InputReader {
		private BufferedReader reader;
		private StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}

		public InputReader(FileReader stream) {
			reader = new BufferedReader(stream);
			tokenizer = null;
		}

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}
		}

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

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 10708
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	int ans = 0;
	rep(i, s.size() - 1) {
		if (s[i] != s[i + 1])ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long
int gcd(int m,int n){return n?gcd(n,m%n):m;}
int lcm(int m,int n){return m/gcd(m,n)*n;}
main(){
  int n,l,c;
  cin>>n>>l;
  while(--n){cin>>c;l=lcm(l,c);}
  cout<<l;
}

Measured memory_bytes: 256
program abc48
 implicit none
 character(len=1000)::S,T
 integer::lengthS,lengthT,ia,ib
 integer,allocatable::a(:)
 read(*,*)S
 read(*,*)T
 lengthT=len_trim(T)
 lengthS=len_trim(S)
 allocate(a(lengthS-lengthT+1))
 a=0
 do ia=1,lengthS-lengthT+1
  do ib=1,lengthT
   if(S(ia+ib-1:ia+ib-1)==T(ib:ib))then
    a(ia)=a(ia)+1
   end if
  end do
 end do
 print'(i0)',lengthT-maxval(a)
end program abc48

Measured memory_bytes: 2784
n, m = map(int, input().split())
answers = [list(map(int, input().split())) for _ in range(n)]

foods = [0] * m

for ans in answers:
    for a in ans[1:]:
        foods[a-1] += 1

cnt = 0
for x in foods:
    if x == n:
        cnt += 1
print(cnt)

Measured memory_bytes: 3060
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   
   long ans = 0;
   long l1 = 2;
   long l2 = 1;
   for(int k = 1;k<N;k++)
   {
     ans = l1+l2;
     l1 = l2;
     l2 = ans;
   }
   if(N==1) System.out.println(1);
   else System.out.println(ans);
 }
}

Measured memory_bytes: 23252
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC122A
{
    class Program
    {
        public static void Main()
        {
            var s = Console.ReadLine();
            var d  = new Dictionary<string, string>() {{"A", "T"}, {"T", "A"}, {"C", "G"}, {"G", "C"}};
            Console.WriteLine(d[s]);
        }
    }
}


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

string s;
int size_, cnt, deletesum;

int main() {
    cin >> s;

    size_ = s.size();
    for (int i = 0; i < size_; ++i) {
        if (s[i] == 'S') cnt++;
        else {
            if (cnt > 0) {
                cnt--;
                deletesum+=2;
            }
        }
    }

    cout << size_ - deletesum << endl;

    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for (int i = a; i < (int)b; ++i)
#define rrep(i, n) for (int i = ((int)n - 1); i >= 0; --i)

using ll = long long;
using ld = long double;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n, k;
    cin >> n >> k;
    vector<int> cnt(n);
    rep (i, k) {
        int d;
        cin >> d;
        rep (j, d) {
            int x;
            cin >> x;
            cnt[x - 1]++;
        }
    }
    int res = 0;
    rep (i, n) {
        if (cnt[i] == 0) res++;
    }
    cout << res << endl;
    
    return 0;
}



Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <cassert>
#include <limits>
#include <numeric>
#include <type_traits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <functional>
#include <utility>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
#include <climits>
#include <time.h>

using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<string> vs;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)

ll gcd(ll a, ll b) {
 	while (a && b) {
 		if (a >= b) a %= b;
 		else b %= a;
  	}
  	return a + b;
}
ll ketasum(ll n) { //桁の数字全ての和を返す 例: 112 -> 4
	ll sum=0;
	if (n<0) return 0;
	while (n>0) {
		sum += n%10;
		n /= 10;
	}
	return sum;
}

typedef pair<ll, ll> pair_t;

bool comp(const pair_t &a, const pair_t &b) {
        return a.first < b.first;
}

void sort2vectors(vector<ll> &av, vector<ll> &bv)
{ // ふたつの配列をまとめてそーと A[2,1] B[3,4] -> 1,4 2,3
        ll n = av.size();
        vector<pair_t> p(n);
        vector<ll> av2(n), bv2(n);
        for (ll i = 0; i < n; i++)
                p[i] = make_pair(av[i], bv[i]);
        sort(p.begin(), p.end(), comp);
        for (ll i = 0; i < n; i++) {
                av2[i] = p[i].first;
                bv2[i] = p[i].second;
        }
        av = av2;
        bv = bv2;
}
ll facctorialMethod(ll k){ //階乗
	ll s;
	if(k > 1){
		s = k*facctorialMethod(k-1);
	} else {
		s = 1;
	}
	return s;
}

map< int64_t, ll > prime_factor(int64_t n) {
	map< int64_t, ll > ret;
 	for(int64_t i = 2; i * i <= n; i++) {
    	while(n % i == 0) {
      		ret[i]++;
      		n /= i;
    	}
  	}
  	if(n != 1) ret[n] = 1;
  	return ret;
}
const ll mod = 1000000007;
const ll INF = 1e9;

// 変数定義start(vectorはresizeしようね)
ll N;
vl d;
// 変数定義end

void solve(){
	cin >> N;
	d.resize(N);
	REP(i, N){
		cin >> d[i];
	}
	ll ans = 0;
	REP(i, N){
		for(ll j = i+1; j < N;j++){
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
}

int main(){

	//clock_t start = clock();

	cout << std::fixed << std::setprecision(10);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	solve();
	//clock_t end = clock();

	//const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
	//printf("time %lf[ms]\n", time);
}

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

x, y = [0]*N, [0]*N

for i in range(N):
    a, b = map(int, input().split())
    x[i] = a
    y[i] = b

maxZ, minZ = x[0] + y[0], x[0] + y[0]
maxW, minW = x[0] - y[0], x[0] - y[0]
for i in range(N):
    z = x[i] + y[i]
    w = x[i] - y[i]

    maxZ = max(maxZ, z)
    minZ = min(minZ, z)
    maxW = max(maxW, w)
    minW = min(minW, w)

ans = max(maxZ-minZ, maxW-minW)
print(ans)


Measured memory_bytes: 77692
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ld long double
#define al(a) (a).begin(),(a).end()
#define mk make_pair
#define check cout<<"?"<<endl;

ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=1e18+5;

int main() {
    cout<<fixed<<setprecision(10);
    int n; cin>>n;
    cout<<(double)((n+1)/2)/n<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_range(i, s, e) for (int i = (s); i < (int)(e); i++)
#define rep_rev(i, s, e) for (int i = (s)-1; i >= (int)(e); i--)
#define sort_vec(v) sort((v).begin(),(v).end())
typedef int64_t lint;
// lint mod = 998244353;
// lint mod = 1000000007;
template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

char app() {
  char a;
  cin>>a;

  if('a'<=a&&a<='z') return 'a';
  return 'A';
}

int main(){cout<<app()<<endl;return 0;}


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

string S,T;

int main() {
  cin>>S>>T;
  int sum = 0;
  for (int i = 0; i < 3; i++) {
    if (S[i] == T[i]) sum++;
  }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int a = k;
		for (int i = 1; i < n; i++) {
			a *= k - 1;
		}
		System.out.println(a);
	}
}


Measured memory_bytes: 9796
def canusol(n, m, c, a, b):
	count = 0
	ans = 0
	for i in range(n):
		count = 0
		for j in range(m):
			count += a[i][j] * b[j]
		if count + c > 0:
			ans += 1
	return ans
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = []
for _ in range(n):
	l = list(map(int, input().split()))
	a.append(l)
print(canusol(n, m, c, a, b))

Measured memory_bytes: 9148
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main() {
	long long r;
    scanf("%lld",&r);
	cout << r*r << endl;

	return 0;
}


Measured memory_bytes: 256
import math
X = int(input())

def is_prime(n):
    if n == 1:
      return True
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

i = X
judge = False
while judge == False:
  judge = is_prime(i)
  if judge == True:
    print(i)
    break
  i += 1

Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
    	int n = sc.nextInt();
      	if (n % 2 == 0) {
          System.out.println((int)n/2);
        } else {
          System.out.println((int)n/2+1);

        }
    }
}




Measured memory_bytes: 22868
from sys import stdin
from math import floor,ceil

N, K = map(int, input().rstrip().split())
A = [int(x) for x in stdin.readline().rstrip().split()]

def is_max_len_less_than_input(x,K,A):
  count = 0
  for ln in A:
    count += ceil(ln/x)-1
    if count > K:
      return False
  return True

def binary_search(begin,end,K,A):
  while abs(end-begin)>1:
    mid = (begin+end)//2
    if is_max_len_less_than_input(mid,K,A):
      end = mid
    else:
      begin = mid
  return end

print(binary_search(0,max(A),K,A))

Measured memory_bytes: 104612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
#define REP(i,a,b) \
for(int i=int(a);i<=int(b);i++)
#define DEP(i,a,b) \
for(int i=int(a);i>=int(b);i--)
#define TR(c, it) \
for (auto it = (c).begin(); it != (c).end(); it++)

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int a,b,c,d,n;
	cin>>n;
	set<string> s;
	string v;
	REP(a,0,n-1)
	{
      cin>>v;
      s.insert(v);
	}
    cout<<s.size();

	return 0;
}


Measured memory_bytes: 19144
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;int a=0,n=s.size();
  for(int i=0;i<(n+1)/2;i++){
    if(s.at(i)!=s.at(n-i-1))a++;
  }
  cout<<a<<endl;
}

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() {
  string s, t;
  cin >> s >> t;
  int ans = 0;
  rep(i, s.size()) ans += s[i] != t[i];
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
#define rep(i, to) for (int i = 0; i < (to); i++)
#define rrep(i, to) for (int i = (to) - 1; i >= 0; i--)
#define repf(i, from, to) for (int i = (from); i < (to); i++)
#define all(v) v.begin(), v.end()
#define unless(cond) if (!(cond))
using namespace std;
using ll = long long;
template <typename T>
using V = vector<T>;
template <typename T, typename U>
using P = pair<T, U>;

int inf = INT32_MAX;

int main() {
  int n;
  cin >> n;
  V<int> column;

  rep(i, n) {
    int r, c;
    cin >> r >> c;
    if(i == 0) {
      column.push_back(r);
    }
    column.push_back(c);
  }

  V<V<int>> dp(n + 1, V<int>(n + 1));
  rep(i, n + 1) {
    dp[i][i] = 0;
  }

  int len = 2;
  while(len <= n) {
    for(int i = 1; i + len - 1 <= n; i++) {
      int j = i + len - 1;

      int min_cost = inf;
      for(int k = i; k < j; k++) {
        int cost = dp[i][k] + dp[k + 1][j] + column[i - 1] * column[k] * column[j];
        min_cost = min(min_cost, cost);
      }

      dp[i][j] = min_cost;
    }
    len++;
  }

  cout << dp[1][n] << endl;
}


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

int main () {
  int N;
  string S;
  cin >> N >> S;
  vector<int>count(26,0);
  
  for (int i = 0; i < N; i++) {
    int M = S.at(i) - '0';
    M -= 49;
    count.at(M)++;
  }
  
  long long ans = 1;
  for (int i = 0; i < 26; i++) {
    ans *= (count.at(i) + 1);
    ans %= 1000000007;
  }
  if (ans == 0){
    cout << 100000006 << endl;
  }
  else {
    cout << ans -1 << endl;
  }
}
    

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

using namespace std;

typedef long long ll;

#define endl "\n"


int main()
{
    
    int a,b;
    cin >> a >> b;
    if ((a+b) > 9)
    	cout << "error" << endl;
    else
    	cout << (a+b) << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    int n,i,cnt=1;
    scanf("%d",&n);
    char s[n][11];
    for(i=0;i<n;i++) scanf("%s",&s[i]);
    qsort(s,n,11,strcmp);
    for(i=1;i<n;i++){
        if(strcmp(s[i-1],s[i])<0) cnt++;
    }
    printf("%d",cnt);
    return 0;
}

Measured memory_bytes: 5740
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long INF=1LL<<60;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	long long int a,b;
	cin>>a>>b;
	if(a%b==0)cout<<-1<<endl;
	else cout<<a<<endl;
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
w = []
ans = 'Yes'
for i in range(n):
    w.append(input())
    if len(w) > 1:
        if w[-2][-1] != w[-1][0]:
            ans = 'No'
            break
if len(w) != len(list(set(w))):
    ans = 'No'
print(ans)

Measured memory_bytes: 3060
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }


signed main()
{
	int X;
	cin >> X;

	if (X <= 599) cout << 8 << endl;
	else if (X <= 799) cout << 7 << endl;
	else if (X <= 999) cout << 6 << endl;
	else if (X <= 1199) cout << 5 << endl;
	else if (X <= 1399) cout << 4 << endl;
	else if (X <= 1599) cout << 3 << endl;
	else if (X <= 1799) cout << 2 << endl;
	else if (X <= 1999) cout << 1 << endl;
}



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

using namespace std;

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

  vector< vector<int> > s(m);
  for (int i = 0; i < m; ++i) {
    int k;
    cin >> k;
    for (int j = 0; j < k; ++j) {
      int S;
      cin >> S;
      s[i].push_back(S - 1);
    }
  }
  vector<int> p(m);
  for (int i = 0; i < m; ++i) cin >> p[i];

  int ans = 0;
  for (int i = 0; i < 1 << n; ++i) {
    int l_cnt = 0;
    for (int j = 0; j < m; ++j) {
      int cnt = 0;
      for (int k = 0; k < s[j].size(); ++k) {
	if (i >> s[j][k] & 1) cnt++;
      }
      if (cnt % 2 == p[j]) l_cnt++;
    }
    if (l_cnt >= m) ans++;
  }

  cout << ans << endl;
  return 0;
}


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

using namespace std;

int k;
string s;
priority_queue<int> q;

int main()
{
    while(1)
    {
        cin >> s;
        if(s=="insert")
        {
            cin >> k;
            q.push(k);
        }
        else if(s=="extract")
        {
            cout << q.top() << endl;
            q.pop();
        }
        else if(s=="end")
        {
            break;
        }
    }
    return 0;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    vector<int> ans;
    while(true){
        int N, M, P; cin >> N >> M >> P;
        if(N == 0 && M == 0 && P == 0) break;
        int people = 0, tousen = 0;
        rep(i, N){
            int temp; cin >> temp;
            people += temp;
            if(i+1 == M) tousen = temp;
        }
        int pool = people*(100-P);
        if(tousen > 0) ans.push_back(pool/tousen);
        else ans.push_back(0);
    }
    rep(i, ans.size()) cout << ans[i] << endl;
    return 0;
}


Measured memory_bytes: 3152
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int answer=0;
    answer=answer+1;
    if(b!=a){
      answer=answer+1;
    }
    if(c!=a&&c!=b){
      answer=answer+1;
    }
    System.out.println(answer);

  }
  

  
}


Measured memory_bytes: 21844
#include "bits/stdc++.h"
using namespace std;
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define PI 3.1415926535
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<Pll> vPll;
typedef vector<vector<int>> vvi;
typedef vector<vector<bool>> vvb;
typedef vector<vector<ll>> vvll;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
typedef vector<vector<double>> vvd;
typedef vector<vector<Pi>> vvPi;
typedef priority_queue<int, vector<int>, greater<int>> pqli;
typedef priority_queue<ll, vector<ll>, greater<ll>> pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi>> pqlP;
string YN(bool y) { return (y?"YES":"NO"); }
string yn(bool y) { return (y?"Yes":"No"); }
string ON(bool y) { return (y?"OK":"NG"); }
int main(void)
{
	int n;

	cin>>n;

	vi a(n);

	rep(i, n) cin>>a[i];

	sort(all(a));

	cout<<a[n-1]<<" ";

	int min=1e9, ans;
	rep(i, n-1){
		if(min>abs(a[n-1]/2-a[i])){
			min=abs(a[n-1]/2-a[i]);
			ans=a[i];
		}
		if(min>abs(a[n-1]/2+a[n-1]%2-a[i])){
			min=abs(a[n-1]/2+a[n-1]%2-a[i]);
			ans=a[i];
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 640