akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main()
{
	int h , w , x , y , n ;
	n = 1 ;
	while( 1 )
	{
		if ( n >= 2 )
			cout << endl;
		y = 1 ;
		cin >> h >> w ;
		if ( h == 0 && w == 0 ) break ;
        h , w <= 300 ;
        while ( y <= h )
        {
        	if ( y >= 2 )
        		cout << endl;
        	if ( y % 2 != 0 )
        	{
        		for ( x = 5 ; x < w + 5 ; x ++ )
        		{
        			if ( x % 2 == 0 )
        			{
        				cout << "." ;
        			}
        			if ( x % 2 != 0 )
        			{
        				cout << "#" ;
        			}
        		}
        	}
        	if ( y % 2 == 0 )
        	{
        for ( x = 5 ; x < w + 5 ; x ++ )
        {
        	if ( x % 2 == 0 )
        	{
        		cout << "#" ;
        	}
        	if ( x % 2 != 0 )
        	{
        		cout << "." ;
        	}
        }
        }
        y ++ ;
        n ++ ;
        }  
        cout << endl;
	}
}

Measured memory_bytes: 1152
<?php
$array = [];
while ($line = fgets(STDIN)) {
    array_push($array, trim($line));
}

$h = (int)$array[0];

$n = 0;
while ($h > 1) {
    $h = floor($h / 2);
    $n = $n + 1;
}

$result = 2 ** ($n + 1) - 1;

print($result);

Measured memory_bytes: 16168
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define FAST  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int 
#define ar array
#define pb push_back
#define fi(a,b) for(int i=a;i<(b);i++)
#define fj(a,b) for(int j=a;j<(b);j++)
#define fk(a,b) for(int k=a;k<(b);k++)
#define lb lower_bound
#define ub upper_bound
//hash base 177013


int main()
{
	FAST;
	//#ifndef ONLINE_JUDGE
	//	freopen("input.txt","r",stdin);
	//	freopen("output.txt","w",stdout);
	//#endif
	//ll testcase;
	//cin>>testcase;
	//while(testcase--)
	{
		int n;
		cin>>n;
		int a[n];
		vector<int> m(1000006);
		fi(0,n) 
		{
			cin>>a[i];
			m[a[i]]++;
		}
		bool pw=true;
		for(ll i=2;i<=1000000;i++)
		{
			int count=0;
			for(ll j=i;j<=1000000;j+=i)
			{
				count+=m[j];
			}
			if(count>1)
			{
				pw=false;
				break;
			}
		}
		if(pw)
		{
			cout<<"pairwise coprime\n";
			return 0;
		}
		
		int temp=a[0];
		fi(1,n)
		{
			temp=__gcd(temp,a[i]);
		}
		if(temp==1)
		{
			cout<<"setwise coprime\n";
		}
		else
		{
			cout<<"not coprime\n";
		}
		
		
	}
}


Measured memory_bytes: 11100
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

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

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			long a = in.nextLong(), b = in.nextLong();

			long k = b - a;
			out.println(k*(k-1)/2-a);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


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

const int N = 2e5 + 10;
int64_t seg[2 * N] = {0};
int64_t dp[N] = {0};
int h[N], v[N];
int n;

// void modify(int64_t l, int64_t r, int64_t idx, int64_t x, int64_t val) {
//    if (l > idx || r < idx) return;
//    if (l == r) {
//       seg[x] = max(seg[x], val);
//       return;
//    }
//    int64_t mid = (l+r)/2;
//    modify(l, mid, idx, x + x + 1, val);
//    modify(mid + 1, r, idx, x + x + 2, val);
//    seg[x] = max(seg[x + x + 1], seg[x + x + 2]);
// }

// int64_t query(int64_t l, int64_t r, int64_t ql, int64_t qr, int64_t x) {
//    if (r < ql || l > qr) return int64_t32_MIN;
//    if (l >= ql && r <= qr) return seg[x];
//    int64_t mid = (l+r)/2;
//    int64_t left = query(l, mid, ql, qr, x + x + 1);
//    int64_t right = query(mid + 1, r, ql, qr, x + x + 2);
//    return max(left, right);
// }

void modify(int p, int64_t value) {  // set value at position p
  for (seg[p += n] = value; p > 1; p >>= 1) seg[p>>1] = max(seg[p], seg[p^1]);
  // changing the parent seg[p] left child, seg[p^1] right child and vice versa
}

int64_t query(int l, int r) {  // sum on int64_terval [l, r)
  int64_t res = 0;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l&1) res = max(res, seg[l++]);
    if (r&1) res = max(res, seg[--r]);
  }
  return res;
}

void solve() {
//    for (int64_t i = 1; i <= n; ++i) dp[h[i]] = v[i];
//    for (int64_t i = 1; i <= n; ++i) {
//       int64_t mx_val = query(1, n, 1, h[i]-1, 0);
//       dp[h[i]] = max(dp[h[i]], mx_val + v[i]);
//       modify(1, n, h[i], 0, dp[h[i]]);
//    }

   for (int i = 1; i <= n; ++i) dp[h[i]] = v[i];
   for (int i = 1; i <= n; ++i) {
      int64_t mx_val = query(1, h[i]);
      dp[h[i]] = max(dp[h[i]], mx_val + v[i]);
      modify(h[i], dp[h[i]]);
   }

   int64_t ans = 0;
   for (int64_t i = 1; i <= n; ++i) {
      ans = max(dp[i], ans);
   }
   cout << ans << '\n';

//    for (int i = 1; i <= 2 * n; ++i) {
//       cout << dp[i] << ' ';
//    }
}

signed main() {
   cin >> n;
   for (int i = 1; i <= n; ++i) cin >> h[i];
   for (int i = 1; i <= n; ++i) cin >> v[i];
   solve();

   return 0;
}


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

int main() {
  // input
  string n;
  int a = 0, b = 0;
  cin >> n;
  for (int i = 0; i < n.size(); i++) {
    if (i % 2 == 0) {
      if (n[i] == '0') {
        a++;
      } else {
        b++;
      }
    } else {
      if (n[i] == '0') {
        b++;
      } else {
        a++;
      }
    }
  }
  if (a > b) {
    cout << b << endl;
  } else {
    cout << a << endl;
  }
  return 0;
}

Measured memory_bytes: 512
// Author : Mohamed Sameh
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define s second
#define FAST ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
typedef long long ll ;
using namespace std ;
int main()
{
  string x;
  cin >> x;
  int ans = 0;
  for (int i = 0; i < 3; i++)
  {
    if (x[i] != 'R')continue;
    int j = i+1;
    while(j < 3 && x[j] == 'R')j++;
    ans = max(ans, j - i);
    i = j-1;
  }
  cout << ans <<"\n";
}


Measured memory_bytes: 3560
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>
using namespace std;

/*--- Macro ---*/
#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 mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()

/*---  Type ---*/
typedef long long ll;

/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;

// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// Util
int max(int a, int b, int c) {return max(a, max(b, c));}
int min(int a, int b, int c) {return min(a, min(b, c));}
ll max(ll x, ll y) {return x > y ? x : y;}
ll min(ll x, ll y) {return x < y ? x : y;}
ll max(ll a, ll b, ll c) {return max(a, max(b, c));}
ll min(ll a, ll b, ll c) {return min(a, min(b, c));}

// How to use 「map」
/*
  - 宣言
    map<{key_type}, {value_type}> salary;
  - 要素の挿入
    salary["Alice"] = 1000;
  - 要素の取得 O(logn)
    salary.at("Alice");
  - 要素の削除
    salary.erase("Alice");
  - キー検索
    salary.find("Alice"); -> true
    salary.find("Bob");   -> false
  - イテレーション
    for(auto& [key, value] : salary) {...}
 */
// -------------------------------------


// How to use 「lower_bound」, 「upper_bound」
/*
  vector<int> a = {1, 2, 3, 4, 5};
  auto iter1 = lower_bound(all(a), 3);  <- 第二引数「以上」の最小イテレータが返る
  auto iter2 = upper_bound(all(a), 3);  <- 第二引数「より大きい」最小のイテレータが返る
 */
// -------------------------------------


// How to use 「struct sort」
/*
  struct Person {
    string name;
    int age;

    Person(string _name, int _age) {
      name = _name;
      age = _age;
    }

    bool operator<(const Person &another) const {
      return age < another.age;
    }
  };

  vector<Person> people;
  people.pb(Person("Alice", 20));
  people.pb(Person("Bob", 19));
  people.pb(Person("John", 40));
  people.pb(Person("Chris", 30));
  sort(all(people));
 */
 // -------------------------------------

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



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

  vector<int> x;
  rep(i, n) {
    int xi;
    cin >> xi;
    x.pb(xi);
  }

  int ans = INF<int>;
  rep(p, 100) {
    int s = 0;
    rep(i, n) {
      s += pow(x[i] - p, 2.0);
    }
    ans = min(ans, s);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import math
n = int(input())
cnt = 0

def f(x):
    for i in range(2, int(math.sqrt(x))+1):
        if x%i == 0:
            return 0
    return 1

for i in range(n):
  m = int(input())
  cnt = cnt + f(m)

print(cnt)


Measured memory_bytes: 5672
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;
ll mod=1e9+7;
ll cnt[100010];
ll cnt1[100010];
int main(){
	int n,m; cin >>n>>m;
	vector<int> a(m);
	cinf(m,a);
	sort(a.begin(),a.end());
	for(int i=0;i<m-1;i++){
		if(a[i+1]-a[i]==1){
			cout << 0 << endl;
			return 0;
		}
	}
	cnt[0]=1;
	for(int i=0;i<m;i++){
		cnt1[a[i]]++;
	}
	for(int i=1;i<=n;i++){
		if(cnt1[i]==0&&cnt[i-1]==0){
			cnt[i]=cnt[i-2];
		}
		else if(cnt1[i]==0&&cnt[i-2]==0){
			cnt[i]=cnt[i-1];
		}
		else if(cnt1[i]==0){
			if(i>1){
				cnt[i]=cnt[i-2]+cnt[i-1];
				cnt[i]%=mod;
			}
			else{
				cnt[i]=cnt[i-1];
			}
		}
		else{
			cnt[i]=0;
		}
	}
	cout << cnt[n]%mod<<endl;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
// #include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) std::cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) std::cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) std::cout << x << endl;
#define println(x) std::cout << x << endl;
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}

using namespace std;
// using namespace atcoder;
void Main()
{
    ll H, W, K;
    cin >> H >> W >> K;

    vector<ll> y(K), x(K), v(K);
    rep(i, K) cin >> y[i] >> x[i] >> v[i];
    
    vector<vector<ll> > field(H, vector<ll>(W));
    rep(i, K) {
        field[y[i]-1][x[i]-1] = v[i];
    }

    ll INF = 1e18;
    // i,jにいるときにその行でk個げっとしている価値の最大
    vector<vector<vector<ll> > > dp(H+1, vector<vector<ll> >(W+1, vector<ll>(4, -INF)));

    dp[1][0][0] = 0;
    rep(y, H){
        rep(x, W) {
            ll val = field[y][x];
            // x,yで拾わない
            rep(k, 4) {
                maxs(dp[y+1][x+1][k], dp[y+1][x][k]);
                maxs(dp[y+1][x+1][0], dp[y][x+1][0]); //下がるとカウントをリセット
                maxs(dp[y+1][x+1][0], dp[y][x+1][1]); //下がるとカウントをリセット
                maxs(dp[y+1][x+1][0], dp[y][x+1][2]); //下がるとカウントをリセット
                maxs(dp[y+1][x+1][0], dp[y][x+1][3]); //下がるとカウントをリセット
            }

            repi(k, 4) {
                if (val > 0) {
                    maxs(dp[y+1][x+1][k], dp[y+1][x][k-1] + val);
                    maxs(dp[y+1][x+1][1], dp[y][x+1][0] + val);
                    maxs(dp[y+1][x+1][1], dp[y][x+1][1] + val);
                    maxs(dp[y+1][x+1][1], dp[y][x+1][2] + val);
                    maxs(dp[y+1][x+1][1], dp[y][x+1][3] + val);
                }
            }
        }
    }

    ll res = 0;
    maxs(res, dp[H][W][0]);
    maxs(res, dp[H][W][1]);
    maxs(res, dp[H][W][2]);
    maxs(res, dp[H][W][3]);

    put(res)
}
signed main(){ Main();return 0;}

Measured memory_bytes: 711696
var k,a,b,i,t:longint;
begin
 readln(k);read(a,b);
 t:=0;
 for i:=a to b do
  if i mod k=0 then
   begin
    t:=1;
    break;
   end;
 if t=0 then write('NG')
 else   write('OK');
end.


Measured memory_bytes: 1384
require 'prime'

is_prime = Array.new( 10 ** 5 + 1, false )
primes = Prime.each(10**5).to_a

primes.each{ |p| is_prime[p] = true }

nums_like_2017 = []
primes.each{ |p| nums_like_2017 << p if is_prime[(p+1)/2] }
m = nums_like_2017.size

Q = gets.to_i
Q.times do |i|
  
  l, r = gets.split.map(&:to_i)
  
  rn = nums_like_2017.bsearch_index{ |x| x > r }
  rn = m if rn.nil?
  ln = nums_like_2017.bsearch_index{ |x| x >= l }
  ln = m if ln.nil?
  
  puts rn - ln
end

Measured memory_bytes: 3764
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
struct node{
    int val;
    int pos;
}a[200010];
bool cmp(node a, node b){
    return (a.val < b.val);
}
int n,cnt;
int main(){
    ios::sync_with_stdio(0);
    cin>>n;
    for(int i=1; i<=n; i++){
        cin>>a[i].val;
        a[i].pos = i;
    }
    sort(a+1, a+n+1, cmp);
    for(int i=1; i<=n; i++){
        if (a[i].pos % 2 != i % 2){
            ++cnt;
        }
    }
    cout<<cnt/2<<endl;
    return 0;
    // position difference(? 
    /*
    1 3 5 4 2
    p = 1 2 3 4 5
    if (pos diff % 2 is changed) then adjacent swap=true to make it become (x+1)%2
    ans/2 as one swap affect 2
    */
}

Measured memory_bytes: 4404
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll H = 3;
  ll W = 3;
  std::vector< std::vector<ll> > grid(H, std::vector<ll>(W, 0LL));
  for (ll y = 0; y < H; y++) {
    for (ll x = 0; x < W; x++) {
      std::cin >> grid[y][x];
    }
  }

  ll res = 0LL;
  bool judge = true;

  res = grid[0][1] - grid[0][0];
  for (ll y = 1; y < H; y++) {
    if (res != grid[y][1] - grid[y][0]) judge = false;
  }

  res = grid[0][2] - grid[0][1];
  for (ll y = 1; y < H; y++) {
    if (res != grid[y][2] - grid[y][1]) judge = false;
  }

  res = grid[0][0] - grid[0][2];
  for (ll y = 1; y < H; y++) {
    if (res != grid[y][0] - grid[y][2]) judge = false;
  }

  res = grid[1][0] - grid[0][0];
  for (ll x = 1; x < W; x++) {
    if (res != grid[1][x] - grid[0][x]) judge = false;
  }

  res = grid[2][0] - grid[1][0];
  for (ll x = 1; x < W; x++) {
    if (res != grid[2][x] - grid[1][x]) judge = false;
  }

  res = grid[0][0] - grid[2][0];
  for (ll x = 1; x < W; x++) {
    if (res != grid[0][x] - grid[2][x]) judge = false;
  }

  if (judge) print("Yes");
  else print("No");

  return 0;
}


Measured memory_bytes: 256
msg=input()
patten=input()

bucket=[None,None]
bucket[0]=[0]*26
bucket[1]=[0]*26
for c in msg:
    bucket[0][ord(c)-ord('a')]+=1
for c in patten:
    bucket[1][ord(c)-ord('a')]+=1
bucket[0]=sorted(bucket[0])
bucket[1]=sorted(bucket[1])
winFlag=True
for i in range(len(bucket[0])):
    if(bucket[0][i]!=bucket[1][i]):
        winFlag=False
if winFlag==False:
    print("No")
else:
    print("Yes")




Measured memory_bytes: 3632
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=[(i,i%10) for i in [a,b,c,d,e] if i%10!=0]
y=[i for i in [a,b,c,d,e] if i%10==0]
x=sorted(x,key=lambda x:x[1])
ans = sum(y)
if len(x)==0:
  print(ans)
else:
  ans += sum((i[0]//10+1)*10 for i in x[1:])
  ans+=x[0][0]
  print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<int> G[114514];
signed main(){
  int n,m;
  cin>>n>>m;
  int a[m],b[m];
  for(int i=0;i<m;i++) cin>>a[i]>>b[i];
  for(int i=0;i<m;i++){
    a[i]--;b[i]--;
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }
  list<int> l;
  l.push_back(a[0]);
  l.push_back(b[0]);
  bool used[n];
  memset(used,0,sizeof(used));
  used[a[0]]=1;
  used[b[0]]=1;
  while(1){
    int x=l.front(),y=l.back();
    //cout<<x<<" "<<y<<endl;
    bool ff=1;
    for(int i=0;i<(int)G[x].size();i++){
      if(used[G[x][i]]) continue;
      used[G[x][i]]=1;
      ff=0;
      l.push_front(G[x][i]);
      break;
    }
    for(int i=0;i<(int)G[y].size();i++){
      if(used[G[y][i]]) continue;
      used[G[y][i]]=1;
      ff=0;
      l.push_back(G[y][i]);
      break;
    }
    if(ff) break;
  }
  int k=l.size();
  cout<<k<<endl;
  bool f=0;
  for(auto it=l.begin();it!=l.end();++it){
    if(f) cout<<" ";
    cout<<(*it)+1;
    f=1;
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 11520
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;

int main() {
	int A, B, C, K;
	cin >> A >> B >> C >> K;
	bool judge = false;
	for (int i = 0; i < K; i++) {
		int BI = B * pow(2, i);
		int CI = C * pow(2, K - i);
		if (BI > A && CI > BI) judge = true;
	}
	if (judge) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 4092
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9) + 7;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) <= (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n); (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define pf(x) cout << (x) << endl
#define all(x) (x).begin(),(x).end()
#define yes pf("Yes")
#define no pf("No")

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

ll factorial(ll n){
    ll t = 1;
    rep1(i, n){
        t *= i;
        t %= mod;
    }
    return t;
}

ll power(ll a, ll b){
    a %= mod;
    if(b == 0){
        return 1;
    }
    ll ans = power(a, b / 2);
    ans = ans * ans % mod;
    if(b % 2 == 1){
        ans = ans * a % mod;
    }
    return ans;
}

ll combination(ll a, ll b){
    if((a == b) || (b == 0)){
        return 1;
    }
    if(a < b) return 0;
    ll ans = 1;
    for(ll i = 0; i < b; i++) {
        ans *= (a - i);
        ans /= (i + 1);
        ans %= mod;
    }
    return ans;
}

int main(){
    double a,b,n;
    cin >> a >> b >> n;
    if(n >= b)pf(floor(a / b * (b - 1)));
    else pf(floor(a / b * n));
    return 0;
}



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

const int mod = 1e9+7;
const int INF = 2000000;
const double PI = acos(-1.0);


int main() {
    
    int N, M, K;
    cin >> N >> M >> K;
    int A[N], B[M];

    rep(i,N) cin >> A[i];
    rep(i,M) cin >> B[i];

    ll an[N+1],am[M+1];
    an[0] = 0, am[0] = 0;
    for(int i = 0; i < N; i++) an[i+1] = an[i] + A[i];
    for(int i = 0; i < M; i++) am[i+1] = am[i] + B[i];
    int ans = 0;
    for(int i = 0; i <= N; i++) {
        ll tmp = K - an[i];
        if(tmp < 0) break;
        int j = upper_bound(am, am+M+1, tmp) - am - 1;
        ans = max(ans, i+j);
    }
    cout << ans << endl;
}


Measured memory_bytes: 8320
#include <bits/stdc++.h>
using namespace std;
#define imp() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define endl "\n"
#define lli long long int 
#define ll long long 
int main() {
	  double d,t,s;cin>>d>>t>>s;
	  double tt=d/s;
	  if(tt<=t)
	  cout<<"Yes"<<"\n";
	  else
	  cout<<"No"<<"\n";
	  
	return 0;
}


Measured memory_bytes: 3712
A = [list( map(int, input().split()) ) for _ in range(3)]
N = int(input())
b = set([int(input()) for _ in range(N)])

def check(A, b):
    # 横
    for i in range(3):
        col, row = [], []
        for j in range(3):
            col.append(A[i][j])  # 横
            row.append(A[j][i])  # 縦
        if set(col) <= b or set(row) <= b:
            return True

    # 斜め
    if set([A[0][0], A[1][1], A[2][2]]) <= b or set([A[0][2], A[1][1], A[2][0]]) <= b:
        return True

if check(A, b):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
X = int(input())
for B in range(131):
    for A in range(B,131):
        if A**5 - B**5 == X:
            print(str(A) + " " + str(B))
            exit()
        elif A**5 + B**5 == X:
            print(str(A) + " " + str(-1*B))
            exit()

Measured memory_bytes: 9188
# coding: utf-8
# Your code here!
import sys

def main():
    A, B, C, X, Y = map(int, sys.stdin.readline().split())
    
    # 
    if C*2 >= A+B:
        ans = A*X + B*Y
    else:
        ans = min(X, Y) * C * 2
        # X: X - min(X, Y)
        # Y: Y - min(X< Y)
        ans += min(A*(X-min(X, Y)), C*2*(X-min(X, Y))) + min(B*(Y-min(X, Y)), C*2*(Y-min(X, Y)))
    print(ans)
    
if __name__ == "__main__":
    main()

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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define ll long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    int n, w;
    cin >> n >> w;
    vector<int> dp(w + 1, -1);
    dp[0] = 0;
    int ans = 0;
    for(int i=0;i<n;i++)
    {
        int a, b;
        cin >> a >> b;
        for(int j=w;j>=0;j--)
            if(dp[j] >= 0 and j+a <= w)
            {
                dp[j+a] = max(dp[j+a], dp[j] + b);
                ans = max(ans, dp[j+a]);
            }
    }
    cout << ans << "\n";
    
                
    return 0;
}



Measured memory_bytes: 1024
import heapq
N = int(input())
A = [None]*N
for i in range(N):
    A[i] = {
        "index": i,
        "value": int(input())
    }

B = heapq.nlargest(2, A, key=lambda e:e["value"])
for i in range(N):
    if i == B[0]["index"]:
        print(B[1]["value"])
    else:
        print(B[0]["value"])


Measured memory_bytes: 78524
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

int main(){
    int a[3],k;
    lol(i,3)cin>>a[i];
    sort(a,a+3);
    cin>>k;
    cout<<a[0]+a[1]+(a[2]<<k)<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<queue>
#include<cmath>
using namespace std;

int main(){
    int N,M;
    cin>>N>>M;
    int a[M];
    for(int i=0;i<M;i++) cin>>a[i];
    int sum=0;
    for(int i=0;i<M;i++){
        sum+=a[i];
    }
    int play;
    play=N-sum;
    if(play>=0){
        cout<<play<<endl;
    }else{
        cout<<-1<<endl;
    }
}


Measured memory_bytes: 3604
using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> num = new List<int> { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
 
            int K = int.Parse(Console.ReadLine());
            int a = num[K-1];

            Console.WriteLine(a);
        }
    }
}

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

int main(){
    int a,b,c,x;
    cin >> a >> b >> c >> x;
    int counter = 0;
    for(int i = 0; i < a+1; i++){
        for(int j = 0; j < b+1; j++){
            for(int k = 0; k < c+1; k++){
                if(500 * i + 100 * j + 50 * k == x){
                    counter += 1;
                }
            }
        }
    }
    cout << counter << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main(){
    int n, m;
    cin >> n >> m;
    if(n >=13) cout << m;
    else if(n >= 6) cout << m/2;
    else cout << 0;
}

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

int main() {
  int A,B;
  string op;
  cin >> A >> op >> B;
  
  if (op == "+") {
    A += B;
     cout << A << endl;
  }
  if (op == "-") {
    A -= B;
     cout << A << endl;
  }
}


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

int b[maxn];
int a[maxn][maxn];
int main()
{
    int n,m,c;
    scanf("%d%d%d",&n,&m,&c);
    for(int i=1;i<=m;i++)scanf("%d",&b[i]);
    for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)scanf("%d",&a[i][j]);
    int cnt=0;
    for(int i=1;i<=n;i++)
    {
        int ans=0;
        for(int j=1;j<=m;j++)
        {
            ans+=a[i][j]*b[j];
        }
        if(ans+c>0)cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}
/*
int a[maxn];
int main()
{
    int H,W;
    int h,w;
    scanf("%d%d",&H,&W);
    scanf("%d%d",&h,&w);
    int ans=(H-h)*(W-w);
    printf("%d\n",ans);
    return 0;
}
*/


Measured memory_bytes: 256
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;



int main(){
  int a,b;
  char kigou;
  int ans;

  cin >> a >> kigou >> b;


  if(kigou == '+'){
    ans = a + b;
  }
  else if(kigou == '-'){
    ans = a - b;
  }

  cout << ans << endl;



}

Measured memory_bytes: 256
N, K = map(int, input().split())
S = input()

if S[K - 1] == "A":
    S = S[:K - 1] + "a" + S[K:]
elif S[K - 1] == "B":
    S = S[:K - 1] + "b" + S[K:]
elif S[K - 1] == "C":
    S = S[:K - 1] + "c" + S[K:]
print(S)


Measured memory_bytes: 3060
N, K, *A = map(int, open(0).read().split())

dp = [0] + [None] * (N - 1)
for n, a in enumerate(A):
    if n:
        l = max(0, n - K)
        dp[n] = min(abs(a - a2) + d for a2, d in zip(A[l : n], dp[l : n]))

print(dp[-1])


Measured memory_bytes: 13876
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <limits.h>
#include <string.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<pi> vii;

typedef long long int lld;

#define F first
#define S second

#define ERR 1e-9
#define MAXN 500010

int sequence[MAXN];
int freqPosPari[MAXN];
int freqPosDispari[MAXN];
pair<pi, pi> freqMaxPari, freqMaxDisp; /// F = occorrenze, S = num

void aggiorna(int freq, int num, pair<pi, pi> & p){
    if(freq > p.F.F){
        if(num != p.F.S){ p.S.F = p.F.F;  p.S.S = p.F.S; }
        p.F.F = freq;
        p.F.S = num;
    }else if(freq > p.S.F){
        p.S.F = freq;
        p.S.S = num;
    }
}

void print(pi p){
 cout << "freq: " << p.F << " num: " << p.S << "\n";
}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE*/

    int N;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> sequence[i];
    }

    for(int i=0; i<N; i++){
        if(i%2 == 0){
            freqPosPari[sequence[i]] ++;
            aggiorna(freqPosPari[sequence[i]], sequence[i], freqMaxPari);
        }else{
            freqPosDispari[sequence[i]] ++;
            aggiorna(freqPosDispari[sequence[i]], sequence[i], freqMaxDisp);
        }
    }

    /*6
105 119 105 119 105 119ccout << "Pari:\n";
    print(freqMaxPari.F);
    print(freqMaxPari.S);
    cout << "Dispari:\n";
    print(freqMaxDisp.F);
    print(freqMaxDisp.S);*/

    N /= 2; int ris = 0;
    if(freqMaxDisp.F.S != freqMaxPari.F.S){
        ris = (N-freqMaxPari.F.F) + (N-freqMaxDisp.F.F);
    }else{
        if(freqMaxPari.S.F > freqMaxDisp.S.F){
            ris = (N-freqMaxPari.S.F) + (N-freqMaxDisp.F.F);
        }else{
            ris = (N-freqMaxPari.F.F) + (N-freqMaxDisp.S.F);
        }
    }
    cout << ris;
    return 0;
}


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


int main(){
    
    int n, k;
    cin >> n >> k;
    vector<int>values(n);
    for(int i = 0; i < n; i++){
        cin >> values[i];
    }
    
    // Lets use logarithms and prefix sums
    
    vector<double>pref(n+1);
    pref[0] = 0;
    for(int i = 1; i <= n; i++){
        pref[i] = pref[i-1] + (double)log10(values[i - 1]);
        //cout << pref[i] << " "; 
    }
    
    double previous_value = -1;
    for(int i = k; i <= n ; i++){
        double current_value = pref[i] - pref[i - k];
        if(i == k){
            previous_value = current_value;
            continue;
        }
        if(current_value > previous_value + 1e-10){
            cout << "Yes\n" ;
        }else{
            cout << "No\n";
        }
        previous_value = current_value;
    }
    return 0;
    
}


Measured memory_bytes: 5612
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> vec(N, 1);
  for(int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for(int j = 0; j < d; j++) {
      int a;
      cin >> a;
      if(vec.at(a - 1) == 1) {
        vec.at(a - 1) *= 10000;
      }
    }
  }
  int sum = 0;
  for(int i = 0; i < N; i++) {
    sum += vec.at(i);
  }
  cout << N - sum / 10000 << endl;
}


Measured memory_bytes: 3632
#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<array>
#include<string>
#include<stack>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<random>
#define int int64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
using namespace std;


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

	string S;
	cin >> S;

	if (S.size() == 1) {
		cout << S << endl;
		return 0;
	}

	int sum = 0;
	const int pattern = int(round(pow(2, S.size() - 1)));

	rep(i, pattern) {
		int siki = 0;
		int kou = S[0] - '0';
		REP(j, 1, S.size()) {
			if (i&(int(1) << (j-1))) {//'+'あり
				siki += kou;
				kou = S[j] - '0';
			}
			else {
				kou = kou * 10 + S[j] - '0';
			}
		}
		sum += siki + kou;
	}

	cout << sum << endl;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main{
	
	public static void main(String[] args)throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		
		String line = br.readLine();
		int n =  Integer.parseInt(line);
		int i = 0;
		for(int j=3; j<=n; j++){
			if(j % 3 ==0){
				sb.append(" ").append(j);
			}
			else{
				i = j;
				while(i != 0){
					if(i % 10 == 3){
						sb.append(" ").append(j);
						break;
					}
					else{
						i = i / 10;
					}
				}
			}
		}
		System.out.println(sb);
	}
}

Measured memory_bytes: 25424
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
    ll n,m;
    cin>>n>>m;
    ll ac = 0;
    ll fail = 0;
    vector<bool> used(n+1,false);
    vector<int> cnt(n+1,0);
    for(int i=0;i<m;i++){
	int p;
	string s;
	cin>>p>>s;
	if( s == "AC"){
	    used[p] = true;
	} 

	if( used[p] ){
	    continue;
	}
	if( s == "AC"){
	    //used[p] = true;
	    //ac++;
	}else{
	    cnt[p]++;
	}

    }

    for(int i=0;i<=n;i++)if( used[i] ) ac++,fail+=cnt[i];
    cout<<ac<<' '<<fail<<endl;
    return 0;
}


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

using namespace std;

bool isprime(int n){
    if(n > 2 && n % 2 == 0) return false;
    if(n > 3 && n % 3 == 0) return false;
    int x = ((int)sqrt(n)) + 1;
    bool f = 0;
    for(int i = 5; i <= x; i++){
	if(n % i == 0) return false;
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    vector<int> V(n);
    for(int i = 0; i < n; i++){
	cin >> V.at(i);
    }
    int sum = 0;
    for(int v: V){
	if(isprime(v)){
	    sum++;
	}
    }
    cout << sum << endl;
}



Measured memory_bytes: 3092
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
ll max1[1 << 18], max2[1 << 18];
void update(int index, ll val) {
	if (max1[index] < val) {
		max2[index] = max1[index];
		max1[index] = val;
	}
	else if (max2[index] < val) {
		max2[index] = val;
	}
}
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < (1 << N); i++) cin >> max1[i];
	for (int i = 0; i < N; i++) {
		for (int bit = 0; bit < (1 << N); bit++) {
			if (bit >> i & 1) {
				update(bit, max1[bit ^ (1 << i)]);
				update(bit, max2[bit ^ (1 << i)]);
			}
		}
	}
	ll prev = 0;
	for (int i = 1; i < (1 << N); i++) {
		ll now = max(prev, max1[i] + max2[i]);
		cout << now << endl;
		prev = now;
	}
}


Measured memory_bytes: 7168
#include <stdio.h>

int main(void)
{
	int a, b, c;
	
	scanf("%d %d %d" ,&a ,&b ,&c);
	
	if(a<b && b<c){
		
		printf("Yes\n");
		
	}
	
	else{
		
		printf("No\n");
		
	}
	
	return 0;
	
}

Measured memory_bytes: 580
#include <cstdio>

#define bin(x) (1<<(x))
#define b(x) (1<<(x)>>1)

inline void cmax(int&x, const int y) {x < y && (x = y);}

const int N = 17, M = 40100;
int f[N][M], g[M];
int mp[N][N];
int n, m;

int main() {
	scanf("%d%d",&n,&m); int Ans = 0;
	for(int i=1,x,y,z;i<=m;++i) {
		scanf("%d%d%d",&x,&y,&z), Ans += z;
		mp[x][y] = mp[y][x] = z;
	}
	for(int s=0;s<bin(n);++s) {
		int&v = g[s];
		for(int i=1;i<=n;++i) if(s & b(i)) 
		for(int j=i+1;j<=n;++j) if(s & b(j)) v += mp[i][j];
	}
	for(int i=1;i<=n;++i)
	for(int j=0;j<bin(n);++j)
		f[i][j] = -1;
	
	f[1][1] = 0;
	for(int S=1;S<bin(n);++S)
	for(int i=1;i<=n;++i) if((S & b(i)) and ~f[i][S]) {
		for(int j=1;j<=n;++j) if((~S & b(j)) and mp[i][j]) cmax(f[j][S|b(j)], f[i][S] + mp[i][j]);
		for(int iS=(bin(n)-1)^S, s = iS; s; s = (s-1) & iS)
			cmax(f[i][S|s], f[i][S] + g[s|b(i)]);
	}
	printf("%d\n", Ans - f[n][bin(n)-1]);
	return 0;
}

Measured memory_bytes: 2304
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long total = 0;
		long mod = 0;
		for (int i = 0; i < n; i++) {
			long a = sc.nextInt();
			if (a != 0) {
				a += mod;
			}
			total += a / 2;
			mod = a % 2;
		}
		System.out.println(total);
	}
}


Measured memory_bytes: 50248
#include <iostream>
using namespace std;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int H, W;
	while (true) {
		cin >> H >> W;
		if (H == 0 & W == 0)return 0;
		for (int i = 0;i < H;i++) {
			for (int j = 0; j < W;j++) {
				if (i % 2 == j % 2) { cout << "#";continue; }
				cout << ".";
			}
			cout << endl;
		}
		cout << endl;
	}
}

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

#define lli long long int
#define pb push_back
#define pii pair <int, int>
#define pll pair <lli, lli>
#define _F first
#define _S second
#define mset(x) memset(x, 0, sizeof(x))
#define fastio() ios_base::sync_with_stdio(0)

using namespace std;

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

	int D[n+1];
	mset(D);

	while(m--)
	{
		int x, y;
		cin >> x >> y;

		D[x]++;
		D[y]++;
	}

	for(int i=0; i<n; i++)
		cout << D[i+1] << endl;
	
	return (0-0);	
}

Measured memory_bytes: 256
A=int(input())
B=int(input())
C=int(input())
X=int(input())
count=0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if (500*i+100*j+50*k)==X:
                    count=count+1
print(count)

Measured memory_bytes: 39536
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long double ld;

using namespace std;

int n;
int l[1200];

int main() {
	cin >> n;
	for (int i = 0; i < 2 * n; ++i)
		cin >> l[i];
	sort(l, l + 2 * n);
	int ans = 0;
	for (int i = 0; i < 2 * n; i += 2)
		ans += l[i];
	cout << ans << "\n";
	return 0;
}




Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1 LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

typedef struct edge{
    int v;              // エッジの　終点　だと思われる
    LL w;               // エッジの　重み　だと思われる
    edge() {}                                              // 構造体のコンストラクタ 
    edge(int v, LL w) : v(v), w(w) {};                     // これはv,wを同時にpush_back(emplace_back)するために必要
} Edge;

vector<vector<Edge>> G;

vector<LL> dijkstra(int n, vector<vector<Edge> >& G, int s) {   // N , G , start (ノードは0-index)
    vector<LL> d(n, LLONG_MAX/10); d[s] = 0;                    // LLONG_MAX はlong　long　の最大値を呼び出す 
    priority_queue<pair<LL, int> > que;                         // p_queue の作成　s　はやっぱりstart地点の番号
    que.push(make_pair(0LL, s));                                // queue に　（0、辺の始点）をpushしてる。                 
    while (!que.empty()) {                                      // queue が空っぽになるまでループ
        auto p = que.top(); que.pop();                          // queue から一個もってくる
        int u = p.second;                                       // もってきたpairから　二番目の情報、つまり対象となるノード番号を獲得
        LL  dist = -p.first;                                    // dist は最短距離の一時変数で、 -p.first と負の数にしているのは、p_queue の greater を省略するため。逆順ソートしたいから。
        if (dist > d[u]) continue;                              // dはそのノードまでの最短距離を表現していると考えられる。
        for (Edge e : G[u]) {                                   // 作ったグラフの　u番目　のもつpairを呼び出してる
            if (d[e.v] > d[u]+e.w) {                            // d[e.v]はEdgeの接続先のこれまでの最短距離。　右辺は接続元までの距離＋辺の重み
                d[e.v] = d[u] + e.w;                            // 最短距離の更新 
                que.push(make_pair(-d[e.v], e.v));              // 更新したノードの（最短距離と番号）をpush
            }                                                   // つまり、拡張for文でpushされた要素たちは、最短距離を更新できなくなると廃棄されて行ってemptyになるということ。
        }
    }
    return d;                                                   // 各ノードまでのstart地点からの最短距離が出る。
}



int main() {
    int N;cin >> N;
    int X,Y;cin >> X >> Y;
    G.resize(N);
    rep(i,N-1){
        G[i].emplace_back(i+1,1);
        G[i+1].emplace_back(i,1);
    }
    G[X-1].emplace_back(Y-1,1);
    vector<int> num(N);

    rep(i,N){
        auto t = dijkstra(N,G,i);
        for(int j = i+1;j < N;j++){
            if(i == j)continue;
            if(t[j] > N-1)continue;
            num[t[j]]++;
        }
    }

    for(int i = 1;i < N;i++)cout << num[i] << endl;


}

Measured memory_bytes: 384
#include "bits/stdc++.h"
#define ll long long
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef pair<ll, ll> pairs;
typedef pair<ll, pairs> tpl;
ll dp[3001][3001][2], a[10001], sum;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n;
    cin >> n;
    for (ll i = 0; i < n; i++)
        cin >> a[i], sum += a[i];
    for (ll i = 0; i < n; i++)
        dp[i][i][0] = a[i], dp[i][i][1] = 0;

    for (ll d = 1; d < n; d++)
    {
        for (ll i = 0; i + d < n; i++)
        {
            ll j = d + i;

            dp[i][j][0] = max(a[i] + dp[i + 1][j][1], a[j] + dp[i][j - 1][1]);
            dp[i][j][1] = min(dp[i + 1][j][0], dp[i][j - 1][0]);
        }
    }

    cout << 2 * dp[0][n - 1][0] - sum;
}

Measured memory_bytes: 85412
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 1010101010
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define mp make_pair

using namespace std;





int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

const int MOD = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}


ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}



long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}



ll B[2010], A[2010], C[2010];
ll dist[1010];
bool negative[1010];
int main() {
	fill(dist, INF);
	m0(negative);
	dist[0] = 0;
	ll N, M; cin >> N >> M;
	REP(i, M) {
		ll a, b, c;
		cin >> a >> b >> c;
		a--; b--; c = c * (-1);//コストの符号を逆にする
		A[i] = a; B[i] = b; C[i] = c;
	}
	//一回の更でパスの長さを1増やすことになり、(閉路がない限り)パスは最長でN-1なので(N-1)回繰り返せば十分
	REP(j, N) {
		REP(i, M) {
			dist[B[i]] = min(dist[B[i]], dist[A[i]] + C[i]);
		}
		//オーバーフロー対策
		if (dist[N] < -111100000000000) {
			cout << "inf" << endl;
			return 0;
		}
	}

	//もう一度だけ更新してみて、もし距離が変わるなら(長さをいくらでも小さくできるような)閉路があるということ
	REP(i, M) {
		if (dist[B[i]] > dist[A[i]] + C[i]) {
			dist[B[i]] = min(dist[B[i]], dist[A[i]] + C[i]);
			negative[B[i]] = true;
		}
	}

	if (dist[N] < -111100000000000) {
		cout << "inf" << endl;
		return 0;
	}

	if (negative[N - 1]) {
		cout << "inf" << endl;
	}
	else {
		cout << dist[N - 1] * (-1) << endl;
	}
}


Measured memory_bytes: 256
A = [list(map(int,input().split())) for i in range(3)]
N = int(input())
B = [int(input()) for i in range(N)]
card = [[False for i in range(3)] for j in range(3)]
for num in B:
    for i in range(3):
        for j in range(3):
            if A[i][j] == num:
                card[i][j] = True

def res(a,b,c):
    return a and b and c
ans = "No"
if res(card[0][0],card[0][1],card[0][2]) or res(card[1][0],card[1][1],card[1][2]) or res(card[2][0],card[2][1],card[2][2]) or res(card[0][0],card[1][0],card[2][0]) or res(card[0][1],card[1][1],card[2][1]) or res(card[0][2],card[1][2],card[2][2]) or res(card[0][0],card[1][1],card[2][2]) or res(card[0][2],card[1][1],card[2][0]):
    ans = "Yes"
print(ans)

Measured memory_bytes: 3188
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse = True)
sumA = 0
sumB = 0
for i in range(N):
  if(i%2 == 0):
    sumA += A[i]
  else:
    sumB += A[i]
print(sumA-sumB)

Measured memory_bytes: 3064
while True:
  n = int(input().rstrip())
  if n == 0:
    break
  else:
    l = []
    while n > 0:
      a = int(input())
      l.append(a)
      n -= 1
    l.sort()
    ans = 0
    t = 0
    for i in l:
      ans += t
      t += i
    print(ans)

Measured memory_bytes: 7824
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

using namespace std;

typedef long long ll;

int main() {

	int n;
	cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; i++)
	{
		cin >> d[i];
	}
	sort(d.begin(), d.end());
	int inf, sup;
	inf = d[n / 2 - 1];
	sup = d[n / 2];
	cout << sup - inf << endl;
	
	return 0;
}

Measured memory_bytes: 640