akhauriyash/Code-Regression huggingface dataset:
#include	<bits/stdc++.h>
using	namespace	std;
typedef	long long ll;

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (ll i=0; i<n; i++)
#define	Rep1(i, n)	for (ll i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

// Vector starting from 1
// index ==0 -> dummy, not used

void	add_BIT(vector<ll> &BIT, ll ix, const ll &v) {
	while (ix<BIT.size()) {
		BIT.at(ix) +=v;
		ix +=ix&-ix;
	}
}

ll	sum_BIT(vector<ll> &BIT, ll ix) {
	ll S=0;
	while (ix>0) {
		S +=BIT.at(ix);
		ix -=ix&-ix;
	}
	return S;
}

//	Inversion number
//	0 <= a <= 10^9
//	n <= 200000
int	main() {
	ll N;
	string S;
	cin >>N >>S;
	vector<vector<ll>> BIT(26, vector<ll> (N+1, 0));
	vector<ll> s(N+1, 0);
	Rep1(i, N){
		s.at(i)=S.at(i-1)-'a';
		add_BIT(BIT.at(s.at(i)), i, 1);
	}
	ll Q;
	cin >>Q;
	Rep0(i, Q) {
		ll q;
		cin >>q;
		if (1==q) {
			ll i;
			char c;
			cin >>i >>c;
			add_BIT(BIT.at(s.at(i)), i, -1);
			s.at(i)=c-'a';
			add_BIT(BIT.at(s.at(i)), i, 1);
		} else {//2==q
			ll l, r;
			cin >>l >>r;
			ll S=0;
			Rep0(j, 26) {
				if (sum_BIT(BIT.at(j), r)!=sum_BIT(BIT.at(j), l-1))
					S++;
			}
			cout <<S <<endl;
		}
	}
	return 0;
}



Measured memory_bytes: 106372
#include <bits/stdc++.h>
#include <iostream>
//#include <vector>
#define ALL(l)  (l).begin(),(l).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;
ll maxn = 1000000000;

//---------------------------------------------------------------------------------------------------
 

 
 
int main(){
    
   int n,flag=1,t,ans=0;
   cin>>n;
   
   vector<int> a(n);
   rep(i,n)cin>>a.at(i);
   
   while(flag){
      
       flag=0;
       for(int j=n-1;j>0;j--){
           
           if(a.at(j)<a.at(j-1)){
                ans++;
               t=a.at(j);
               a.at(j)=a.at(j-1);
               a.at(j-1)=t;
               flag=1;
           }
       }
   }
   rep(i,n-1)cout<<a.at(i)<<" ";
   cout<<a.at(n-1)<<endl;
   cout<<ans<<endl;
}
  



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

// auto mod int
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  //初期化子リストを用いた初期化
  //mint型が負にならないようにする
  mint(ll x=0):x((x%mod+mod)%mod){}
  
  //mintが負になったときの処理
  //constメンバ関数、メンバ変数の書き換えができなくなる
  mint operator-() const { return mint(-x);}//直接初期化
  
  //代入演算子のオーバーロードは*thisを参照として返すようにする
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);//集成体初期化
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  //逆元
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint choose(ll n, ll r) {
  mint x = 1, y = 1;
  rep(i,r) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  mint ans = mint(2).pow(n);
  ans -= 1;
  ans -= choose(n,a);
  ans -= choose(n,b);
  cout << ans.x;
}


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

namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {
            string read = Console.ReadLine();
            var split = read.Split(' ');
            long A = long.Parse(split[0]);
            long B = long.Parse(split[1]);
            long K = long.Parse(split[2]);

            while (true)
            {
                K--;
                B = A / 2 + B;
                A /= 2;
                if (K == 0) break;
                K--;
                A = B / 2 + A;
                B /= 2;
                if (K == 0) break;


            }
            Console.WriteLine(A + " " + B);

        }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std; 
long long int p[100000],j[100000];
int main(void)
{
	long long int n,sum,sum1,max,cnt,i;
	while(1){
		scanf("%lld",&n);
		if(n==0) break;
		sum=0;
		for(i=0;i<n;i++){
			scanf("%lld",&p[i]);
			sum+=p[i];
		}
		cnt=n; max=sum*cnt;
		for(i=0;i<n-1;i++){
			scanf("%lld",&j[i]);
			j[i]*=-1;
		}
		sort(j,j+n);
		for(i=0;i<n-1;i++) j[i]*=-1;
		for(i=0;i<n-1;i++){
			cnt--;
			sum+=j[i];
			sum1=sum*cnt;
			if(max<sum1) max=sum1;
		//	printf("%d\n",sum1);
		}
		printf("%lld\n",max);
	}
	return 0;
}


Measured memory_bytes: 4248
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<ll> a(n),b(n);
    ll ok=0,ans=0,sub=0;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n;i++){
        ll buf;
        cin>>buf;
        b[i]=a[i]-buf;
        ok+=b[i];
        if(b[i]<0){
            ans++;
            sub+=b[i];
        }
    }    
    if(ok<0) cout<<"-1"<<endl;
    else {
        sort(b.begin(),b.end(),greater<ll>());
        for(int i=0;sub<0;i++){
            sub+=b[i];
            ans++;
        }
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 1792
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll = long long;
using plong = pair<long,long>;

bool cmp(plong p1,plong p2){
    return p1.second<p2.second;
}
int main(){
    long N,M;
    cin>>N>>M;
    vector<plong> p(M);
    for(long i=0;i<M;i++){
        long a_,b_;cin>>a_>>b_;
        a_--;b_--;
        p[i].first = a_;
        p[i].second = b_;
    }
    sort(p.begin(),p.end(),cmp);
    long res=0;
    long brk=-1;
    for(long i=0;i<M;i++){
        if(p[i].first<brk)continue;
        res++;
        brk = p[i].second;
    }
    cout<<res<<endl;
}



Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
import heapq

N, M = map(int, str(input()).split())
job_list = [list(map(int, input().split())) for i in range(N)]

# 日数と報酬のDictにまとめ直す
job_dict = dict()
for job in job_list:
    job_dict.setdefault(job[0], []).append(job[1])

# 残り日数に収まる最大の日数で、最大もらえる報酬を足して行く
# 残り日数が厳しい方から求めていく
result = 0
heap = []
for days in range(1, M + 1):
    if days in job_dict:
        for v in job_dict[days]:
            heapq.heappush(heap, -v)
    if len(heap) != 0:
        result -= heapq.heappop(heap)

print(result)

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

int main() {
  string s;
  cin >> s;
  vector<string> w;
  w.push_back("Sunny");
  w.push_back("Cloudy");
  w.push_back("Rainy");
  int i;
  for (i = 0; i < 3; i++) {
    if (s == w[i]) {
      cout << w[(i + 1) % 3] << endl;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;

void solve(){
    ll x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;
    Vl p(a), q(b), r(c);
    rep(i, 0, a) cin >> p[i];
    rep(i, 0, b) cin >> q[i];
    rep(i, 0, c) cin >> r[i];
    sort(ALL(p),greater<ll>());
    sort(ALL(q),greater<ll>());
    sort(ALL(r),greater<ll>());
    Vl v(x+y);
    rep(i, 0, x) v[i] = p[i];
    rep(i, x, x+y) v[i] = q[i-x];
    sort(ALL(v));
    rep(i, 0, min(x+y, c)){
        v[i] = max(v[i], r[i]);
    }
    ll ans = 0;
    rep(i, 0, x+y) ans += v[i];
    cout << ans << "\n";
}


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

    solve();
    return 0;
}


Measured memory_bytes: 3968
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; 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 FORR(i, m, n) for (int i = m; i >= n; i--)
#define pb(a) push_back(a)
using namespace std;
typedef long long ll;

int main()
{
    string S;
    int b = 0, r = 0;
    cin >> S;
    for (auto x : S)
    {
        if (x == '0')
            r++;
        else
            b++;
    }

    cout << 2 * min(b, r) << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<list>
//#include<unordered_map>
using namespace std;
#define ll long long 
#define dd cout<<endl
#define lll __int128
const int mod=1e9+7;
const int inf=1e9+7;

const int maxn=1e5+10;

int num[maxn];

int main()
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	
	int n;
	cin>>n;
	
	for(int i=0;i<n;i++)
		cin>>num[i];
	
	int maxx=0;
	
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(i==0)
		{
			cnt=0;
			continue;
		}
		
		if(num[i]<=num[i-1])
		{
			cnt++;
		}
		else
		{
			maxx=max(maxx,cnt);
			cnt=0;
		}
	}
	maxx=max(maxx,cnt);
	
	cout<<maxx<<endl;
	
	return 0;
}

Measured memory_bytes: 640
N = gets.chomp.to_i
alice = 0
bob = 0
cards = gets.chomp.split(" ").map(&:to_i) 
cards.sort!{|a, b| b <=> a }
cards.each_with_index do |card,i|
  if i%2 == 0
    alice += card
  else
    bob += card
  end
end

puts alice-bob


Measured memory_bytes: 1788
#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<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;
int N;
ll x[200000],y[200000];
int main(){
	cin>>N;
	int amn=0,amx=0;
	rep(i,N){
		cin>>x[i]>>y[i];
		if(x[i]>y[i]) swap(x[i],y[i]);
		if(x[amn]>x[i]) amn = i;
		if(y[amx]<y[i]) amx = i;
	}
	if(N==1){
		puts("0");
		return 0;
	}
	ll ans = 2e18;
	if(amn!=amx){	//rr
		using P = pair<ll,ll>;
		priority_queue<P,vector<P>,greater<P>> que;
		vector<bool> canmove(N,true);

		ll mx = 0;
		ll res = 2e18;
		rep(i,N){
			if(i!=amn){
				que.push(P(x[i],i));
				chmax(mx,x[i]);
			}else{
				que.push(P(y[i],i));
				chmax(mx,y[i]);
			}
		}
		canmove[amn] = canmove[amx] = false;

		while(!que.empty()){
			P p = que.top();
			que.pop();
			ll v = p.fs;
			int i = p.sc;
			chmin(res,mx-v);
			chmax(mx,y[i]);

			if(!canmove[i]) break;

			que.push(P(y[i],i));
			canmove[i] = 0;
		}
		chmin(ans,res*(y[amx]-x[amn]));
	}
	{	//(max - rmin)*(bmax - min)
		ll rmx = -2e18, rmn = 2e18, bmx = -2e18, bmn = 2e18;
		rep(i,N){
			chmax(rmx,x[i]);
			chmin(rmn,x[i]);
			chmax(bmx,y[i]);
			chmin(bmn,y[i]);
		}
		ll tmp = (rmx-rmn)*(bmx-bmn);
		chmin(ans,tmp);
	}
	cout<<ans<<endl;

}


Measured memory_bytes: 9588
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
    string o,e;
    cin>>o>>e;
    for(int i=0;i<e.size();i++){
        cout<<o[i]<<e[i];
    }
    if(o.size()==e.size())cout<<endl;
    else cout<<o[o.size()-1]<<endl;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(unknown_lints)]
#![allow(unused_variables)]
#![allow(unused_must_use)]
#![allow(unused_mut)]
#![allow(dead_code)]
#![allow(unused_assignments)]

use std::collections::HashMap;
use std::process::exit;
use std::io::{
    stdin,
    stdout,
    stderr,
    Read,
    Write,
    BufReader,
    BufWriter
};

macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

macro_rules! stdin {
    () => ({
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    })
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => (
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input.to_string()), $output);
            )*
        }
    )
}

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));
        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() {
    println!("{}", solve(stdin!()));
}

fn solve(src: String) -> String {
    let mut res = String::from("");
    input!{
        source = src,
        a: i32,
        b: i32,
        t: i32
    }
    let mut time = 0;
    let mut ans = 0;
    loop {
        time += a;
        debug!(time);
        debug!(ans);
        if time <= t {
            ans +=  b;
        } else {
            break;
        }
    }
    res.push_str(&ans.to_string());
    res.push_str("\n");
    res
}

test! {
r"3 5 7
"
=>
r"10
"
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    int x;
    cin >> x;
    if (x < 1200) cout << "ABC\n";
    else cout << "ARC\n";
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}

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

int main() {
    int X, Y, Z, K;
    cin >> X >> Y >> Z >> K;
    vector<long long> A(X), B(Y), C(Z);
    for(int i=0; i<X; ++i) cin >> A[i];
    for(int i=0; i<Y; ++i) cin >> B[i];
    for(int i=0; i<Z; ++i) cin >> C[i];

    vector<long long> D(X * Y);
    for(int i=0; i<X; ++i) {
        for(int j=0; j<Y; ++j) {
            D[i * Y + j] = A[i] + B[j];
        }
    }
    sort(begin(D), end(D), greater<long long>());

    priority_queue<long long> Q;
    for(int i=0; i<Z; ++i) {
        for(int j=0; j<min(X * Y, K); ++j) {
            Q.push(C[i] + D[j]);
        }
    }

    for(int i=0; i<K; ++i) {
        cout << Q.top() << endl;
        Q.pop();
    }
}

Measured memory_bytes: 42984
#include <iostream>

using namespace std;

int main() {
	int H, N, P;
	cin >> H >> N;
	P = 0;
	for(int i=1; i<=N;i++) {
		int tmp;
		cin >> tmp;
		P += tmp;
	}
	if(H<=P) {
		cout << "Yes" << endl;
	}else {
		cout << "No" << endl;
	}
	return 0;
	
}

Measured memory_bytes: 256
import scala.io.Source.stdin

object Main {
  val r = Array(2,3,5,7)

  def twoPow(d:Int,s:Int):(Int,Int) = {
    if(d%2 == 1) (d,s)
    else twoPow(d>>1,s+1)
  }

  def maybePrime(i:Int,d:Int,s:Int, n:Int):Boolean = {
    if(i>3) true
    else {
      val a = r(i)
      val x = BigInt(a).modPow(d,n).toLong

      if(x==1 || x==n-1) maybePrime(i+1,d,s,n)
      else repeat(s-1,BigInt(x).modPow(2,n).toLong, i, d, s, n)
    }
  }

  def repeat(j:Int, x:Long, i:Int, d:Int, s:Int, n:Int):Boolean = {
    if(j==0) false
    else if(x==1) false
    else if(x==n-1) maybePrime(i+1,d,s,n)
    else repeat(j-1,BigInt(x).modPow(2,n).toLong,i,d,s,n)
  }

  def isPrime(n:Int):Boolean = {
    if(n==2 || n==3 || n==5 || n==7) true
    else if(n%2==0) false
    else {
      val (d,s) = twoPow(n-1,0)
      maybePrime(0,d,s,n)
    }
  }

  def main(args:Array[String]) = {
    println(stdin.getLines.count{ x => isPrime(x.toInt) })
  }
}

Measured memory_bytes: 66648
#include<iostream>
#include<string.h>
using namespace std;
long long n,k;
long long a[1000110],c[1000010],d[1000010];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>n>>k;
		long long sum=0;
	sum=(k+1)*k/2;
	sum-=k;
	sum%=1000000007;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	memset(c,0,sizeof(c));
	memset(d,0,sizeof(d));
	for(int i=0;i<n;i++){
		for(int j=0;j<i;j++){
			if(a[i]>a[j]){
				c[i]++;
			}
		}
		for(int j=i+1;j<n;j++){
			if(a[i]>a[j]){
				d[i]++;
			}
		}
	}
 
	long long ans=0;
//	cout<<sum<<endl;
	for(int i=0;i<n;i++){
//		cout<<c[i]<<"   "<<d[i]<<endl;
		ans+=(c[i]*sum);
		ans%=1000000007;
		ans+=(d[i]*(sum+k));
		ans%=1000000007;
	}
	cout<<ans<<endl;
	return 0;
}




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

int main(void) {
  int length = 200020;
  char a[length];
  char b[length];

  scanf("%s", a);
  scanf("%s", b);

  int ans = 0;
  for (int i = 0; i < strlen(a); i++) {
    if (a[i] != b[i]) {
      ans++;
    }
  }

  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 2124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

int main() {
	ll n; cin >> n;
	ll a, b, c;
	a = b = c = 1;
	while (n--) {
		a = a * 10 % MOD;
		b = b * 9 % MOD;
		c = c * 8 % MOD;
	}
	cout << (((a - 2*b + c) % MOD) + MOD) % MOD << '\n';
	return 0;
}

Measured memory_bytes: 3640
#include<stdio.h>
#include<ctype.h>
#include<string.h>
int main(){
int count=0,j,n;
char moji[11];
char text[50];
scanf("%s",moji);
while(1){
 scanf("%s",text);
 if(strcmp(text,"END_OF_TEXT")==0) break;
 n=strlen(text);
  for(j=0;j<n;j++){
   text[j]=tolower(text[j]);
 }
 if(strcmp(moji,text)==0) count++;
}
printf("%d\n",count);
return 0;
}


Measured memory_bytes: 2112
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
ll const INF = 1LL << 60;
ll const MAX_N = 100000;
ll const MOD = 1000000007;
ll const MAX_V = 10000;
ll const MAX_E = 10000;

int main() {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    ll minA = INF;
    ll minA_idx = -1;
    rep(i, N) {
        if (minA > A[i]) {
            minA = A[i];
            minA_idx = i;
        }
    }

    vector<ll> dist(N, 0);
    rep(i, N) { dist[i] = abs(i - minA_idx); }

    // repv(dist) { cout << *it << " "; }
    // cout << endl;

    cout << ceil((double)(dist[0] + dist[N - 1]) / (K - 1)) << endl;

    return 0;
}


Measured memory_bytes: 4848
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)

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


	int n; cin >> n;
	vector<int> a(n), b(n);
	rep(i, 0, n)
		cin >> a[i] >> b[i];
	
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	if (n & 1) {
		cout << b[n / 2] - a[n / 2] + 1 << endl;
	}
	else {
		int l = a[n / 2 - 1] + a[n / 2];
		int r = b[n / 2 - 1] + b[n / 2];
		cout << r - l + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 4700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void){
	ll l,r; cin>>l>>r;
	ll I=0,J=0,ans=100000000000000;
	ll k;
	if(l%2019==0||r%2019==0||l/2019!=r/2019){
		cout<<0<<endl;
		return 0;
	}
	l=l%2019; r=r%2019;
	I=min(l,r); J=max(l,r);
	//cout<<I<<" "<<J<<endl;
	for(int i=I;i<J;i++){
		for(int j=i+1;j<=J;j++){
			k=i*j%2019;
			ans=min(ans,k);
		}
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 256
import io.StdIn._

object Main extends App {

  var range = Range.inclusive(0, 999).toArray

  val NM = readLine.split(" ").map(_.toInt)
  val N = NM(0)
  val M = NM(1)
  range = range.filter { n =>
    N match {
      case 1 => n < 10
      case 2 => n >= 10 && n < 100
      case 3 => n >= 100
    }
  }

  for (_ <- 0 until M) {
    val SC = readLine.split(" ").map(_.toInt)
    val S = SC(0)
    val C = SC(1)

    range = range.filter { n =>

      (N, S) match {
        case (3, 1) => n / 100 == C
        case (3, 2) => (n / 10) % 10 == C
        case (3, 3) => n % 10 == C

        case (2, 1) => n / 10 == C
        case (2, 2) => n % 10 == C

        case (1, 1) => n == C
        case _ => false
      }
    }
  }

  println(if(range.isEmpty) -1 else range(0))
}


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

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

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

    bitset<2000*2000 + 1> dp;
    dp[0] = 1;
    for(int i=0; i<n; i++){
        dp |= (dp << a[i]);
    }

    int x = (sum + 1) / 2;
    while(1){
        if(dp[x] == 1){
            cout << x << endl;
            return 0;
        }
        x += 1;
    }
    return 0;
}

Measured memory_bytes: 5104
package main

import (
  "bufio"
  "container/list"
  "fmt"
  "os"
  "strconv"
  "strings"
)

const rsize = 1000000
var reader = bufio.NewReaderSize(os.Stdin,rsize)
func NextLine() string {
  var line,buffer []byte
  var isPrefix bool = true
  var err error
  for ;isPrefix; {
    line,isPrefix,err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
  }
  return string(buffer)
}
func Next2Ints() (int,int) {
  var x,y int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  return x,y
}
func Next3Ints() (int,int,int) {
  var x,y,z int
  var s []string = strings.Split(NextLine()," ")
  x,_ = strconv.Atoi(s[0])
  y,_ = strconv.Atoi(s[1])
  z,_ = strconv.Atoi(s[2])
  return x,y,z
}

func main() {
  var n,m int = Next2Ints()
  var l,r,d int
  var edge []map[int]int = make([]map[int]int,n)
  for i:=0;i<n;i++ { edge[i] = map[int]int{} }
  for i:=0;i<m;i++ {
    l,r,d = Next3Ints()
    l,r = l-1,r-1
    if k,ok := edge[l][r];ok&&k!=d {
      fmt.Println("No")
      os.Exit(0)
    }
    edge[l][r] = d
    edge[r][l] = -d
  }
  var visited []bool = make([]bool,n)
  var value []int = make([]int,n)
  for i:=0;i<n;i++ {
    if visited[i] { continue }
    visited[i] = true
    value[i] = 0
    queue := list.New()
    queue.PushBack(i)
    for queue.Len() > 0 {
      k,_ := queue.Remove(queue.Front()).(int)
      for key,val := range edge[k] {
        if visited[key] && value[key] != value[k]+val {
          fmt.Println("No")
          os.Exit(0)
        } else if !visited[key] {
          visited[key] = true
          value[key] = value[k]+val
          queue.PushBack(key)
        }
      }
    }
  }
  fmt.Println("Yes")
}

Measured memory_bytes: 39808
#include <iostream>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
   long a=0,b=0,c=0,i=0;
   double f =0.000000000000;
        cin >> a;
        cin >> b;
        c = a/b;
        i = a%b;
        f = (double)a/(double)b;
   cout << c << " " << i << " ";
   cout << fixed;
   cout.precision(16);
   cout << (double)(f) << endl;


}

Measured memory_bytes: 1248
n = int(input())
abc = [[] for i in range(n)]
for i in range(n):
    abc[i] = list(map(int, input().split()))
dp = [[0, 0, 0] for i in range(n)]
dp[0] = abc[0]

for i in range(1, n):
    for j in range(3):
        dp[i][j] = dp[i-1][j-2] + abc[i][j] if dp[i-1][j-2] > dp[i-1][j-1] else dp[i-1][j-1] + abc[i][j]

print(max(dp[n-1]))

Measured memory_bytes: 50212
#include <bits/stdc++.h>
#define range(i, a, n) for(int (i) = (a); (i) < (n); (i)++)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
using namespace std;
double eps = 1e-9;
int main(void){
    double d; cin >> d;

    double res = (int)d + 1.0;

    res = max(res, d / sqrt(2.0) * 2.0);

    printf("%.12f\n", res);

	return 0;
}

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

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

void merge_sort (int array[], int left, int right) {
    int i, j, k, mid;
    int work[200010];
    
    if (left < right) {
        mid = (left + right)/2;
        merge_sort(array, left, mid);
        merge_sort(array, mid+1, right);
        for (i = mid; i >= left; i--)    work[i] = array[i];
        for (j = mid+1; j <= right; j++) work[right-(j-(mid+1))] = array[j];
        i = left;
        j = right;
        for (k = left; k <= right; k++) {
            if (work[i] < work[j]) array[k] = work[i++];
            else                   array[k] = work[j--];
        }
    }
}

int main() {
    int a[200010];
    int n;
    int old = 0;
    bool flag = false;
    
    cin >> n;
    
    rep(i, n){
        cin >> a[i];
    }
    
    merge_sort(a, 0, n-1);
    
    rep(i, n){
        if(old == a[i]){
            flag = true;
            break;
        }
        old = a[i];
    }
    
    if(!flag){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    
    return 0;
}











Measured memory_bytes: 15104
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	ll x;
	cin>>x;
	ll ans = 0;
	ans += x/11*2;
	x %= 11;
	if(x&&x<=6) ans++;
	else if(x) ans+=2;
	cout<<ans<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 256
//abc146_f.cpp
//Fri Jun  5 22:06:06 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int n,m;
	cin >> n >> m;
	string s;
	cin >> s;
	reverse(s.begin(),s.end());
	int maxplace[n+1];
	fill(maxplace,maxplace+n+1,0);
	set<int> nums;
	for (int i=0;i<=min(m,n);i++){
		if (s[i]=='0'){
			nums.insert(i);
		}
	}

	for (int i=0;i<n;i++){
		int tmp = i+m+1;
		// cout << i << " " << tmp << endl;
		if (nums.size()==0){
			cout << -1 << endl;
			return 0;
		}
		if (s[i]=='1'){
			if (s[min(tmp,n)]=='0'){
				nums.insert(min(tmp,n));
			}
			continue;
		}
		auto itr = nums.rbegin();
		maxplace[i] = *itr;
		nums.erase(i);
		if (s[min(tmp,n)]=='0'){
			nums.insert(min(tmp,n));
		}
	}

	// cout << s << endl;
	// for (int i=0;i<n+1;i++){
	// 	cout << maxplace[i];
	// }
	// printf("\n");

	vector<int> ans;
	ans.push_back(0);
	int cur = 0;
	while (cur != n){
		if (maxplace[cur]==cur){
			cout << -1 << endl;
			return 0;
		}
		ans.push_back(maxplace[cur]);
		cur = maxplace[cur];
	}

	for (int i=ans.size()-1;i>0;i--){
		cout << ans[i]-ans[i-1] << " ";
	}
	printf("\n");
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 3456
N = int(input())
T, A = map(int, input().rstrip().split())
H = list(map(int, input().rstrip().split()))

difference = 1000000
for i, height in enumerate(H):
    tmp = T - 0.006*height
    sub = abs(tmp - A)
    if sub < difference:
        difference = sub
        answer = i + 1

print(answer)


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

int main() {
  int n, a;
  cin >> n >> a;
  
  if ( a < 500 ) {
    if ( n % 500 != 0) {
      if ( n % 500 > a) {
        cout << "No" << endl;
      } else {
        cout << "Yes" << endl;
      }
    } else {
      cout << "Yes" << endl;
    }
  } else {
    cout << "Yes" << endl;
  }
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        //入力
    	@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
    	long a = sc.nextLong();
    	long b = sc.nextLong();
    	long c = sc.nextLong();


    	if( c - a - b >= 0) {
    		if((c - a - b)*(c - a - b) > 4 * a * b){
    			System.out.println("Yes");
    		}else {
    			System.out.println("No");
    		}
    	}else {
    		System.out.println("No");
    	}
    }
}

Measured memory_bytes: 24020
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int n,m;
    std::cin >> n >> m;
    std::vector<int> cnt(m,0);
    for(int i=0;i<n;i++){
        int k;
        std::cin >> k;
        for(int j=0;j<k;j++){
            int a;
            std::cin >> a;
            cnt[a-1]++;
        }
    }
    int ans=0;
    for(int i=0;i<m;i++){
        if(cnt[i]==n){
           ans++; 
        }
    }
    std::cout << ans << std::endl;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cstdio>
#include <bitset>
using namespace std;


int main() {
	int n, count = 0;
	cin >> n;

	vector<int> v(n);

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

	for (int i = 0; i < n; i++)
	{
		if ( i + 1 != n && v[i] == i + 1 && v[i + 1] == i + 2 ) swap(v[i], v[i + 1]), count++;
		else if ( i > 0 &&v[i] == i + 1 && v[i - 1] == i ) swap(v[i], v[i - 1]), count++;
		else if (v[i] == i + 1) count++;
	}

	cout << count << endl;
	return 0;
}

Measured memory_bytes: 640
x, y = [int(i) for i in input().split()]
s = 0
if x == 1:
  s += 300000
elif x == 2:
  s += 200000
elif x == 3:
  s += 100000
if y == 1:
  s += 300000
elif y == 2:
  s += 200000
elif y == 3:
  s += 100000
if x == 1 and y == 1:
  s += 400000
print(s)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAX = 2001;
const ll MOD = 924844033;
 
int n, k, nxt[2*MAX], dp[2*MAX][MAX][2];
ll ans, fact[MAX];
bool mark[2*MAX], st[2*MAX];
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> k;
	fact[0] = 1;
	for(int i = 1; i <= n; i++) fact[i] = fact[i-1] * i % MOD;
	for(int i = 1; i <= n; i++) {
		nxt[i] = (i+k <= n ? n+i+k : -1);
		nxt[n+i] = (i+k <= n ? i+k : -1);
	}
	for(int i = 1, curr = 0; i <= n; i++) {
		if(!mark[i]) {
			mark[i] = true;
			st[++curr] = true;
			for(int v = i; nxt[v] != -1; v = nxt[v]) {
				++curr;
				mark[nxt[v]] = true;
			}
		}
		if(!mark[n+i]) {
			mark[n+i] = true;
			st[++curr] = true;
			for(int v = n+i; nxt[v] != -1; v = nxt[v]) {
				++curr;
				mark[nxt[v]] = true;
			}
		}
	}
	dp[0][0][0] = 1;
	for(int i = 1; i <= 2*n; i++) for(int j = 0; j <= n; j++) {
		if(!st[i]) {
			dp[i][j][0] = (dp[i-1][j][0] + dp[i-1][j][1]) % MOD;
			if(j) dp[i][j][1] = dp[i-1][j-1][0];
		} else dp[i][j][0] = (dp[i-1][j][0] + dp[i-1][j][1]) % MOD;
	}
	for(int sz = 0; sz <= n; sz++) {
		ans += (sz & 1 ? -1 : 1) * (dp[2*n][sz][0] + dp[2*n][sz][1]) * fact[n-sz];
		ans %= MOD;
	}
	cout << (ans + MOD) % MOD;
}

Measured memory_bytes: 62848
import fractions

A,B = map(int, input().strip().split(' '))

# 素因数分解
def trial_division(n):
  result = []
  while n % 2 == 0:
    result.append(2)
    n //= 2
  f = 3
  while f*f <= n:
    if n % f == 0:
      result.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
    result.append(n)
  return result

gcd_ = fractions.gcd(A,B)
if gcd_ == 1:
  print(1)
else:
  print(len(set(trial_division(gcd_)))+1)


Measured memory_bytes: 64108
#include <bits/stdc++.h>
using namespace std;
long lucas(int n){
  if(n == 0){
    return 2;
  }else if(n == 1){
    return 1;
  }else{
    return lucas(n-1) + lucas(n-2);
  }
}

int main(){
  int n;
  cin >> n;
  vector<long> x(100,0);
  x[0] = 2;
  x[1] = 1;
  for(int i=2;i<=n;i++){
    x[i] = x[i-1] + x[i-2];
  }
  cout << x[n] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  string K; int N;
  cin >> N >> K;
  if(K.size()<=N) cout << K << endl;
  else {
    for(int i=0;i<N;i++) cout << K.at(i);
    cout << "...";
  }
  
}

Measured memory_bytes: 3628
#include <iostream>

using namespace std;

int main(void)
{
    int N, i, count=0;

    cin >> N;

    for(i=1; i<=N; i++){
	if(i<=9){
	    count++;
	}

	if(i>=100 && i<=999){
	    count++;
	}

	if(i>=10000 && i<=99999){
	    count++;
	}
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
bool in(int y,int x,int h,int w){
  return 0<=y&&y<h&&0<=x&&x<w;
}
signed main(){
  int h,w,m;
  cin>>h>>w>>m;
  string s[h];
  for(int i=0;i<h;i++) cin>>s[i];
  int c[3][h][w];
  for(int k=0;k<3;k++)
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)
	cin>>c[k][i][j];
  
  int y[m],x[m];
  for(int i=0;i<m;i++) cin>>y[i]>>x[i];

  vector<int> v[h][w];

  

  int ax[]={1,-1,0,0};
  int ay[]={0,0,1,-1};

  int cd=0;
  for(int k=0;k<m-1;k++){
    int cy=y[k],cx=x[k];
    if(y[k]==y[k+1]&&x[k]==x[k+1]) continue;
    queue<vector<int> > q;
    vector<int> t(1,cy*w+cx);
    q.push(t);
    bool used[h][w];
    memset(used,0,sizeof(used));
    used[cy][cx]=1;
    while(!q.empty()){
      vector<int> p=q.front();q.pop();
      int ty=p[p.size()-1]/w,tx=p[p.size()-1]%w;
      if(ty==y[k+1]&&tx==x[k+1]){
	t=p;
	break;
      }
      for(int i=0;i<4;i++){
	int ny=ty+ay[i],nx=tx+ax[i];
	if(!in(ny,nx,h,w)) continue;
	if(used[ny][nx]||s[ny][nx]=='#') continue;
	used[ny][nx]=1;
	int np=ny*w+nx;
	p.push_back(np);
	q.push(p);
	p.pop_back();
      }
    }
    for(int i=0;i<(int)t.size()-1;i++)
      v[t[i]/w][t[i]%w].push_back(cd++);
    //for(int i=0;i<(int)t.size()-1;i++) cout<<t[i]/w<<" "<<t[i]%w<<endl;
  }
  v[y[m-1]][x[m-1]].push_back(cd);
  int ans=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      //v[i][j].erase(unique(v[i][j].begin(),v[i][j].end()),v[i][j].end());
      ans+=(c[1][i][j]+c[2][i][j])*v[i][j].size();
      
      for(int k=0;k<(int)v[i][j].size()-1;k++){
	if((v[i][j][k+1]-v[i][j][k])*c[0][i][j]<(c[1][i][j]+c[2][i][j]))
	  ans+=(v[i][j][k+1]-v[i][j][k])*c[0][i][j]-(c[1][i][j]+c[2][i][j]);
      }
      
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main(){

    while(1){
        int n, m, q; cin >> n >> m >> q;
        if(!n) break;

        vector<vector<bool> > a(n, vector<bool> (m, true));

        vector<string> s(q + 1);
        vector<string> t(q + 1);        

        for(int i = 0; i < n; i++) s[0] += '0';
        for(int i = 0; i < m; i++) t[0] += '0';


        for(int i = 1; i <= q; i++){
            cin >> s[i] >> t[i];

            //押して、変化なし　|| 押さずに変化ありをfalseに
            for(int j = 0; j < n; j++){

                for(int k = 0; k < m; k++){                    
                    if((s[i][j] == '1' && (t[i][k] == t[i-1][k])) || s[i][j] == '0' && (t[i][k] != t[i-1][k])) a[j][k] = false; 
                }
                
            }
        
        }


        /*for(int i = 0; i < n; i++){
            for(int j = 0; j < m; j++){
                cout << a[i][j] << " ";            
            }
            cout << endl;
        }*/

        string M = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

        string ans;
        for(int i = 0; i < m; i++) ans += '?';
        for(int i = 0; i < m; i++){
            for(int j = 0; j < n; j++){
                if(a[j][i] == true && ans[i] == '?') ans[i] = M[j];
                else if(a[j][i] == true && ans[i] != '?'){
                    ans[i] = '?';
                    //cout << i << " con" << endl;
                    break;
                }
            }
        }

        cout << ans << endl;
    }

    return 0;
}


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

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

    if((a*b)%2 == 0 ){
        cout << "Even" << endl;
    }

    else{
        cout << "Odd" << endl;
    }
}

    

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
const int N=105;
int n,dp[N];

namespace utils{
	template <class T> inline void apn(T &x,const T y){x=x<y?x:y;}
	template <class T> inline void apx(T &x,const T y){x=x>y?x:y;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=c=='-'&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

int main(){
	n=nxi();
	for(int i=1; i<=n; ++i){
		dp[i]=std::max(dp[i],dp[i-1])+nxi();
	}
	for(int i=1; i<=n; ++i){
		dp[i]=std::max(dp[i],dp[i-1])+nxi();
	}
	printf("%d\n",dp[n]);
	return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static ArrayList<String>gyou = new ArrayList<String>();
	static ArrayList<String>retu = new ArrayList<String>();


	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			int H = scan.nextInt();
			int W = scan.nextInt();
			int K = scan.nextInt();

			char[][]c = new char[H][W];
			String []s = new String[H];

			for(int i = 0;i<H;i++) {
				s[i] = scan.next();
				c[i] = s[i].toCharArray();
			}

			int count = 0;


			for(int i = 0;i<=H;i++) {
				if(i!=0) {
				for(int z = 0;z<=H-i;z++) {
					gyou(i-1,H,z,String.valueOf(z));
				}
				}
			}

			for(int i = 0;i<=W;i++) {
				if(i!=0) {
				for(int z = 0;z<=W-i;z++) {
					retu(i-1,W,z,String.valueOf(z));
				}
				}
			}

			//System.out.println(gyou.size());
			//System.out.println(retu.size());

			for(int i = -1;i<gyou.size();i++) {
				for(int j = -1;j<retu.size();j++) {
					String G = "";
					String R = "";
					if(i!=-1)G = gyou.get(i);
					if(j!=-1)R = retu.get(j);
					char[][]cha = new char[H][W];
					for(int k = 0;k<H;k++) for(int o = 0;o<W;o++)cha[k][o]=c[k][o];

					for(int w = 0;w<=G.length();w++) {
						int q = -1;
						if(w!=0) {
						 q=G.charAt(w-1)-'0';
						for(int x = 0;x<W;x++) cha[q][x] = '+';
						}
						for(int z = 0;z<=R.length();z++) {
							int d = -1;
							if(z!=0) {
								d=R.charAt(z-1)-'0';
								for(int xr = 0;xr<H;xr++) cha[xr][d] = '+';
							}
						}
					}

					int co = 0;
					for(int h = 0;h<H;h++) {
						for(int e = 0;e<W;e++) {
							if(cha[h][e]=='#')co++;
						}
					}

					if(co==K)count++;



				}

			}


			System.out.println(count);






		}


	}




	private static void gyou(int count,int H,int k,String S) {//count個選ぶ
		if(count!=0) {
			for(int i =k+1;i<=H-count;i++) {
				gyou(count-1,H,i,S+String.valueOf(i));
				}
		}else {
			//System.out.println(S);



			gyou.add(S);
			}
	}
	private static void retu(int count,int W,int k,String S) {//count個選ぶ
		if(count!=0) {
			for(int i =k+1;i<=W-count;i++) {
				retu(count-1,W,i,S+String.valueOf(i));
				}
		}else {
			//System.out.println(S);
			retu.add(S);
			}
	}




}



Measured memory_bytes: 41596
#include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) for (int i = (int)(n-1); i >= 0; i--)
#define sz(x) int(x.size())
#define bitsz(x) int(__builtin_popcount(x))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define INF 1e9
#define LINF 1e18
#define mod 1000000007
template<class T> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return 1; } return 0; }
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
const int di[4] = {1,0,-1,0};
const int dj[4] = {0,1,0,-1};


const int MAX = 5100000; //必要な分だけ用意
ll fac[MAX], finv[MAX], inv[MAX];

//前処理 O(n)
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i=2; i<MAX; i++) {
        fac[i] = fac[i-1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}

//二項係数計算 O(1)
ll COM(int n, int k) {
    if (n<k) return 0;
    if (n<0 || k<0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

int main() {
    int x, y; cin >> x >> y;
    ll ans = 0;
    COMinit();
    rep(i,x/2+1) { //i:右に2の移動の回数
        int nx = x-2*i, ny = y-i;
        if (nx<0 || ny<0) break;
        if (ny != 2*nx) continue;
        int step = nx;
        ans += COM(i+step,i);
        ans %= mod;
        if (ans<0) ans += mod;
    }
    cout << ans << endl;
}

Measured memory_bytes: 123164
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author iavanish
 */
public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BHomework solver = new BHomework();
        solver.solve(1, in, out);
        out.close();
    }

    static class BHomework {

        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();

            for (int i = 0; i < m; i++) {
                n -= in.nextInt();
            }

            out.println(0 <= n ? n : -1);
        }

    }

    static class FastReader {

        private final int BUFFER_SIZE = 1 << 16;
        private final InputStream inputStream;
        private final byte[] buffer;
        private int bufferPointer;
        private int bytesRead;

        public FastReader() {
            this.inputStream = new DataInputStream(System.in);
            this.buffer = new byte[BUFFER_SIZE];
            this.bufferPointer = bytesRead = 0;
        }

        public FastReader(InputStream inputStream) {
            this.inputStream = inputStream;
            this.buffer = new byte[BUFFER_SIZE];
            this.bufferPointer = bytesRead = 0;
        }

        public FastReader(String fileName) {
            try {
                this.inputStream = new DataInputStream(new FileInputStream(fileName));
                this.buffer = new byte[BUFFER_SIZE];
                this.bufferPointer = bytesRead = 0;
            } catch (FileNotFoundException e) {
                throw new RuntimeException(e);
            }
        }

        public int nextInt() {
            int nextInt = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean negative = (c == '-');
            if (negative) {
                c = read();
            }
            do {
                nextInt = nextInt * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (negative) {
                return -nextInt;
            }
            return nextInt;
        }

        private void fillBuffer() {
            try {
                bytesRead = inputStream.read(buffer, bufferPointer = 0, BUFFER_SIZE);
                if (bytesRead == -1) {
                    buffer[0] = -1;
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        private byte read() {
            if (bufferPointer == bytesRead) {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

    }

}



Measured memory_bytes: 25700
import java.util.*;
import java.io.PrintWriter;
class Main{
	
	static PrintWriter out;
	static Scanner sc;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		sc=new Scanner(System.in);
		out=new PrintWriter(System.out);
		
		
		int n=sc.nextInt();
		if(n>=30) {
			out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		
		sc.close();
		out.close();
		
	}
}

Measured memory_bytes: 35716