akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 1<<30
#define MOD 1000000007
#define mod 1000000007
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //------------------------------
    ll n,k;cin>>n>>k;
    ll ans=0;
    if(n>k){
        n%=k;
    }
    while(n>abs(n-k)){
        n=abs(n-k);
    }
    ans=n;
    cout<<ans<<endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------













































Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def main():
    n = I()
    a = LI()
    r = 0
    c = 0
    for i in range(n):
        t = a[i]
        if i%2 == 0:
            if c+t > 0:
                c += t
            else:
                r += 1 - (c+t)
                c = 1
        else:
            if c+t < 0:
                c += t
            else:
                r -= -1 - (c+t)
                c = -1
    r2 = 0
    c = 0
    for i in range(n):
        t = a[i]
        if i%2 == 1:
            if c+t > 0:
                c += t
            else:
                r2 += 1 - (c+t)
                c = 1
        else:
            if c+t < 0:
                c += t
            else:
                r2 -= -1 - (c+t)
                c = -1

    return min(r,r2)


print(main())


Measured memory_bytes: 16728
use strict;
use warnings;
use v5.18.0;
use List::Util qw(sum);

chomp(my $arg = <>);

my @res = ();
my $sum;

sub gcd {
  my ($a, $b) = @_;
  return ($b == 0) ? $a : gcd($b, $a % $b);
}

for my $a (1..$arg) {
  for my $b (1..$arg) {
    my $tmp = ($res[$a][$b]) ? $res[$a][$b] : gcd($a, $b);
    $res[$a][$b] = $tmp;
    $res[$b][$a] = $tmp;

    for my $c (1..$arg) {
      my $tmp2 = ($res[$tmp][$c]) ? $res[$tmp][$c] : gcd($tmp, $c);
      $res[$tmp][$c] = $tmp2;
      $res[$c][$tmp] = $tmp2;
      $sum += $tmp2;
    }
  }
}

print $sum."\n";



Measured memory_bytes: 6756
a,b,c=map(int,input().split())

if a==b and b==c:
    print("No")
if a==b and b!=c:
    print("Yes")
if a!=b and b==c:
    print("Yes")
if a!=b and b!=c:
    if a==c:
        print("Yes")
    if a!=c:
        print("No")

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

int main(){
  	int i,j;
  	cin>>i>>j;
  	int a=i+j,b=i-j,c=i*j;
  	if (a>=b & a>=c){
    int r = a;
    cout << r << endl;
    }
  	else if (b>=a & b>=c){
    int r = b;
    cout << r << endl;
    }
  	else{
    int r = c;
    cout << r << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;

using namespace std;
using Graph = vector<vector<int>>;
Graph G;
const int AMAX = 100000;
/*int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}

int n;
vll a;

ll solve(bool isp)
{
	ll sum = 0ll;
	ll ret = 0ll;

	for (int i = 0; i < n; i++)
	{
		sum += a[i];
		if (isp and sum <= 0)
		{
			ret += -sum + 1;
			sum = 1ll;
		}
		if (not isp and sum >= 0)
		{
			ret += sum + 1;
			sum = -1ll;
		}
		isp ^= 1;
	}
	return ret;
}

*/
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	
	/*ll N, K;
	cin >> N >> K;
	ll t1 = N%K;
	ll t2 = abs(t1 - K);

	ll ans = min(t1, t2);
	

	cout << ans << endl;*/
	ll A, B;
	//vector<ll> S(AMAX + 1);
	cin >> A >> B;
	if ((A + B) >= 10)
	{
		cout << "error" << endl;
	}
	else
	{
		cout << A + B << endl;
	}

	return 0;

}

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

/*alias*/
#define REP(i,n) for (int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
using ll=long long;

using namespace std;

/*input*/
int n;
int a[10000001];
/*funcs*/


/*main*/
int main(){
    cin>>n;
    ll sum=0;
    int count=0;
    int min=1000000001;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(abs(a[i])<min){
            min=abs(a[i]);
        }
        if(a[i]>0){
            sum=sum+a[i];
        }else{
            count++;
            sum=sum-a[i];
        }
    }
    ll ans;
    if(count%2==0){
        ans=sum;
    }else{
        ans=sum-2*min;
    }
    cout<<ans;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(){
	int n, r0, r, d;

	scanf("%d", &n);
	scanf("%d", &r0);

	int maxv = -1000000000;
	int minv = r0;

	for( int i = 1; i < n; i++){
		scanf("%d", &r);
		d = r - minv;
		maxv = (d > maxv ? d : maxv);
		minv = (r < minv ? r : minv);
	}

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

	return 0;
}



Measured memory_bytes: 2136
#include <iostream>
#include <vector>
#include <utility>

int64_t gcd(int64_t max, int64_t min) {
  if (max < min) {
    std::swap(max, min);
  }

  while (true) {
    max = max % min;
    std::swap(max, min);
    if (min == 0) {
      return max;
    }
  }
}

int main(int argc, char const *argv[]) {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> a(n);
  for (auto &i : a) {
    std::cin >> i;
  }

  auto v = gcd(a[0], a[1]);

  for (size_t i = 2; i < n; i++) {
    v = gcd(v, a[i]);
  }

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

Measured memory_bytes: 1024
H,W = map(int,input().split())
if H % 3 == 0 or W % 3 == 0:
    print(0)
    exit()

ans = float('inf')
for _ in range(2):
    for i in [H//3,H//3+1]:
        a = i*W
        b = ((H - i)//2)*W
        c = ((H - i + 1)//2)*W
        ans = min(ans, abs(max(a, b, c) - min(a, b, c)))

        b = (H-i)*(W//2)
        c = (H-i)*((W + 1)//2)
        ans = min(ans, abs(max(a, b, c) - min(a, b, c)))
    H, W = W, H
print(ans)

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

int main(){
  int N;
  cin >> N;
  ll L[N];
  rep(i,0,N) cin >> L[i];
  int ans = 0;
  rep(i,0,N){
    rep(j,i+1,N){
      rep(k,j+1,N){
        if(L[i]!=L[j]&&L[j]!=L[k]&&L[i]!=L[k]){
          if(L[i]+L[j]>L[k]&&L[i]+L[k]>L[j]&&L[k]+L[j]>L[i]) ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    vector<ll> A(n);
    for(int i=0; i<n; i++){
        cin >> A.at(i);
    }
    ll money=1000;
    ll stock=0;
    for(int i=0; i<n-1; i++){
        if(A.at(i+1) >= A.at(i)){
            stock += money/A.at(i);
            money -= (money/A.at(i)) * A.at(i);
        }
        else{
            money += stock*A.at(i);
            stock=0;
        }
    }
    cout << money+stock*A.at(n-1) << endl;
}

Measured memory_bytes: 3524
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
  string s;
  cin >> s;
  int n = s.size(), cnt1 = 0, cnt2 = 0;
  for (int i = 0; i < n; i++) {
    if (s.at(i) - '0' != i % 2) cnt1++;
    else cnt2++;
  }
  cout << min(cnt1, cnt2) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

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

	string S, T; cin >> S >> T;
	int a, b; cin >> a >> b;
	string tmp; cin >> tmp;
	if (tmp == S) cout << a - 1 << " " << b << endl;
	else cout << a << " " << b - 1 << endl;
 
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  bool flag = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') {
      flag = 1;
    }
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  if (flag) {
    x = -x;
  }
}
const int N = 200005;
int n, sz[N];
vector<int> g[N];
void dfs(int u, int fa) {
  sz[u] = 1;
  int cnt = 0;
  for (auto v : g[u]) {
    if (v ^ fa) {
      dfs(v, u);
      sz[u] += sz[v];
      cnt += sz[v] & 1;
    }
  }
  if (cnt > 1) {
    puts("First");
    exit(0);
  }
}
int main() {
  read(n);
  if (n & 1) {
    puts("First");
    return 0;
  } 
  for (int i = 1; i < n; ++i) {
    int u, v;
    read(u), read(v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  puts("Second");
  return 0;
}

Measured memory_bytes: 11876
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <stack>

using namespace std;

using ll = long long;
using p = pair<ll, ll>;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;

constexpr ll MAX_N = 1e5;

vector<ll> G[MAX_N + 1];
ll N, M;

bool validate(deque<ll>& path, vector<bool>& used) {
    ll start = path.front();
    ll end = path.back();
    for (auto g : G[start]) {
        if (!used[g]) {
            return false;
        }
    }

    for (auto g : G[end]) {
        if (!used[g]) {
            return false;
        }
    }

    return true;
}

void add(deque<ll>& path, vector<bool>& used) {
    ll start = path.front();
    ll end = path.back();
    for (auto g : G[start]) {
        if (!used[g]) {
            used[g] = true;
            path.push_front(g);
            return;
        }
    }

    for (auto g : G[end]) {
        if (!used[g]) {
            used[g] = true;
            path.push_back(g);
            return;
        }
    }
}

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

    cin >> N >> M;
    for (ll i = 0; i < M; i++) {
        ll a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vector<bool> used(N + 1, false);
    deque<ll> path;
    path.push_back(1);
    path.push_back(G[1].front());
    used[1] = used[path.back()] = true;

    while (!validate(path, used)) {
        add(path, used);
    }

    cout << path.size() << endl;
    for (auto node : path) {
        cout << node << " ";
    }
    cout << endl;

    return 0;
}



Measured memory_bytes: 7168
package main

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

func main() {
	sc := NewScanner()
	S := sc.NextLine()

	mp := make([]int, 26)
	for i := 0; i < len(S); i++ {
		mp[S[i]-'a']++
	}
	for i := 0; i < 26; i++ {
		if mp[i] == 0 {
			fmt.Println(string('a' + i))
			return
		}
	}
	fmt.Println("None")

}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 1280
#include <iostream>                                             
using namespace std;                                            
                                                                
int main(void) {                                                
  int N;                                                        
  cin >> N;                                                     
  int A[N];                                                     
  for (int i=0; i<N; i++) {                                     
    cin >> A[i];                                                
  }                                                             
  int v, j;                                                     
  for (int i=0; i<N; i++) {                                     
    v = A[i];                                                   
    j = i-1;                                                    
    while (j>=0 && A[j]>v) {                                    
      A[j+1] = A[j];                                            
      j--;                                                      
      A[j+1] = v;                                               
    }                                                           
    for (int k=0; k<N; k++) {                                   
      cout << (k==0?"":" ") << A[k] << flush;                   
    }                                                           
    cout << endl;                                               
  }                                                             
  return 0;                                                     
}                                                               
                   

Measured memory_bytes: 3068
n,m = map(int,input().split())
a = []
b = []

for _ in range(n):
    a += [list(input())]

for _ in range(m):
    b += [list(input())]

for i in range(n-m+1):
    for j in range(n-m+1):
        if [k[j:m+j] for k in a[i:m+i]] == b:
            print('Yes')
            exit()
print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,count;
  cin >> N;
  count=0;
  vector<int> A(N+2);
  for(int i=0;i<N;i++){cin >> A[i];}
  for(int i=0;i<N;i++){
    if(A[i]%2==1){count++;}
  }
  if(count%2==1){cout << "NO" << endl;}
  else{cout << "YES" << endl;}
}

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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	string s;
	cin >>s;
	
	set<char> st;
	for(auto x: s) st.insert(x);
	cout << (sz(st)<2? "No":"Yes") <<"\n";
	return 0;
}


Measured memory_bytes: 256
def mcxi_to_digit(s)
  h = { 'm' => 1000, 'c' => 100, 'x' => 10, 'i' => 1 }
  h.to_a.map do |k, v|
    if s.include?(k)
      if s[s.index(k)-1] >= '2' and s[s.index(k)-1] <= '9'
        s[s.index(k)-1].to_i * v
      else
        v
      end
    else
      nil
    end
  end.compact.inject(:+)
end

def digit_to_mcxi(n)
  h = { 'm' => 1000, 'c' => 100, 'x' => 10, 'i' => 1 }
  h.to_a.map do |k, v|
    val = n/v
    n = n%v
    if val >= 2
      "#{val}#{k}"
    elsif val == 1
      k
    else
      nil
    end
  end.compact.join('')
end

n = gets.to_i
n.times do
  a, b = gets.chomp.split(' ')
  sum = mcxi_to_digit(a) + mcxi_to_digit(b)
  puts digit_to_mcxi(sum)
end

Measured memory_bytes: 6120
#include <iostream>


int c[500];
int sT[500];
int t[500];


int calculate(int i, int end, int timeSpent = 0)
{
	if (i == end)
      return 0;
  int wait = ((timeSpent < sT[i]) ? (sT[i] - timeSpent) : ((timeSpent % t[i]) ? (t[i] - timeSpent % t[i]) : 0));
  return calculate(i + 1, end, timeSpent + wait + c[i]) + wait + c[i];
}

int main()
{
  int trains; std::cin >> trains;
  
  for (int i = 1; i < trains; i++)
    std::cin >> c[i] >> sT[i] >> t[i];
  
  for (int i = 1; i <= trains; i++)
    std::cout << calculate(i, trains) << '\n';
  
  return 0;
}

Measured memory_bytes: 256
def solve():
    N, M, C = [int(_) for _ in input().split()]
    B = [int(_) for _ in input().split()]
    res = 0
    for i in range(N):
        sum = 0
        A = [int(_) for _ in input().split()]
        for a, b in zip(A, B):
            sum += a * b
        sum += C
        if sum > 0:
            res += 1
    return res
if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 3060
a = list(map(int,input().split()))
N = a[0]
A = a[1]
B = a[2]
Lis = []
for i in range(1,N+1):
    k = i%10 + i//10%10 + i//10//10%10 + i//10//10//10%10 + i//10//10//10//10%10
    if k <= B and k >= A:
        Lis.append(i)
print(sum(Lis))

Measured memory_bytes: 3396
#include<iostream> 
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
int main(){cout<<"1407 38"<<endl;int t=2;r(i,38){cout<<1<<" ";r(j,37){cout<<t<<" ";t++;}cout<<endl;}r(i,37){r(j,37){cout<<i+2<<" ";r(l,37)cout<<2+37*(l+1)+(j+i*l)%37<<" ";cout<<endl;}}}

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

using namespace std;
typedef long long ll;
#define rep(i, n, s) for (int i = s; i < (int)(n); i++)

ll calcNumOfCombination(ll n, ll r) {
    ll num = 1;
    for (ll i = 1; i <= r; i++) {
        num = num * (n - i + 1) / i;
    }
    return num;
}

int gcd(int x, int y) { return (x % y) ? gcd(y, x % y) : y; }

int findSumDigits(int s) {
    int num = 0;
    int temp = 0;
    while (s) {
        temp = s % 10;
        num += temp;
        s = s / 10;
    }
    return num;
}

int main() {
    ll n, y;
    cin >> n >> y;

    ll a = -1, b = -1, c = -1;
    ll k = 0;
    ll sum = 0;

    for (int i = 0; i <= n; i++) {
        for (int j = 0; i + j <= n; j++) {
            k = n - i - j;
            sum = 10000 * i + 5000 * j + 1000 * k;
            if (sum == y) {
                a = i;
                b = j;
                c = k;
            }
        }
    }

    cout << a << ' ' << b << ' ' << c << endl;

    return 0;
}

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

arr = []

for i in range(1,int(a**0.5)+1):
    b = a / i
    
    if a == int(b)*i:
        arr.append([int(i),int(b)])

arrb = [sum(arr[i]) for i in range(len(arr))]
print(min(arrb)-2)

Measured memory_bytes: 3688
#include<bits/stdc++.h>
#define ll long long
#define ui unsigned int
#define ull unsigned long long
using namespace std;
const int N = 1e6+7;
char s[N];
int main()
{
    int d, n;
    scanf("%s%d", s, &d);
    n = strlen(s);
    for(int i = 0; i < n; i += d)
    {
        printf("%c", s[i]);
    }
    puts("");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, y;
    cin >> n >> y;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= n - i; j++){
            int k = n - i - j;
            if(i * 10000 + j * 5000 + k * 1000 == y){
                cout << i << " " << j << " " << k << endl;
                return 0;
            }
        }
    }
    cout << -1 << " " << -1 << " " << -1 << endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	int c;
	cin >> c;
	if (c >= 30) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

struct edge {
	int to;			//?????????to
	long long cost;	//????????????cost
	edge(int _to, long long _cost) :to(_to), cost(_cost) {}
};
vector<edge> G[1010];	//??£??\?????????

int v, e, r;
long long d[1010];	//?§????r????????????????????¢
bool f[1010];		//?§????r????????°?????????????????????

//start????????°?????????????????????????????????????????????true
bool bellman_ford(int start) {
	for (int i = 0; i < v; i++)d[i] = 1e12;
	d[start] = 0;
	f[start] = 1;

	for (int i = 0; i < v; i++) {
		bool update = false;		//???????????¢?????´??°????????£???????????????
		for (int j = 0; j < v; j++) {
			int from = j;
			if (!f[from])continue;
			for (int k = 0; k < G[from].size(); k++) {
				edge e = G[j][k];
				if (d[from] != INF&&d[e.to] > d[from] + e.cost) {
					f[e.to] = 1;
					d[e.to] = d[from] + e.cost;
					update = true;
				}
			}
		}
		if (update == false)break;	//???????????¢?????´??°????????????????????£????????????
		if (i == v - 1)return true; //v???????????§??´??°??????????????¨????????????????????????
	}
	return false;
}

int main() {
	cin >> v >> e >> r;
	rep(i, e) {
		int s, t, d;
		cin >> s >> t >> d;
		G[s].push_back(edge(t, d));
	}

	if (bellman_ford(r)) {
		cout << "NEGATIVE CYCLE" << endl;
		return 0;
	}

	for (int i = 0; i < v; i++) {
		if (d[i] != 1e12)cout << d[i] << endl;
		else cout << "INF" << endl;
	}

}

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

using namespace std;

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


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

class timer {
    chrono::system_clock::time_point start;
  public:
    timer() : start(chrono::system_clock::now()) {}
    void init() { start = chrono::system_clock::now();}
    void print() {
        auto end = chrono::system_clock::now();
        cout << chrono::duration_cast<chrono::milliseconds>(end - start).count()
             << "ms" << endl;
    }
};

template<class T, class __Comp>
class Heap {
    vector<T> data;
    size_t last;  // 0 - indexed
    __Comp Comp;
  public:
    explicit Heap() : last(0), Comp(__Comp()) {}
    void insert(T obj) {
        if(data.size() <= last)
          data.emplace_back(obj);
        else
          data[last] = obj;
        ++last;
        for(size_t i = last - 1; i > 0; ) {
            assert((i - 1) / 2 < data.size());
            if(Comp(data[(i - 1) / 2], data[i])) {
                swap(data[i], data[(i - 1) / 2]);
                i = (i - 1) / 2;
            }
            else
              break;
        }
    }
    T pop() {
        if(last == 0) return 0;
        T res = data[0];
        data[0] = data[--last];
        for(size_t i = 0; i < last / 2; ) {
            size_t left = i * 2 + 1, right = i * 2 + 2;
            size_t child = (right >= last || !Comp(data[left], data[right]) ? left : right);
            if(Comp(data[child], data[i]) || data[child] == data[i]) break;
            swap(data[i], data[child]);
            i = child;
        }
        return res;
    }

};
template<class T> using minHeap = Heap<T, greater<T>>;
template<class T> using maxHeap = Heap<T, less<T>>;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    maxHeap<int> heap;
    string s;
    while(cin >> s && s != "end") {
        if(s == "insert") {
            int t;
            cin >> t;
            heap.insert(t);
        }
        else
          cout << heap.pop() << '\n';
    }
    return 0;
}

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

inf = float('inf')

import heapq
def dijkstra(adj, n, st=1):
    dj = [inf] * (n + 1)
    dj[st] = 0
    q = []
    heapq.heappush(q, (0, st))
    while q:
        fc, fn = heapq.heappop(q)
        if dj[fn] < fc: continue
        for tn, lc in adj[fn]:
            if dj[fn] + lc < dj[tn]:
                dj[tn] = dj[fn] + lc
                heapq.heappush(q, (dj[tn], tn))
    return dj

adj = dict((x, []) for x in range(N + 1))
for _ in range(N - 1):
    a, b = map(int, input().split())
    adj[a].append((b, 1))
    adj[b].append((a, 1))

c_f = dijkstra(adj, N, 1)
c_s = dijkstra(adj, N, N)

score = 0
for i in range(1, N + 1):
    if c_f[i] > c_s[i]:
        score -= 1
    else:
        score += 1

print("Fennec" if score > 0 else "Snuke")

Measured memory_bytes: 50400
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)

int g[15][15];
const int INF = 1001001001;
const int dx[4] = { -1,0,1,0 };
const int dy[4] = { 0,-1,0,1 };

//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
vector<pair<ll, int>>factorize(ll n) {
	vector<pair<ll, int>>res;
	for (ll i = 2;i * i <= n;++i) {
		if (n % i)continue;
		res.emplace_back(i, 0);
		while (n % i == 0) {
			n /= i;
			res.back().second++;
		}
	}
	if (n != 1)res.emplace_back(n, 1);
	return res;
}

int bingo[3][3];
bool flag[3][3];
int cnt[2][105];
int h, w;
int choco[1010][1010];
int s[11][11];

int main() {
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5])puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a;
  cin >> a;
  if(a == "Sunny"){
    cout << "Cloudy" << endl;}
  else if(a == "Cloudy" ){
    cout << "Rainy" << endl;}
  else{cout << "Sunny" << endl; }}

Measured memory_bytes: 256
#pragma warning(disable:4786)
#pragma warning(disable:4996)
#include<list>
#include<bitset>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<functional>
#include<string>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<utility>
#include<fstream>
#include<sstream>
#include<cmath>
#include<stack>
#include<assert.h>
using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(X) ( (X) > 0 ? (X) : ( -(X) ) )
#define S(X) ( (X) * (X) )
#define SZ(V) (int )V.size()
#define FORN(i, n) for(i = 0; i < n; i++)
#define FORAB(i, a, b) for(i = a; i <= b; i++)
#define ALL(V) V.begin(), V.end()
#define IN(A, B, C)  ((B) <= (A) && (A) <= (C))

typedef pair<int,int> PII;
typedef pair<double, double> PDD;
typedef vector<int> VI;
typedef vector<PII > VP;

#define AIN(A, B, C) assert(IN(A, B, C))

//typedef int LL;
typedef long long int LL;
//typedef __int64 LL;

LL num[10];

// I, O, T, J, L, S, Z
int main()
{
	for (int i = 1; i <= 7; i++) scanf("%lld", &num[i]);
	LL ans;
	LL now;
	
	// 
	now = num[2] + 2 * (num[1]/2 + num[4]/2 + num[5]/2);
	ans = now;
	if (num[1] > 0 && num[4] > 0 && num[5] > 0) now = num[2] + 3 + 2 * ((num[1] - 1) / 2 + (num[4] - 1) / 2 + (num[5] - 1) / 2);
	ans = MAX(ans, now);

	printf("%lld\n", ans);
	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 REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    int ans=0;
    for(int i=1; i<=n; i++){
        int v; cin>>v;
        if((i%2==1)&&(v%2==1)){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vz;
typedef vector<vz> vvz;
typedef pair<ll, ll> pll;
#define sz(x) ll((x).size())
#define fo(i,n) for(ll i=0; i<(n); i++)
#define FO(i,a,b) for(ll i=(a); i!=(b); i+=(b)>(a)?1:-1)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(c) c.begin(), c.end()
#define F first
#define S second
#define os(x) cout<<x<<' '
#define on(x) cout<<x<<"\n"
#define nl cout<<"\n"
#define maxe(x) max_element(all(x))-(x).begin()
#define mine(x) min_element(all(x))-(x).begin()
const ll P=1e9+7;
const ll N=1e6+10;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("C:\\Users\\ASISH\\Desktop\\coding\\input1.txt", "r", stdin);
	freopen("C:\\Users\\ASISH\\Desktop\\coding\\output1.txt", "w", stdout);
#endif

	string s, t;
	cin>>s>>t;
	ll l=sz(t), ans=l;
	fo(i, sz(s)-l+1){
		string x=s.substr(i, l);
		ll cnt=l;
		fo(j, l){
			if(x[j]==t[j]) cnt--;
		}
		ans=min(ans, cnt);
	}
	on(ans);
	cerr << "Time : " << ((double)clock()) / (double)CLOCKS_PER_SEC << "s\n";
	return 0;
}

Measured memory_bytes: 3760
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	int s=0;
	if(k<a)
	s=k;
	else if(k<a+b)
	s=a;
	else
	s=a-(k-a-b);
	cout<<s<<endl;
}

Measured memory_bytes: 3164
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int r = sc.nextInt();

    if (n >= 10) {
      System.out.println(r);
    } else {
      System.out.println(r + (100 * (10 - n)));
    }
  }
}

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

int main(){
    int n, r, t;
    cin >> n;

    while(n-- > 0){
        cin >> r >> t;
        
        vector<int> ans;

        if(r % 100 == 0){
            ans.push_back(t/30*5 + r/100);
            if(t%30){
                ans.push_back((t/30+1)*5 + r/100);
            }
        }else{
            ans.push_back(t/30*5 + r/100);
            ans.push_back(t/30*5 + r/100 + 1);
            if(t%30){
                ans.push_back((t/30+1)*5 + r/100);
                ans.push_back((t/30+1)*5 + r/100 + 1);
            }
        }

        for(int i = 0; i < ans.size(); i++) cout << ans[i] << " \n"[i == ans.size()-1];
    }

    return 0;
}


Measured memory_bytes: 3168
l = [2]
for i in range(3, 60000):
    flag = True
    for j in l:
        if i % j == 0:
            flag = False
            break
    if flag:
        l.append(i)

while True:
    try:
        n = int(input())
    except:
        break
    a = b = 0
    for k in range(1, n):
        if n -k in l:
            a = n-k
            break
    for kk in range(1, 10000):
        if n+kk in l:
            b=n+kk
            break
    print(a,b)



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

using namespace std;

long long a ,b,k,x;

int main()
{
    cin>>a>>b>>k;
    x=a;
    a=max(0LL,a-k);
    k-=min(x,k);
    b=max(0LL,b-k);
    cout<<a<<" "<<b<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdlib>
using namespace std;

int main(){
	int n,m,k;
	int sum;
	int flag = 0;
	scanf("%d %d %d",&n,&m,&k);
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= m;j++){
			sum = (i * m + j * n) - (2 * (i * j));
			if(sum == k){
				flag = 1;
				break;
			}
		}
		if(flag == 1) break;
	}
	if(flag == 1) cout<<"Yes"<<endl;
	else if(flag == 0) cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a==c||b==d)
	{
		cout<<0<<'\n';
		return 0;
	}
	ll x = abs(a-c);
	ll y = abs(b-d);
	cout<<x+y-__gcd(x,y)<<'\n';
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
string x;

int main()
{
	cin>>x;
	int s=-1,t=-1;
	for(int i=0;i<x.length();i++)
	{
		if(i>0&&x[i]==x[i-1])
		{
			s=i;t=i+1;
			break;
		}
		else if(i>1 && (x[i-2]==x[i-1]||x[i-2]==x[i]||x[i-1]==x[i]))
		{
			s=i-1;t=i+1;
			break;
		}
	}
	printf("%d %d\n",s,t);
	return 0;
}

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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    string s; cin >> s;
    int K; cin >> K;
    REP(i, s.length())
    {
        if(i == s.length()-1) s[s.length()-1] = (s[s.length()-1]+ (K % 26) - 'a') % 26 + 'a';
        else if(s[i] != 'a' && K >= 26 - (s[i]-'a'))
        {
            K -= 26-(s[i]-'a');
            s[i] = 'a';
        }
    }
    cout << s << endl;
}
    
signed main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 592
#include <stdio.h>

int min(int a, int b) {
  return a < b ? a : b;
}

int main(void) {
  int i, j, k, q, c, a, n;
  scanf("%d", &q);
  for(i = 0; i < q; ++i) {
    int ans = 0, t;
    scanf("%d%d%d", &c, &a, &n);
    ans = min(c, min(a, n));
    c -= ans, a -= ans, n -= ans;
    ans += min(c / 2, a);
    t = min(c / 2, a);
    c -= 2 * t, a -= t;
    ans += c / 3;
    printf("%d\n", ans);
  }
  return 0;
}


Measured memory_bytes: 2724
#include <string.h>
#include <iostream>
using namespace std;

#define int long long

int32_t main() {
    int n, W;
    cin >> n >> W;
    pair<int, int> v[n];
    for(int i = 0; i < n; i++) {
        cin >> v[i].first >> v[i].second;
    }
    int dp[n + 1][W + 1];
    memset(dp, 0, sizeof dp);

    for(int i = 1; i <= n; i++) {
        for(int j = 0; j <= W; j++) {
            if(v[i - 1].first > j) 
                dp[i][j] = dp[i - 1][j];
            else 
                dp[i][j] = max(dp[i - 1][j], v[i - 1].second + dp[i - 1][j - v[i - 1].first]);
        }
    }
/*    for(int i = 0; i <= n; i++) {
        for(int j = 0; j <= W; j++) {
            cout << dp[i][j] << " \n"[j == W];
        }
    }
    cout << endl;*/
    cout << dp[n][W];
}



Measured memory_bytes: 79104
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
import sys
import io
import re
import math
import itertools
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.141592653589
xy=[(1,0),(-1,0),(0,1),(0,-1)]
bs=[(-1,-1),(-1,1),(1,1),(1,-1)]
#start = time.clock()
ans=chk=0
a=[0,2,5,3]
b=[0,1,5,4]
c=[1,2,4,3]

def rolling(word,dice):
    if word=='S':
        dice[0],dice[1],dice[5],dice[4]=dice[4],dice[0],dice[1],dice[5]
    elif word=='N':
        dice[0],dice[1],dice[5],dice[4]=dice[1],dice[5],dice[4],dice[0]
    elif word=='W':
        dice[0],dice[2],dice[5],dice[3]=dice[2],dice[5],dice[3],dice[0]
    else:
        dice[0],dice[2],dice[5],dice[3]=dice[3],dice[0],dice[2],dice[5]
    return dice

def sortdice(dice1,dice2,p,q,r):
    for i in range(4):
        dice1[p[0]],dice1[p[1]],dice1[p[2]],dice1[p[3]]=dice1[p[1]],dice1[p[2]],dice1[p[3]],dice1[p[0]]
        for j in range(4):
            dice1[q[0]],dice1[q[1]],dice1[q[2]],dice1[q[3]]=dice1[q[1]],dice1[q[2]],dice1[q[3]],dice1[q[0]]
            for k in range(4):
                dice1[r[0]],dice1[r[1]],dice1[r[2]],dice1[r[3]]=dice1[r[1]],dice1[r[2]],dice1[r[3]],dice1[r[0]]
                if dice1==dice2:
                    print 'No'
                    exit()
    return 0
n=int(raw_input())
l=[]
for i in range(n):
    l.append(map(int,raw_input().split()))
for i in range(0,n-1):
    for j in range(i+1,n):
        sortdice(l[i],l[j],a,b,c)
print 'Yes'

Measured memory_bytes: 4832
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  string o, e;
  cin >> o >> e;
  int n = o.size();
  int m = e.size();
  string ans;
  REP(i, n){
    ans += o[i];
    if(i < m) ans += e[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import deque

h, w = map(int, input().split())

as_ = []
for i in range(h):
    a = [s for s in input().split()]
    for a_ in a:
        as_.append(a_)

ds = [[None]*w for _ in range(h)]
# ds = [[None]*w]*h ←これだとうまくいかないので注意

starts = deque()
for i, a in enumerate(as_):
    for j, a_ in enumerate(a):
        if a_ == "#":
            ds[i][j] = 0
            starts.append((i,j))
def bfs(starts, ds):
    d = 0
    while starts:
        i, j = starts.popleft()
        d = ds[i][j]
        for mx, my in [(0,1),(1,0),(-1,0),(0,-1)]:
            ni = i + my
            nj = j + mx
            if 0 <= ni < h and 0 <= nj < w:
                if ds[ni][nj] == None:
                    ds[ni][nj] = d + 1
                    starts.append((ni, nj))
    return d
d = bfs(starts, ds)
print(d)

Measured memory_bytes: 98652
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <sstream>
#include <map>
#include <cmath>






using namespace std;
#define ll long long int
map<string,int> m;



int main()
{
  ll s;
  cin>>s;
  ll sq=ceil(sqrt(s));
  ll resi=sq*sq-s;
  cout<<0<<" "<<0<<" "<<1<<" "<<sq<<" "<<sq<<" "<<resi<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
     
    using namespace std;
     
    #define sim template < class c
    #define ris return * this
    #define dor > debug & operator <<
    #define eni(x) sim > typename \
      enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
    sim > struct rge { c b, e; };
    sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
    sim > auto dud(c* x) -> decltype(cerr << *x, 0);
    sim > char dud(...);
    struct debug {
    #ifdef LOCAL
        ~debug() { cerr << endl; }
        eni(!=) cerr << boolalpha << i; ris; }
        eni(==) ris << range(begin(i), end(i)); }
        sim, class b dor(pair < b, c > d) {
        ris << "(" << d.first << ", " << d.second << ")";
        }
        sim dor(rge<c> d) {
        *this << "[";
        for (auto it = d.b; it != d.e; ++it)
            *this << ", " + 2 * (it == d.b) << *it;
        ris << "]";
        }
    #else
    sim dor(const c&) { ris; }
    #endif
    };
    #define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
     
    typedef vector<int> vi;
    typedef vector<long long> vll;
    typedef vector<long double> vld;
    typedef long long ll;
    typedef long double ld;
    #define PI 3.14159265358979323846
    #define sqr(a) ((a) * (a))
    #define len(V) (int)V.size()
    #define FOR(i, a, b) for(int i = (a); i < (b); ++i)
    #define all(a) (a).begin(),(a).end()
    #define rall(a) (a).rbegin(),(a).rend()
    #define pb push_back
    #define mp make_pair
    #define ff first
    #define ss second
    #define endl '\n'
    #define fix(a) fixed << setprecision(a)
    #define readv(x) for(auto &_ : (x)) {cin >> _;}
    #define printv(x) for(auto &_ : (x)) {cout << _ << ' ';} cout << endl
    #define EPS 1e-6
    #define MAXN 100047
     
     
    void solve(){
    	string s; cin >> s;
    	
    	FOR(i, (int)'a', (int)'z'+1){
    		if(s.find((char)(i)) == -1){
    			cout << (char)i << endl;
    			return;
    		}
    	}
    	
    	cout << "None\n";
    }
     
    int main() {
    	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    	
    	solve();
    	
    	return 0;
    }

Measured memory_bytes: 3552
A,B,C,D=map(int,input().split())
if A%C==0:
    cmin=A//C
else:
    cmin=A//C+1
cmax=B//C
if A%D==0:
    dmin=A//D
else:
    dmin=A//D+1
dmax=B//D
#最大公約数
def gcd(C,D):
  while D!=0:
    C,D=D,C%D
  return C
#最小公倍数
def lcm(C,D):
  return C*D//gcd(C,D)
e=lcm(C,D)
if A%e==0:
    emin=A//e
else:
    emin=A//e+1
emax=B//e
total=(cmax-cmin+1)+(dmax-dmin+1)-(emax-emin+1)
f=B-A+1-total
print(f)

Measured memory_bytes: 3064
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    ll H,W;
    cin>>H>>W;
    ll h1,h2,w1,w2,S1,S2,S3,S_MAX,S_MIN;
    ll S=H*W;
    ll ans=INF;
    //縦→縦
    w1=W/3;
    w2=w1+(W-w1)/2;
    S1=H*w1;
    S2=H*(w2-w1);
    S3=H*(W-w2);
    S_MAX=max(S1,S2);
    S_MAX=max(S_MAX,S3);
    S_MIN=min(S1,S2);
    S_MIN=min(S_MIN,S3);
    if(w1!=0&&w1!=w2&&w2!=W){
        ans=min(S_MAX-S_MIN,ans);
    }
    

    //縦→横A
    w1=W/3;
    S1=H*w1;
    h2=H/2;
    S2=h2*(W-w1);
    S3=S-S1-S2;
    S_MAX=max(S1,S2);
    S_MAX=max(S_MAX,S3);
    S_MIN=min(S1,S2);
    S_MIN=min(S_MIN,S3);
    if(w1!=0&&h2!=0&&h2!=H){
        ans=min(S_MAX-S_MIN,ans);
    }



    //縦→横B
    w1=W/3+1;
    S1=H*w1;
    h2=H/2;
    S2=h2*(W-w1);
    S3=S-S1-S2;
    S_MAX=max(S1,S2);
    S_MAX=max(S_MAX,S3);
    S_MIN=min(S1,S2);
    S_MIN=min(S_MIN,S3);
    if(w1!=W&&h2!=0&&h2!=H){
        ans=min(S_MAX-S_MIN,ans);
    }

    swap(H,W);
    //縦→縦
    w1=W/3;
    w2=w1+(W-w1)/2;
    S1=H*w1;
    S2=H*(w2-w1);
    S3=H*(W-w2);
    S_MAX=max(S1,S2);
    S_MAX=max(S_MAX,S3);
    S_MIN=min(S1,S2);
    S_MIN=min(S_MIN,S3);
    if(w1!=0&&w1!=w2&&w2!=W){
        ans=min(S_MAX-S_MIN,ans);
    }
    
    //縦→横A
    w1=W/3;
    S1=H*w1;
    h2=H/2;
    S2=h2*(W-w1);
    S3=S-S1-S2;
    S_MAX=max(S1,S2);
    S_MAX=max(S_MAX,S3);
    S_MIN=min(S1,S2);
    S_MIN=min(S_MIN,S3);
    if(w1!=0&&h2!=0&&h2!=H){
        ans=min(S_MAX-S_MIN,ans);
    }

    //縦→横B
    w1=W/3+1;
    S1=H*w1;
    h2=H/2;
    S2=h2*(W-w1);
    S3=S-S1-S2;
    S_MAX=max(S1,S2);
    S_MAX=max(S_MAX,S3);
    S_MIN=min(S1,S2);
    S_MIN=min(S_MIN,S3);
    if(w1!=W&&h2!=0&&h2!=H){
        ans=min(S_MAX-S_MIN,ans);
    }
    cout<<ans<<endl;
    

}

Measured memory_bytes: 3544