akhauriyash/Code-Regression huggingface dataset:
import sys
import math

def is_capable(n, k, w, P):
    track = 0
    cnt = 0
    i = 0

    while cnt < k:
        if i == n:
            return True

        if track + w[i] > P:
            track = 0
            cnt += 1
        else:
            track += w[i]
            i += 1

    return False
    pass

# ??\?????¨
n, k = map(int, sys.stdin.readline().split())
w = []
for i in range(n):
    w.append(int(sys.stdin.readline().strip()))

'''
print(n,k)
print(w)
'''

# ????????¨

if k == 1:
    ans = sum(w)
    print(ans)
elif n == 1:
    ans = w[0]
    print(ans)
else:
    max_p = sum(w)
    min_p = math.ceil(max_p / k) - 1

    # print(max_p, min_p)
    # sys.exit(0)

    capable = {min_p:False, max_p:True}

    # sys.exit(0)
    
    bottom = min_p
    top = max_p

    while bottom < top:
        mid = (bottom + top) // 2

        if mid not in capable:
            capable[mid] = is_capable(n, k, w, mid)

        if capable[mid] == True:
            if (mid - 1) not in capable:
                capable[mid - 1] = is_capable(n, k, w, mid - 1)

            if capable[mid - 1] == False:
                ans = mid
                break
            else:
                top = mid
        elif capable[mid] == False:
            if (mid + 1) not in capable:
                capable[mid + 1] = is_capable(n, k, w, mid + 1)

            if capable[mid + 1] == True:
                ans = mid + 1
                break
            else:
                bottom = mid + 1

    print(ans)
    # print(capable)

Measured memory_bytes: 11716
#include <iostream>
#include <algorithm>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl


int main() {
    int n, m, cnt;
    cin >> n >> m;
    int vec[n][m];
    int col[m];

    for(int i = 0;i < n; i++){
        for(int j = 0;j < m; j++){
            cin >> vec[i][j];
        }
    }
    for(int j = 0;j < m; j++){
        cin >> col[j];
    }

    for(int i = 0;i < n; i++){
        cnt = 0;
        for(int j = 0;j < m; j++){
            cnt += vec[i][j] * col[j];
        }
        cout << cnt << endl;
    }

    return 0;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
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 FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int gcd(int a, int b){return (b==0?a:gcd(b,a%b));}
int lcm(int a, int b){return a/gcd(a,b)*b;}

int main(){
  int N, X;
  cin >> N >> X;
  vector<int> v;
  rep(i,N){
    int x;
    cin >> x;
    v.push_back(abs(x-X));
  }

  int ret = v[0];
  REP(i,1,N){
    ret = gcd(ret, v[i]);
  }
  cout << ret << endl;
  
  return 0;
}


Measured memory_bytes: 892
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

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

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

void solve(ll N, ll M, vector<ll> a, vector<ll> b) {
  vector<int> cnt(N, 0);
  for (ll i: a) cnt[i - 1]++;
  for (ll i: b) cnt[i - 1]++;
  for (int i: cnt) cout << i << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll M;
	ll N;
	scanf("%lld", &N);
	scanf("%lld", &M);
	vector<ll> a(M-1+1);
	vector<ll> b(M-1+1);
	for (int i = 0 ; i <= M-1 ; i++) {
	  scanf("%lld", &a[i]);
	  scanf("%lld", &b[i]);
	}
	solve(N, M, a, b);
	return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("faild to read char") as char)
        .take_while(|c| !c.is_whitespace())
        .collect();
    token
        .parse()
        .ok()
        .expect("faild to parse token")
}

fn main(){
    let s: u64 = read::<String>().into_bytes().into_iter().fold(0, |sum, a| sum + (a as u64));
    if s == 195 || s == 198 {
        println!("No");
    } else {
        println!("Yes");
    }
}



Measured memory_bytes: 4352
import sys
input = sys.stdin.readline

def main():
    N,x = map(int,input().split())
    a = list(map(int,input().split()))
    
    ans = 0
    for i in range(N-1):
        if (a[i+1] + a[i] > x):
            eat = a[i+1]+a[i]-x
            ans += eat
            if eat <= a[i+1]:
                a[i+1] -= eat
            else:
                a[i+1] = 0
                
    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 14132
n,m=map(int,input().split())
A=[int(input()) for _ in range(m)]
DP=[0]*(n+1)
DP[0]=1
DP[1]=1

for a in A:
	DP[a]=-1
	
if DP[1]==-1:DP[1]=0

for i in range(n-1):
		if DP[i+2]<0:
			DP[i+2]=0
		else:
			DP[i+2]=DP[i+1]+DP[i]

print(DP[n]%1000000007)	

Measured memory_bytes: 460020
N = int(input())
S = input()

c = 0

for i in range(N):
    x = 1
    while True:
        j = i + x
        k = j + x
        if k >= N:
            break
        if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
            c += 1
        x += 1

ans = S.count("R") * S.count("G") * S.count("B") - c
print(ans)


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

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PI;

int main() {
	int x, y;
	while (cin >> x >> y) {
		if (x == 0 && y == 0)
			break;
		cout << min(x, y) << " " << max(x, y) << endl;
	}
	return 0;
}


Measured memory_bytes: 3008
import sys
readline = sys.stdin.readline

def main():
    N = int(readline())
    S = [readline().rstrip() for _ in range(N)]
    alp = list('abcdefghijklmnopqrstuvwxyz')
    d = {a: 100 for a in alp}
    for s in S:
        for w in alp:
            if w in s:
                d[w] = min(d[w], s.count(w))
            else:
                d[w] = 0

    d = sorted(d.items())
    for k, v in d:
        if v == 100:
            continue
        print(k * v, end='')


if __name__ == '__main__':
    main()

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

bool han(int p, int q, int m, int n){
  int x = m*m+n*n;
  if((m*p+n*q)%x==0&&(m*q-n*p)%x==0) return true;
  else return false;
}

int main(){
  int q;
  cin >> q;
  map<int,vector<pair<int,int>>> mp;
  rep(i,151){
    repp(j,i,151){
      if(i!=0||j!=1){
        mp[i*i+j*j].push_back({i,j});
      }
    }
  }
  int m,n;
  rep(t,q){
    cin >> m >> n;
    int x = m*m+n*n;
    bool ok=true;
    repp(i,2,sqrt(x)+1){
      if(x%i==0){
        int k = i;
        vector<pair<int,int>> &v=mp[k];
        for(auto &p:v){
          if(han(m,n,p.first,p.second)){ok=false;goto next;}
          if(han(m,n,-p.first,p.second)){ok=false;goto next;}
          if(han(m,n,p.first,-p.second)){ok=false;goto next;}
          if(han(m,n,-p.first,-p.second)){ok=false;goto next;}
        }
        k=x/i;
        v=mp[k];
        for(auto &p:v){
          if(han(m,n,p.first,p.second)){ok=false;goto next;}
          if(han(m,n,-p.first,p.second)){ok=false;goto next;}
          if(han(m,n,p.first,-p.second)){ok=false;goto next;}
          if(han(m,n,-p.first,-p.second)){ok=false;goto next;}
        }
      }
    }
    next:;
    if(ok) cout << "P" << endl;
    else cout << "C" << endl;
  }
  return 0;
}



Measured memory_bytes: 3880
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 505

// it's swapnil07 ;)

int n, k;
int arr[MAXN];

bool play(int x){
    vector<int> up;
    int val = 0;
    int ans = 0;

    For(i, 0, n){
        if(arr[i]%x==0){
            continue;
        }
        int v1 = arr[i]/x;
        int v2 = v1+1;
        int upp = x*v2 - arr[i];
        val += upp;
        up.pb(upp);
    }

    if(up.size() == 0)
        return true;

    sort(all(up));

    int j = up.size() - 1;

    For(i, 0, up.size()){
        if(up[i]==x){
            break;
        }
        int v = up[i];
        ans += v;
        for(j; j>=0; j--){
            int vv = x - up[j];
            up[j] += min(v, vv);
            v -= min(v, vv);
            if(v==0)
                break;
        }
    }

    if(ans <= k){
        return true;
    }
    else{
        return false;
    }
}

signed main(){
    fast
    #ifdef SWAPNIL07
        freopen("/home/swapnil/Desktop/c++/input.txt","r",stdin);
        freopen("/home/swapnil/Desktop/c++/output.txt","w",stdout);
    #endif
    cin>>n>>k;
    int sumv = 0;
    For(i, 0, n){
        cin>>arr[i];
        sumv += arr[i];
    }
    int ans = 1;

    if(k>sumv){
        cout<<sumv;
        return 0;
    }

    vector<int> div;

    for(int i=1; i*i<=sumv; i++){
        if(sumv%i == 0){
            div.pb(i);
            div.pb(sumv/i);
        }
    }

    for(auto i: div){
        if(sumv % i == 0){
            bool v = play(i);
            if(v)
                ans = max(i, ans);
        }
    }
    cout<<ans;
    return 0;
}

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

int main(){
  int N;
  cin>>N;
  vector<int> v(N);
  
  int i;
  for (i = 0; i < N; i++) {
		cin >> v[i];
  }
  sort(v.begin(), v.end());

  v.erase( unique(v.begin(), v.end()), v.end() );
  int M=v.size();
 if(N!=M)cout<<"NO";
  	
  else cout<<"YES";
  
  
}

Measured memory_bytes: 1152
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <tuple>
#include <cstring>
#include <map>
#include <iomanip>
#include <ctime>
#include <complex>
#include <cassert>
#include <climits>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>
typedef priority_queue<Tiii, vector<Tiii>, greater<Tiii>> pq;

class UnionFind {
public:
    vector<int> par;
    vector<int> rnk;
    vector<int> sze;

    UnionFind(ll n): par(n), rnk(n, 0), sze(n, 1) {
        for (ll i = 0; i < n; ++i) par[i] = i;
    }

    void init(int n) {
        for (int i = 0; i < n; i++) {
            par.resize(n);
            rnk.assign(n, 0);
            sze.assign(n, 1);
        }
    }

    int find(int x) {
        if (par[x] == x) return x;
        else return par[x] = find(par[x]);
    }

    bool unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return 0;
        if (rnk[x] < rnk[y]) {
            sze[y] = sze[x] + sze[y];
            par[x] = y;
        }
        else {
            sze[x] = sze[x] + sze[y];
            par[y] = x;
            if (rnk[x] == rnk[y]) rnk[x]++;
        }
        return 1;
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }

    bool size(int x) {
        return sze[find(x)];
    }
};

pair<vector<Pii>, int> Kruscal(int v, pq U) {
    UnionFind uf(v);
    vector<Pii> mst;
    int cost = 0;
    while (!U.empty()) {
        Tiii q = U.top();
        U.pop();
        int c = get<0>(q), ti = get<1>(q), tj = get<2>(q);
        if (!uf.same(ti, tj)) {
            uf.unite(ti, tj);
            mst.emplace_back(ti, tj);
            cost += c;
        }
    }
    return pair<vector<Pii>, int>(mst, cost);
}

int main() {
    int v, e;
    cin >> v >> e;

    pq que;
    for (int i = 0; i < e; i++) {
        int a, b, r;
        cin >> a >> b >> r;
        que.push(Tiii(r, a, b));
    }

    cout << Kruscal(v, que).second << endl;
}


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

int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    vector<int64_t> f(2);
    vector<int64_t> s(2);
    cin >> f[0] >> f[1] >> s[0] >> s[1];
    sort(f.begin(), f.end());
    sort(s.begin(), s.end());
    int64_t ans = -1e19;
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
            ans = max(ans, f[i] * s[j]);    
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3652
import sys
for l in sys.stdin:
  H, W = map(int,l.split())
  if H == 0 and W == 0:
    break
  for i,h in enumerate(range(H)):
    if i % 2 == 0:
      print (('#.' * (int(W/2)+1))[:W])
    else:
      print(('.#' * (int(W/2)+1))[:W])
  print ('')

Measured memory_bytes: 7664
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin >>s;
    bool flag = true;
    for(int i = 1; i < 4; i++)
        if(s[i] == s[i-1])
            flag = false;
    if(flag)
        cout <<"Good";
    else 
        cout <<"Bad";
    return 0;
}


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

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

  set<string> st;
  int n; cin >> n;
  REP(i, n) {
    string s; cin >> s;
    st.insert(s);
  }
  cout << SZ(st) << endl;


}
























Measured memory_bytes: 19108
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <tuple>
# include <unordered_map>
# include <numeric>
# include <complex>
# include <bitset>
# include <random>
# include <chrono>
# include <cstdlib>
# include <tuple>
# include <array>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using D = double;
constexpr int INF = 2147483647;
constexpr int HINF = INF / 2;
constexpr double DINF = 100000000000000000.0;
constexpr double HDINF = 50000000000000000.0;
constexpr long long LINF = 9223372036854775807;
constexpr long long HLINF = 4500000000000000000;
const double PI = acos(-1);
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_num(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define RALL(qpqpq)           (qpqpq).rbegin(),(qpqpq).rend()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define RFOR(i,tptpt,ypypy)  for(LL i=(tptpt);i>=(ypypy);i--)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
double a[1010];
vector < pair<double, int>>v;
int main() {
	cin >> n;
	REP(i, n) {
		cin >> a[i];
		v.emplace_back(make_pair(a[i], i));
	}
	double ans = -INF;
	sort(ALL(v));
	reverse(ALL(v));
	REP(i, n) {
		REP(j, n) {
			if (i == j)continue;
			double num[2];
			int cur = 0;
			REP(k, n) {
				if (cur == 2)break;
				if (v[k].second == i || v[k].second == j)continue;
				num[cur] = v[k].first;
				cur++;
			}
			ans = max(ans, (num[0] + num[1]) / abs(a[i] - a[j]));
		}
	}
	cout<<fixed<<setprecision(13) << ans << endl;
}


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

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  priority_queue<int> p, q, r;
  rep(i,a) {
    int z;
    cin >> z;
    p.push(z);
  }
  rep(i,b) {
    int z;
    cin >> z;
    q.push(z);
  }
  rep(i,c) {
    int z;
    cin >> z;
    r.push(z);
  }
  ll ans = 0;
  int rc = 0;
  while (x+y-rc > 0) {
    int s = 0, t = 0, u = 0;
    if (!p.empty() && x > 0) s = p.top();
    if (!q.empty() && y > 0) t = q.top();
    if (!r.empty()) u = r.top();
    if (s >= t && s >= u && x > 0) {
      ans += s;
      p.pop();
      x--;
    }
    else if (t >= s && t >= u && y > 0) {
      ans += t;
      q.pop();
      y--;
    }
    else if (u > s && u > t) {
      ans += u;
      r.pop();
      rc++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1784
n, m, k = gets.chomp.split.map(&:to_i)
a = gets.chomp.split.map(&:to_i)
b = gets.chomp.split.map(&:to_i)

a.unshift(0)
b.unshift(0)

1.step(n) do |i|
  a[i] += a[i - 1]
end
1.step(m) do |j|
  b[j] += b[j - 1]
end

i = 0
j = m
res = 0

while j >= 0 && i <= n
  break if a[i] > k
  j -= 1 while b[j] > k - a[i] && j > 0
  res = [res, j + i].max
  i += 1
end
puts res

Measured memory_bytes: 47596
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	string ans;

	if (S == "ABC") {
		ans = "ARC";
	} else {
		ans = "ABC";
	}

	cout << ans << endl;

	return 0;
}

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

int main(void){
  int n;
  cin >> n;
  string s[n];
  for(int i = 0; i < n; i++) cin >> s[i];
  bool flag = true;
  for(int i = 0; i < n - 1; i++){
    if(s[i][s[i].length() - 1] != s[i + 1][0]){
      flag = false;
      break;
    }
  }
  int c = 0;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < n; j++){
      if(s[i] == s[j]) c++;
    }
    if(c != 1){
      flag = false;
      break;
    }
    c = 0;
  }
  
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

	
   
   

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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp make_pair
#define pb push_back

const long long MOD = 1000000007;
const long long INF = 1LL<<60;


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

    ll x;
    cin >> x;

    ll a = x / 500 * 1000;
    ll b = x % 500 / 5 * 5;

    cout << a + b << endl;

    return 0;
}


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

int main(){

    int k;
    cin >> k;

    int e=0,o=0;

    for(int i=1;i<=k;i++){
        if(i%2==0) e++;
        else o++;
    }

    cout << e*o << endl;

    return 0;
}

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

int a[100005];

int main()
{
	string s;
	cin>>s;
	int cnt=0;
	for(int i=0; i<s.length(); i++)
	{
		if(s[i]=='R') cnt++;
		else a[i]=cnt, cnt=0;
	}
	for(int i=s.length()-1; i>=0; i--)
	{
		if(s[i]=='L') cnt++;
		else a[i]=cnt, cnt=0;
	}
	for(int i=0; i<s.length(); i++)
	{
		if(a[i]!=0 && s[i]=='R')
		{
			int temp=a[i]+a[i+1];
			if(temp%2==0) a[i]=temp/2, a[i+1]=a[i];
			else
			{
				temp/=2;
				if(a[i]%2==1) a[i]=temp, a[i+1]=temp+1;
				else a[i]=temp+1, a[i+1]=temp;
			}
		}
		cout<<a[i] <<" ";
	}
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
int main(){
	const int INF = 10000000;
	int min_p = INF, min_j = INF;
	for(int i=0;i<5;i++){
		int n;
		std::cin >> n;
		if(i < 3)
			min_p = std::min(min_p, n);
		else
			min_j = std::min(min_j, n);
	}
	std::cout << min_p + min_j - 50 << std::endl;
}

Measured memory_bytes: 0
using System;
using System.IO;
using System.Linq;

class Solve{
    static void Main(string[] args){
        Console.ReadLine();
        var answer = Console.ReadLine().Split().Select(int.Parse).Min(x => { var y = 0; while ((x & 1) == 0) { x >>= 1; y++; } return y; });
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}}

Measured memory_bytes: 28396
/*
*  Author: windystreet
*  Date  : 2019-04-13 20:02:03
*  Motto : Think twice, code once.
*/
#include<bits/stdc++.h>

using namespace std;

#define X first
#define Y second
#define eps  1e-5
#define gcd __gcd
#define pb push_back
#define PI acos(-1.0)
#define lowbit(x) (x)&(-x)
#define bug printf("!!!!!\n");
#define mem(x,y) memset(x,y,sizeof(x))

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef unsigned long long uLL;

const int maxn = 100+7;
const int INF  = 1<<30;
const int mod  = 1e9+7;

int s[maxn];
int a[maxn];
void solve(){
    int n;
    while(cin>>n){
    	s[0] = 0;
    	mem(a,0);
    	int ans= 0;
    	for(int i=1;i<=n;i++){
    		cin>>s[i];
    		a[i] = max(a[i-1],s[i]);
    	}
    	for(int i=1;i<=n;i++){
    		if(a[i] == s[i]) ++ans;
    	}
    	cout<<ans<<'\n';
    }
    
    return;
}

int main()
{
#ifndef ONLINE_JUDGE
   // freopen("F:/in.txt","r",stdin);
#endif
//    freopen("out.txt","w",stdout);
//    ios::sync_with_stdio(false);
    int t = 1;
    //scanf("%d",&t);
    while(t--){
    //    printf("Case %d: ",cas++);
        solve();
    }
    return 0;
}

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

typedef long long int ll;
int main(){

ll a, b, r1, r2, r3, result;

scanf("%lld %lld", &a, &b);

r1 = a * b;
r2 = a + b;
r3 = a - b;

result = max(r1, r2);
result = max(result, r3);

printf("%lld\n", result);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <iomanip>
#if __cplusplus >= 201103L
#include <unordered_map>
#include <unordered_set>
#endif
#define ls x<<1
#define rs x<<1|1
#define fi first
#define se second
#define ll long long
#define pb push_back
#define mp make_pair
#define fun function
#define vi vector<int>
#define lowbit(x) x&(-x)
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);

using namespace std;

const int INF = 0x3f3f3f3f;

ll a[111];

int main() {
	IOS;
#ifdef xiaofan
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
#endif

	int n;
	cin>>n;
	ll mi=INF,ma=-INF;
	for(int i=0;i<n;i++){
		cin>>a[i];
		mi=min(a[i],mi);
		ma=max(a[i],ma);
	} 
	ll ans=1e16;
	for(int i=mi;i<=ma;i++){
		ll sum=0;
		for(int j=0;j<n;j++){
			sum=sum+fabs(i-a[j])*fabs(i-a[j]);
		}
		ans=min(ans,sum);
	
	}
	cout<<ans<<endl;



	return 0;
}



Measured memory_bytes: 256
parseint(x) = parse(Int, x)
readints() = map(parseint, readline() |> split)

function cnt(l, r, n)
    fld(r, n) - fld(l-1, n)
end

function main()
    a, b, c, d = readints()
    m = lcm(c, d)
    println(b - a + 1 - (cnt(a, b, c) + cnt(a, b, d) - cnt(a, b, m)))
end

main()


Measured memory_bytes: 114856
n=int(input())
l=[int(x) for x in input().split()]
sum=0
n=len(l)
for i in range(0,n):
    if(i==0):
        if(len(l)>1 and l[i]>l[i+1]):
            sum=sum+(l[i]+l[i+1])
        else:
            sum=sum+(l[i]*2)
    elif(i==n-1):
        sum=sum+l[i]
    else:
        if(l[i]<=l[i+1]):
            sum=sum+l[i]
        else:
            sum=sum+l[i+1]
print(sum)
            

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n; cin >> n;
    map<string, int> mp;
    repeat (i, n) {
        string s;
        cin >> s;
        ++mp[s];
    }
    
    int m; cin >> m;
    repeat (i, m) {
        string s;
        cin >> s;
        --mp[s];
    }
    
    int ans = 0;
    for (auto &e: mp) {
        int value = e.snd;
        ans = max(ans, value);
    }
    cout << ans;
}

Measured memory_bytes: 256
#include<stdio.h>
char s[10010];
int r=0;
void f(long long a){
	char d[20],i;
	for(i=0;a;a/=10)d[i++]=a%10+'0';
	while(i--)s[r++]=d[i];
}
int main(){
	long long n,a=1,b,i,j;
	char c[][5]={"Fizz","Buzz"};
	scanf("%lld",&n);//printf("%lld\n",n);fflush(stdout);
	for(i=2;n>=6*a*8*(i+4)-5;i++){
		n-=6*a*8*(i+4)-5;
		a*=10;
	}//printf("%lld\n",n);
	if(8*(i+4)-5<n)n+=5;
	b=n/(8*(i+4));
	n%=8*(i+4);//printf("%lld %lld %lld\n",a,b,n);fflush(stdout);
	for(i=1;i<=30;i++){
		if(i%3==0){
			for(j=0;j<4;j++)s[r++]=c[0][j];
		}
		if(i%5==0){
			for(j=0;j<4;j++)s[r++]=c[1][j];
		}
		if(i%3&&i%5)f(a*10+(b-1)*15+i+5);
	}
	s[n+19]=0;
	printf("%s\n",s+n-1);
	return 0;
}


Measured memory_bytes: 2140
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
LL A[SIZE],F[SIZE];
int main(){
    LL N,K;
    R(N,K);
    REP(i,N)R(A[i]);
    REP(i,N)R(F[i]);
    sort(A,A+N);
    sort(F,F+N,greater<LL>());
    LL ll=0,rr=1e12;
    while(ll<rr){
        LL mm=(ll+rr)/2;
        LL need=0;
        REP(i,N){
            if(A[i]*F[i]>mm){
                need+=(A[i]*F[i]-mm+F[i]-1)/F[i];
            }
            if(need>K)break;
        }
        if(need>K)ll=mm+1;
        else rr=mm;
    }
    W(ll);
    return 0;
}


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

signed main() {
  string S;
  cin >> S;
  
  string mae = "";
  int ans = 0;
  for( int i = 0; i < S.size(); i++ ){
    if( i == 0 ){
      mae += S.at(i);
      ans++;
    }else{
      if( mae == S.substr(i, 1) ){
        mae = S.substr(i, 2);
        if( i != S.size()-1 ) ans++;
        i++;
      }else{
        mae = S.substr(i,1);
        ans++;
      }
    }
  }
  cout << ans << endl;
}

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

int main(){

  while(1){

    int n, p, cnt = 0, win, sum = 0;
    int human[51] = {0};

    cin >> n >> p;
    if(n == 0 && p == 0) break;

    while(1){
      cnt = 0;
      if(p == 0){
	for(int i = 0; i < n; i++){
	  if(human[i] == 0){
	    cnt++;
	  }else if(human[i] != 0) win = i;
	}
	if(cnt == n - 1){
	  cout << win << endl;
	  break;
	}else {
	  //cout << "B";
	  p = human[sum];
	  human[sum] = 0;
	  sum++;
	  cnt = 0;
	  if(sum > n - 1) sum = 0;
	}
      }else {
	p -= 1;
	//cout << "A";
	human[sum] += 1;
	sum++;
	if(sum > n - 1) sum = 0;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>
#include <bitset>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    ll weight;
    Edge(int t, ll w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

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

ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}

constexpr ll LNF = 1LL<<50;

constexpr int INF = 1e9+7;

const long double PI=3.14159265358979323846;


vector<int> dx = {1,0,-1,1,-1,0};
vector<int> dy = {1,1,1,0,0,-1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,k; cin >> n >> k;
    vector<ll> a(n);
    rep(i,0,n){
        cin >> a[i];
    }
    rep(i,k,n){
        ll p = a[i];
        ll q = a[i-k];
        if(p>q){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
const long long Mod=1e9+7;
// must edit

long long fst(long long x, long long n){
    long long temp=1;
    if (n==0)return 1;
    temp=fst(x,n/2);
    if(n%2==0)return (temp%Mod * temp%Mod)%Mod;
    else return (x%Mod*(temp%Mod * temp%Mod)%Mod)%Mod;
}

long long c(long long n, long long k) {
    long long res = 1;
    for (long long i = 1; i <= k; ++i){
        res = ((res*(long long)(n - k + i)%Mod) *fst(i,Mod-2)%Mod)%Mod;
        res %= Mod;
    }
    return res ;
}

int main ()
{
long long n , a , b ;
cin >> n >> a >> b ;
long long ans = fst(2,n);
ans-=1;
if (a==b){
    ans= ans - c(n,a);
    ans%=Mod;
    ans+=Mod;
    ans%=Mod;
    cout << ans;
}
else {
    ans = ans-(c(n,a)+c(n,b));
    ans%=Mod;
    ans+=Mod;
    ans%=Mod;
    cout << ans ;
}
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
struct job
{
	int a,b;
}j[200005];
int n;
bool cmp(job x,job y)
{
	if(x.b<y.b)return true;
	else
	  if(x.b>y.b) return false;
	return x.a>y.a;
}
int main()
{
	cin>>n;
	int t=0;
	for(int i=1;i<=n;i++)cin>>j[i].a>>j[i].b;
	sort(j+1,j+1+n,cmp);
	for(int i=1;i<=n;i++)
	{
		t+=j[i].a;
		if(t>j[i].b)
		{
			cout<<"No\n";
			return 0;
		}
	}
	cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 1792
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,m = LI()
    p = [[float(x) for x in input().split()] for i in range(n)]
    f = [[sum([(a-b)**2 for (a,b) in zip(p[i],p[j])]) for j in range(n)] for i in range(n)]
    l = 1<<n
    ans = 0
    for b in range(l):
        if bin(b).count("1") != m:
            continue
        s = 0
        for i in range(n):
            if not b&(1<<i):
                continue
            x = p[i]
            for j in range(i):
                if not b&(1<<j):
                    continue
                y = p[j]
                s += f[i][j]
        if ans < s:
            ans = s
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()



Measured memory_bytes: 8180
#include <stdio.h>
#include <math.h>
#define MAX 10000

int main(int argc, char const *argv[])
{
  int i, j, n, count = 0;
  int prime[MAX];

  for(i=0; i<=MAX; i++)
    prime[i] = 1;            //i == 1 -> prime
  prime[0] = prime[1] = 0;   //i == 0 -> !prime

  for(i=2; i<sqrt(MAX); i++) {
    if(prime[i] == 1) {
      for(j=i; i*j <= MAX; j++) {
        prime[i*j] = 0;
      }
    }
  }

  while(scanf("%d", &n) != EOF) {
    count = 0;
    for(i=1; i<=n; i++)
      if(prime[i] + prime[(n+1)-i] == 2)
        count++;
    printf("%d\n", count);
  }

  return 0;
}

Measured memory_bytes: 632
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    string S;
    cin >> S;
    for(int i = 0; i < S.size() - 8; i++){
        cout << S.at(i);
    }
    cout << endl;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
    double L;
  double ans;
    cin >> L ;
  ans =(double)(L / 3)* (double)(L/3)* (double)(L/3);
          cout << fixed << setprecision(15) << ans << endl;
    return 0;
}


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

struct pair_3
{
    string val1;
    int val2;
    int val3;
};

 
bool operator<(const pair_3& left, const pair_3& right) {
    if (left.val1 != right.val1){
        return left.val1 < right.val1;
    } else {
        if (left.val2 != right.val2){
            return left.val2 < right.val2;
        } else {
            return left.val3 < right.val3;
        }
    }
}


int main(){
    int N;
    cin >> N;
    vector<pair_3> restaurants(N);
    rep(i,N){
        string s;
        int p;
        cin >> s >> p;
        restaurants[i] = {s,-p,i+1};
    }
    sort(restaurants.begin(),restaurants.end());
    for (pair_3 restaurant : restaurants){
        cout << restaurant.val3 << endl;;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int num=0,ans=0,flag=0;
  char ch;
  while((ch=getchar())!=EOF){
    if(ch>='0' && ch<='9'){
      num=(num*10)+(ch-'0');
      flag=1;
    }
    else{
      if(flag==1){ ans+=num; num=0; flag=0; }
    }
  }
  printf("%d\n",ans);
  return 0;
}



Measured memory_bytes: 2104
H,W = map(int,input().split())
S = ["."+input()+"."for i in range(H)]
S = ["."*(W+2)]+S+["."*(W+2)]
flag=0
for i in range(H):
    for j in range(W):
        if S[i][j] == "#":
            if S[i-1][j]== "." and S[i+1][j]=="." and S[i][j-1]=="." and S[i][j+1]==".":
                flag=1
print("Yes" if flag==0 else "No")

Measured memory_bytes: 3064
N = int(input())
d = {}
M = 1

for i in range(N) :
    S = input()
    if S in d.keys() :
        d[S] += 1
        if d[S] > M :
            M = d[S]
    else :
        d.setdefault(S,1)

d = sorted(d.items())
for w,t in d :
    if t == M :
        print(w)




    

Measured memory_bytes: 46640
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
  string S;
  
  cin >> S;
  
  int ans = 1000;
  for(int i = 2;i < S.size();i++){
    int X = 100*(S.at(i-2)-'0') + 10*(S.at(i-1)-'0') + (S.at(i)-'0');
    ans = min(ans, abs(753 - X));
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9+7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

int main()
{
    cin >> N >> K;
    vi arr(N,0);
    vi  drr(K);
    for (int i = 0; i < K; i++) {
        cin >> drr.at(i);
        for (int j = 0; j < drr[i]; j++)
        {
            cin >> A;
            arr[A-1]++;
        }
    }

    cout << count(all(arr),0);
    
    return 0;
}

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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x)      cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x)      cout << ((x) ? "YES" : "NO") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )

int main(int argc, const char* argv[]) {
	ll a, p;
	cin >> a >> p;

	cout << (a * 3 + p) / 2 << endl;

	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<set>
#define ll long long
#define dou(s) atof(s.c_str())
#define lon(s) atoll(s.c_str())
#define str(n) to_string(n)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define fion(n) fixed<<setprecision(n)
#define endl "\n"
#define OR ||
#define AND &&
#define NOT !
#define line(s) getline(cin,s)
#define MOD 1000000007
#define fdarst(a,n) (a[a.size()-1]>=n&&a[lower_bound(ALL(a),n)-a.begin()]==n?lower_bound(ALL(a),n)-a.begin():-1)
#define fist(s,t) ((int)s.find(t))
#define START int main(){cin.tie(0);ios::sync_with_stdio(false);
#define END }
using namespace std;
void f(ll n, double x1, double y1, double x2, double y2) {
	if (n == 0)cout << fion(8) << x2 << ' ' << fion(8) << y2 << endl;
	else {
		f(n - 1, x1, y1, x1 + (x2 - x1) / 3, y1 + (y2 - y1) / 3);
		f(n - 1, x1 + (x2 - x1) / 3, y1 + (y2 - y1) / 3, (x1 + x2) / 2 - (y2 - y1)*sqrt(3) / 6, (y1 + y2) / 2 + (x2 - x1)*sqrt(3) / 6);
		f(n - 1, (x1 + x2) / 2 - (y2 - y1)*sqrt(3) / 6, (y1 + y2) / 2 + (x2 - x1)*sqrt(3) / 6, x1 + (x2 - x1) * 2 / 3, y1 + (y2 - y1) * 2 / 3);
		f(n - 1, x1 + (x2 - x1) * 2 / 3, y1 + (y2 - y1) * 2 / 3, x2, y2);
	}
}
START
ll n; cin >> n;
cout << "0 0" << endl;
f(n, 0, 0, 100, 0);
END


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

int main() {
    int n, k;
    scanf("%d%d", &n, &k);
    std::vector<int> a(n);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    int ans = INT_MAX;
    int position = std::find(a.begin(), a.end(), 1) - a.begin();
    for (int left = 0; left <= k - 1; left++) {
        int right = k - 1 - left;
        int cost = 1;
        if (left < position)
            cost += (position - left + k - 2) / (k - 1);
        if (right < n - 1 - position)
            cost += (n - 1 - position - right + k - 2) / (k - 1);
        ans = std::min(ans, cost);
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
int main(void)
{
    int i, n, x, cnt=0;

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

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

int d2[n+1];
d2[0]=0;
    for(i=0; i<n; i++){
        d2[i+1] = d2[i] + d[i];
    }

    for(i=0; i<=n; i++){
        if(d2[i]<=x)
            cnt++;
    }

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

    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

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

	auto ans = 0;
	for (auto i = 1; i <= N; i += 2)
	{
		auto temp = 0;
		for (auto j = 1; j <= i; ++j)
		{
			if (i % j == 0)
			{
				++temp;
			}
		}

		if (temp == 8)
		{
			++ans;
		}
	}

	cout << ans << endl;

	return 0;
}

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

#define dbg(help) cerr << #help << " = " << (help) << endl;
#define int  long long
#define endl "\n"

using namespace std;

void boot_up() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef LOCAL 
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout); 
#endif
    cout.setf(ios::fixed); cout.precision(4);
}

const int INF = 1e18, maxn = 3e5 + 1;

signed main() {
    boot_up();

    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i].second >> a[i].first;
    }

    sort(a.begin(), a.end());

    int t = 0;
    for (int i = 0; i < n; ++i) {
        if (t + a[i].second > a[i].first) {
            cout << "No" << endl;
            return 0;
        }
        t += a[i].second;
    }

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


Measured memory_bytes: 3328
n = int(input())
a = []
for _ in range(n):
  a.append(list(map(int,input().split())))

target = [0, 0, 0]
for i in range(n):
  target = [a[i][0] - target[0], a[i][1] - target[1], a[i][2] - target[2]]
  if target[0] % 2 == (target[1] + target[2]) % 2 and target[0] >= (target[1] + target[2]):
    continue
  else:
    print('No')
    exit()

print('Yes')


Measured memory_bytes: 27300
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <stdio.h>

using namespace std;

typedef long double ld;

ld xa, ya, ra, xb, yb, rb;

int ans;

int main(void) {
    int N;
    scanf("%d", &N);

    while(N > 0) {
        cin >> xa >> ya >> ra >> xb >> yb >> rb;
        ans = 1;

        ld dist = sqrt(pow(xa - xb, 2) + pow(ya - yb, 2));

        if(dist + rb < ra) {
            ans = 2;
        } else if(dist + ra < rb) {
            ans = -2;
        } else if(dist > ra + rb) {
            ans = 0;
        }
        printf("%d\n", ans);
        N--;
    }

    return 0;
}

Measured memory_bytes: 0
d['   '];p,s,t;main(n){scanf("%d%*d",&n);for(p=n;--n;d[n]=s+=*d)scanf("%d",d);for(;~scanf("%d",&n);t=(t+abs(d[p-=n]-d[s]))%100000)s=p;p=!printf("%d\n",t);}

Measured memory_bytes: 0