akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unistd.h>

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair


int main() {
  string s;
  cin >> s;
  if (s <= "2019/04/30") {
    cout << "Heisei" << endl;
  }
  else {
    cout << "TBD" << endl;
  }
}


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

using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<int> B(N, 0);
	for (int i = 0; i < N - 1; ++i) {
		int A;
		cin >> A;
		--A;
		++B[A];
	}
	for (auto y : B) {
		cout << y << endl;
	}
}


Measured memory_bytes: 3976
use std::io;
use std::cmp;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let A: i32 = iter.next().unwrap().parse().unwrap();
    let B: i32 = iter.next().unwrap().parse().unwrap();
    println!("{}", cmp::max(A+B, cmp::max(A-B, A*B)));
}


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

#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)

#define ll long long
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)

#define xx first
#define yy second
#define mp make_pair
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define pdd pair<double,double>
#define ALL(v) (v).begin(), (v).end()

const ll MOD=1e9+7;
const ll inf=1e10;

#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;


ll power(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a);
        n>>=1;
        a=(a*a);
    }
    return ans;
}


ll powerMod(ll a,ll n){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%MOD;
        n/=2;
        a=(a*a)%MOD;
    }
    return ans;
}

ll powerMod1(ll a,ll n,ll mod){
    ll ans=1;
    while(n){
        if(n&1)
            ans=(ans*a)%mod;
        n>>=1;
        a=(a*a)%mod;
    }
    return ans;
}

ll lcm(ll a,ll b){
    return a*(b/__gcd(a,b));
}

ll sumdigit(ll n){
    ll sum=0;
    while(n){
        sum+=n%10;
        n=n/10;
    }
    return sum;
}

ll countSetBit(ll a){
    return __builtin_popcount(a);
}
ll countBit(ll a){
    ll sum=0;
    while(a){
        sum++;
        a>>=1;
    }
    return sum;
}

ll length(ll a){
    ll ans=0;
    while(a){
        ans++;
        a=a/10;
    }
    return ans;
}

int main()
{
    fast;
    ll t;
    //cin>>t;
    t=1;

    while(t--){
        ll n;
        cin>>n;
        ll ans=(n*(n-1))/2;
        cout<<ans;
    }
    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define REP(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) REP((i),0,(n))
using ll = long long;
constexpr ll MOD = 998244353;

int main()
{
    ll N;
    cin >> N;
    vector<pair<ll, ll>> lr(N);
    rep(i, N) {
        ll X, D;
        cin >> X >> D;
        lr[i] = { X,X + D };
    }
    sort(lr.begin(), lr.end());

    set<pair<ll, ll>> st;
    while (!lr.empty()) {
        ll l, r;
        tie(l, r) = lr.back(); lr.pop_back();
        ll mul = 1;
        while (!st.empty()) {
            ll pos, level;
            tie(pos, level) = *st.begin();
            if (pos < r) {
                (mul *= level) %= MOD;
                st.erase(st.begin());
            }
            else {
                break;
            }
        }
        (mul += 1) %= MOD;
        st.insert({ l,mul });
    }
    ll res = 1;
    for (auto num : st)(res *= num.second) %= MOD;
    cout << res << endl;
    return 0;
}


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

int main() {
  int64_t N,A,B;
  cin >>N >> A >>B;
  int64_t sum=0;
  sum = N/(A+B) * A;
  if(A>=N%(A+B)) sum+=N%(A+B);
  else sum+=A;
  
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

const int MOD_VALUE = 1000000007;


int main(void){
	int x,y;
	int m;

	m = 0;

	scanf("%d %d",&x,&y);

	if(x == 1 && y == 1){
		m = 300000 + 300000 + 400000;

	}else{
		if(x == 1){
			m += 300000;			 
		}else if(x == 2){
			m += 200000;			 
		}else if(x == 3){
			m += 100000;			 
		}else{
			m += 0;
		}

		if(y == 1){
			m += 300000;			 
		}else if(y == 2){
			m += 200000;			 
		}else if(y == 3){
			m += 100000;			 
		}else{
			m += 0;
		}

	}

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



	return 0;
}

Measured memory_bytes: 128
import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

#
#import numpy as np

from itertools import combinations

def main():
	n=II()
	k=n//500
	print(1000*k+(n-k*500)//5*5)


if __name__ == "__main__":
	main()

Measured memory_bytes: 3064
#include <iostream>
using namespace std;
int main() {
  string a, b; bool c=1;
  cin >> a >> b;
  if (a.at(0)!=b.at(2)) {
    c=0;
  }
  else if (a.at(1)!=b.at(1)) {
      c=0;
    }
  else if (a.at(2)!=b.at(0)) {
     c=0;
  }
  if (c==0) cout << "NO" << endl;
  else if (c==1) cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
static const int N = 100;

int main() {
  int M[N][N];
  int n, u, k, v;

  cin >> n;

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) M[i][j] = 0;
  }

  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    u--;
    for (int j = 0; j < k; j++) {
      cin >> v;
      v--;
      M[u][v] = 1;
    }
  }

  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (j) cout << " ";
      cout << M[i][j];
    }
    cout << endl;
  }

  return 0;
}


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


int main() {
#ifdef HOME
    freopen("in", "r", stdin);
#endif

    string s;
    while (cin >> s) {
        int n = s.length();

        int l = 0, r = n - 1;
        int ans = 0;
        while (l <= r) {
            if (s[l] == s[r]) {
                l++;
                r--;
                continue;
            }
            if (s[l] == 'x') {
                ans++;
                l++;
                continue;
            }
            if (s[r] == 'x') {
                ans++;
                r--;
                continue;
            }
            ans = -1;
            break;
        }
        cout << ans << endl;
    }

#ifdef HOME
    cerr << clock() / (double)CLOCKS_PER_SEC << endl;
#endif
    return 0;
}

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

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

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

int main()
{
    char str[20],ch;
    gets(str);
    int i,j;
    int len = strlen(str);
    for(i=0,j=len-1;i<(int)len/2;++i,--j)
    {
        ch = str[i];
        str[i] = str[j];
        str[j] = ch;
    }
    str[len]='\0';
    puts(str);

    return 0;
}

Measured memory_bytes: 524
#include <stdio.h>

int main(void){

  long a,b;
  char op[2];
  scanf("%ld %s %ld", &a, op, &b);
  if (op[0] == '+') {
    printf("%ld\n", a+b);
  } else {
    printf("%ld\n", a-b);
  }

  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
const long long INF = 1LL << 60;

// --------write my code!!!!!----------//

int main(){
    int A,B; cin >> A >> B;
    if(B%A==0) cout << A + B << endl;
    else cout << B - A << endl;
}


Measured memory_bytes: 256
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use proconio::*;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    input! {
        n:usize,
        a:[usize;n],
    }

    const MAX_NUM: usize = 1000000;
    let mut g = 0;
    // let is_set_wise = a.iter().fold(0, |acc, ai| acc.gcd(ai)) == 1;

    let era = Eratosthenes::new(MAX_NUM);
    let mut divisor_counter = [0; MAX_NUM + 1];

    let mut flag = false;

    for ai in a {
        g = g.gcd(&ai);

        let hm = era.factorization(ai);

        for (k, _v) in hm {
            divisor_counter[k] += 1;
            if divisor_counter[k] >= 2 {
                flag = true;
                break;
            }
        }
    }

    let is_set_wise = g == 1;

    let ans = if !flag {
        "pairwise coprime"
    } else if is_set_wise {
        "setwise coprime"
    } else {
        "not coprime"
    };

    println!("{}", ans);
}

use itertools::Itertools;
use num::Integer;
use rustc_hash::FxHashMap;
use smallvec::alloc::collections::BTreeMap;
use std::collections::HashMap;
use std::mem::swap;

/// 二分累乗法
pub fn pow(x: isize, n: usize) -> isize {
    if n == 0 {
        1
    } else if n == 1 {
        x
    } else if n % 2 == 1 {
        x * pow(x, n - 1)
    } else {
        pow(x * x, n / 2)
    }
}

/// エラトステネスの篩
/// 構築 O(N log log N)
/// 素因数分解 O(log N)
/// 素数判定 O(log N)
pub struct Eratosthenes {
    smallest_prime_factors: Vec<usize>,
}

impl Eratosthenes {
    pub fn new(n: usize) -> Self {
        let mut smallest_prime_factors = (0..=n).collect_vec();

        for i in 2..n {
            if i * i > n {
                break;
            }

            if smallest_prime_factors[i] != i {
                continue;
            }

            let mut j = i * i;
            while j <= n {
                if smallest_prime_factors[j] == j {
                    smallest_prime_factors[j] = i;
                }

                j += i;
            }
        }

        Self {
            smallest_prime_factors,
        }
    }

    pub fn factorization(&self, mut i: usize) -> FxHashMap<usize, usize> {
        assert_ne!(i, 0);

        let mut factors = FxHashMap::default();

        while i != 1 {
            let divisor = self.smallest_prime_factors[i];
            *factors.entry(divisor).or_insert(0) += 1;

            i /= divisor;
        }

        factors
    }

    pub fn is_prime(&self, i: usize) -> bool {
        i >= 2 && self.smallest_prime_factors[i] == i
    }
}


Measured memory_bytes: 29172
#include<stdio.h>

int main(void) {
	int i,n,k,j;
	scanf("%d",&n);
	char hairetu[n][50];
	int abc[n][27];
	for(i = 0; i < n; i++) {
	    for(k = 0; k < 27; k++) {
	        abc[i][k] = 0;
	    }
	}
	for(i = 0; i < n; i++) {
		scanf("%s", hairetu[i]);
		for(k = 0; hairetu[i][k] != '\0'; k++) {
			abc[i][hairetu[i][k] - 'a']++;
		}
	}
	
	int temp = abc[0][0];
	for(i = 0; i < 27; i++) {
		for(k = 1; k < n; k++) {
			if(temp - abc[k][i] > 0) {
				temp = abc[k][i];
			}
		}
		for(j = 0; j < temp; j++){
			printf("%c", 'a' + i);
		}
		temp = abc[0][i + 1];
	}
	return 0;
}

Measured memory_bytes: 128
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main() {
    input!{
        a: i64,
        b: i64,
    }

    println!("{}", (a - 1) * (b - 1));
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int i = 0; i <n; i++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}

using namespace std;
int main(){
    int n,count=0;string a,c,b;std::cin >> n>>a>>b>>c;
    rep(i,n){
        if(a.at(i)==b.at(i)&&b.at(i)==c.at(i)){}
        else if(a.at(i)==b.at(i))count++;
        else if(a.at(i)==c.at(i))count++;
        else if(c.at(i)==b.at(i))count++;
        else count+=2;
    }
    std::cout << count << std::endl;
    
}



Measured memory_bytes: 256
n=0
Answer=0
N=int(input())
h=list(map(int,input().split()))
h.insert(0,0)

for i in range(N):
    if h[n]<=h[n+1]:
        m=h[n+1]-h[n]
        Answer=Answer+m
    else :
        pass
    n=n+1
print(Answer)

Measured memory_bytes: 39832
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pa;
const int maxn=2e5+7;
const int mod=1e9;
int n,t,m;
char a[maxn];
int main()
{
    scanf("%d%d",&n,&m);
    printf("%d\n",max(100*(10-n),0)+m);
    return 0;
}


Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d %d %d", $a, $b, $h, $m);

$rad = ($h + $m / 60) / 6 * pi() - $m / 30 * pi();

$c2 = $a * $a + $b * $b - 2 * $a * $b * cos($rad);

echo sqrt($c2);


Measured memory_bytes: 16536
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;

ii P[200002];

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

	int N; cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> P[i].f >> P[i].s;
		if (P[i].f > P[i].s) swap(P[i].f, P[i].s);
	}
	auto cmps = [](const ii & a, const ii & b) { return a.s < b.s; };
	ll ans = (ll)(max_element(P, P+N)->f - min_element(P, P+N)->f) * (max_element(P, P+N, cmps)->s - min_element(P, P+N, cmps)->s);
	
	sort(P, P+N);
	ll a = max_element(P, P+N, cmps)->s - P[0].f;
	int l = P[0].s, h = P[N-1].f;
	for (int i = 1; i < N; ++i) {
		l = min(P[i - 1].s, l), h = max(P[i - 1].s, h);
		ans = min(a * (h - min(P[i].f, l)), ans);
	}
	cout << ans;
}

Measured memory_bytes: 5128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,T,A;
  cin >> N >> T >> A;
  vector<int> H(N+1);
  double better_T_abs = 10000;
  int better_index;
  for(int i=1; i < N+1 ; i++){
    cin >> H.at(i);
    if(better_T_abs > double(abs(A -(T-H.at(i)*0.006)))){
      better_T_abs = double(abs(A-(T-H.at(i)*0.006)));
      better_index = i;
    }
    
  }
  cout << better_index << endl;
}

Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    string S;

    public void Do()
    {
        cin = new Scanner();
        S = cin.nextString();

        int ans = 0;
        int tmpAns = 0;
        for (int i = 0; i < S.Length; i++)
        {
            if (S[i] == 'A' || S[i] == 'G' || S[i] == 'T' || S[i] == 'C')
            {
                tmpAns++;
            }
            else
            {
                if (tmpAns > ans)
                {
                    ans = tmpAns;
                }
                tmpAns = 0;
            }
        }
        Console.WriteLine(Math.Max(ans, tmpAns));
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }

    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

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

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<max(a*b,c*d);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  while (1){
    int n, d;
    cin >> n >> d;
    if (n == 0 && d == 0){
      break;
    }
    vector<int> m(n);
    vector<vector<int>> c(n);
    for (int i = 0; i < n; i++){
      cin >> m[i];
      c[i] = vector<int>(m[i]);
      for (int j = 0; j < m[i]; j++){
        cin >> c[i][j];
      }
    }
    vector<vector<int>> S(n);
    for (int i = 0; i < n; i++){
      S[i] = vector<int>(m[i] + 1, 0);
      for (int j = 0; j < m[i]; j++){
        S[i][j + 1] = S[i][j] + c[i][j];
      }
    }
    bool ok = true;
    for (int i = 0; i < n; i++){
      for (int j = 0; j < n; j++){
        if (i != j){
          for (int k = 0; k < m[i]; k++){
            auto itr1 = upper_bound(S[j].begin(), S[j].end(), S[i][k] + d);
            auto itr2 = lower_bound(S[j].begin(), S[j].end(), S[i][k + 1] - d);
            if (itr1 <= itr2){
              ok = false;
            }
          }
        }
      }
    }
    if (ok){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}


Measured memory_bytes: 3160
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        static int Main(string[] args)
        {
            new Program().Process();

            return 0;
        }

        private CommonInput cin;

        private void Process()
        {
            cin = new CommonInput();

            int x, max;

            // ??????????´???°??§????????¨?????? true
            // ????????\?????? false
            max = 300000;
            bool[] prime = new bool[max];
            List<int> primeList = new List<int>();

            for (int i = 2; i <= max; i++)
            {
                if (i % 7 == 1 || i % 7 == 6)
                {
                    for (int j = 6; i * j < max; j++)
                    {
                        prime[i * j] = true;
                    }
                }
                else
                {
                    prime[i] = true;
                }
            }

            while (true)
            {
                x = cin.GetNextToInt();

                if (x == 1)
                    break;

                primeList.Clear();

                for (int i = 2; i < max; i++)
                {
                    if (!prime[i] && x % i == 0)
                        primeList.Add(i);
                }

                Console.Write("{0}:", x);

                for (int i = 0; i < primeList.Count; i++)
                {
                    Console.Write(" {0}", primeList[i]);
                }
                Console.WriteLine();
            }
        }
    }

    public class CommonInput
    {
        public CommonInput()
        {
            this._s = new string[0];
            this._i = 0;
        }

        public string Line { get; set; }
        private string[] _s;
        private int _i;
        private char[] _sep = { ' ' };

        public void GetLine()
        {
            this._i = 0;
            do
            {
                this.Line = Console.ReadLine();
            } while (this.Line == "");

            if (this.Line != null)
                this._s = this.Line.Split(this._sep, StringSplitOptions.RemoveEmptyEntries);
        }

        public string GetNext()
        {
            if (this._i < this._s.Length)
                return this._s[this._i++];

            this.GetLine();

            return this._s[this._i++];
        }

        public int GetNextToInt()
        {
            return int.Parse(this.GetNext());
        }

        public long GetNextToLong()
        {
            return long.Parse(this.GetNext());
        }

        public double GetNextToDouble()
        {
            return double.Parse(this.GetNext());
        }
    }
}

Measured memory_bytes: 9788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
ll k;
char s[1000010];
ll fac[2000010], ifac[2000010], inv[2000010];
ll n;
ll ans;
ll ksm(ll a, ll b, ll m) {
	ll ret = 1;
	while (b) {
		if (b & 1) ret = (ret * a) % m;
		a = (a * a) % m;
		b >>= 1;
	}
	return ret;
}
ll C(ll i, ll j) {
	return fac[i] * ifac[j] % mod * ifac[i - j] % mod;
}
int main() {
	scanf("%lld", &k);
	scanf("%s", s + 1);
	n = strlen(s + 1);
	fac[0] = ifac[0] = inv[1] = 1;
	for (ll i = 2; i <= n + k; i++) {
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	}
	for (ll i = 1; i <= n + k; i++) {
		fac[i] = fac[i - 1] * i % mod;
		ifac[i] = ifac[i - 1] * inv[i] % mod;
	}
	for (ll i = 0; i <= k; i++) {
		ans = (ans + ksm(26, i, mod) * C(n + k - i - 1, n - 1) % mod * ksm(25, k - i, mod)) % mod;
	}
	printf("%lld", ans);
	return 0;
}

Measured memory_bytes: 51652
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>
using namespace std;
int main() {
	int n,n5;
	while (cin >> n, n != 0){
		n5 = n;
		int five = 0;
		int two = 0;
		while (n / 2 != 0){ 
			two += n / 2;
			n /= 2;
		}
		while (n5 / 5 != 0) {
			five += n5 / 5;
			n5 /= 5;
		}
		cout <<min(two,five)<<endl;

	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;



string s;
int n;

typedef pair<char,int> P;

int dp[200010];

int before[26];

int main()
{
	fill(dp,dp + 200010,1e9);
	cin >> s;
	n = s.length();


	dp[n + 1] = 0;
	dp[n] = 1;

	vector<P> to(n + 1);

	to[n] = P('a' , n + 1);

	fill(before , before + 26 , n + 1);


	for(int i = n - 1;i >= 0;i--)
	{
		before[s[i] - 'a'] = i + 1;

		for(int j = 0;j < 26;j++)
		{
			if(dp[before[j]] + 1 < dp[i])
			{
				dp[i] = dp[before[j]] + 1;
				to[i] = P('a' + j , before[j]);
			}
		}
	}

	int now = 0;

	while(now < n + 1)
	{
		cout << to[now].first;
		now = to[now].second;
	}

	return 0;





}


Measured memory_bytes: 2948
def memfact(a,m):
    temp = 1
    yield temp
    for i in range(1,a+1):
        temp = temp * i % m
        yield temp
def comb(n,r,m):
    if r == 0: return 1
    return memf[n]*pow(memf[r],m-2,m)*pow(memf[n-r],m-2,m)

n,k = map(int, open(0).read().split())
dp = [0] * n
dp[0] = 1
m = 1000000007
dp[1] = (n * (n-1)) % m
memf = []
mfappend = memf.append
for x in memfact(n,m):
    mfappend(x)
for i in range(2,min(k+1,n)):
    dp[i] = (dp[i-1]+comb(n,i,m)*comb(n-1,i,m)) % m
print((dp[min(n-1,k)]+1)%m)

Measured memory_bytes: 67860
using System;

namespace ABC133
{
    class Program
    {
        static int Main(string[] args)
        {
            problemA();
            return 0;
        }

        static void problemA()
        {
            string[] input = Console.ReadLine().Split(' ');

            int n = int.Parse(input[0]);
            int a = int.Parse(input[1]);
            int b = int.Parse(input[2]);

            int ans = b;

            if(n*a < b)
            {
                ans = a*n;
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define R cin>>
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ld PI = acos(-1);
const ld EPS = 1e-11;
template<typename T> void co(T e){cout << e << "\n";}
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
{ cout << e << " "; } cout << "\n";}
ll gcd(ll a, ll b) {
    if (a < b)swap(a, b);
    if (b == 0) return a;
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
ll lcm(ll a, ll b) {
    ll g = gcd(a, b);
    return a * b / g;
}
bool prime(ll n) {
    for (ll i = 2; i <= sqrt(n); i++) {
        if (n%i == 0)return false;
    }
    return n != 1;
}

Vec fac, finv;

ll PowMod(ll a, ll n){
    if(n == 1) return a;
    if(n%2 == 0) return PowMod(a*a%MOD, n/2);
    return a*PowMod(a*a%MOD, n/2)%MOD;
}

ll combi(ll n, ll k){
    if(k>n) return 0;
    return fac[n]*finv[k]%MOD*finv[n-k]%MOD;
}


int main(){
    int n, ans=0;
    R n;
    REP(i, 1, n + 1){
        if (i % 2){
            int cnt = 0;
            REP(j, 1, i + 1){
                if(i % j == 0) cnt++;
            }
            if(cnt == 8) ans++;
        }
    }
    co(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

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

	int cnt = 0;
	int j = 0;
	int jj = 0;
	while (1) {
		cnt++;
		for (int i = j; i < k - 1 + j; i++) {
			if (j + k - 1 >= n - 1) {
				std::cout << cnt << std::endl;
				return 0;
			}
			jj = i + 1;
		}
		j = jj;
	}
}

Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VI l(n);
    REP(i,0,n) cin >> l[i];
    sort(all(l));
    int sum = 0;
    REP(i,0,n-1) sum += l[i];
    if (l[n-1] < sum) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

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

int main(){
	std::string s;
	std::cin >> s;
	if (s.size()==3){
		for(int i=0; i<3; i++){
			std::cout <<s[2-i];
		// s = s[2]+s[1]+s[0];
		}
		std::cout << std::endl;
	}else{
		std::cout << s <<std::endl;
	}
	return 0;
}


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

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

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
  std::vector<int> x(5);
  rep(i, 5) {
    std::cin >> x[i];
    if(x[i] == 0) {
      std::cout << i + 1 << '\n';
      return 0;
    }
  }
}


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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 1e9+7;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

int main()
{
  fastio;
  long n, k; cin >> n >> k;
  n %= k; cout << min(n, k - n);
  return 0;
}

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

// Shortcut

#pragma optimize ("O3")
#define int long long
#define endl '\n'
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << ' ';
#define PrintVl(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << endl;
#define PrintA(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << ' ';
#define PrintAl(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a));
#define mmset(a) memset(a, 0x3f, sizeof(a));
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
#define y0 _y0_
#define y1 _y1_
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 2e5 + 5, mod = 1e9 + 7, inf = 1e9 + 7;

int n, l, ans;
int a[N];

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> l;
    ForE(i, 1, n){
        ans += l + i - 1;
    }
    if (l <= 0 && l + n - 1 >= 0) Ptest(ans);
    if (l < 0 && l + n - 1 < 0){
        ans -= l + n - 1;
    }
    else{
        ans -= l;
    }
    cout << ans << endl;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

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

int main() {
  string S; cin >> S;
  if (S.at(0) == S.at(1) || S.at(1) == S.at(2)
      || S.at(2) == S.at(0)) {
    cout << "No" << endl;
  }
  else {
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#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)
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;
typedef pair<int, int> pint;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    vector<int> a(n,0);
    rep(i,n) cin>>a[i];
    Int ans=0;
    for(int i=0; i<n-1; i++){
        Int h=0;
        if(a[i+1]<a[i]){
            h=abs(a[i+1]-a[i]);
        }
        ans+=h;
        a[i+1]+=h;
    }
    cout<<ans<<endl;
    return 0;
}

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

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

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

//*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)



void solve(){
    string S, T;
    cin >> S >> T;
    int s = S.length();
    int t = T.length();
        
    vector<vector<int>> dp(s+1, vector<int>(t+1, INF));
    
    dp[0][0] = 0;
    for(int i=1; i<=s; i++) dp[i][0] = i;
    for(int i=1; i<=t; i++) dp[0][i] = i;
    
    for(int i=0; i<s; i++){
        for(int j=0; j<t; j++){
            if(S[i]==T[j])
                dp[i+1][j+1] = min({dp[i][j], dp[i][j+1] + 1, dp[i+1][j] + 1});
            else
                dp[i+1][j+1] = min({dp[i][j] + 1, dp[i][j+1] + 1, dp[i+1][j] + 1});
        }
    }
    cout << dp[s][t] << endl;
        
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}



Measured memory_bytes: 10876
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <fstream>
using namespace std;
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
typedef pair<int, int> p;
vector< int64_t > divisor(int64_t n) {
	vector< int64_t > ret;
	for (int64_t i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return (ret);
}
long long mod = 1e9 + 7;
p mov[4] = { p(0,1),p(1,0),p(-1,0),p(0,-1) };
int main(int argc, char* argv[]) {
	int h, w;
	cin >> h >> w;
	int grid[103][103];
	int visit[103][103];
	for (int i = 0; i < 103; i++) {
		for (int j = 0; j < 103; j++) {
			visit[i][j] = 0;
		}
	}
	for (int i = 1; i <= h; i++) {
		string str;
		cin >> str;
		for (int j = 1; j <= w; j++) {
			if (i % 2 == 0 && j % 2 == 0) {
				grid[i][j] = 0;
				continue;
			}
			int num;
			int s = i / 2;
			int t = j / 2;
			if (i % 2 == 1 && j % 2 == 1) {
				if ((s + t) % 2 == 0)num = 6;
				else num = 1;
			}
			if (i % 2 == 1 && j % 2 == 0) {
				if (t % 2 == 1)num = 3;
				else num = 4;
			}
			if (i % 2 == 0 && j % 2 == 1) {
				if (s % 2 == 1)num = 2;
				else num = 5;
			}
			if (str[j-1] - '0' == num)grid[i][j] = 1;
			else grid[i][j] = 0;
		}
	}
	queue<p>que;
	que.push(p(1, 1));
	visit[1][1] = 1;
	while (!que.empty()) {
		p now = que.front();
		que.pop();
		for (int i = 0; i < 4; i++) {
			p next = p(now.first + mov[i].first, now.second + mov[i].second);
			if (next.first <= h &&next.first>=1&& next.second <= w &&next.second>=1&& visit[next.first][next.second] == 0 && grid[next.first][next.second] == 1) {
				que.push(next);
				visit[next.first][next.second] = 1;
			}
		}
	}
	if (visit[h][w] == 1) {
		cout << "YES\n";
	}
	else {
		cout << "NO\n";
	}
}



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

using namespace std;
long long n;
long long kq=1e18;
int main()
{
    cin>>n;
    for(long long i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            kq=min(kq,n/i+i-2);
        }
    }
    cout<<kq;
    return 0;
}


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

#define mp              make_pair
#define pb              push_back

#define ff              first
#define ss              second

typedef long long ll;

int main()
{
    int n;
    string s;
    cin >> n >> s;
    
    int count = 1;
    char color = s[0];
    
    for(int i=0; i<n; ++i)
    {
        if(color != s[i])
        {
            count++;
            color = s[i];
        }
    }
    
    cout << count << "\n";
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main(){
	int c[3][3];
	for(int i = 0; i < 3; i++)for(int j = 0; j < 3; j++) cin >> c[i][j];
	for(int i = 0; i <= 100; i++){
		for(int j = 0; j <= 100; j++){
			for(int k = 0; k <= 100; k++){
				int a[] = {i, j, k};
				int b[] = {c[0][0] - a[0], c[0][1] - a[0], c[0][2] - a[0]};
				bool po = 1;
				for(int l = 0; l < 3; l++)for(int m = 0; m < 3; m++)if(c[l][m] != a[l] + b[m]) po = 0;
				if(po){
					cout << "Yes\n";
					return 0;
				}
			}
		}
	}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
main(){int A,B,C,D,i=8;scanf("%1d%1d%1d%1d",&A,&B,&C,&D);while(i--)if(A+(i/4%2?-B:B)+(i/2%2?-C:C)+(i%2?-D:D)==7){char p[]={'+','-'};printf("%d%c%d%c%d%c%d=7\n",A,p[i/4%2],B,p[i/2%2],C,p[i%2],D);return 0;}}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int x, y;
  while (cin >> x >> y) {
    if (!x && !y)
      break;

    if (x > y) {
      int t = x;
      x = y;
      y = t;
    }
    cout << x << " " << y << endl;
  }
}



Measured memory_bytes: 3144
#include<iostream>
#include<math.h>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<vector>
using namespace std;
int main() {

	long long int x;
	cin >> x;
	long long int y;
	y = x % 11;
	x = x / 11;
	if (y == 0) {
		cout << 2 * x << endl;
	}
	else if (y < 7) {
		cout << 2 * x + 1 << endl;
	}
	else {
		cout << 2 * x + 2 << endl;
	}
	return 0;

}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstdlib>
#include<cstring>

struct Node {
    int key;//変数定義
    Node *prev;//ポインタ変数定義(nextも同様)
    Node *next;
};


/*番兵*/
Node *nil;
void init(){
    nil = (Node *)malloc(sizeof(Node));//メモリ領域確保
    nil->next = nil;
    nil->prev = nil;
}

/*insertの動作*/
void insert(int key){
    Node *x = (Node *)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;//xのnext設定
    nil->next->prev = x;//nilのぺprev設定
    nil->next = x;//番兵のnextを新しいノードに繋げる
    x->prev = nil;//xのprevd設定
}

/*探索*/
Node* listSearch(int key){
    Node *cur = nil->next;//番兵を飛ばす
    while (cur != nil && cur->key != key){
        cur = cur->next;//次のノードへ
    }
    return cur;
}

/*削除の基本処理*/
void deleteNode(Node *t){
    if (t==nil) return;//tが番兵のとき処理なし
    /*tの前のノードと後ろのノードを結ぶ*/
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);//不必要のノードは解放
}

void deletekey(int key){
    deleteNode(listSearch(key));//探索で要素を探し削除
}

/*番兵のnextとprevは先頭と最後尾のノードをさすことから*/
void deleteFirst(){
    deleteNode(nil->next);
}
void deleteLast(){
    deleteNode(nil->prev);
}

void printList(){
  Node *cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur -> key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");//改行
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];//文字数の制限
  int np = 0, nd = 0;
  
  scanf("%d", &n);//回数の取得
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);//命令と変数の取得
    
    /*先頭の文字で判断かつ文字数が多い時の間の文字でも分岐*/
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	deletekey(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}




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

typedef long long s64;
#define rep(i,l,r) for(int i=l;i<=r;++i)

int main()
{
	//freopen("1.in","r",stdin);
	s64 a[7];
	rep(i,0,6)cin>>a[i];
	if(!a[0]||!a[3]||!a[4])cout<<a[1]+a[0]/2*2+a[3]/2*2+a[4]/2*2;
	else
		cout<<a[1]+a[0]+a[3]+a[4]-(a[0]%2!=a[3]%2||a[3]%2!=a[4]%2);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

static const int X_MAX = 35;
static const int Y_MAX = 3005;

int main() {
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    bool x[X_MAX], y[Y_MAX];
    for (int i = 0; i <= X_MAX; i++) x[i] = false;
    for (int i = 0; i <= Y_MAX; i++) y[i] = false;
    int tw, water = 0, sugar = 0;
    int a_max = f / (100 * a), b_max = f / (100 * b), c_max = f / c, d_max = f / d;
    for (int i = 0; i <= a_max; i++) {
        x[i * a] = true;
        for (int j = 0; j <= b_max; j++) {
            x[j * b] = true;
            tw = i * a + j * b;
            if (100 * tw <= f) x[tw] = true;
        }
    }
    for (int i = 0; i <= c_max; i++) {
        y[i * c] = true;
        for (int j = 0; j <= d_max; j++) {
            y[j * d] = true;
            tw = i * c + j * d;
            if (tw <= f) y[tw] = true;
        }
    }
    double conc, maxc = -1, conc_lim = (double)(100 * e) / (100 + e);
    for (int i = 0; i <= X_MAX; i++) {
        if (!x[i]) continue;
        for (int j = 0; j <= Y_MAX; j++) {
            if (y[j] && 100 * i + j <= f) {
                conc = (double)(100 * j) / (100 * i + j);
                if (conc <= conc_lim && conc == (maxc = max(maxc, conc))) {
                    water = 100 * i;
                    sugar = j;
                }
            }
        }
    }
    cout << water + sugar << ' ' << sugar << endl;
}

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

int main() {
int n,a;
  a=1;
  cin>>n;
  vector<string> vec(n);
for(int i=0;i<n;i++){
cin>>vec.at(i);
}
 sort(vec.begin(), vec.end()); 
  for(int i=0;i<n-1;i++){
  if(vec.at(i)!=vec.at(i+1)){a++;}
  }
 
  cout<<a<<endl;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int main() 
{
    long long int n;
    cin>>n;
    map<long long int,long long int >m;
    long long int sum=0;
    for(long long int i=0;i<n;i++)
    {
        long long int temp;
        cin>>temp;
        sum+=temp;
        m[temp]++;
    }

    long long int q;
    cin>>q;
    while(q--)
    {
        long long int a,b;
        cin>>a>>b;
        if(m.count(a)==0)
        {
            cout<<sum<<endl;
            continue;
        }

        long long int fr=m[a];
        sum=sum+fr*(b-a);

        cout<<sum<<endl;

        m.erase(a);
        m[b]+=fr;

    }
return 0;
}


Measured memory_bytes: 7500