akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>

#define DIV 10000
using namespace std;

int main() {
    string s, t;
    cin >> s >> t;

    int n = s.size(), m = t.size();

    vector<vector<int>> dp(n + 1, vector<int>(m + 1));
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
            if (s[i - 1] == t[j - 1])
                dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
        }
    }
    //cout << dp[n][m] << endl;
    string ans = "";
    int i = n, j = m;
    while (i > 0 && j > 0) {
        if (dp[i][j] == dp[i - 1][j]) {
            i--;
        }

        else if (dp[i][j] == dp[i][j-1]) {
            j--;
        }

        else {
            ans = s[i - 1] + ans;
            i--, j--;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 35584
using Yorukatsu040.Questions;
using Yorukatsu040.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Yorukatsu040.Questions
{
    /// <summary>
    /// ABC116
    /// </summary>
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var abc = inputStream.ReadIntArray();
            var a = abc[0];
            var b = abc[1];
            yield return a * b / 2;
        }
    }
}


namespace Yorukatsu040
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace Yorukatsu040.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace Yorukatsu040.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a[3];
	for(int i=0;i<3;++i)cin>>a[i];
		sort(a,a+3);
	int f=0;
	if(a[0]==a[1]&&a[1]==a[2])f=1;
	if(a[0]!=a[1]&&a[1]!=a[2])f=1;
	if(f==0)cout<<"Yes\n";
	else cout<<"No\n";
}

Measured memory_bytes: 256
from collections import Counter
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
#import numpy as np
import bisect
import sys
#import sympy
sys.setrecursionlimit(10**6)


def bfs(s, n, node):
    # 頂点が探索済みかどうかのチェック配列
    check = [False for _ in range(n)]
    check[s] = True
    # 次見る頂点を格納するキュー
    queue = deque([s])
    visited_num = 1

    # 問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color = [-1 for _ in range(n)]
    color[s] = 0

    while visited_num < n:
        # グラフが全連結ではない場合
        if len(queue) == 0:
            # 空配列を返す
            # 現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex = queue.popleft()
        # インデックスがない場合は
        for next_vertex in node[now_vertex]:

            if check[next_vertex] == True:
                continue

            queue.append(next_vertex)
            check[next_vertex] = True

            # 問題固有の計算
            color[next_vertex] = color[now_vertex]+1
            visited_num += 1

    return color


mod = 10**9+7
# n=int(input())
# n,m=list(map(int,input().split()))
# a=list(map(int,input().split()))
def ceil(x, y): return (x+y-1)//y
def input_list(): return list(map(int, input().split()))


def buy(buy_cost, sell_cost, money):
    return money % buy_cost+(money//buy_cost)*sell_cost


a, b, c = input_list()
n = int(input())
ans = 0
if a >= b:
    tmp = math.ceil(math.log((a+1)/b, 2))
    ans += tmp
    b *= 2**tmp


if b >= c:
    tmp = math.ceil(math.log((b+1)/c, 2))
    ans += tmp

if ans > n:
    print("No")
else:
    print("Yes")


Measured memory_bytes: 9420
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
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() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.length();
    vector<ll> a(n + 1);
    ll b = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '<') {
            b++;
            a[i + 1] = b;
        } else {
            b = 0;
        }
    }
    b = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (s[i] == '>') {
            b++;
            chmax(a[i], b);
        } else {
            b = 0;
        }
    }
    ll res = 0;
    for (int i = 0; i <= n; i++) {
        res += a[i];
    }
    cout << res << endl;
}

Measured memory_bytes: 4892
package main

import (
	"fmt"
)

func main() {
	var a, b, ans int

	fmt.Scan(&a, &b)
	for aa := 1; aa <= a; aa++ {
		ans += aa - 1
	}
	for bb := 1; bb <= b; bb++ {
		ans += bb - 1
	}

	fmt.Println(ans)

}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(abs(a-c) <= d){
        cout << "Yes" << endl;
    }
    else if(abs(a-b) <= d && abs(b-c) <= d){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

vector<int>to[200005];
vector<int>ans;

void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p)continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, q; cin >> n >> q;
	rep(i, n - 1) {
		int a, b; cin >> a >> b;
		a--; b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	ans.resize(n);
	rep(i, q) {
		int p, x; cin >> p >> x;
		p--;
		ans[p] += x;
	}
	dfs(0);
	rep(i, n) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 24320
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    ll a,b,k;cin>>a>>b>>k;
    ll sum = a+b-k;
    if(sum<=0)cout<< "0 0"<<endl;
    else {cout<<max(0LL,sum-b)<<' '<<min(sum,b)<<endl;}
}


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

int main() {
	int a, b, c, d, e, k;
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
	cin >> e;
	cin >> k;
	
	if (e - a > k) {
		cout << ":(";
	} else {
		cout << "Yay!";
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
    ll N,K;
    cin>>N>>K;
    ll ans=1;
    for(ll i=0;i<N;i++) {
        ans=min(ans*2,ans+K);
    }

    cout<<ans<<endl;

    }

Measured memory_bytes: 3580
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
 
#define  rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i>=0; i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).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 (b<a) { a=b; return 1; } return 0; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  std::vector<ll> B(N-1); rep(i,N-1) std::cin >> B[i];

  ll sum = 0; 
  for(int i=1; i<N-1; i++) sum += std::min(B[i-1], B[i]);

  std::cout << sum + B[0] + B[N-2] << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define ALL(c) (c).begin(), (c).end()
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;

ll dp[2010][2010];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    // int ary[n];
    // rep(i,n) cin >> ary[i];
    pair<ll, int> ary[n];
    rep(i,n)
    {
        ll tmpa;cin>>tmpa;
        ary[i] = make_pair(tmpa, i);
    }
    sort(ary, ary+n, greater<pair<ll, int> >());
    // rep(i,n) cout << ary[i].first << " " << ary[i].second << endl;
    // ok

    // dp[Leftからいくつうまったか][Rightからいくつ埋まったか]
    // dp[0][0] = 0;
    rep(i,n+1) rep(j,n+1) dp[i][j] = 0;
    REP(i,1,n+1)
    {
        // ↑L+R [1,n]
        rep(j,i+1)
        {
            // zk l [0,i]
            int l = j;
            int r = i-l;
            // cout << l << " " << r << endl;
            // ok
            if (l==0)
            {
                // cout << l << " " << r << " " << ary[i].first << " " << dp[l][r-1]+abs((n-r)-ary[i].second) * ary[i].first << endl;
                dp[l][r] = max(dp[l][r], dp[l][r-1]+abs((n-r)-ary[i-1].second) * ary[i-1].first);

            }
            else if (r==0)
            {
                dp[l][r] = max(dp[l][r], dp[l-1][r]+abs((l-1) - ary[i-1].second) * ary[i-1].first);

            }
            else
            {
                dp[l][r] = max(dp[l][r], dp[l-1][r]+abs((l-1) - ary[i-1].second) * ary[i-1].first);
                dp[l][r] = max(dp[l][r], dp[l][r-1]+abs((n-r)-ary[i-1].second) * ary[i-1].first);
            }
            

        }
    }

    ll ans = 0;
    rep(i,n+1)
    {
        // cout << dp[i][n-i] << endl;
        ans = max(ans, dp[i][n-i]);
    }
    cout << ans << endl;
}




Measured memory_bytes: 35112
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,Y;
    cin>>N>>Y;
    bool finished=false;
    bool ans=true;
    for(int i=0;i<N+1;i++){
        for(int k=0;k<N-i+1;k++){
            if(10000*i+5000*k+1000*(N-i-k)==Y){
            cout<<i<<" "<<k<<" "<<N-i-k<<endl;
            finished=true;
            ans=false;
            break;
            }
        }
        if(finished)break;
    }
    if(ans)cout<<"-1 -1 -1"<<endl;
}


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

using namespace std;
typedef long long LL;
int main(){
    int n;
    cin>>n;
    int ans[20000] = {};
    for(int i = 1; i <= 100; i++){
        for (int j = 1; j <= 100; ++j) {
            for (int k = 1; k <= 100; ++k) {
                if(i * i + j * j + k * k + i * j + i * k + j *k < 10004)
                ans[i * i + j * j + k * k + i * j + i * k + j *k] ++;
            }
        }
    }

    for (int l = 0; l < n; ++l) {
        cout<<ans[l + 1]<<endl;
    }
} 

Measured memory_bytes: 3712
package main
 
import (
  "fmt"
)
 
func main()  {
  var a, b, c int
  fmt.Scan(&a, &b, &c)
  
  if a != b && a != c && b != c {
    fmt.Println("No")
  } else {
    if a == b && a == c {
      fmt.Println("No")
    } else {
      fmt.Println("Yes")
    }
  }
}

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

typedef long long ll;
typedef long double ld;

#define pb push_back
#define sort(s) sort(s.begin(),s.end())
#define reverse(s) reverse(s.begin(),s.end())
#define rep(i,n) for(ll (i)=0;(i)<(n);(i)++)

const ll mod = 1e9+7;

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

//最小公倍数
ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

//素数判定
bool isPrime(ll x){
    ll i;
    if(x < 2)return 0;
    else if(x == 2) return 1;
    if(x%2 == 0) return 0;
    for(i = 3; i*i <= x; i += 2) if(x%i == 0) return 0;
    return 1;
}

//桁和
int digsum(ll n) {
    int res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

//桁数
int dignum(ll n) {
    int res = 0;
    while(n > 0) {
        res++;
        n /= 10;
    }
    return res;
}

//文字列中の特定の文字カウント
ll stringcount(string s,char c){
    return count(s.cbegin(),s.cend(),c);
}



int main(){
    string s; cin >> s;
    int count=0;
    rep(i,s.size()){
        if(s[i]==s[i+1]){
            count++;
            if(s[i+1]=='0'){
                s[i+1]='1';
            }else{
                s[i+1]='0';
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 512
/* Those who cannot remember the past are condemned to repeat it.*/
/* author:Ajeet */

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
const int sz=1e7+5;
#define mod 1000000007
#define ull unsigned long long int

int main()
{

    fast_cin();
    int n;
    cin>>n;
    int x=0,min=INT_MAX;
    int k;
    cin>>k;
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i],x+=arr[i];
    sort(arr,arr+n);
    cout<<n+((k-x)/arr[0])<<endl;

    return 0;
}

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

int main(){
  int n,r;
  int array1[50],array2[50];

  while(1){
    cin>>n>>r;
    if(n+r==0)break;

    for(int i=0;i<n;i++) array1[n-i-1]=array2[n-i-1]=i+1;

    for(int j=0;j<r;j++){
      int c,p;
      cin>>c>>p;

      for(int i=0;i<p;i++){
	swap(array1[c-1+i],array1[i]);
	array2[c-1+i]=0;
      }
      int k=p;
      for(int i=0;i<n;i++){
	while(array2[i]==0) i++;
	array1[k++]=array2[i];
      }
      for(int i=0;i<n;i++){
	//	while(array2[i]==0)i++;
	array2[i]=array1[i];
      }
      //      for(int i=0;i<n;i++) cout<<array1[i]<<endl;     
    }

    cout<<array1[0]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

using i8 = ::std::int_least8_t;
using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u8 = ::std::uint_least8_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;
using isize = ::std::ptrdiff_t;
using usize = ::std::size_t;

class rep {
	const usize f, l;

public:
	class itr {
		friend rep;
		usize i;
		itr(usize x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		usize operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	rep(usize first, usize last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(f); }
	itr end() const noexcept { return itr(l); }
};
class revrep {
	const usize f, l;

public:
	class itr {
		friend revrep;
		usize i;
		itr(usize x) noexcept : i(x) {}

	public:
		void operator++() noexcept { --i; }
		usize operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	revrep(usize first, usize last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(l - 1); }
	itr end() const noexcept { return itr(f - 1); }
};
template <class T> bool maxi(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool mini(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool smaxi(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool smini(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}
template <class T> using vec_alias = ::std::vector<T>;
template <class T> auto md_vec(usize n, const T &value) {
	return ::std::vector<T>(n, value);
}
template <class... Args> auto md_vec(usize n, Args... args) {
	return ::std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> const T &as_const(const T &v) noexcept { return v; }

#include <algorithm>
#include <iostream>
#include <utility>
#include <string>

int main() {
	::std::string s;
	::std::cin >> s;
	for (auto &e : s)
		e -= '0';
	const usize n = s.size();
	s.insert(s.begin(), 0);
	if (!s[1] || s[n])
		return ::std::cout << "-1" << ::std::endl, 0;
	for (const auto i : rep(0, n + 1))
		if (s[i] != s[n - i])
			return ::std::cout << "-1" << ::std::endl, 0;
	::std::vector<::std::pair<usize, usize>> edge;
	::std::vector<usize> temp;
	s[n] = 1;
	for (const auto i : rep(1, n + 1)) {
		if (s[i]) {
			for (const auto e : temp)
				edge.emplace_back(i, e);
			temp.clear();
		}
		temp.emplace_back(i);
	}
	for (const auto &e : edge)
		::std::cout << e.first << " " << e.second << ::std::endl;
	return 0;
}


Measured memory_bytes: 4272
#include<stdio.h>

int main()
{
  int w,n,a,b,row[36],i,j,temp1;

  scanf("%d",&w);
  for(i=0;i<=w;i++){
    row[i] = i;
  }
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d,%d",&a,&b);
    temp1 = row[a];
    row[a] = row[b];
    row[b] = temp1;
  }

  for(i=1;i<=w;i++){
    printf("%d\n",row[i]);
  }

  return 0;
}

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

int main(){
    int A, B, C;
    cin >> A >> B >> C;
    vector<int> cnt(10, 0);
    cnt[A]++;
    cnt[B]++;
    cnt[C]++;

    for(auto i : cnt){
        if(i == 2){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string a, b;
    cin >> a >> b;
    if (a.size() > b.size())
    {
        cout << "GREATER" << endl;
    }
    else if (a.size() < b.size())
    {
        cout << "LESS" << endl;
    }
    else
    {
        cout << ((a > b) ? "GREATER" : (a < b) ? "LESS" : "EQUAL") << endl;
    }
    return 0;
}

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

int main()
{
    long long mod = 1e9+7;
    int N; cin >> N;
    vector < vector <int> > pairings(N, vector<int>(N));
    for (int i=0; i<N; ++i)
    {
        for (int j=0; j<N; ++j)
        {
            cin >> pairings[i][j];
        }
    }
    vector < long long> numberOfPairings(1<<N);
    numberOfPairings[0]=1;
    for (int i=0; i<(1<<N); ++i)
    {
        int assigned=0;
        for (int j=0; j<N; ++j)
        {
            if ((1<<j) & i) assigned++;
        }
        for (int j=0; j<N; ++j)
        {
            if ((1<< j) &i) continue;
            if (pairings[assigned][j]) 
                numberOfPairings[i | (1<<j)] = (numberOfPairings[i | (1 << j)] + numberOfPairings[i])%mod;
		}
	}
	cout << numberOfPairings[(1<<N)-1] << "\n";
}


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

int main(){

  int N,W;cin>>N>>W;
    vector<long long int> S1,S2,S3,S4;
    long long int j;
    for(int i=0;i<N;i++){
        long long int a;
        int b;cin>>a>>b;
        if(i==0){
            S1.push_back(b);
            j=a;
        }
        else{
            if(a==j) S1.push_back(b);
            if(a==j+1) S2.push_back(b);
            if(a==j+2) S3.push_back(b);
            if(a==j+3) S4.push_back(b);
        }
    }
    sort(S1.rbegin(),S1.rend());
    sort(S2.rbegin(),S2.rend());
    sort(S3.rbegin(),S3.rend());
    sort(S4.rbegin(),S4.rend());
    vector<long long int> T1(S1.size()+1,0),T2(S2.size()+1,0),T3(S3.size()+1,0),T4(S4.size()+1,0);
    for(int i=0;i<S1.size();i++){
        T1[i+1]=T1[i]+S1[i];
    }
    for(int i=0;i<S2.size();i++){
       T2[i+1]=T2[i]+S2[i];
    }
    for(int i=0;i<S3.size();i++){
        T3[i+1]=T3[i]+S3[i];
    }
    for(int i=0;i<S4.size();i++){
        T4[i+1]=T4[i]+S4[i];
    }
    long long int ans=0;
    for(int i=0;i<T1.size();i++){
        for(int f=0;f<T2.size();f++){
            for(int k=0;k<T3.size();k++){
                for(int l=0;l<T4.size();l++){
                    if(j*(i)+(j+1)*(f)+(j+2)*(k)+(j+3)*(l)<=W){
                    long long int sum=T1[i]+T2[f]+T3[k]+T4[l];
                        ans=max(ans,sum);
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<list>
#include <algorithm>
#include <string>
#include <math.h>
#include<map>
#include <utility>

#include<queue>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
 
#define INF (1e10)
typedef long long unsigned int ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define MOD 1000000007

template<typename T>
int vector_finder(std::vector<T> vec, T number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

template<typename T>
T gcd(T a,T b){
	if(b>0){
		return gcd(b, a % b);
	}else{
		return a;
	}
}

template<typename T>
T lcm(T a,T b){
	T g = gcd(a, b);
	return a * b / g;
}

void clear( std::queue<pair<int,int> > &q )
{
   std::queue<pair<int,int> > empty;
   std::swap( q, empty );
}
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
template<typename T>
std::vector<T> enum_div(T n)//nの約数を列挙
{
	std::vector<T> ret;
	for(T i=1 ; i*i<=n ; ++i)
	{
		if(n%i == 0)
		{
			ret.push_back(i);
			if(i!=1 && i*i!=n)
			{
				ret.push_back(n/i);
			}
		}
	}
	return ret;
}

int N,M;


long long ans=0;



int main()
{
  cin>>N>>M;
  long long x[N],y[N], z[N];
  REP(i,0,N){
    cin >> x[i] >> y[i] >> z[i];
  }

  int master[8][3]={{1,1,1},{1,1,-1},{1,-1,1},{1,-1,-1},{-1,1,1},{-1,1,-1},{-1,-1,1},{-1,-1,-1}};

  REP(i,0,8){
    vector<pair<long long, int> > v;
    REP(j,0,N){
      v.push_back(make_pair(master[i][0] * x[j] + master[i][1] * y[j] + master[i][2] * z[j], j));
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    long long xx=0;
    long long yy=0;
    long long zz=0;
    REP(j,0,M){
      xx += x[v[j].second];
      yy += y[v[j].second];
      zz += z[v[j].second];
    }
    long long a = abs(xx) + abs(yy) + abs(zz);
    if(a>ans){
      ans = a;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
H, W = map(int, input().split())
Ch, Cw = map(lambda x: int(x) - 1, input().split())
Dh, Dw = map(lambda x: int(x) - 1, input().split())
S = [input() for _ in range(H)]

grid = [[0 for _ in range(W)] for _ in range(H)]
grid[Ch][Cw] = 1

stack1 = [(Ch, Cw)]
stack2 = []

answer = 0

while 1:
    while stack1:
        sh, sw = stack1.pop()
        stack2.append((sh, sw))
        for i, j in [(-1, 0), (1, 0), (0, 1), (0, -1)]:
            nh, nw = sh + i, sw + j
            if 0 <= nh < H and 0 <= nw < W and S[nh][nw] != "#" and grid[nh][nw] == 0:
                if nh == Dh and nw == Dw:
                    print(answer)
                    exit()
                grid[nh][nw] = 1
                stack1.append((nh, nw))
    answer += 1

    while stack2:
        sh, sw = stack2.pop()
        for i in range(-2, 3):
            for j in range(-2, 3):
                nh, nw = sh + i, sw + j
                if 0 <= nh < H and 0 <= nw < W and S[nh][nw] != "#" and grid[nh][nw] == 0:
                    if nh == Dh and nw == Dw:
                        print(answer)
                        exit()
                    grid[nh][nw] = 1
                    stack1.append((nh, nw))
    if not stack1:
        print(-1)
        exit()


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

using namespace std;

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

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n, y;
	cin >> n >> y;

	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n; j++) {
			int k = n - (i + j);
			if (k < 0) {
				continue;
			}

			if (i * 10000 + j * 5000 + k * 1000 == y) {
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}

	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;
	vector<long long> A(X), B(Y), C(Z);
	for (int i = 0; i < X; i++) { cin >> A[i]; }
	for (int j = 0; j < Y; j++) { cin >> B[j]; }
	for (int k = 0; k < Z; k++) { cin >> C[k]; }
	sort(A.begin(),A.end());
	reverse(A.begin(), A.end());
	sort(B.begin(), B.end());
	reverse(B.begin(), B.end());
	sort(C.begin(), C.end());
	reverse(C.begin(), C.end());
	vector<long long> ABC;
	for (int a = 0; a < X; a++) {
		for (int b = 0; b < Y; b++) {
			if ((a + 1) * (b + 1) > K) {break;}
			for (int c = 0; c < Z; c++) {
				if ((a + 1) * (b + 1) * (c + 1) > K) {break;}
				ABC.push_back(A[a] + B[b] + C[c]);
			}
		}
	}
	sort(ABC.begin(), ABC.end());
	reverse(ABC.begin(), ABC.end());
	for (int i = 0; i < K;i++) {
		cout << ABC.at(i) << endl;
	}
}

Measured memory_bytes: 1404
#include<stdio.h>
int main(){
	int n,m;
	int Avectar[100][100];
	int Bvectar[100];
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			scanf("%d",&Avectar[i][j]);
		}
	}
	for(int i=0;i<m;i++)scanf("%d",&Bvectar[i]);
	int sum=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++)sum+=Avectar[i][j]*Bvectar[j];
	printf("%d\n",sum);
	sum=0;
	}
	return 0;
}


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

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

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

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

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

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

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

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

void mainmain(){
	int K;
	string s;
	cin>>s;
	int n;
	convert(s,n);
	cin>>K;
	vint D(K);
	rep(i,K) cin>>D[i];
	rep(i,n,100000){
		string t;
		convert(i,t);
		bool ok = true;
		rep(j,t.size()){
			rep(k,K){
				if(t[j]==D[k]+'0') ok = false;
			}
		}
		if(ok){
			cout<<i<<endl;
			return;
		}
	}
}


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


Measured memory_bytes: 256
/**
        	C++14 (GCC 5.4.1)
**/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
using namespace std;

int main(){
    int r, D, x;
    cin >> r >> D >> x;

    for(int i = 0 ; i < 10 ; i++){
        cout << r * x - D << endl;
        x =  r * x - D ;
    }
    return 0;
}

Measured memory_bytes: 256
#define DEB
#include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second

using namespace std;


#ifdef DEB
#define dump(x)  cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
#define dumpR(x) cerr<<"\x1b[31m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpY(x) cerr<<"\x1b[33m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
#define dumpG(x) cerr<<"\x1b[32m"<<#x<<" = " <<(x)<<"\x1b[39m"<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define dumpR(x) ;
#define dumpY(x) ;
#define dumpG(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif

template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }

typedef long long int lint;
typedef pair<int,int> pi;

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fr<<','<<a.sc<<')';
    return out;
  }
}

//const int INF=5e8;
int A,B;
int n;
typedef vector<int> vi;

bool ask(int a,int b){
  printf("? %d %d\n",a,b);
  fflush(stdout);
  char tmp[5];
  scanf("%s",tmp);
  return (tmp[0]=='Y'?true:false);
}

int main(){
  cin>>A>>B;
  n=A+B;
  if(B>=A){
    puts("Impossible");
    fflush(stdout);
    return 0;
  }
  vi stk;
  REP(i,n){
    if(stk.empty()){
      stk.pb(i);
    }else{
      int a=stk.back();
      if(ask(a,i)==false){
        stk.pop_back();
      }else stk.pb(i);
    }
  }
  int honest=stk.back();
  bool res[4005]={};
  REP(i,n) if(ask(honest,i)) res[i]=true;
  printf("! ");
  REP(i,n) printf("%d",res[i]?1:0);
  puts("");
  fflush(stdout);
  return 0;
}





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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

const int MOD = 1000000007;

int main(){
    string s;
    cin>>s;

    V<Vll> dp(100005,Vll(13,0));

    dp[0][0] = 1;
    REP(i,s.size()){
        int c;
        if(s[i] == '?'){
            c = -1;
        }else{
            c = s[i] - '0';
        }

        REP(j,10){
            if(c != -1 && c != j) continue;
            REP(k,13){
                dp[i+1][(k*10+j)%13] += dp[i][k];
            }
        }
        REP(j,13) dp[i+1][j] %= MOD;
    }

    cout<<dp[s.size()][5]<<endl;
    return 0;
}

Measured memory_bytes: 13696
#include <stdio.h>
#define MAX 100
int M[MAX][MAX],R[MAX];
int Min(int a,int b){
  if(a<b)return a;
  return b;
}
int main(){
  int n,i,j,k,r;
  scanf("%d",&n);
  for(i=1;i<n+1;i++)  scanf("%d%d",&R[i-1],&R[i]);
  for(i=2;i<n+1;i++){
    for(j=1;j<n-i+2;j++){
      r=j+i-1;
      M[j][r]=(1<<20);
      for(k=j;k<r;k++){
	M[j][r]=Min(M[j][r],M[j][k]+M[k+1][r]+R[j-1]*R[k]*R[r]);
      }
    }
  }
  printf("%d\n",M[1][n]);
  return 0;
}

Measured memory_bytes: 636
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n, k, q, a;
    cin >> n >> k >> q;

    vector <int> count(n, k - q);
    while (q--) {
        cin >> a;
        count[--a]++;
    }

    for (int i = 0; i < n; i++) cout << (count[i] > 0 ? "Yes" : "No") << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
using namespace std;
typedef pair<int,int> P;
const int INF = (int)((unsigned int)-1>>1);


int main(){
    vector<int> prime;
    prime.push_back(2);

    for(int i=3;i<=999999;i+=2){
        bool is_prime = true;
        for(int j=0;j<prime.size();j++){
            if (prime[j]*prime[j] > i) break;
            if (i % prime[j] == 0){
                is_prime = false;
                break;
            }
        }
        if(is_prime){
            prime.push_back(i);
        }
    }

    int n;
    while(cin >> n){
        int ans = 0;
        for(int j=0;j<prime.size();j++){
            if (prime[j] > n) break;
            ans++;
        }
        cout << ans << endl;
    }

    return 0;
}

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

constexpr int N = 100009, X = 4;
int n;
int A, B, C;
int8_t dp[N][X][X][X];
char choice[N][X][X][X];
string s[N];

auto go(int i, int a, int b, int c) -> int8_t {
  if(a < 0 || b < 0 || c < 0 || a >= X || b >= X || c >= X) return 0;
  if(i == n + 1) return 1;
  if(dp[i][a][b][c] != -1) return dp[i][a][b][c];
  if(s[i] == "AB") {
    dp[i][a][b][c] = go(i + 1, a - 1, b + 1, c) | go(i + 1, a + 1, b - 1, c);
    if(go(i + 1, a - 1, b + 1, c)) choice[i][a][b][c] = 'B';
    else choice[i][a][b][c] = 'A';
  }
  if(s[i] == "AC") {
    dp[i][a][b][c] = go(i + 1, a - 1, b, c + 1) | go(i + 1, a + 1, b, c - 1);
    if(go(i + 1, a - 1, b, c + 1)) choice[i][a][b][c] = 'C';
    else choice[i][a][b][c] = 'A';
  }
  if(s[i] == "BC") {
    dp[i][a][b][c] = go(i + 1, a, b + 1, c - 1) | go(i + 1, a, b - 1, c + 1);
    if(go(i + 1, a, b + 1, c - 1)) choice[i][a][b][c] = 'B';
    else choice[i][a][b][c] = 'C';
  }
  return dp[i][a][b][c];
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  fill((int8_t*) dp, (int8_t*) dp + N * X * X * X, -1);
  cin >> n >> A >> B >> C;
  for(int i = 1; i <= n; ++i) {
    cin >> s[i];
  }
  A = min(A, X - 2);
  B = min(B, X - 2);
  C = min(C, X - 2);
  if(go(1, A, B, C) == 0) {
    cout << "No\n"; 
  } else {
    cout << "Yes\n";
    int i = 1;
    while(i != n + 1) {
      char x = choice[i][A][B][C];
      cout << x << '\n';
      if(x == 'A') A += 1;
      if(x == 'B') B += 1;
      if(x == 'C') C += 1;
      char y;
      if(s[i][0] != x) y = s[i][0];
      else y = s[i][1];
      if(y == 'A') A -= 1;
      if(y == 'B') B -= 1;
      if(y == 'C') C -= 1;
      i += 1;
    }
  }
}

Measured memory_bytes: 31808
/// input macro from https://qiita.com/tanakh/items/1ba42c7ca36cd29d0ac8
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" ) } ; }
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 ! 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 ) * } } ; }

fn solve() {
    input!(n: i8);
    println!("{}", 1 - n);
}
fn main() {
    std::thread::Builder::new()
        .name("solve".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(solve)
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2176
from collections import deque

class MyList(deque):
    def __init__(self):
        self.__init__ = deque
        self.d = {'deleteFirst':self.delF, 'deleteLast':self.delL, 'insert':self.insX, 'delete':self.delX}
    def cmd(self,command):
        if ' ' in command:
            ope, num = command.split()
            num = int(num)
            self.d[ope](num)
        else:
            self.d[command]()
            
    def delF(self):
        self.popleft()

    def delL(self):
        self.pop()

    def insX(self,num):
        self.appendleft(num)

    def delX(self,num):
        if num in self:
            self.remove(num)

if __name__ == '__main__' :
    l = MyList()
    n = input()
    
    for i in range(n):
        l.cmd(raw_input())

    q = deque(l)
    for i in range(len(l)-1):
        print q.popleft(),
    print l[-1]

Measured memory_bytes: 102440
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	int h, w, k;
	cin >> h >> w >> k;
	vector<string> v(h);
	rep(i,h) cin >> v[i];
	vector<vector<int>> ans(h, vector<int>(w));
	int p = 1;
	string emp = "";
	rep(i,w) emp += '.';
	rep(i,h) {
		string t = v[i];
		if (t == emp) continue;
		for (int j = 0; j < w; ) {
			while (j < w && t[j] == '.') {
				ans[i][j] = p;
				j++;
			}
			if (j < w && t[j] == '#') {
				ans[i][j] = p;
				j++;
			}
			while (j < w && t[j] == '.') {
				ans[i][j] = p;
				j++;
			}
			p++;
		}
	}
	rep(i,h) {
		if (v[i] == emp) continue;
		int cur = i;
		while (cur - 1 >= 0 && v[cur - 1] == emp) {
			ans[cur - 1] = ans[i];
			cur--;
		}
		cur = i;
		while (cur + 1 < h && v[cur + 1] == emp) {
			ans[cur + 1] = ans[i];
			cur++;
		}
	}
	rep(i,h) {
		rep(j, w) {
			if (j != 0) cout << " ";
			cout << ans[i][j];
		}
		cout << endl;
	}
}

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

Measured memory_bytes: 4160
#include<bits/stdc++.h>
    #define REP(i,n) for(int i=0;i<n;i++)
    #define LOOP(i,x,n) for(int i=x;i<n;i++)
    #define ALL(v) (v).begin(),(v).end()
    #define PB push_back
    #define MP make_pair
    #define FIR first
    #define SEC second
    #define int long long
    using namespace std;
    const int MOD=1000000007;
    const int INF=1000000009;
     
    signed main(){
      string s;
      cin>>s;
      if((s[0]==s[1]&&s[1]==s[2])||(s[1]==s[2]&&s[2]==s[3])||(s[0]==s[1]&&s[1]==s[2]&&s[2]==s[3]))cout<<"Yes"<<endl;
      else cout<<"No"<<endl;
      return 0;
    }

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

using namespace std;

#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define ALL(x) x.begin(),x.end()
#define pb push_back
#define mk make_pair

typedef long long LL;
typedef pair<int,int> Interval;

template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {
    _for(i,0,v.size()) os << v[i] << " ";
    return os;
}

template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){
    for(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){
    os << v.first <<" "<<v.second<<endl;
    return os;
}

const int maxn = 300+5;
int mem[maxn];
int d[maxn][maxn];
vector<int> A[maxn];
int n;

int dp(int l,int r){
    int &ans = d[l][r];
    if(ans >= 0) return ans;
    if(r-l <= 0){
        ans = 0;
        return ans;
    }

    ans = dp(l+1,r);
    for(auto a:A[l]){
        if(a > r) break;
        int dd = dp(l+1,a-1);
        int nex = dp(a+1,r);
        if(dd == a-l-1) nex = dd + nex + 2;
        else nex = nex + dd;
        ans = max(ans,nex);
    }
    return ans;
}

int main()
{
    while(1)
    {
        scanf("%d", &n);
        memset(d,-1,sizeof(d));
        if(!n) break;
        memset(mem, 0, sizeof(mem));
        _for(i,0,maxn) A[i].clear();

        for(int i = 0; i < n; i++)
        {
            scanf("%d", &mem[i]);
        }

        for(int i = 0; i < n; i++){
          for(int j = i+1; j < n; j++)
          {
              if(abs(mem[i]- mem[j])<=1)
              {
                  A[i].push_back(j);
              }
          }
        }
        cout << dp(0,n-1) << endl;

    }

}



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

using namespace std;

int main(){
    vector<int> students(30);
    int num;
    for(int i = 0; i < 28; i++){
        cin >> num;
        students[num - 1] = 1;
    }
    for(int i = 0; i < 30; i++){
        if(students[i] == 0){
            cout << i + 1 << endl;
        }
    }
}


Measured memory_bytes: 3044
#include <bits/stdc++.h>
#define ull unsigned long long int
#define ll long long
#define int long long
#define ld long double
#define endl '\n'
const int mod= 1e9+7;
#define F first
#define S second
//#define x first
//#define y second
#define pb push_back
#define mp make_pair
#define trace(x) cerr << #x << " is " << x << endl;
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<"\n";
#define all(x) x.begin(),x.end()
#define reset(x,val) memset(x,val,sizeof(x))
#define flush fflush(stdout)
#define sz(a) a.size()
#define pii pair<int,int>
void fail(){std::cout<<"NO\n";exit(0);}
using namespace std;
string k;
const int N=1e5+5,D=105;
int cache[N][D][2],ip[N];
int n,d;
int dp(int idx,int rem,bool less)
{
 if(idx==n+1)return (rem==0);
 int &ans=cache[idx][rem][less];
 if(ans!=-1)return ans;
 ans=0;
 if(less)
 {
  for(int i=0;i<10;i++)
  {
   ans+=dp(idx+1,(rem+i)%d,less);
   ans%=mod;
  }
 }
 else
 {
  for(int i=0;i<=ip[idx];i++)
  {
   ans+=dp(idx+1,(rem+i)%d,less|(i<ip[idx]));
   ans%=mod;
  }
 }
 return (ans+mod)%mod;
}
int32_t main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL); 
    cin>>k>>d;
    n=k.size();
    reset(cache,-1);
    for(int i=0;i<n;i++)
    {
     ip[i+1]=k[i]-'0';
    }
    
    cout<<(dp(1,0,0)-1+mod)%mod<<endl;
    return 0; 
}

Measured memory_bytes: 164992
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll arr[59];
ll prr[109];
map<ll,ll>mp;
vector<ll>pr;
int main()
{
   ll i=1000,j=5,k,l,p,q,r,s,t,n,m;
   string str;
   cin>>n;
   p=n/500;
   q=n%500;
   l=p*i+(q/5)*j;
   cout<<l;
  
}

Measured memory_bytes: 256