akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define inf 1000000000
#define IOS ios_base::sync_with_stdio(0);cin.tie(0)
#define meM(y,a) memset(y,a,sizeof y)
#define sC(a) scanf("%d",&a)
#define alL(a) a.begin(),a.end()
#define prinT(a,sz)  cout<<a[0];for(int i=1;i<sz;i++)cout<<" "<<a[i];cout<<endl
#define ranD srand(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int>pi;
typedef pair<ll,ll>pll;
//int fx[]={0,0,1,-1};
//int fy[]={1,-1,0,0};
//int gx[]={0,0,1,1,1,-1,-1,-1};
//int gy[]={1,-1,0,1,-1,0,1,-1};
const int N=100010;
bool lun(ll num)
{
    int prev=num%10;
    num/=10;
    while(num>0)
    {
        int d=num%10;
        num/=10;
        if(abs(d-prev)>1)return 0;
        prev=d;
    }
    return 1;
}
ll nxt_lun(ll x)
{
    vector<int>v;
    if(lun(x))return x;
    ll num=x;
    ll prev=num%10;
    ll mul=1;
    num/=10;
    v.pb(prev);
    while(num>0)
    {
        int d=num%10;
        num/=10;
//        cout<<d<<" "<<prev<<endl;
        if(d-prev>1){
            v[v.size()-1]=d-1;
            for(int i=v.size()-2;i>=0;i--)
                v[i]=max(v[i+1]-1,0);
        }
        else if(prev-d>1)
        {
            d=d+1;
            v[v.size()-1]=d-1;
            for(int i=v.size()-2;i>=0;i--)
                v[i]=max(v[i+1]-1,0);
        }
        v.pb(d);
        prev=d;
    }
    ll z=0;
    for(int i=v.size()-1;i>=0;i--)
        z=z*10+v[i];
    return z;
}
ll ara[N];
int main()
{
    IOS;
    int cnt=0;
    ara[0]=0;
    for(int i=1;i<=100000;i++)
    {
        ara[i]=nxt_lun(ara[i-1]+1);
//        cout<<ara[i]<<endl;
    }
    int n;cin>>n;
    cout<<ara[n]<<endl;
}








Measured memory_bytes: 4444
const main = (input) => {
  const [, ...rows] = input.trim().split('\n')
  const ans = {}

  for (let v of rows) ans[v] = true
  return console.log(Object.keys(ans).length)
}

process.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))

Measured memory_bytes: 93028
import java.io.*;
public class Main{
	public static void main(String[] args)throws Exception{
		BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
		String str=input.readLine();
		String str2=input.readLine();
		String[] atr=str2.split(" ");
		int n=Integer.parseInt(str);
		int[] number =new int[n];
		for(int i=0;i<atr.length;i++){
		number[i]=Integer.parseInt(atr[i]);
		}
		int min=number[0];
		int max=number[0];
		long sum=0;
		for(int i=0;i<number.length;i++){
			if(min>number[i]){
				min=number[i];
			}
		}
		for(int i=0;i<number.length;i++){
			if(max<number[i]){
				max=number[i];
			}
		}
		for(int i=0;i<number.length;i++){
			sum+=number[i];
		}
		System.out.println(min+" "+max+" "+sum);	
		
	}
}

Measured memory_bytes: 28524
// ABC139_A
#include <iostream>
#include <string>
#include <vector>
#include <iterator>  // std::prev(iter, n) n 個分デクリメントしたイテレータ
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;
using ll = long long;

#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define MIN(vec) min_element(vec.begin(), vec.end())  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(vec.begin(), vec.end())
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(vec.begin(), vec.end(), 0LL)  // 0 は初期値
#define pll pair<ll, ll>
#define F first
#define S second
const ll INF = 1LL<<60;  // 10^18（const int inf   = 1<<29;）

int main() {
    // input(sunippets: inpv, inpn, inps)
    string S, T;
    cin >> S >> T;
    
    // calculation
    int sum = 0;
    REP(i, 3) {
        if (S[i] == T[i]) sum++;
    }
    
    cout << sum << "\n";
    
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n - 1); i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using ld = long double;
template <class T>
using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-9;
ll mod = static_cast<ll>(1e9 + 7);
template <class T>
constexpr int sz(const T &a) { return (int)a.size(); }
template <class T>
constexpr T pow2(const T a) { return a * a; }
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class A, int N, class T>
void fillArray(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }

constexpr int N = 85 * 85;
int h, w;
int a[85][85];
bitset<N * 2> dp[85][85];
void solve() {
    cin >> h >> w;
    rep(i, h) rep(j, w) cin >> a[i][j];
    rep(i, h) rep(j, w) {
        int b;
        cin >> b;
        a[i][j] = abs(a[i][j] - b);
    }

    dp[0][0].set(N);
    rep(i, h) rep(j, w) {
        dp[i + 1][j] |= dp[i][j] << a[i][j];
        dp[i + 1][j] |= dp[i][j] >> a[i][j];
        dp[i][j + 1] |= dp[i][j] << a[i][j];
        dp[i][j + 1] |= dp[i][j] >> a[i][j];
    }

    int ans = iinf;
    rep(i, 2 * N) if (dp[h - 1][w - 1][i]) {
        mins(ans, abs(i + a[h - 1][w - 1] - N), abs(i - a[h - 1][w - 1] - N));
    }
    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 12544
import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
from collections import Counter
c = Counter([])
ans = 0
for i,ai in enumerate(a):
  S = i+1+ai
  if i > 0:
    L = i+1-ai
    if L in c:
      ans += c[L]
  c.update({S:1})
print(ans)

Measured memory_bytes: 40360
#include<iostream>
using namespace std;
int main(){
  int A, B;
  cin >> A >> B;
  int cnt = 0;
  for (int i = A; i <= B; i++)
  {
    string str = to_string(i);
    if(str.at(0)==str.at(4) && str.at(1)==str.at(3)){
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
using ull = unsigned long long;
const static int MAX_N = 200000;
int first[MAX_N][26];

int main(){
    unsigned N;
    scanf("%u\n", &N);
    pair<string, pair<char, unsigned> > word[N];
    unsigned sz[N];
    memset(first, -1, sizeof first);
    for (unsigned i = 0; i < N; i++)
    {
        cin >> word[i].first;
        sz[i] = word[i].first.size();
        reverse(word[i].first.begin(), word[i].first.end());
        for (unsigned j = 0; j < sz[i]; j++){
            first[i][word[i].first[j] - 'a'] = j;
        }
        word[i].second.second = i;
        word[i].second.first = word[i].first[sz[i]-1];
        word[i].first.pop_back();
    }
    sort(word, word + N);
    ull answer = 0;
    for (unsigned i = 0; i < N-1; i++){
        unsigned j = i+1;
        while(j < N && sz[word[j].second.second] == sz[word[i].second.second]) j++;
        while(j < N && word[j].first.substr(0, sz[word[i].second.second]-1) == word[i].first){
            if(first[word[j].second.second][word[i].second.first - 'a'] + 1 >= sz[word[i].second.second]) answer++;
            j++;
        }
    }
    printf("%llu\n", answer);
	return 0;
}

Measured memory_bytes: 32544
n = int(input())
s = list()
t = list()
ans = 0
for i in range(n) :
    addS,addT = input().split()
    s.append(addS)
    t.append(int(addT))
x = input()
for i in t :
    if t.index(i) > s.index(x) : 
        ans+=i
print(ans)



Measured memory_bytes: 3060
import sys
input = sys.stdin.readline
def main():
    X = int(input())
    ans = 0
    for i in range(1,X+1):
        for j in range(2,X+2):
            if i**j <= X:
                ans = max(ans, i**j)
            else:
                break
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
def inp() a=gets.chomp.split(" ").map(&:to_i)end 
def inpf() a=gets.chomp.split(" ").map(&:to_f)end
def inps() a=gets.chomp.split(" ")end  
def copy(a) Marshal.load(Marshal.dump(a)) end
def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end
def scount(a) b = na(a.max+1); a.each{|n|b[n]+=1};return b end
def na(n=0,d=0) Array.new(n,d)end
def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end
def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end
class Uf
def initialize(n)
  @r = na(n+1)
  @a = (0...n).to_a
end
def uf(x)
  return x if (@a[x] == x)
  @a[x] = uf(@a[x])
end
def add(x,p)
  root  = uf(x)
  connect  = uf(p)
  return if root == connect
  if @r[root] > @r[connect]
    @a[connect] = root
  elsif @r[root] == @r[connect]
    @a[connect] = root
    @r[root] += 1
  else
    @a[root] = connect
  end
end
def ufj(x,p)
   return uf(x) == uf(p) 
end
end
h = {}
n,k,l = inp
a = Uf.new(n+1)
b = Uf.new(n+1)
(k).times do |i|
  d = inp
  a.add(d[0],d[1])
end
(l).times do |i|
  d = inp
  b.add(d[0],d[1])
end
(1..n).each do |i|
  aa = a.uf(i)
  bb = b.uf(i)
  h[aa+n*bb] = 0 if(h[aa+n*bb] == nil)
  h[aa+n*bb] += 1 
end
(1..n-1).each do |i|
  aa = a.uf(i)
  bb = b.uf(i)
  print "#{h[aa+n*bb]} " 
end
aa = a.uf(n)
bb = b.uf(n)
puts h[aa+n*bb]
=begin
max = c if max < c 
=end

Measured memory_bytes: 20152
a, b, c, d = \
  gets.split(//).map(&:to_i)

if a + b + c + d == 7
  op = ["+", "+", "+"]
elsif a + b + c - d == 7
  op = ["+", "+", "-"]
elsif a + b - c + d == 7
  op = ["+", "-", "+"]
elsif a + b - c - d == 7
  op = ["+", "-", "-"]
elsif a - b + c + d == 7
  op = ["-", "+", "+"]
elsif a - b + c - d == 7
  op = ["-", "+", "-"]
elsif a - b - c + d == 7
  op = ["-", "-", "+"]
elsif a - b - c - d == 7
  op = ["-", "-", "-"]
end

puts "#{a}#{op[0]}#{b}#{op[1]}#{c}#{op[2]}#{d}=7"

Measured memory_bytes: 3836
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int x = sc.nextInt();
		if(a <= x && x <= a + b) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}

}


Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
int a[200000],tmp[200000];
int main()
{
	int n,i,l;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		tmp[i]=a[i];
	}
	sort(tmp,tmp+n);
	for(i=0;i<n;i++)
	{
		printf("%d\n",a[i]<=tmp[n/2-1]?tmp[n/2]:tmp[n/2-1]);
	}
	return 0;
}

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

using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define sz(s) (int)s.size()

int main() {
    int n;
    cin >> n;
    map<int, int> f;
    rep(i, 0, n) {
        int x;
        cin >> x;
        ++f[x];
    }
    long long ans = 0LL;
    vector<int> a;
    for (auto it : f) {
        if (it.second >= 4) ans = 1LL * it.first * it.first;
        if (it.second >= 2) a.push_back(it.first);
    }
    if (sz(a) >= 2) ans = max(ans, 1LL * a.back() * a[sz(a) - 2]);
    cout << ans << '\n';
}

Measured memory_bytes: 4992
if __name__ == '__main__':
    while True:
        data = [int(x) for x in input().split(' ')]
        H = data[0]
        W = data[1]
        assert  0<=H<=300 and 0<=W<=300, "invalid input"

        if H == 0 and W == 0:
            break

        for i in range(H):
            print('#' * W)
        print('')

Measured memory_bytes: 7712
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
m = int(input())
t = [input() for _ in range(m)]
count_red = Counter(s)
count_blue = Counter(t)
ans = [0]
for i in count_red:
    a = count_red[i]
    if i in count_blue:
        a -= count_blue[i]
    ans.append(a)
print(max(ans))

Measured memory_bytes: 38384
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&c<48)c=getchar();if(c=='-')f=-1,c=getchar();while(c>47)x=x*10+(c^48),c=getchar();return f*x;}

const int maxn = 1e6+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

int a[maxn];
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int vis[maxn];

int main() {
    int n=read();
    int x=0;
    for(int i=1; i<=n; ++i) {
        x=gcd(x,a[i]=read());
        vis[a[i]]++;
    }
    if(x>1) printf("not coprime\n");
    else {
        int f=0;
        for(int i=2; i<maxn; ++i) {
            int cnt=0;
            for(int j=i; j<maxn; j+=i) cnt+=vis[j];
            if(cnt>1) { f=1; break; }
        }
        if(f) printf("setwise coprime\n");
        else printf("pairwise coprime\n");
    }
}

Measured memory_bytes: 11368
a = [
    1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15,
    2, 2, 5, 4, 1, 4, 1, 51
]
k = int(input())
print(a[k - 1])


Measured memory_bytes: 2940
#include <iostream>
#include <map>
#include <set>

using namespace std;

string::iterator it;
map<char, set<int>> elements;

set<int> term();
set<int> expr();

set<int> difference(const set<int> a, const set<int> b)
{
    set<int> res;
    for(auto x : elements['U']){
        if(a.count(x) > 0 and b.count(x) == 0){
            res.insert(x);
        }
    }
    return res;
}

set<int> complement(const set<int> a)
{
    return difference(elements['U'], a);
}
    
set<int> intersection(const set<int> a, const set<int> b)
{
    set<int> res;
    for(auto x : elements['U']){
        if(a.count(x) > 0 and b.count(x) > 0){
            res.insert(x);
        }
    }            
    return res;
}

set<int> union_(const set<int> a, const set<int> b)
{
    set<int> res;
    for(auto x : elements['U']){
        if(a.count(x) > 0 or b.count(x) > 0){
            res.insert(x);
        }
    }            
    return res;
}

set<int> sym_difference(const set<int> a, const set<int> b)
{
    return (union_(difference(a, b), difference(b, a)));
}

set<int> term()
{
    set<int> a;
    if(*it == '('){
        ++it;
        a = expr();
        ++it;
    }else if(*it == 'c'){
        ++it;
        a = term();
        a = complement(a);
    }else{
        a = elements[*it];
        ++it;
    }
    return a;
}
    
set<int> expr()
{
    set<int> a = term(), b;
    while(*it == 'd' ||
          *it == 'i' ||
          *it == 's' ||
          *it == 'u')
    {
        char ch = *it; ++it;
        b = term();
        switch(ch)
        {
            case 'd':
                a = difference(a, b);
                break;
            case 'i':
                a = intersection(a, b);
                break;
            case 's':
                a = sym_difference(a, b);
                break;
            case 'u':
                a = union_(a, b);
                break;
        }
    }
    return a;
}

int main()
{
    char ch;
    int N, x;
    while(cin >> ch >> N)
    {
        elements.clear();
        set<int> U = {};

        do{
            if(ch == 'R') break;
            set<int> st;
            for(int i = 0 ; i < N ; i++){
                cin >> x;
                st.insert(x);
                U.insert(x);
            }                    
            elements[ch] = st;
        }while(cin >> ch >> N);

        elements['U'] = U;
        
        string str;
        cin >> str;
        it = str.begin();
        set<int> res = expr();
        if(res.size() == 0){
            cout << "NULL" << endl;
        }else{
            bool sp = 0;
            for(auto r : res){
                if(sp) cout << " ";
                sp = 1;
                cout << r;
            }
            cout << endl;
        }
    }
    return 0;
}

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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
#define INIT(a,b) memset(a,b,sizeof(a))
using lint = long long int;

string convert(string L, string R) {
    int n = min(L.size(), R.size()), m = L.size();
    for_(i,0,n) if (L[m - i - 1] != R[i]) return "#";
    if (L.size() < R.size()) return R.substr(L.size());
    return L.substr(0, L.size() - R.size());
}

int N;
string S[55];
lint C[55];

int main() {
    cin >> N;
    for_(i,0,N) cin >> S[i] >> C[i];

    struct State {
        int p;
        string T;
        lint cost;
        bool operator < (const State& o) const { return cost > o.cost; }
    };

    map<string, lint> memo[2];
    priority_queue<State> que;

    for_(i,0,N) {
        int m = S[i].size();
        string L = "";
        for_(j,0,m) {
            vector<string> cand = {S[i].substr(j), S[i].substr(j + 1)};
            for (const string& R : cand) {
                string T = convert(L, R);
                if (T != "#") {
                    int p = (L.size() < R.size() ? 1 : 0);
                    que.push(State{p, T, C[i]});
                    memo[p][T] = C[i];
                }
            }
            L += S[i][j];
        }
    }

    while (!que.empty()) {
        State s = que.top(); que.pop();

        if (s.T == "") {
            cout << s.cost << endl;
            return 0;
        }

        for_(i,0,N) {
            string L = (s.p == 0 ? s.T : S[i]);
            string R = (s.p == 1 ? s.T : S[i]);

            int p = (L.size() < R.size() ? 1 : 0);
            string T = convert(L, R);
            if (memo[p].count(T) == 0) memo[p][T] = 1LL << 60;
            if (memo[p][T] > s.cost + C[i]) {
                memo[p][T] = s.cost + C[i];
                que.push(State{p, T, s.cost + C[i]});
            }
        }
    }

    cout << -1 << endl;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  string s[H];

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

  for(int i=-1; i < H + 1; i++) {
    for(int j=-1; j < W+1; j++) {
      if(i == -1 || i == H) {
        cout << "#";
      }
      else {
        cout << "#" << s[i] << "#";
        break;
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////
int main() {
	int N;
	cin >> N;
	int four = 0;
	int key = 0;
	bool flag = false;
	for (int i = 0; i < N; ++i) {
		int a;
		cin >> a;
		if (a % 4 == 0) {
			four++;
		}
		else if (a % 2 != 0) {
			key++;
		}
		else {
			flag = true;
		}
	}
	int X;
	if (flag) {
		X = four + key + 1;
	}
	else {
		X = four + key;
	}
	if (X % 2 == 0) {
		if (four >= X / 2) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		if (four >= X / 2 ) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b;
    cin>>a;
    b =a%7;
    if(b==0){
        cout<<"thu"<<endl;
    }if(b==1){
        cout<<"fri"<<endl;
    }if(b==2){
        cout<<"sat"<<endl;
    }if(b==3){
        cout<<"sun"<<endl;
    }if(b==4){
        cout<<"mon"<<endl;
    }if(b==5){
        cout<<"tue"<<endl;
    }if(b==6){
        cout<<"wed"<<endl;
    }
    
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && b == c) {cout << 1 << endl;}
  else if (a == b || a == c || b == c) {cout << 2 << endl;}
  else if (a != b && a != c && b != c) {cout << 3 << endl;}
}

Measured memory_bytes: 3580
#include<cstdio>
using namespace std;

long gyaku(long n){
  long p[31],ans=1;
  p[0]=n;
  ans=n;
  for(int i=1;i<31;i++){
    p[i]=p[i-1]*p[i-1]%1000000007;
    if(i==2||i==9||i==11||i==14||i==15||i==17||i==19||i==20||i==23||i==24||i==25||i==27||i==28||i==29)
      ans=ans*p[i]%1000000007;
  }
  return ans;
}

int main(){
  long n,a[100010],ans=0,sum[100000]={};
  scanf("%ld",&n);
  for(long i=0;i<n;i++)
    scanf("%ld",&a[i]);
  sum[0]=1;
  for(int i=1;i<n;i++)
    sum[i]=(sum[i-1]+gyaku(i+1))%1000000007;
  for(int i=0;i<n;i++){
    ans+=a[i]*(sum[i-0]+sum[n-1-i]-1)%1000000007;
    ans%=1000000007;
  }
  for(int i=1;i<=n;i++){
    ans*=i;
    ans%=1000000007;
  }
  printf("%ld\n",ans);
}

Measured memory_bytes: 1792
#include <stdio.h>
 
int main(){
  int H,W,i,j;
  while(1){
    scanf("%d %d",&H,&W);
    if(H==0&&W==0){
      break;
    }
    for(i=0; i<H; i++){
      for(j=0; j<W; j++){
        if(i==0||j==0||j==W-1||i==H-1)
        printf("#");
        else printf(".");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}


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

int main() {
  string s;
  while(s!="0"){
    int sum=0;
    cin>>s;
    if(s=="0")break;
    for(int i=0;i<s.size();i++){
      sum+=s[i]-'0';
    }
    cout<<sum<<endl;
  }
  return 0;
}


Measured memory_bytes: 3188
#include <stdio.h>
#include <queue>

typedef std::pair<int, int> P;

const int INF = 1e5;
int H, W;
char s[50][51];

int d[50][50];
int di[4] = {1, 0, -1, 0}, dj[4] = {0, 1, 0, -1};

int bfs() {
    std::queue<P> que;

    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W; ++j) {
            d[i][j] = INF;
        }
    }

    que.push(P(0, 0));
    d[0][0] = 0;

    while (que.size()) {
        P p = que.front();
        que.pop();
        if (p.first == H - 1 && p.second == W - 1) {
            break;
        }

        for(int k = 0; k < 4; k++) {
            int ni = p.first + di[k], nj = p.second + dj[k];
            if (0 <= ni && ni < H && 0 <= nj && nj < W && s[ni][nj] != '#' && d[ni][nj] == INF) {
                que.push(P(ni, nj));
                d[ni][nj] = d[p.first][p.second] + 1;
            }
        }
    }

    return d[H-1][W-1];
}
int main() {
    scanf("%d %d", &H, &W);
    for(int i = 0; i < H; ++i) {
        scanf("%s", s[i]);
    }

    int n0 = -1;
    for(int i = 0; i < H; ++i) {
        for(int j = 0; j < W ; ++j) {
            if (s[i][j] == '.') {
                n0 += 1;
            }
        }
    }

    int nmin = bfs();


    if (nmin == INF) {
        nmin = n0 + 1;
    }

    printf("%d\n", n0 - nmin);

    return 0;
}

Measured memory_bytes: 256
# coding: UTF-8
N=int(input())
a=list(map(int,input().split()))
f=0
g=0
h=0
for i in range(N):
    if a[i]%4==0:
        f=f+1
    elif a[i]%2==0:
        g+=1
    else :
        h+=1
if g==0 and f>=h-1 :
    print("Yes")
elif g>=1 and f>=h:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14252
#include <bits/stdc++.h>
#define FOR(i,n) for(int i=0;i<(int)(n);i++)
#define FORR(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define pb(a) push_back(a)
#define mp(x,y) make_pair(x,y)
#define ALL(a) a.begin(),a.end()
#define ZERO(a) memset(a,0,sizeof(a))
#define len(a) sizeof(a)
#define ll long long
#define pii pair<int,int>
#define INF 1<<29
#define MAX 
using namespace std;

void solve(){
 int D,n,m;
 for(;;){
  cin>>D;
  if(!D) break;
  cin>>n;
  cin>>m;
  int ans=0;
  vector<int> d;
  d.pb(0); d.pb(D);
  int dd;
  FOR(i,n-1){
   cin>>dd;
   d.pb(dd);
  }
  int k,ind;
  sort(ALL(d));
  FOR(i,m){
   cin>>k;
   int ind=upper_bound(ALL(d),k)-d.begin();
   int mi=1000000001;
   if(ind<d.size()) mi=min(mi,d[ind]-k);
   ind--;
   if(ind>=0) mi=min(mi,k-d[ind]);
   ans+=mi;
  }
  cout<<ans<<endl;
 }
}

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

Measured memory_bytes: 3516
#include<bits/stdc++.h>
#define taskname "test1"
#define int long long
#define sz(a) static_cast<int>(a.size())
using namespace std;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);   cout.tie(nullptr);
    if (ifstream("test.inp"))
    {
        freopen("test.inp", "r", stdin);
        #ifdef CHECKING
            freopen(taskname".out", "w", stdout);
        #else
            freopen("test.out", "w", stdout);
        #endif //CHECKING
    }
    else if (ifstream(taskname".inp"))
    {
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }

    int n;  cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; ++i)
    {
        cin >> a[i];
        a[i] -= i;
    }
    sort(&a[1], &a[n] + 1);
    int b = a[(n + 1) >> 1];
    int ans = 0;
    for (int i = 1; i <= n; ++i) ans += abs(a[i] - b);
    cout << ans;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;

ll fast(ll a, ll n)
{
  ll ret=1;
  while (n>0)
  {
    if (n & 1)
    {
      ret = ret * a % MOD;
    }
    n = (n>>1);
    a = a * a % MOD;
  }
  return (ret);
}

ll comb(ll n, ll r)
{
  ll top=1;
  ll bot=1;
  ll ans;
  while (r>0)
  {
    top *= n; top %= MOD;
    bot *= r; bot %= MOD;
    n--; r--;
    //cout<<top<<" "<<bot<<endl;
  }
  ans = top * fast(bot,MOD-2) %MOD;
  return (ans);
}

int main()
{
  ll n,a,b;cin>>n>>a>>b;
   //2^n - 1 - nCa -nCbを出力したい
  ll ans = fast(2,n) - 1;
  ans %= MOD;
  ans = ans - comb(n,a) + MOD;
  ans %= MOD;
  ans = ans - comb(n,b) + MOD;
  ans %= MOD;
  cout<<ans<<endl;
}

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

int main(){
  int n;
  int r=0;
  cin >> n;
  
  if(n>1999)r=0;
  else if(n>=1800)r=1;
  else if(n>=1600)r=2;
  else if(n>=1400)r=3;
  else if(n>=1200)r=4;
  else if(n>=1000)r=5;
  else if(n>=800)r=6;
  else if(n>=600)r=7;
  else if(n>=400)r=8;
  
  cout << r <<endl;
  return 0;
}

Measured memory_bytes: 3636
from itertools import accumulate

n = int(input())
A = list(map(int, input().split()))
infi = 10 ** 20
SA = list(accumulate([0] + A))

dp = [[infi] * (n + 1) for _ in range(n + 1)]
# dp[i]左からi個決めた時の最小値とする。
if n >= 3:
    for i in range(n):
        dp[i][i] = 0
        dp[i][i + 1] = 0
        if i <= n - 2:
            dp[i][i + 2] = A[i] + A[i + 1]
    for d in range(n + 1):
        for i in range(n):
            j = i + d
            if j > n:
                continue
            if d >= 2:
                for m in range(i + 1, j + 1):
                    dp[i][j] = min(dp[i][j], dp[i][m] + dp[m][j] + SA[j] - SA[i])
    print(dp[0][n])
else:
    print(sum(A))


Measured memory_bytes: 44636
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void){
   string s,t;

   cin >> s >> t;
   sort(s.begin(), s.end());
   sort(t.begin(), t.end());
   reverse(t.begin(), t.end());

   if(s < t){
       cout << "Yes" << endl;
   }
   else{
       cout << "No" << endl;
   }
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long 
int ctoi(char c) {return c-'0';}/*char to int*/
int gcd(ll a,ll b){return b?gcd(b,a%b):a;}/*MAX*/
int lcm(ll a,ll b){return a*b/gcd(a,b);}/*MIN*/
bool primecheck(ll n){/*sosuu*/if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int  main(){
int n;
cin >> n;
vector<int>a(n);
for(int i=0;i<n;i++){
    cin >> a.at(i);
}
vector<bool>che(n,true);
int minn = a.at(0);
for(int i=1;i<n;i++){
    if(minn<=a.at(i))che.at(i)=false;
    minn = min(a.at(i),minn);
}
ll ans = 0;
for(int i=0;i<n;i++){
 if(che.at(i))ans++;
}
cout << ans << endl;
}





Measured memory_bytes: 1024
fun main(args: Array<String>) {
    arc093a()
}

fun arc093a() {
    val n = readLine()!!.toInt()
    val aList = (listOf(0) + readLine()!!.split(' ').map { it.toInt() } + listOf(0))
        .toIntArray()

    val allSum = (1..n + 1).map { Math.abs(aList[it - 1] - aList[it]) }.sum()

    val answer = (1..n).map {
        val before = aList[it - 1]
        val curr = aList[it]
        val after = aList[it + 1]
        if (curr in before..after || curr in after..before) allSum else {
            allSum - Math.min(Math.abs(before - curr), Math.abs(after - curr)) * 2
        }
    }.joinToString(System.lineSeparator())

    println(answer)
}


Measured memory_bytes: 57344
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

class Edge
{
public:
    int to, cost;
    Edge(){};
    Edge(int to0, int cost0){to = to0; cost = cost0;}
};

void shortestPath(const vector<vector<Edge> >& edges, int start, vector<int>& dist)
{
    dist.assign(edges.size(), INT_MAX);
    dist[start] = 0;
    priority_queue<pair<int,int> ,vector<pair<int,int> >, greater<pair<int,int> > > q;
    q.push(make_pair(0, start));

    while(!q.empty()){
        pair<int, int> p = q.top();
        q.pop();
        int v = p.second;
        if(dist[v] < p.first)
            continue;
        for(unsigned i=0; i<edges[v].size(); ++i){
            Edge e = edges[v][i];
            if(dist[v] + e.cost < dist[e.to]){
                dist[e.to] = dist[v] + e.cost;
                q.push(make_pair(dist[e.to], e.to));
            }
        }
    }
}

int main()
{
    for(;;){
        int n, m;
        cin >> n >> m;
        if(n == 0)
            return 0;
        
        vector<vector<Edge> > edges(2*n);
        for(int i=0; i<m; ++i){
            int a, b, c;
            cin >> a >> b >> c;
            -- a;
            -- b;
            edges[a].push_back(Edge(b, c));
            edges[b].push_back(Edge(a, c));
            edges[a+n].push_back(Edge(b+n, c));
            edges[b+n].push_back(Edge(a+n, c));
        }

        for(int i=0; i<n; ++i){
            for(unsigned j=0; j<edges[i+n].size(); ++j){
                int s = edges[i+n][j].to;
                for(unsigned k=0; k<edges[s].size(); ++k){
                    int t = edges[s][k].to;
                    edges[i].push_back(Edge(t, 0));
                }
            }
        }

        vector<int> dist;
        shortestPath(edges, 0, dist);
        cout << min(dist[n-1], dist[2*n-1]) << endl;
    }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll> > vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
const long long INF = numeric_limits<ll>::max();
const long long MOD = 1000000007;
const long double PI = 3.1415926;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
 
ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
//char c;
 
#define Endl endl
 
/*--------------------template--------------------*/
 
int main() {
    int a, b;
    cin >> a >> b;
    if (b >= a) cout << a << endl;
    else cout << a - 1 << endl;
    return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())
cnt = b - a + 1

def xor_chain(n):
	return n // 2 % 2

ans = 0
if a % 2 == 0:
	if b % 2 == 0:
		ans = xor_chain(cnt) ^ b
	else:
		ans = xor_chain(cnt)
else:
	if b % 2 == 0:
		ans = a ^ xor_chain(cnt - 2) ^ b
	else:
		ans = a ^ xor_chain(cnt)
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define ll long long
ll l,r;
int main ()
{
	cin>>l>>r;
	if(r-l>=2018)
	{
		printf("%d\n",0);
		return 0;
	}
	ll minn=2020;
	for(ll i=l;i<r;i++){
		for(ll j=r;j>l;j--){
			int tmp=(i*j)%2019;
			if(tmp<minn) minn=tmp;
		}	
	}
	cout<<minn<<endl;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f(i,a,b) for(i=a;i<=b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define ll long long
#define mod (1000*1000*1000+7)
#define scan1(x) scanf("%lld",&x)
#define scan2(x,y) scanf("%lld %lld",&x,&y)
#define scan3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define print(x) printf("%lld\n",x)
#define ff first
#define ss second
using namespace std;
ll n,i,j;
double p[3000];
vector<vector<double>> dp(3000,vector<double>(3000));

int main(){
    
    scan1(n);
    f(i,1,n)
    cin>>p[i];
    
    dp[0][0]=1.0;
    f(i,1,n)
    dp[i][0]=dp[i-1][0]*(1.0-p[i]);
    
    f(i,1,n)
    fd(j,i,1)
    dp[i][j]=dp[i-1][j]*(1.0-p[i])+dp[i-1][j-1]*p[i];
    
    double ans=0.0;
    f(i,(n+1)>>1,n)
    ans+=dp[n][i];
    
    printf("%.9f\n",ans);
    
}

Measured memory_bytes: 70656
#include<stdio.h>
int main()
{
	char l[5];
	char ball = 'A';
	while (fgets(l, 5, stdin)) {
		if (ball == l[0])
			ball = l[2];
		else if (ball == l[2])
			ball = l[0];
	}
	printf("%c\n", ball);
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
int min(int x, int y) { return x < y ? x : y; }
int max(int x, int y) { return x > y ? x : y; }
int main() {
	int n, a, minA = 1000, maxA = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a);
		minA = min(a, minA);
		maxA = max(a, maxA);
	}
	printf("%d\n", maxA - minA);
	return 0;
}

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

using namespace std;

typedef struct {
	int a;
	int b;
	int c;
} fuku_t;

int d, n;

int t[200];
fuku_t fuku[200];

int dp[200][200];

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

	for (int i = 0; i < d; ++i) cin >> t[i];

	for (int i = 0; i < n; ++i) scanf("%d %d %d", &fuku[i].a, &fuku[i].b, &fuku[i].c);

	for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) {
		if (fuku[j].a <= t[0] && t[0] <= fuku[j].b && fuku[i].a <= t[1] && t[1] <= fuku[i].b) {
			dp[1][i] = max(dp[1][i], abs(fuku[j].c - fuku[i].c));
		}
	}

	for (int i = 2; i < d; ++i) for (int j = 0; j < n; ++j) for (int k = 0; k < n; ++k) {
		if (fuku[j].a <= t[i] && t[i] <= fuku[j].b && fuku[k].a <= t[i - 1] && t[i - 1] <= fuku[k].b) {
			dp[i][j] = max(dp[i][j], dp[i - 1][k] + abs(fuku[k].c - fuku[j].c));
		}
	}

	int ans = 0;

	for (int i = 0; i < n; ++i) ans = max(ans, dp[d - 1][i]);

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

Measured memory_bytes: 1392
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d,i;
    cin>>a>>b>>c>>d;
    for(i=1;i>=1;i++)
    {
        if(i%2!=0)
        {
            c-=b;
        }
        else
        {
            a-=d;
        }
        if(c<=0||a<=0)
        {
            if(i%2!=0)
            {
                cout<<"Yes"<<endl;
            }
            else
            {
                cout<<"No"<<endl;
            }
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3596
s=int(input())
a=[s]
for i in range(1000000):
    if a[i]%2==0:
        a.append(a[i]//2)
    else:
        a.append(3*a[i]+1)
    if a.count(a[i+1])==2:
        ans=i+2
        break
print(ans)


Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <random>
using namespace std;

#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

ll n, s;

ll f(ll b, ll k) {
    if (k < b) return k;
    return f(b, k/b) + k % b;
}

ll solve() {
    if (s == n) return n+1;
    ll res = inf;
    ll p, q;
    for (ll i = 1; i < n; i++) {
        p = n / i; q = n / (i+1) + 1;
        if (p == q) break;
        ll v = f(p, n);
        if (v <= s && s <= v + i * (p-q) && (s - v) % i == 0)
            res = p - (s - v) / i;
    }
    for (ll i = p; i > 1; i--)
        if (f(i, n) == s)
            res = i;
    
    return (res >= inf ? -1 : res);
}

void input() {
    cin >> n >> s;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void) {
    long long n,k;
    long double ans = 0.0;
    cin >> n >> k;

    for (long long i=1; i<=n; i++) {
        long double sum = i;
        long double tmp = n;

        while( sum <= k-1 ) {
            sum *= 2.0;
            tmp *= 2.0;
        }
        ans += (1.0 / tmp);
        // ans += tmp;
    }

    // cout << ans << endl;
    printf("%.16Lf\n", ans);
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC_110_D solver = new ABC_110_D();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC_110_D {
        int mod = 1000000007;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int mNokori = m;
            long ans = 1;
            for (int i = 2; i * i <= mNokori; i++) {
                if (mNokori % i == 0) {
                    int cnt = 0;
                    while (mNokori % i == 0) {
                        cnt++;
                        mNokori /= i;
                    }
                    ans *= calcComb(cnt + n - 1, n - 1);
                    ans %= mod;
                }
            }
            if (mNokori != 1) {
                ans *= calcComb(n + 1 - 1, n - 1);
                ans %= mod;
            }


            out.print(ans);


        }

        long modpow(long a, int p) {
            if (p == 0) return 1;
            if (p % 2 == 0) {
                int halfP = p / 2;
                long halfA = modpow(a, halfP);
                return halfA * halfA % mod;
            } else {
                return a * modpow(a, p - 1) % mod;
            }
        }

        long calcComb(int a, int b) {
            if (b > a - b) return calcComb(a, a - b);
            long ansMul = 1;
            long ansDiv = 1;
            for (int i = 0; i < b; i++) {
                ansMul *= (a - i);
                ansDiv *= (i + 1);
                ansMul %= mod;
                ansDiv %= mod;
            }
            //ansMul / ansDivをやりたい
            //ansDivの逆元を使いたい
            long ans = ansMul * modpow(ansDiv, mod - 2) % mod;

            return ans;
        }

    }
}



Measured memory_bytes: 23764
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using ll = long long;
using namespace std;

int main() {
    
    int A,B; cin >> A >> B;

    if(A + B >= 10){
        cout << "error" << endl;
    } else {
        cout << A + B << endl;
    }

    return 0;
}


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

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

    int x,n; cin >> x >> n;
    vector<int> p(n);
    for(int i = 0;i < n;i ++) cin >> p.at(i);

    for(int i = 0;;i ++){

        bool hantei = true;

        for(int j = 0;j < n;j ++){
            if(p.at(j) == x - i) hantei = false;
        }
        if(hantei == true){
            cout << x - i << endl;
            return 0;
        }

        hantei = true;

        for(int j = 0;j < n;j ++){
            if(p.at(j) == x + i) hantei = false;
        }
        if(hantei == true){
            cout << x + i << endl;
            return 0;
        }

    }
}

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

#define MOD 1000000007

int N;
int A[100010];

int pow(int a, int x, int m) {
  int ret = 1;
  for (int i=0; i<x; i++) ret = (ret*a) % m;
  return ret;
}

bool valid() {
  if (N % 2 == 1) {
    if (A[0] != 1) return false;
    for (int i=1; i<=(N-1)/2; i++) {
      if (A[i*2] != 2) return false;
    }
  }
  else {
    for (int i=0; i<=(N-1)/2; i++) {
      if (A[i*2+1] != 2) return false;
    }
  }
  return true;
}

int main() {
  cin >> N;
  for (int i=0; i<N; i++) {
    int a;
    cin >> a;
    A[a]++;
  }
  if (valid()) cout << pow(2, N/2, MOD) << "\n";
  else         cout << 0 << "\n";
  return 0;
}


Measured memory_bytes: 640
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;

int main(void) {
	ll a, b, v, w, t;

	cin >> a >> v;
	cin >> b >> w;
	cin >> t;


	if (a < b) {
		b += t*w;
		a += t*v;
		if (a >= b) {
			cout << "YES" << endl;
			return 0;
		}
	}
	else if (a > b) {
		b -= t*w;
		a -= t*v;
		if (a <= b) {
			cout << "YES" << endl;
			return 0;
		}
	}
	else {
		cout << "YES" << endl;
		return 0;
	}


	cout << "NO" << endl;
	return 0;
}

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

int main(void)
{
    string s;
    cin >> s;
    if(s.substr(0,4) == "YAKI"){cout << "Yes" << endl;}
    else{cout << "No" << endl;}
    return 0;
}

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

int main(){

    long long N, T; cin >> N >> T;
    vector<long long> t(N);
    for(int i = 0; i < N; i++) cin >> t[i];


    long long ans = 0;
    for(int i = 1; i < N; i++){
         ans += min(T, t[i] - t[i - 1]); 
    }

    cout << ans + T << endl;
    return 0;
}

Measured memory_bytes: 1792
/*input
5 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000
*/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
 
using namespace std; 
 
int GCD(int x,int y){return y?GCD(y,x%y):x;}
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,a,b) for(int i=(a);i<(b);i++)
#define repm(i,a,b) for(int i=(a);i>(b);i--)
#define rept(v) for(auto it=v.begin();it<v.end();it++)
#define all(v) v.begin(),v.end()
const int INF = 1<<30;
typedef long long ll;
typedef pair<int,int> pii;
 
 
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m,k;
	cin >> n >> m >> k;
	int a[n], b[m];
	rep(i, n) cin >> a[i];
	rep(i, m) cin >> b[i];
	ll sum=0;int aptr=0, bptr=0, ans;
	while(sum+a[aptr]<=k&&aptr<n) sum+=a[aptr++];
	while(sum+b[bptr]<=k&&bptr<m) sum+=b[bptr++];
	ans = aptr+bptr;
	while(aptr>0&&bptr<m) {
		sum-=a[--aptr];
		while(sum+b[bptr]<=k&&bptr<m) sum+=b[bptr++];
		ans=max(ans,aptr+bptr);
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 5188
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
#define mod 998244353
#define ll long long
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
int add(int x,int y){return x+y>=mod?x+y-mod:x+y;}
int sub(int x,int y){return x-y<0?x-y+mod:x-y;}
int mul(int x,int y){return 1LL*x*y%mod;}
#define N 100005
int a[N],b[N];
signed main()
{
	int n,m,k;
	cin>>n>>m>>k;
	int mi=1e9,ans=0;
	for(int i=1;i<=n;i++) a[i]=read();
	for(int i=1;i<=n;i++) if(a[i]<mi) mi=a[i];
	ans=mi;
	for(int i=1;i<=m;i++) b[i]=read();
	for(int i=1;i<=n;i++) if(b[i]<mi) mi=b[i];
	ans+=mi;
	for(int i=1;i<=k;i++)
	{
		int  u=read(),v=read(),w=read();
		if(a[u]+b[v]-w<ans) ans=a[u]+b[v]-w;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 1024
#include<stdio.h>
int main(void) {
	int s;
	int i;
	
	
	int ans = 0;
	int ans1 = 0;
	scanf("%d", &s);
	ans = s / 100;
	ans1 =s%100 ;
	if (ans <= 12&&ans>0) {
		if (ans1 <= 12&&ans1>0) {
			printf("AMBIGUOUS\n");
		}
		else {
			printf("MMYY\n");
		}
	}
	else {
		if (ans1 <= 12 && ans1 > 0) {
			printf("YYMM\n");
		}
		else {
			printf("NA\n");
		}
	}
	return 0;

}

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

int main() {
  //input
  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  rep(i,N) {
    cin >> p.at(i);
  }
  //calc
  priority_queue<int> pq;
  int candidate = 0;
  rep(i,K) {
    candidate += p.at(i);
  }
  pq.push(candidate);
  for(int i = 1; i <= N - K; i++) {
    candidate -= p.at(i-1);
    candidate += p.at(i+K-1);
    pq.push(candidate);
  }
  int max_sum = pq.top();
  double answer = (max_sum + K) / 2.0;
  //answer;
  cout << fixed << setprecision(15) << answer << endl;
}

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

int main()
{
    int N,mx=0;
    cin >> N;
    vector<int> H(N);
    for(int i=0;i<N;i++) {
        cin >> H[i];
    }
    for(int i=0;i<N;i++) {
        mx = max(H[i],mx);
        if(mx-H[i]>1) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 640
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

for ans in range(10 ** n):
    flag = True
    ans = str(ans)
    if len(ans) == n:
        for i in range(m):
            if str(sc[i][1]) != ans[sc[i][0] - 1]:
                flag = False
        if flag == True:
            print(ans)
            exit()
print(-1)


Measured memory_bytes: 40176