akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k,sum=0;
    cin>>a>>b>>c>>k;

    while(k--)
    {
        if(a>0)
        {
            sum=sum+1;
            a--;
        }
        else if(b>0)
        {
            sum=sum+0;
            b--;
        }
        else if(c>0)
        {
            sum=sum-1;
            c--;
        }
    }

cout<<sum<<endl;



    return 0;
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define V vector
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define MOD 1000000007
#define INF 1e9
#define F first
#define S second
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(void){
    int N;
    cin>>N;

    ll ans=0;
    VI a(N,0),b(N,0),c(N,0);
    REP(i,N)cin>>a[i];
    REP(i,N)cin>>b[i];
    REP(i,N-1)cin>>c[i];
    REP(i,N){
        ans+=b[a[i]-1];
        if(a[i]==a[i-1]+1){
            ans+=c[a[i]-2];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while (isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

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

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        String a = fs.next(), b = fs.next(), c = fs.next();
        String ans;
        if (a.charAt(a.length() - 1) == b.charAt(0) && b.charAt(b.length() - 1) == c.charAt(0)) {
            ans = "YES";
        } else {
            ans = "NO";
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 22996
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <algorithm>

using namespace std;
#define n_max 100000

int main()
{
    int N;
    vector<int> d;
    int abc_cnt = 0;
    int ans = 0;

    cin >> N;

    for(int i = 0; i < N; i++){
        int tmp;
        cin >> tmp;
        d.push_back(tmp);
    }
    
    sort(d.begin(), d.end());

    //cout << d[N/2 - 1] << endl ;
    //cout << d[N/2] << endl ;

    if(d[N/2 - 1] == d[N/2]) { 
        cout << 0;
    } else {
        cout << d[N/2] - d[N/2 - 1];
    }

    return 0;
}


Measured memory_bytes: 892
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define fastIO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (???test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
int INPUT_INT() { int d; cin >> d; return d; } // ??\??????push_back(d)???array[d]???????????????1?????§?????????

// ------------------- include, typedef, define END. -------------------

bool uruu(LL Y) {
	return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false);
}

int main() {
	int c1, c5, c10, c50, c100, c500;
	cin >> c1 >> c5 >>c10 >> c50 >> c100 >> c500;

	LL sum = c1 + c5 * 5 + c10 * 10 + c50 * 50 + c100 * 100 + c500 * 500;


	cout << ((sum >= 1000) ? 1 : 0);

	puts("");
	return 0;
}

Measured memory_bytes: 1160
from typing import List


class DSU:
    def __init__(self, n: int = 0) -> None:
        self._n: int = n
        self.parent_or_size: List[int] = [-1] * n

    def merge(self, a: int, b: int) -> int:
        assert 0 <= a and a < self._n
        assert 0 <= b and b < self._n
        x, y = self.leader(a), self.leader(b)
        if x == y:
            return x
        if -self.parent_or_size[x] < -self.parent_or_size[y]:
            x, y = y, x
        self.parent_or_size[x] += self.parent_or_size[y]
        self.parent_or_size[y] = x
        return x

    def same(self, a: int, b: int) -> bool:
        assert 0 <= a and a < self._n
        assert 0 <= b and b < self._n
        return self.leader(a) == self.leader(b)

    def leader(self, a: int) -> int:
        assert 0 <= a and a < self._n
        if self.parent_or_size[a] < 0:
            return a
        self.parent_or_size[a] = self.leader(self.parent_or_size[a])
        return self.parent_or_size[a]


N, Q = map(int, input().split())

dsu = DSU(N)
for _ in range(Q):
    t, a, b = map(int, input().split())
    if t == 0:
        dsu.merge(a, b)
    else:
        print(int(dsu.same(a, b)))


Measured memory_bytes: 12664
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T, typename U, typename V>
ostream &operator<<(ostream &os, const tuple<T, U, V> &t){
  os << "(" << get<0>(t) << "," << get<1>(t) << "," << get<2>(t) << ")";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef tuple<int, int, int> TT;
typedef pair<int, TT> PT;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


int a[200000];
signed main(){
  int n, m;cin >> n >> m;
  rep(i,m){
    int l, r;cin >> l >> r;
    a[l]++;a[r+1]--;
  }
  repi(i,2,n+1)a[i] += a[i-1];
  int ans = 0;
  rrep(i,n)ans += a[i]==m;
  cout << ans << endl;
  return 0;
}






Measured memory_bytes: 1024
/*   --------------------
    |       LOSER        |
    |     ~NOOBOSS~      |
     --------------------
*/
#include <bits/stdc++.h>
using namespace std;

#define      inl(x)              scanf("%lld",&x)
#define      in(x)               scanf("%d",&x)
#define      mxx                 10000000000000
#define      mnn                 -10000000000000
#define      Y()                 cout<< "YES" <<endl
#define      N()                 cout << "NO"<<endl
#define      endl                "\n"
#define      max_3(a,b,c)        max(a, max(b,c))
#define      max_4(a,b,c,d)      max(a,max(b,max(c,d)))
#define      min_3(a,b,c)        min(a, min(b,c))
#define      min_4(a,b,c,d)      min(a,min(b,min(c,d)))
#define      gcd(a,b)            __gcd(a,b)
#define      lcm(a,b)           (a*b)/gcd(a,b)
#define      loser               return 0
#define      ll                  long long
#define      PI                  acos(-1)
#define      mem(a,v)            memset(a,v,sizeof(a))
#define      SORT(v)             sort(v.begin(),v.end())
#define      REV(v)              reverse(v.begin(),v.end())
#define      O(x)                cout<<x<<endl
#define      B                   begin()
#define      E                   end()
#define      V                   vector
#define      F                   first
#define      S                   second
#define      PSB                 push_back
#define      EMB                 emplace_back
#define      MP                  make_pair
#define      PII                 pair<int,int>
#define      MII                 map<int,int>
#define      FAST()              ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
const ll MOD = 998244353;
//auto it=std:: unique(v.B,v.E);
//v.resize(std::distance(v.B,it));
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
/*-----*/
#define bug1(a)  cout<<a<<endl;
#define bug2(a,b)  cout<<a<<" "<<b<<endl;
#define bug3(a,b,c)  cout<<a<<" "<<b<<" "<<c<<endl;
/*----*/
ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
ll binpow(ll a, ll b){ll res = 1;while (b > 0) {if (b & 1)res*=a;a*=a;b>>=1;}return res;}
ll fact(ll num){ll fac=1;while(num!=1){fac=fac*num;num--;}return fac;}
string to_binary(int x) {string s;while(x > 0) {s += (x % 2 ? '1' : '0');x /= 2;}reverse(s.begin(), s.end());return s;}
ll nsum(ll num){return (num*(num+1))/2;}
/*-----*/
const int N=2e5+5;

/*-----*/
//vector<int> v[202];

/*-----*/
int main()
{
	FAST();

       ll test=1;
       //cin>>test;
       while(test--){
           ll n;
           string s;
           cin>>n;
           string ans;
           while(n>0){
            n--;
            ans+=('a'+n%26);
            n/=26;
           }
           REV(ans);
           cout<<ans<<endl;

        }
	loser;
}
///////LeArN MoRe AnD Wait FoR ThE Result///////


Measured memory_bytes: 3596
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define deb(x) cout << #x << " is " << x << "\n";

using namespace std;
using namespace __gnu_pbds;

const double PI = 2 * acos(0.0);
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    char c;
    cin >>c;
    c = c + 1;
    cout <<c;
    return 0;
}


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

int dist[110][110];

int main() {
    int n, k;
    cin >> n >> k;
    if (k > (n - 2) * (n - 1) / 2) {
        cout << -1 << endl;
        return 0;
    }
    int ma = (n - 2) * (n - 1) / 2;
    int sub = ma - k;
    vector<int> v[n + 1];
    int m = 0;
    for (int i = 2; i <= n; i++) {
        v[1].push_back(i);
        m++;
    }
    int idx = n - 1;
    while (sub > 0) {
        for (int j = idx; j < n; j++) {
            v[idx].push_back(j + 1);
            m++;
            sub--;
            if (sub == 0) break;
        }
        idx--;
    }
    cout << m << endl;
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < v[i].size(); j++) {
            cout << i << " " << v[i][j] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
s = input()

if len(s) != 2:
    for i in range(len(s) - 2):
        if s[i] == s[i + 1] or s[i + 1] == s[i + 2] or s[i] == s[i + 2]:
            print(i + 1, i + 3)
            exit()

else:
    if s[0] == s[1]:
        print(1, 2)
        exit()


print(-1, -1)

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

int main()
{
  int bell1, bell2, bell3, price1, price2, price3;
  price1 = 0;
  price2 = 0;
  price3 = 0;

  cin >> bell1 >> bell2 >> bell3;
  price1 = bell1 + bell2;
  price2 = bell2 + bell3;
  price3 = bell3 + bell1;

  if(price1<=price2)
  {
    if(price1 <= price3)
    cout << price1 << endl;
    else
    cout << price3 << endl;
  }

  else if(price2<=price3)
  {
    if(price2<=price1)
    cout << price2 << endl;
    else
    cout << price1 << endl;
  }

  else if(price3<=price1)
  {
    if(price3<=price2)
    cout << price3 << endl;
    else
    cout << price2 << endl;
  }

}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <string>
#include <map>
#include <algorithm>
#include <stack>
#include <cstdlib>
#include <iomanip>
#include <ctime>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    string s;
  	cin >> s;
  	int ans = 0, cur = 0;
  	for (int i = 0; i < 3; i++)
    	if (s[i] == 'R')
        	cur++;
  		else {
          ans = max(ans, cur);
          cur = 0;
        }
  	ans = max(ans, cur);
  	cout << ans << '\n';
    return 0;
}

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

using namespace std;

#define INP "solve"
#define OUT "solve"

const int QQ = 3e5 + 10;
const int maxN = (1 << 21) + 100;
const int maxM = 3e5 + 100;
const long long oo = 4e18;
const int INF = 2e9 + 100;
const int MOD = 1e9 + 7;
const int Base = 311;
const long double du = 1e-9;
const string YES = "YES";
const string NO = "NO";
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, 1, 0, -1};

void doc() {
    freopen(INP ".inp","r",stdin);
    freopen(OUT ".out","w",stdout);
}

void solve() {
    string s;
    cin >> s;
    int n = (int)s.size();
    string t;
    while ((int)t.size() < n) t += "hi";
    if (t == s) cout << "Yes";
    else cout << "No";
}
int main(int argc,char *argv[]) {
    srand(time(nullptr));
    ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
   /// doc();
    solve();
}


Measured memory_bytes: 256
import copy
import numpy as np

h, w, k =  map(int, input().split())
redK = (h*w)-k

result = 0
table = []
for i in range(h):
  table.append(list(input()))

totalBlackCount = 0
for i in range(h):
  for j in range(w):
    if table[i-1][j-1] == '#':
      table[i-1][j-1] = 0
      totalBlackCount += 1
    else:
      table[i-1][j-1] = 1
npTable = np.asarray(table)

rowPattern = []
columnPattern = []
rowCount = 0
columnCount = 0
for i in range(2**h):
  rowPattern.append(list(format(rowCount, str('0')+str(h)+'b')))
  rowCount += 1
for i in range(2**w):
  columnPattern.append(list(format(columnCount, str('0')+str(w)+'b')))
  columnCount += 1

rowRed = []
rowBlack = []
columnRed = []
columnBlack = []
for i in range(h):
  columnRed.append(1)
  columnBlack.append(0)
for i in range(w):
  rowRed.append(1)
  rowBlack.append(0)

for i in range(2**h):
  npCalcTable = copy.deepcopy(npTable)
  rowBit = rowPattern[i-1]
  rowColorTable = []
  for j in range(h):
    if rowBit[j] == '0':
      rowColorTable.append(rowBlack)
    else:
      rowColorTable.append(rowRed)
  npRowColorTable = np.asarray(rowColorTable)
  for j in range(2**w):
    columnBit = columnPattern[j-1]
    columnColorTable = []    
    for k in range(w):
      if columnBit[k-1] == '0':
        columnColorTable.append(columnBlack)
      else:
        columnColorTable.append(columnRed)
    npColumnColorTable = np.asarray(columnColorTable).T
    npColorTable = npRowColorTable | npColumnColorTable
    npDiffTable = npColorTable | npCalcTable

    if np.sum(npDiffTable) == int(redK):
      result += 1
print(result)

Measured memory_bytes: 27280
import sys,collections

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# Summarize count of factor within list -- START --
def summarize_list(l):
  sl=sorted(l)

  a=sl[0]
  c=1
  res=[]

  for x in sl[1:]:
    if x==a:
      c+=1
    else:
      res.append([a,c])
      a=x
      c=1
  res.append([a,c])

  return res
# Summarize count of factor within list --- END ---

def main():
  n=I()
  l=[S() for _ in range(n)]

  l=summarize_list(l)

  l=sorted(l,key=lambda x:x[0])
  l=sorted(l,key=lambda x:x[1],reverse=True)

  a=l[0][1]
  print(l[0][0])

  for x,y in l[1:]:
    if y!=a:
      break
    else:
      print(x)

main()
# print(main())


Measured memory_bytes: 40976
#include <iostream>
#include <cstdio>
using namespace std;
 
int main(){
  int i,j;
  int n,S,r[20000],cnt;
  while(1){
    cnt =0;
 
    cin >> n >> S;
    if(n==0&&S==0)break;
 
    for(i=0;i<n;i++)cin>>r[i];
     
for(j=0;j<n-1;j++){
    for(i=j+1;i<n;i++){
      if((r[j]+r[i])>S)cnt++;
    }
    }
    cout << cnt << endl;
 
}
 
  return 0;
}

Measured memory_bytes: 1204
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)
#define pf push_front
#define ins insert

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
unsigned XorShift(void){static unsigned x = 123456789;static unsigned y = 362436069;static unsigned z = 521288629;static unsigned w = 88675123;unsigned t;t = x ^ (x << 11);x = y; y = z; z = w;return w = (w ^ (w >> 19)) ^ (t ^ (t >> 8));}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

int h,w,k,t;

main(){
	cin>>h>>w>>k;
	rep(i,h+1){
		rep(j,w+1){
			if(k==i*w+j*h-2*i*j){
				dump("Yes");
				return 0;
			}
		}
	}
	dump("No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <boost/functional/hash.hpp>
//example: unordered_set< pair<int,int>,boost::hash< std::pair<int, int> > > used;
//priority_queue< pair<int,pair<int,int> >, vector<pair<int,pair<int,int>>>, greater<pair<int,pair<int,int> > > > pqueue;    //cost, vertex(行き先)
using namespace std;

#define MODULE 1000000007
#define MP make_pair
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second



template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
template<typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val){ //usage: int dp[10][10]; Fill(dp,INF);
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef pair<int, int> P;
typedef long long LL;
const int INF = INT_MAX / 2;    //int_max->2*e+9 LLの時はLLONG_MAX
/*const int MAXN = 100001;

struct edge {
    edge(int to, int cost) : to(to), cost(cost) {}
    int to, cost;
};
vector<edge> graph[MAXN];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};*/

//-----Template---------
string str;
int main(){
    ios::sync_with_stdio(false); //cout<< fixed << setprecision(10);
    cin>>str;
    bool n=false;
    bool s=false;
    bool e=false;
    bool w=false;
    for(int i=0;i<str.length();i++){
        switch(str[i]){
            case 'N':
                n=true;
                break;
            case 'S':
                s=true;
                break;
            case 'E':
                e=true;
                break;
            case 'W':
                w=true;
                break;
        }
    }
    //bool flag = true;
    if(n!=s || e!=w){
        cout<<"No"<<endl;
    }else{
        cout<<"Yes"<<endl;
    }

}

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

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

  std::string A, B;
  std::cin >> A >> B;
  if (A.length() < B.length()) {
    std::cout << "LESS\n";
    return 0;
  } else if (A.length() > B.length()) {
    std::cout << "GREATER\n";
    return 0;
  }

  for (size_t i=0; i<A.length(); ++i) {
    if (A[i] < B[i]) {
      std::cout << "LESS\n";
      return 0;
    } else if (A[i] > B[i]) {
      std::cout << "GREATER\n";
      return 0;
    }
  }

  std::cout << "EQUAL\n";
  return 0;
}


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

using namespace std;

const long MOD = 1000000007;
typedef pair<int, int> P;
typedef long long ll;

int main(){
    int N, M;
    cin >> N >> M;

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

    P bc[M];
    for(int i=0; i<M; i++){
        int b, c;
        cin >> b >> c;
        bc[i] = P(c, b);
    }

    sort(A, A+N);
    sort(bc, bc+M, greater<P>());

    long ans = 0;
    int ind = 0;
    for(int i=0; i<N; i++){
        if(bc[ind].second == 0) ind++;
        if(ind == M){
            ans += (ll)A[i];
        }else{
            if(bc[ind].first > A[i]){
                ans += (ll)bc[ind].first;
                bc[ind].second--;
            }else{
                ans += (ll)A[i];
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
import Data.Bits
import Data.Bool
import Data.List

solve :: Int -> Int -> [Int] -> Int
solve n k a = fst $ foldr f (0, sums) [0..39] where
  sums = concatMap (scanl1 (+)) $ init $ tails a 
  f e (c, sums)
    | length ok >= k = (nc, ok)
    | otherwise = (c, sums)
    where
      ok = filter ((== nc) . (.&. nc)) sums
      nc = c + 2^e

main = do
  [n,k] <- readWords
  a <- readWords
  print $ solve n k a

readWords = map read . words <$> getLine

Measured memory_bytes: 43260
#include<stdio.h>
int main(){
int a[3][3],c,b[8]={0},n;
for(int i=0;i<3;i++)
    for(int f=0;f<3;f++)
        scanf("%d",&a[i][f]);
    scanf("%d",&n);
    for(int t=0;t<n;t++)
    {
        scanf("%d",&c);
    for(int i=0;i<3;i++)
    for(int f=0;f<3;f++)
        if(a[i][f]==c)
            a[i][f]=0;
    }
    for(int i=0;i<3;i++)
    for(int f=0;f<3;f++)
    {b[i]=b[i]+a[i][f];
    b[f+3]=b[f+3]+a[i][f];
    if(i==f)b[6]=b[6]+a[i][f];
    if(i+f==2)b[7]=b[7]+a[i][f];
    }
    int y=0;
    for(int i=0;i<8;i++){
        if(b[i]==0){
        y=1;break;}}

    if(y==1)
        printf("Yes\n");
    else printf("No\n");

}


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

int kiriage(int a,int b){
  return (a + (b - 1)) / b;
}

int main(){
  int n,k; cin >> n >> k;
  int cnt;
  for(int i=1;i<=n;i++){
    int a; cin >> a;
    if(a==1){
      cnt = i;
      break;
    }
  }
  
  int left_num = cnt-1;
  int right_num = n-cnt;
  
  cout << kiriage(left_num + right_num,k-1) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int a,b,c;
	int oishii;
	
	scanf("%d %d %d",&a,&b,&c);
	
	if(b>c){
		oishii=b+c;
	}else if(a+b<c){
		oishii=a+b+1+b;
	}else{
		oishii=b+c;
	}
	
	printf("%d",oishii);
	
	return 0;
}

Measured memory_bytes: 128
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,m = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in range(n)]
    ab.sort()
    res = 0
    for a,b in ab:
        if m<=b:
            res += a*m
            print(res)
            exit()
        else:
            res += a*b
            m -= b

if __name__ == '__main__':
    main()

Measured memory_bytes: 56412
#include <bits/stdc++.h>
using namespace std;
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define fill(x, y)     memset(x, y, sizeof(y))
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define rep(i, x, y)   for (__typeof(x) i = x; i <= y; i ++)
#define repi(i, x, y)  for (__typeof(x) i = x; i >= y; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
const   int            inf = 0;
const   double         eps = 0;
const   int            ms  = 0;
const   int            md  = 0;


int main() {
  ios::sync_with_stdio(false);
  int N;
  float prob;
  cin >> N;
  if (N == 1) {
      prob = 1.000000000;
  }
  else if (N % 2 == 0) {
      prob = 0.5000000000;
  }
  else {
      prob = ((1.000000000 * (N - 1) / 2.000000000) + 1) / (1.000000000 * N);
  }
  cout << prob;
  return 0;
}

Measured memory_bytes: 256
def main():
    import heapq
    x,y,a,b,c = map(int,input().split(" "))
    rs = list(map(int,input().split(" ")))
    rg = list(map(int,input().split(" ")))
    rn = list(map(int,input().split(" ")))

    rs_s = sorted(rs,reverse=True)[:x]
    rg_s = sorted(rg,reverse=True)[:y]

    hp = []
    for r in rs_s:
        heapq.heappush(hp,r)
    for r in rg_s:
        heapq.heappush(hp,r)

    rn.sort(reverse=True)

    sum = 0
    i = 0
    rnlen = len(rn)

    while len(hp)>0:
        r = heapq.heappop(hp)
        if i < rnlen:
            if r < rn[i]:
                sum+=rn[i]
                i+=1
            else:
                sum+=r
        else:
            sum+=r
    
    print(sum)
main()

Measured memory_bytes: 22848
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;

int main(){
  int N, K;
  cin >> N >> K;
  vi h(N);
  for(int i = 0; i < N; i++){
    cin >> h.at(i);
  }
  sort(ALL(h));
  int result = 1000000000;
  for(int i = 0; i < N - (K-1); i++){
    chmin(result, h.at(i+K-1) - h.at(i));
  }
  cout << result << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
#include<cmath>

using namespace std;


int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    int sum=0;
    for(int i=0;i<1000;i++){
        string p = to_string(i);
        if(p.length() == 2){
            p = "0"+p;
        }else if(p.length() == 1){
            p = "00"+p;
        }
        int pi=0;
        for(int si=0;si<S.size();si++){
            if(S[si] == p[pi]){
                pi++;
                if(pi == 3){
                    sum++;
                }
            }
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n;
    cin>>n;
    string a="zabcdefghijklmnopqrstuvwxy";
    vector<int>p;
    while(1)
    {
       bool ok=false;
       p.push_back(n%26);
       if(n%26==0)
            ok=true;
       n=n/26;
       if(ok==true)
        n=n-1;
       if(n==0)
        break;

    }
    for(int i=p.size()-1; i>=0; i--)
        cout<<a[p[i]];
    cout<<endl;
    return 0;
}



Measured memory_bytes: 3640
import java.util.Scanner;


public class Main {

	static String[][]  map;
	static int h;
	static int w;
	static int cnt;

	public static void main(String[] args)  {
		Scanner sc = new Scanner(System.in);
		double d = Double.parseDouble(sc.next());
		double t = Double.parseDouble(sc.next());
		double s = Double.parseDouble(sc.next());
		

		if(d/s <= t) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		


	}
}

Measured memory_bytes: 27020
#include <stdio.h>
#include <math.h>

int prime(int n)
{
    for (int i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return 0;
    return n;
}

int main(void)
{
    int ans = 0;
    int x;
    scanf("%d", &x);

    int i = 0;
    while (ans == 0)
    {
        int tmp = x + i;
        if(prime(tmp))
            ans = tmp;
        else
            i++;
    }

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

    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<vector>
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
using namespace std;
#define rep2(x,from,to) for(long long (x)=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 1000000000000000
int c;
int d;
int main()
{
    int a,b;
    cin>>a>>b;
    if(b==100)
    {
        if(a==0)cout<<101<<endl;
        if(a==1)cout<<10100<<endl;
        if(a==2)cout<<1010000<<endl;
        return 0;
    }
    cout<<b;
    for(int i=0;i<a;i++)
    {
        cout<<"00";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a[200000]={0};
	int n,m,x,y,i;
	scanf("%d %d",&n,&m);
	int flag=0;
	for(i=0;i<m;i++)
	{
		scanf("%d %d",&x,&y);
		if(x==1&&y!=n)
		{
			a[y]++;
		}
		if(y==n&&x!=1)
		{
			a[x]++;
		}
		if(a[x]==2||a[y]==2)
		{
			flag=1;
		}
	}
	if(flag==1) printf("POSSIBLE\n");
	else printf("IMPOSSIBLE\n");
	return 0;
} 

Measured memory_bytes: 896
//==================================================================================================
// Name        : SAO.cpp
// Author      : lotus.eater086
// Copyright   : If you're reading this then this warning is for you. Every word you read of this 
//               useless fine print is another second of your life. Don't you've other things to do?
//               Is your life so empty that you honestly can't think of a better way to spend these
//               moments ? Or are you so impressed with authority that you give respect and 
//               credence to all who claim it ? Do you read everything you're supposed to read ? Do
//               you think everything you're supposed to think ? Buy what you're told you should 
//               want ? Get out of your apartment . Meet a member of the opposite sex. Stop the 
//               excessive shopping and self-improvement . Quit your boring job.
//               Start a fight. Prove you're alive. If you don't claim your humanity you'll become a
//               statistic. You've been warned !

// Description : 
// Date        : 2019-08-06
// Time        : 19:30:54
// Directory   : c:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode
// FilePath    : c:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode\SAO.cpp
//==================================================================================================
    

#include <bits/stdc++.h>
#define LL long long
#define endl "\n"

using namespace std ;
    
//
template < typename T >

inline T read( T &x )
{

    x = 0 ;

    int f = 0 ;

    char ch = getchar() ;

    while( ch < '0' || ch > '9' )  {

        f |= ( ch == '-' ) , ch = getchar() ;

    }

    while( ch >= '0' && ch <= '9' )  {

        x = ( x << 1 ) + ( x << 3 ) + ch - '0' , ch = getchar() ;

    }

    return x = f ? -x:x ;

}
//

void solve( void )
{

    int A , B , C ;

    read( A ) , read( B ) , read( C ) ;

    if( (A-B) >= C )  cout << 0 << endl ;

    else  cout << C-A+B << endl ;  

}

int main( void )

{

    ios_base::sync_with_stdio( false ) ;  cin.tie( NULL ) ;  cout.tie( NULL ) ;

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

    if( 0 )  {

        int t = 100 ;

        for( int i = 1 ; i <= t ; i++ )  solve() ;

    }

    else  {

        solve() ;

    }

   // #ifndef ONLINE_JUDGE
   //     cout << "\nTime Elapsed: " << 1.0*clock()/CLOCKS_PER_SEC << " sec\n" ;
   // #endif

    return 0 ;

}


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

ll MOD = 1000000007;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	//cin >>t;
	ll t= 1;

	while(t--)
	{
		ll k;
		cin >> k ;
		ll cnt  = 0;
		ll amt = 100;
		
		while(amt < k)
		{
			amt += (amt/100);
			cnt++;
		} 
		cout << cnt << endl;

	}
}

Measured memory_bytes: 3652
import sys
input = sys.stdin.readline
def gcd(a, b):
    while b: a, b = b, a % b
    return a

N = int(input())
S = 0
Y = []
for i in range(N):
    a, b = map(int, input().split())
    if b > a:
        S += b-a
        Y.append((b, b))
    else:
        Y.append((a, b))

Y = sorted(Y)
YY = [0] * (N+1)
for i in range(N):
    YY[i+1] = YY[i] + Y[i][0]

# i番目を除いてn個選ぶときの余裕度
def f(i, n):
    return S - Y[i][0] + Y[i][1] - (YY[n] if n <= i else YY[n+1] - Y[i][0])

ma1, ma2 = 0, 1
for i in range(N):
    l = 0
    r = N
    while r - l > 1:
        m = (l+r) // 2
        if f(i, m) >= 0:
            l = m
        else:
            r = m

    a = l * Y[i][1] + min(f(i, l), Y[i][1])
    b = N * Y[i][1]
    if a * ma2 > b * ma1:
        ma1, ma2 = a, b

g = gcd(ma1, ma2)
print(ma1//g, ma2//g)

Measured memory_bytes: 53596
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  string s;
  cin >> s;

  REP(i, 19){
    if(i == 5 || i == 13) cout << " ";
    else cout << s[i];
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <functional>
#include <sstream>
#include <complex>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define EPS 1e-8

int kake(int x, int y){ return min(x,y); }
int pulas(int x, int y){ return max(x,y); }
int inverse(int x){ return 2-x; }


int parse(char *s, int p, int q, int r){
	//printf("%c\n",*s);
	switch(*s){
		case '\0' : return 0;
		case 'P' : return p;
		case 'Q' : return q;
		case 'R' : return r;
		case '0' : case '1' : case '2' : return *s-'0';
		
		case '-' :
			return inverse(parse(s+1,p,q,r));
		case '(' :
			int x=1;
			char *tmp = s+1;
			do{
				if( *tmp=='(' )x++;
				else if( *tmp==')' )x--;
				if( x==1 ){
					if( *tmp=='*' || *tmp=='+' ) break;
				}
				//printf("x:%d , %c\n",x,*tmp);
				tmp++;
			}while(x);
			
			//printf("e? : %c\n",*tmp);
			if( *tmp=='*' ){
				return kake(parse(s+1,p,q,r),parse(tmp+1,p,q,r));
			}else if( *tmp=='+' ){
				return pulas(parse(s+1,p,q,r),parse(tmp+1,p,q,r));
			}
			puts("error");
	}
	return 0;
}
int main(){
	char in[128];
	int ret;
	while(scanf("%s",in),strcmp(in,".")){
		ret = 0;
		rep(p,3)rep(q,3)rep(r,3)if( parse(in,p,q,r)==2 )ret++;
		printf("%d\n",ret);
	}
	return 0;
}

Measured memory_bytes: 0
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <utility>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
#include <climits>
#include <numeric>
#include<stdio.h>
#include <queue>
#include <iomanip>
#include <float.h>
#include <set>
#include<functional>
#include <stack>
#include <time.h>
#include <climits>
#include <bitset>
#include <fstream>
using namespace std;
typedef pair<int, int>p;
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
vector<long long> divisor(long long n) {
	vector< long long> ret;
	for (long long i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(begin(ret), end(ret));
	return (ret);
}
struct LazySegmentTree {
private:
	int n;
	vector<int> node, lazy;
	vector<bool> lazyFlag;

public:
	LazySegmentTree(vector<int> v) {
		int sz = (int)v.size();
		n = 1; while (n < sz) n *= 2;
		node.resize(2 * n - 1);
		lazy.resize(2 * n - 1, INT_MAX);
		lazyFlag.resize(2 * n - 1, false);

		for (int i = 0; i<sz; i++) node[i + n - 1] = v[i];
		for (int i = n - 2; i >= 0; i--) node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
	}

	void lazyEvaluate(int k, int l, int r) {
		if (lazyFlag[k]) {
			node[k] = lazy[k];
			if (r - l > 1) {
				lazy[k * 2 + 1] = lazy[k * 2 + 2] = lazy[k];
				lazyFlag[k * 2 + 1] = lazyFlag[k * 2 + 2] = true;
			}
			lazyFlag[k] = false;
		}
	}

	void update(int a, int b, int x, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		lazyEvaluate(k, l, r);
		if (b <= l || r <= a) return;
		if (a <= l && r <= b) {
			lazy[k] = x;
			lazyFlag[k] = true;
			lazyEvaluate(k, l, r);
		}
		else {
			update(a, b, x, 2 * k + 1, l, (l + r) / 2);
			update(a, b, x, 2 * k + 2, (l + r) / 2, r);
			node[k] = min(node[2 * k + 1], node[2 * k + 2]);
		}
	}

	int find(int a, int b, int k = 0, int l = 0, int r = -1) {
		if (r < 0) r = n;
		lazyEvaluate(k, l, r);
		if (b <= l || r <= a) return INT_MAX;
		if (a <= l && r <= b) return node[k];
		int vl = find(a, b, 2 * k + 1, l, (l + r) / 2);
		int vr = find(a, b, 2 * k + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
};
long long mod = 1000000007;
signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(16);
	long long two[100004];
	long long three[100004];
	two[0] = 1;
	three[0] = 1;
	for (int i = 1; i < 100004; i++) {
		two[i] = two[i - 1] * 2;
		two[i] %= mod;
		three[i] = three[i - 1] * 3;
		three[i] %= mod;
	}
	string s;
	cin >> s;
	long long ans = 0;
	long long tmp = 1;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '1') {
			ans += tmp*three[s.length() - i - 1];
			ans %= mod;
			tmp *= 2;
			tmp %= mod;
		}
	}
	ans += tmp;
	ans %= mod;
	cout << ans;
}

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

int main() {
  int n;
  cin >> n;
  set<char> st;

  for (int i=0; i<n; i++) {
    char c;
    cin >> c;
    st.insert(c);
  }

  cout << (st.size()==4 ? "Four": "Three");
}

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

int main() {
  int N,L;
  cin >> N>>L;
  vector<int> d(N);
  vector<int> e(N);

  for(int i=0;i<N;i++){
    d[i]= L+i;
    e[i]= abs(d[i]);
  }
  int idx=0,m=e[0];
  for(int i=1;i<N;i++){
    if(m>e[i]){
      idx = i;
      m = e[i];
    }
  }

  int sum=0;
  for(int i=0;i<N;i++){
    sum += d[i];
  }
  //cout<< sum-d[idx]<<endl;
  cout<< sum-d[idx]<<endl;
}


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

#define rep(i,n) for(int i=0;i<n;i++)
#define all(v,a,b) v.begin(a),v.end(b)
#define in cin>>
#define out cout<<
#define end <<endl
#define INF 100000000000

int main()
{
	int N, K;
	in N >> K;
	vector<int> h(110000);
	rep(i, N)
	{
		in h.at(i);
	}
	vector<long> ans(110000);
	rep(i, 110000)
	{
		ans.at(i) = INF;
	}
	ans.at(0) = 0;
	rep(i, N)
	{
		rep(j, K+1)
		{
			ans.at(i + j) = min(ans.at(i + j), ans.at(i) + abs(h.at(i + j) - h.at(i)));
		}
	}
	out ans.at(N - 1) end;
}


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

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";
long long prime[1000000];

void sieve()
{
	prime[0]=0;
	prime[1]=0;
	for(int i=2;i<1000000;i++)
		prime[i]=1;

	for(int i=2;i*i<1000000;i++)
		if(prime[i]==1)
			for(int j=i*i;j<1000000;j+=i)
				prime[j]=0;
}

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i <= floor(sqrt(n)); i++)
        if (n % i == 0)
            return false;

    return true;
}

int factorial(int n)
{
    int f=1;
    for(int i = 1;i<=n ; i++)
        f = (f*i)%mod;
    return f;
}

int gcd(int a, int b)
{
	return !b ? a : gcd(b, a % b);
}

int lcm(int a, int b)
{
	return (a / gcd(a, b)) * b;
}

int fastExponentiation(int n, int x, int modulo)
{
	int res = 1;
	while(x > 0)
       {
          if(x & 1)
          res = (res*n) % modulo;
          x = x >> 1;
          n = (n * n) % modulo;
       }
       return res;
}

int power(int n , int p )
{
	if(p==0)
	   return 1;

	 int res = power((n*n)%mod,p/2);
	 if(p%2==1)
	   res = (n*res)%mod;

	   	 return res;
}

bool isPowerOfTwo(int n)
{
   	return n && (!(n&(n-1)));
}

bool isSet(int n,int i)
{
	// To check if ith bit is set or not in binary representation of n
   	return n & (1 << i);
}

bool valid_coordinate(ll x,ll y,ll n,ll m)
{
    if(x<0 || y<0)
       return false;

   	else if(x>=n || y>=m)
       return false;

   	else
   		return true;
}

int sod(int n)
{
	int sum=0;
	while(n)
	{
		sum+=(n%10);
		n/=10;
	}
	return sum;
}



void solve()
{
	string s;
	cin>>s;
	int a,b;
	a=b=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='A')
		a++;
		if(s[i]=='B')
		b++;
	}
	if(a>0&&b>0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
}

int32_t main()
{

	//int t; cin>>t; while(t--)
	solve();

	return 0;
}


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

using namespace std;

void solve()
{
	int n;
	while(cin >> n, n)
	{
		bool flag[1000001];
		memset(flag, 0, sizeof(flag));
		int temp;
		for(int i = 0; i < n; ++i)
		{
			cin >> temp;
			flag[temp] = true;
		}
		bool first = true;
		for(int i = 1; i < 1000001; ++i)
		{
			if(flag[i])
			{
				if(!first)
				{
					cout << " ";
				}
				if(i + 1 < 1000001 && flag[i + 1] == true)
				{
					cout << i << "-";
					while(flag[i] == true)
					{
						++i;
					}
					cout << i - 1;
				}
				else
				{
					cout << i;
				}
				first = false;
			}
		}
		cout << endl;
	}
}

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

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(){
    int big[3];
    for(int i=0;i<3;i++)big[i]=0;
    for(int i=0;i<10;i++){
        int a;
        cin>>a;
        if(a>big[0]){
            big[2]=big[1];
            big[1]=big[0];
            big[0]=a;
        }
        else if(a>big[1]){
            big[2]=big[1];
            big[1]=a;
        }
        else if(a>big[2])big[2]=a;
    }
    int W=big[0]+big[1]+big[2];

    for(int i=0;i<3;i++)big[i]=0;
    for(int i=0;i<10;i++){
        int a;
        cin>>a;
        if(a>big[0]){
            big[2]=big[1];
            big[1]=big[0];
            big[0]=a;
        }
        else if(a>big[1]){
            big[2]=big[1];
            big[1]=a;
        }
        else if(a>big[2])big[2]=a;
    }
    int K=big[0]+big[1]+big[2];
    cout<<W<<" "<<K<<endl;
    return 0;
}

Measured memory_bytes: 1164