akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

void print(pair<string, int> p)
{
	cout << p.second << " " << p.first << endl;
}

int main()
{
    vector<pair<string, int> > v(24);
	map<int, int> m;
	
	rep(i, 24)
		cin >> v[i].second >> v[i].first;
	
	rep(i, 3)
	{
		sort(v.begin() + 8 * i, v.begin() + 8 * (i + 1));
		
		print(v[8 * i]);
		print(v[8 * i + 1]);
		
		m[v[8 * i].second] = -1;
		m[v[8 * i + 1].second] = -1;
	}
	
	sort(ALL(v));
	
	int b = 2;
	for(int i = 0; i < 24 && b; i++)
	{
		if(m[v[i].second] != -1)
		{
			print(v[i]);
			b--;
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) noexcept {
  return std::vector<T>(n, std::forward<T>(val));
}

template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) noexcept {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}

template<class T, class Cond>
struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  bool operator()(T& a, const T& b) const {
    if(cond(a, b)) { a = b; return true; }
    return false;
  }
};
template<class T, class Cond>
chain<T, Cond> make_chain(Cond cond) { return chain<T, Cond>(cond); }

int main() {
  int s, w;
  cin >> s >> w;
  cout << (s <= w ? "unsafe" : "safe") << endl;
}


Measured memory_bytes: 3600
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		boolean[] can = new boolean[10];
		for (int i = 0; i < k; i++) {
		    can[sc.nextInt()] = true;
		}
		while (true) {
		    boolean flag = true;
		    int x = n;
		    while(x > 0) {
		        if (can[x % 10]) {
		            flag = false;
		            break;
		        }
		        x /= 10;
		    }
		    if (flag) {
		        System.out.println(n);
		        return;
		    }
		    n++;
		}
	}
}


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

int main() {
  int N,M;
  cin >> N;
  vector<string> s(N);
  for(int i=0; i<N; i++)
    cin >> s.at(i);
  
  cin >> M;
  vector<string> t(M);
  for(int i=0; i<M; i++)
    cin >> t.at(i);
  
  int m_cnt = 0;
  for(int i=0; i<N; i++){
    int cnt = 0;
    for(int j=0; j<N; j++){
      if(s.at(i) == s.at(j))
        cnt++;
    }
    for(int j=0; j<M; j++){
      if(s.at(i) == t.at(j))
        cnt--;
    }
    if(cnt > m_cnt)
      m_cnt = cnt;
  }
  cout << m_cnt << endl;
}


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

// macros
#define ll long long int
#define pb emplace_back
#define mk make_pair
#define pq priority_queue
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define FI first
#define SE second
using namespace std;

//  types
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
 
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1e9 + 7;

// solve
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}

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

int main(int argc, char const* argv[])
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<ll> a(n);
  cin >> a;
  ll res = 1;
  rep(i, n){
    res = res * (a[i] / gcd(res, a[i]));
  }
  cout << res << endl;
	return 0;
}



Measured memory_bytes: 3152
test = ""
#test = \
"""
1
1
"""
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
    

n = int(input2())
nums = list(map(int, input2().strip().split()))
nums.reverse()

ans = 0
wanted = 1
while nums:
    tmp = nums.pop()
    if tmp == wanted:
        wanted += 1
    else:
        ans += 1

if ans == n:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 26268
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n % 2 == 0) return false; // 1と偶数はあらかじめ除く
  for(int i = 3; i <= sqrt(n); i += 2){
    if(n % i == 0) return false;
  }
  return true;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ABC084D - 2017-like Number
  int Q; cin >> Q;
  vector<bool> prime(1e5+1, false);
  vector<int> dp(1e5+1, 0);
  prime[2] = true;
  for(int i = 3; i <= 1e5; i += 2){
    if(isPrime(i)){
      prime[i] = true;
      if(prime[(i+1)/2]){
        dp[i] = dp[i-2] + 1;
      }else{
        dp[i] = dp[i-2];
      }
    }else{
      dp[i] = dp[i-2];
    }
  }
  vector<pair<int, int> > q(Q, pair<int, int>());
  REP(i, Q){
    int l, r; cin >> l >> r;
    q[i] = {l, r};
  }
  REP(i, Q){
    cout << dp[q[i].second] - dp[q[i].first - 2] << endl;
  }
}

Measured memory_bytes: 1920
#最小コストソート

n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
c = 0
for i in range(n-1):
    t = cnt = 0
    #本来i番目にいるべき値はaではどこにいるのか（ループの最小値）
    x = a.index(b[i])
    #もしあるべき場所にあったり、あるべき場所に帰ってきたら終了
    while x != i:
        #ループで最も小さい値を使いまわしながら整えていく
        #ループの最小値が入っている場所にいるべき値がaでは何処にいるか
        y = a.index(b[x])
        #a[x]とa[y]を入れ替えればよい
        a[x],a[y] = a[y],a[x];cnt += 1
        t += a[x] + a[y]
        x = y
    if cnt: c += min(t, (b[i]+b[0])*2 + t -(b[i]-b[0])*cnt)
print(c)
# print(a)


Measured memory_bytes: 5624
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define INPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.in"
#define OUTPUT "/Users/bekhzodsoliev/Desktop/C++/cp/cp/file.out"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

void solve()
{
    int a, b;
    cin >> a >> b;
    if(a <= 8 and b <= 8)
    {
        cout << "Yay!";
    }
    else
    {
        cout << ":(";
    }
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0);
    //freopen(INPUT, "r", stdin);freopen(OUTPUT, "w", stdout);
    //freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    int t = 1;
    //cin >> t;
    
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

#ifdef DEBUG
#include <util.h>
#else
#define Dump(x)
#endif

using namespace std;

using ll_t = long long;
using ull_t = unsigned long long;
using ld_t = long double;

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

    cout << S.substr(0, 3) << endl;
}


Measured memory_bytes: 3596
import itertools
import copy
from collections import deque
import heapq
x,n = map(int,input().split())
if n == 0:
    print(x)
    exit()
p = list(map(int,input().split()))
check = {key:0 for key in p}
mi = copy.deepcopy(x)
ma = copy.deepcopy(x)
while True:
    if not mi in check:
        print(mi)
        exit()
    if not ma in check:
        print(ma)
        exit()
    mi -= 1
    ma += 1


Measured memory_bytes: 9632
#include "bits/stdc++.h"
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define forn(i, x, n) for (int i = x; i < n; i++)
#define all(a) (a).begin(), (a).end()
#define nl '\n'
#define precision(n) setprecision(n)
typedef long double ld;
typedef long long ll;

int main() { _
    int a,b,c,d; cin >> a >> b >> c >> d;
    cout << min(a,b) + min(c,d) << nl;
    return 0;
}


Measured memory_bytes: 256
let () =
  let rec doit (x, y) r =
    match Scanf.scanf "%f,%f\n" (fun d t -> d, t) with
    | (0., 0.) -> Printf.printf "%d\n%d\n" (truncate x) (truncate y)
    | (d, t) -> let z = 3.141 *. r /. 180. in doit (x +. d *. cos z, y +. d *. sin z) (r -. t)
  in
  doit (0., 0.) 90.

Measured memory_bytes: 2508
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define pii pair<ll,ll>
#define ff first
#define ss second
#define mxx 100005
#define endl "\n"
const ll mod=1e9+7;

int main()
{
    ll n;
    cin>>n;
    ll ans=0;
    while(n--)
    {
        ll x;
        cin>>x;
        if(x%2==0)
        {
            for(ll i=30; i>=1; i--)
            {
                ll a=(ll)pow(2,i);
                if(a<=x)
                {
                    if(x%a==0)
                    {
                        //cout<<x<<" "<<a<<endl;
                        ans+=i;
                        x/=a;
                        if(x%2!=0)
                            break;
                    }
                }
            }
        }
    }

    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	string s;
	int ans=0;
	cin >>s;
	bool can=false;
	for(int l=1;l<s.size()/2;l++){
		can=true;
		for(int i=0;i<l;i++){
			
				if(s[i]!=s[i+l]){
					can=false;
				}
			
		}
		if(can){
			chmax(ans,l*2);
		}
	}
	cout<<ans<<endl;
}

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

using namespace std;

const int MAX = 12;

bool cross[MAX][MAX];
int n,start,goal,d;


void init(){
  memset(cross,false,sizeof(cross));
}

bool move(){
  int pos = start;
  for(int i = 1; i <= d; i++){
    if(cross[i][pos]) pos++;
    else if(cross[i][pos-1]) pos--;
  }
  return pos == goal;
}


bool addline(){

  for(int i = 1; i <= d; i++)
    for(int j = 1; j < n; j++)
      if(!cross[i][j] && !cross[i][j-1] && !cross[i][j+1]){
	cross[i][j] = true;
	if(move()){
	  cout << i << " " << j << endl;
	  return true;
	}
	cross[i][j] = false;
      }

  return false;
}

void solve(){

  if(move()) cout << "0" << endl;
  else if(addline()) return;
  else cout << "1" << endl;
}

int main(){
  while(cin >> n && n){
    init();
    cin >> start >> goal >> d;

    for(int i = 1; i <= d; i++)
      for(int j = 1; j < n; j++){
	char c;
	cin >> c;
	if(c == '1') cross[i][j] = true;
	else cross[i][j] = false;
      }
    
    solve();
  }
  return 0;
}

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

int main(){
	int N, M;
	int a[100];
	int res[100];
	cin >> N >> M;
	fill(res, res + N, 0);
	for(int i = 0; i < M; i++){
		cin >> a[i];
		a[i]--;
	}
	for(int i = 0; i < M; i++){
		int p = N;
		for(int j = 0; j < N; j++){
			int b;
			cin >> b;
			b--;
			if(b == a[i]){
				res[j]++;
				p--;
			}
		}
		res[a[i]] += p;
	}
	for(int i = 0; i < N; i++){
		cout << res[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define rep(i,a,n)  for (int i=(int)(a); i<=(int)(n); ++i)
#define rrep(i,a,n) for (int i=(int)(a); i>=(int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
int A,B,C;
//=============================
void input()
{
    cin>>A>>B>>C;

}
//=============================
void func(){}
//=============================
void solve()
{
    int mn = min({A,B,C});
    A -= mn;B -= mn; C -= mn;

    int ans=0;
    vector<int> abc = {A,B,C};
    sort(all(abc));
    int sum = A+B+C;
    int r = abc[2]*3 - sum;
    if (r % 2 == 0) {
        cout<< r/2 << endl;
    }
    else {
        cout<< (r+3)/2 << endl;
    }


}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define SC scanf
#define PR printf
#define pb push_back
#define mp make_pair
#define SZ(v) ((int)(v).size())
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define db double
#define ldb long double
#define uint unsigned
#define ll long long
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef pair<pii,pii> ppp;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef map<int,int> mii;
const int INF=0x3f3f3f3f;
const ll LL_INF=0x3f3f3f3f3f3f3f3f;
const int xx[4]={1,-1,0,0};
const int yy[4]={0,0,1,-1};
int inline nextin(){
	int t;
	if(scanf("%d",&t)!=1)exit(0);
	return t;
}
int inline in(){
	int x=0,c;
	for(;(uint)((c=getchar())-'0')>=10;){
		if(c=='-')return -in();
		if(!~c)throw ~0;
	}
	do{
		x=(x<<3)+(x<<1)+(c-'0');
	}while((uint)((c=getchar())-'0')<10);
	return x;
}
bool d[10];
char c[10];
int main(){
    cin.sync_with_stdio(false);cin.tie(0);
	int n,k;
	cin>>n>>k;
	for(int i=0;i<k;i++){
		int x;
		cin>>x;
		d[x]=true;
	}
	string s;
	bool f;
	for(int i=0;i<10;i++)c[i]='0'+i;
	for(int i=n;i<n*100;i++){
		stringstream ss;
		ss<<i;
		s=ss.str();
		f=true;
		for(int j=0;j<10;j++){
			if(d[j]&&s.find(c[j])!=-1){
				f=false;
				break;
			}
		}
		if(f){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define fi first
#define se second
#define pb push_back
#define forn(i,n) for(int i=0;i<(n);i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define forr(i,n) for(int i=n;i>=0;i--)
#define all(x) x.begin(), x.end()
const int MAXN = 1e5 +5;

void fio(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}

vector<array<int,4> > Q;
int n,m,q;
int an = 0;
vector <int> v;

void dfs(int u){
	if(v.size()==n){
		int ma = 0;
		an = max(an, accumulate(all(Q), ma, [&](int k, array<int,4> z){
			return v[z[1]-1] - v[z[0]-1] == z[2]? k + z[3]: k;
		}));
		return;
	}
	for(int i = u; i<=m ;i++){
		v.pb(i);
		dfs(i);
		v.pop_back();
	}
}

int main(){
  fio();
  cin>>n>>m>>q;
  Q.resize(q);
  forn(i,q) cin>>Q[i][0]>>Q[i][1]>>Q[i][2]>>Q[i][3];
  dfs(1);
  cout<<an<<endl;
  return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	IOS;
	int n, m;
	cin >> n >> m;
	if (n == m) {
		put("Yes");
	} else {
		put("No");
	}
	return 0;
}


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

typedef long long ll;

int main(void){
    ll N, K;
    cin >> N >> K;
    
    vector<ll> A(200200);
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    for(int i = K; i < N; i++){
        if(A[i] > A[i-K]){
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
    }
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	int n;
	while(cin>>n&&n){
		vector<int> p(n),j(n-1);
		ll sum=0;
		for(int i=0;i<n;i++){
			cin>>p[i];
			sum+=p[i];
		}
		for(int i=0;i<n-1;i++){
			cin>>j[i];
			sum+=j[i];
		}
		sort(p.begin(),p.end());
		sort(j.begin(),j.end());
		ll ans=sum;
		for(int i=0;i<n-1;i++){
			sum-=j[i];
			ans=max(sum*(i+2),ans);
		}
		cout<<ans<<endl;
	}
}

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

int main(){
  int H, W, N;
  cin >> H >> W >>N;
  int ans;
  if(N%max(H,W)==0) ans=N/max(H,W);
  else ans=N/max(H,W)+1;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
template<typename T> inline void add(T& a, T b) { a += b; if (a >= MOD) a -= MOD; }

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

  int A,B,C; cin >> A >> B >> C;
  cout << C << " " << A << " " << B << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) scanf("%lld",&n)
#define pl(n) printf("%lld",n)
#define sz(a) (int)(a).size()
const int mod=1e9+7;
const int maxn=1e3+2;
int dx[2]={1,0};
int dy[2]={0,1};
int matrix[maxn][maxn];
int dp[maxn][maxn];
int r,c;
int recur(int x,int y){
	if(x==r && y==c)return 1;
	if(x>r || y>c || matrix[x][y]==1)return 0;
	if(dp[x][y]!=-1)return dp[x][y];
	int ans=recur(x+1,y)+recur(x,y+1);
	return dp[x][y]=ans%mod;
}

signed main()
{
	ms(dp,-1);
	sl(r);sl(c);
	for(int i=1;i<=r;i++)
	{
	  for(int j=1;j<=c;j++)
	  {
		  char ch;
		  cin>>ch;
		  if(ch=='.')matrix[i][j]=0;
		  else matrix[i][j]=1;
		  
	  }	
		
	}
	cout<<recur(1,1)%mod<<endl;
  
  return 0;
}




Measured memory_bytes: 16000
#include <iostream>
#include <cstring>

using namespace std;

int main() {
    long long n;
    cin>>n;
    
    long long g;
    cin>>g;
    
    long long p[n+1], w[n+1], dp[n+1][g+1];
    
    for (long long i=1; i<=n; i++)
        cin>>w[i]>>p[i];
        
    memset(dp,0,sizeof(dp));
    
    for (long long i=1; i<=n; i++){
        for (long long j=1; j<=g; j++)
        {
            dp[i][j] = dp[i-1][j];
            if (j-w[i]>=0) dp[i][j] = max(dp[i][j], dp[i-1][j-w[i]] + p[i]);
        }
    }
    
    cout<<dp[n][g];
}

Measured memory_bytes: 82292
#include<bits/stdc++.h>
using namespace std;
char s[20];

int main()
{
	scanf("%s",s+1);
	int n=strlen(s+1);
	int ans=0;
	for(int i=1;i<=n;i++){
		int cur=0;
		for(int j=i;j<=n;j++){
			++cur;
			if(s[j]!='A'&&s[j]!='G'&&s[j]!='C'&&s[j]!='T'){
				break;
			}
			ans=max(ans,cur);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
using System;

namespace QuestionB
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string t = Console.ReadLine();
            char[] sChar = s.ToCharArray();
            char[] tChar = t.ToCharArray();

            int resultCount = 0;

            for (int startIndex = 0;  startIndex < s.Length - t.Length + 1; startIndex++)
            {
                int sameCount = 0;
                for(int charCount = 0; charCount < t.Length; charCount++)
                {
                    if(sChar[charCount + startIndex] == tChar[charCount])
                    {
                        sameCount++;
                    }
                }

                if(sameCount > resultCount)
                {
                    resultCount = sameCount;
                }
            }

            Console.WriteLine(t.Length - resultCount);
        }
    }
}


Measured memory_bytes: 25820
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a, b = MAP()

com1 = a//(10**(len(str(a))-1))
com2 = b//(10**(len(str(b))-1))

if com1 < com2:
	print(str(a)*b)
else:
	print(str(b)*a)

Measured memory_bytes: 5184
n=int(input())
lists=[[ [] for j in range(10)]for i in range(10)]
for i in range(1,n+1):
    a=str(i)
    lists[int(str(a[0]))][int(str(a[-1]))].append(i)
c=0
for i in range(1,10):
    for j in range(1,10):
        c+=len(lists[i][j])*len(lists[j][i])
print(c)        

Measured memory_bytes: 11476
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    int mxi = max_element(A.begin(), A.end()) - A.begin();
    int64_t ans = A[mxi];
    vector<int> ansv = {mxi};
    for(int k=0; k<2; k++){
        int64_t res = 0;
        vector<int> resv;
        for(int i=k; i<N; i+=2) if(A[i] > 0){
            res += A[i];
            resv.push_back(i);
        }
        if(res > 0 && res > ans){
            ans = res;
            ansv = resv;
        }
    }
    vector<int> op;
    int tail = N-1;
    while(tail > ansv.back()) op.push_back(tail--);
    int sz = ansv.size();
    while(sz >= 2){
        int s = ansv[sz-2], t = ansv[sz-1];
        while(t-s > 2){
            op.push_back(s+2);
            t -= 2;
        }
        op.push_back(s+1);
        ansv.pop_back();
        sz--;
    }
    while(ansv[0]--) op.push_back(0);
    
    cout << ans << endl;
    cout << op.size() << endl;
    for(int a : op) cout << a+1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;
typedef long long ll;
cs int N = 205, M = 65;
int T, n; ll a[N], b[M];
char S[N];
void ins(ll x){
	for(int i=60;~i;i--)
	if(x>>i&1){
		if(b[i])x^=b[i]; 
		else return b[i]=x,void();
	}
} bool chk(ll x){
	for(int i=60;~i;i--)
	if(x>>i&1){
		if(b[i])x^=b[i];
		else return true;
	} return false;
}
void Main(){
	scanf("%d",&n);
	memset(b,0,sizeof(b));
	for(int i=1; i<=n; i++)
	scanf("%lld",&a[i]);
	scanf("%s",S+1);
	for(int i=n; i>=1; i--){
		if(S[i]=='0')ins(a[i]);
		else if(chk(a[i])) 
		return puts("1"),void();
	} puts("0"); 
}
int main(){
	#ifdef FSYolanda
	freopen("1.in","r",stdin);
	#endif
	scanf("%d",&T);
	while(T--)Main();
	return 0;
}

Measured memory_bytes: 3760
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<pair<int, int> >X[20], Y[20]; int N, A, B, C, dist[20];
int main() {
	while (true) {
		for (int i = 0; i < 20; i++) { X[i].clear(); Y[i].clear(); dist[i] = 1 << 30; }
		cin >> N; int G = 0, J = 0; dist[0] = 0; if (N == 0)break;
		for (int i = 0; i < N - 1; i++) {
			cin >> A >> B >> C; A--; B--; X[A].push_back(make_pair(B, C)); X[B].push_back(make_pair(A, C));
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < X[i].size(); j++) {
				int st = i, go = X[i][j].first;
				if ((X[st].size() == 1 && st >= 1) || (X[go].size() == 1 && go >= 1))continue;
				Y[st].push_back(X[i][j]); G += X[i][j].second;
			}
		}
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				for (int k = 0; k < Y[j].size(); k++) {
					dist[Y[j][k].first] = min(dist[Y[j][k].first], dist[j] + Y[j][k].second);
				}
			}
		}
		for (int i = 0; i < N; i++) { if (dist[i] < (1 << 30))J = max(J, dist[i]); }
		cout << G - J << endl;
	}
	return 0;
}

Measured memory_bytes: 1196
//Author: A_S_M_M@sud_P@rvez
#include<bits/stdc++.h>
using namespace std;
#define    MP ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define    For(i,n) for(int i=0;i<n;i++)
#define    rFor(i,n) for(int i=n-1;i>=0;i--)
#define    forn(i,n) for(int i=1;i<=n;i++)
#define    fors(i,s) for(int i=0;i<s.size();i++)
#define    all(v) v.begin(),v.end()
#define    gcd(a, b) __gcd(a , b)
#define    lcm(a,b) (a*(b/__gcd(a,b)))
#define    test   int t;cin>>t;for(int l=0;l<t;l++)
#define    min3(a,b,c)     min(a,min(b,c))
#define    max3(a,b,c)     max(a,max(b,c))
#define    min4(a,b,c,d)   min(min(a,b),min(c,d))
#define    max4(a,b,c,d)   max(max(a,b),max(c,d))
#define    Max(a)  *max_element(a,a+sizeof(a)/sizeof(a[0]))
#define    Min(a)  *min_element(a,a+sizeof(a)/sizeof(a[0]))
#define    nl     "\n"
#define    End    return 0 
#define    gt     greater<int>()
#define    ll     long long 
#define    mp     make_pair
#define    pb     push_back
#define    vi     vector<int>
#define    vl     vector<ll>
#define    mod    1000000007
#define    sp(n)  fixed<<setprecision(n)
#define    pi     acos(-1)

int main()
{
MP;
    //test
    {
        int n,x,t;
        cin>>n>>x>>t;
        int p=n/x;
        if(n%x!=0)p++;
        cout<<p*t;
    }
    
End;
}


Measured memory_bytes: 3636
def checkDraw(S, y, x):
  return S[y][x] == '#'

H,W = map(int, input().split())
S = [input() for _ in range(H)]

for h,ss in enumerate(S):
  for w,s in enumerate(ss):
    if s == '#':
      if h == 0:
        if w == 0:
          if checkDraw(S, h+1, w) or checkDraw(S, h, w+1):
            pass
          else:
            print('No')
            exit()
        elif w == W-1:
          if checkDraw(S, h+1, w) or checkDraw(S, h, w-1):
            pass
          else:
            print('No')
            exit()
        else:
          if checkDraw(S, h+1, w) or checkDraw(S, h, w-1) or checkDraw(S, h, w+1):
            pass
          else:
            print('No')
            exit()
      if h == H-1:
        if w == 0:
          if checkDraw(S, h-1, w) or checkDraw(S, h, w+1):
            pass
          else:
            print('No',1)
            exit()
        elif w == W-1:
          if checkDraw(S, h-1, w) or checkDraw(S, h, w-1):
            pass
          else:
            print('No',2)
            exit()
        else:
          if checkDraw(S, h-1, w) or checkDraw(S, h, w-1) or checkDraw(S, h, w+1):
            pass
          else:
            print('No',3)
            exit()
      if w == 0 and 0 < h < H-1:
        if checkDraw(S, h+1, w) or checkDraw(S, h-1, w) or checkDraw(S, h, w+1):
          pass
        else:
          print('No')
          exit()
      if w == W-1 and 0 < h < H-1:
        if checkDraw(S, h+1, w) or checkDraw(S, h-1, w) or checkDraw(S, h, w-1):
          pass
        else:
          print('No')
          exit()
      if 0 < h < H-1 and 0< w < W-1:
        if checkDraw(S, h-1, w) or checkDraw(S, h+1, w) or checkDraw(S, h, w-1) or checkDraw(S, h, w+1):
          pass
        else:
          print('No')
          exit()

print('Yes')


Measured memory_bytes: 3192
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        n: usize,
    }
    if n % 1000 == 0 {
        println!("0")
    } else {
        println!("{}", 1000 - n % 1000)
    }
}


Measured memory_bytes: 2152
main :: IO ()
main = do
  n <- getLine
  putStrLn $ if isGoodInteger n then "Yes" else "No"

isGoodInteger :: String -> Bool
isGoodInteger n =
  let h = head n
      t = last n
  in (h == n!!1 && h == n!!2) || (t == n!!1 && t == n!!2)


Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
int A[100010];
int dp[100010];
int main(){
   // freopen("input.txt","r",stdin);
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>A[i];
    }
    dp[0]=0;

    for(int i=1;i<n;i++)
    {
        dp[i]=dp[i-1]+abs(A[i]-A[i-1]);
        for(int j=1;j<=k&&i-j>-1;j++){
        dp[i]=min(dp[i-j]+abs(A[i-j]-A[i]),dp[i]);
       // cout<<dp[i-j]+abs(A[i-j]-A[i])<<endl;
        }
      //  cout<<" dp:"<<dp[i]<<endl;
    }
    cout<<dp[n-1]<<endl;

}

Measured memory_bytes: 1024
//
//  b.cpp
//  agc029
//
//  Created by reproy on 12/15/18.
//  Copyright © 2018 reproy. All rights reserved.
//

#include<bits/stdc++.h>
using namespace std;
/*------- Constants---- */

#define LL                      long long
#define Ulong                   unsigned long long
#define REP(i,n)                for(long long i=0; i < n ; i++ )
#define mp                      make_pair
#define pb                      push_back
#define all(x)                  (x).begin(),(x).end()
#define PI                      acos(-1.0)
#define EPS                     1e-14
#define F                       first
#define S                       second
#define di(x)                   int x; input(x)
#define in(x)                   input(x)
#define in2(x,y)                in(x),in(y)
#define in3(x,y,z)              in(x),in2(y,z)
#define lc                      ((n)<<1)
#define rc                      ((n)<<1|1)
#define db(x)                   cout << #x << " -> " << x << endl
#define nl                      cout<<endl
#define ms(ara_name,value)      memset(ara_name,value,sizeof(ara_name))
#define IO                      ios_base::sync_with_stdio(0);cin.tie(0)
#define READ                    freopen("/home/matrixcode/Desktop/in.txt","r",stdin)
#define WRITE                   freopen("out.txt","w",stdout)
template<class T> inline void input(T &x) {
    register char c = getchar();x = 0;
    int neg = 0;
    for(; ((c<48 || c>57) && c != '-'); c = getchar());
    if(c=='-'){neg = 1;c = getchar();}
    for(; c>47 && c<58 ; c = getchar()){x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x = -x;
}
inline long long bigmod(long long p,long long e,long long M){
    long long ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}

/***************************** END OF TEMPLATE *******************************/

const int N = 2e5+5;
LL A[N];

int main()
{
    int n;
    in(n);
    for(int i = 0; i < n; i ++) in(A[i]);
    sort(A,A+n);
    unordered_map<int,int>Map;
    int ans = 0;
    for(int i = 0; i < n; i ++) Map[A[i]] ++;
    for(int i = n-1; i >= 0; i --) {
        
        int cur = A[i];
        if(Map[cur] == 0) continue;
        Map[cur] --;
        int p2 = 1;
        while(p2 <= cur) p2 *= 2;
        
        if(Map[p2-cur] >= 1) {
            ans ++;
            Map[p2-cur] --;
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 18420
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
    long long q,h,s,d,n;
    while(scanf("%lld%lld%lld%lld%lld",&q,&h,&s,&d,&n)==5)
    {
        long long m=min(min(4*q,2*h),s);
        long long s=min(d*(n/2)+m*(n%2),n*m);
        printf("%lld\n",s);
    }
    return 0;
}


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

using i64 = long long int;

int main(){
    i64 n, w;
    cin >> n >> w;
    vector<i64> items[4];
    i64 weight;
    for(int i=0;i<n;++i){
        i64 w, v;
        cin >> w >> v;
        if(i == 0){
            weight = w;
            items[0].push_back(v);
            continue;
        }
        items[w-weight].push_back(v);
    }

    for(int i=0;i<4;++i)sort(items[i].rbegin(), items[i].rend());

    i64 ans = 0;
    for(i64 i=0;i<=items[0].size();++i){
        for(i64 j=0;j<=items[1].size();++j){
            for(i64 k=0;k<=items[2].size();++k){
                i64 l = (w - (i * weight + j * (weight + 1) + k * (weight + 2))) / (weight + 3);
                l = min(l, (i64)items[3].size());
                if(i + j + k + l > n || l < 0 || i * weight + j * (weight + 1) + k * (weight + 2) + l * (weight + 3) > w)continue;
                long long int sum = 0;
                for(int m=0;m<i;++m)sum += items[0][m];
                for(int m=0;m<j;++m)sum += items[1][m];
                for(int m=0;m<k;++m)sum += items[2][m];
                for(int m=0;m<l;++m)sum += items[3][m];
                ans = max(ans, sum);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n=int(input())
t=[0]*1000002

for i in range(n):
    a,b=map(int,input().split())
    t[a-1]+=1
    t[b]-=1
    
ans=0
for i in range(1000002):
    t[i]+=t[i-1]
    if i<=t[i]:
        ans=i

print(ans)


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

int main(){
	
	int Aps, Pcs, Pie;
	scanf ("%d %d", &Aps, &Pcs);
	
	int Tot=Aps*3+Pcs;
	printf("%d\n", Tot/2);
	
	return 0 ;
}

//  \N JANGAN LUPA!!!!!

Measured memory_bytes: 1696
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll mod = 1e9+7;

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

	bool ok = true;

	for(int i = 0; i < n; i++){
		int num;
		cin>>num;

		if(num%2 == 0){
			if(num%3 !=0 && num%5!=0)
				ok = false;
		}
	}

	if(ok)
		cout<<"APPROVED\n";
	else
		cout<<"DENIED\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define vi vector<int>
#define vvi vector<vi>
#define vb vector<bool>
#define vvb vector<vb>
#define pb push_back
#define inf 1e18
#define mod 1000000007
#define ps(x,y) fixed<<setpricision(y)<<x
#define w(t) int t; cin>>t; while(t--)
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.14159265358979323846
#define takeArrInput(a,n) for(auto &i : a) cin>>i;
#define printArr(a, n) for(int i=0;i<n;i++) cout<<a[i]<<" ";
using namespace std;
const int N = 300 * 1000 + 13;
void init() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int power(int x, unsigned int y)
{
	int res = 1;

	while (y > 0) {
		if (y & 1)
			res = res * x;
		y = y >> 1;
		x = x * x;
	}
	return res;
}
int32_t main()
{
	FIO;
	init();
	int a, b, c, k; cin >> a >> b >> c >> k;
	int ans = 0;
	// while (k > 0) {
	if (k >= a) {
		ans += a * 1;
		k -= a;
	} else {
		ans += k;
		k = 0;
	}
	if (k >= b) {
		k -= b;
	}
	if (k >= c) {
		ans += c * -1;
		k -= c;
	} else {
		ans += k * -1;
		k = 0;
	}
	// }
	cout << ans << '\n';
}

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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define l_l pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

ll N, K;

ll getNum(ll n) {
  ll r = 0;
  for (;;) {
    if (n >= K) {
      break;
    }
    n *= 2;
    r++;
  }
  return r;
}

int main() {
  std::cout << std::fixed << std::setprecision(10);
  scanf("%lld %lld", &N, &K);

  double ans = 0;
  for (ll i = 1; i <= N; i++) {
    ll n = getNum(i);
    double plus = powf(0.5, n);
    ans += plus;
  }

  cout << ans / N << endl;

  // cout << (log2(5)) << endl;
}


Measured memory_bytes: 4036
#include<stdio.h>
int main()
{
    long long int n,s,l;
    scanf("%lld%lld%lld",&n,&s,&l);
    if(l<s)
        printf("0");
    else if(l==s)
    {
        printf("1");
    }
    else if(l>s)
    {
        if(n==1)
            printf("0");
        if(n==2)
            printf("1");
        if(n>=3)
        {
            printf("%lld",(l*(n-2)-s*(n-2)+1));
        }
    }
    return 0;
}



Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


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

	int N;
	string S;
	cin >> N >> S;
	int ans = 0;

	for (int i = 0; i < N; i++) {
		string temp;
		for (int j = i; j < N; j++) {
			temp.pb(S[j]);
			if (temp == "ABC")ans++;
		}
	}
	puts(ans);

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;
    vector<int> t(n), v(n);

    bool ok = true;
    rep(i, n){
        int a, b, c;
        cin >> a >> b >> c;

        t[i] = a;
        v[i] = b + c;
    }

    if(t[0] < v[0] || t[0] % 2 != v[0] % 2) {
        ok = false;
    }
    rep(i, n-1){
        if((t[i+1] - t[i]) % 2 != abs(v[i+1]-v[i]) % 2 || (t[i+1] - t[i]) < abs(v[i+1] - v[i])){
            ok = false;
        }
    }

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}

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

int main() {
  double pi = 3.14159265359;
  double r;
  cin >> r;
  cout << fixed << setprecision(6);
  cout << (r * r * pi) << ' ';
  cout << (2 * r * pi) << endl;
  return 0;
}

Measured memory_bytes: 1284
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)                                                         

using namespace std;
#define ll long long

int main(){
  int A, B, X;
  cin >> A >> B >> X;
  if(A <= X && X <= A + B)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int n;
    cin>>n;
    long long a[n],b[n];
    long long x=0,y=0;
    pair<long long ,int> v[n];
    for(int i=0;i<n;i++){
        cin>>a[i]>>b[i];
        v[i]=make_pair(a[i]+b[i],i);
    }
    sort(v,v+n);
    reverse(v,v+n);

    for(int i=0;i<n;i++){
        if(i%2==0){
            x+=a[v[i].second];
        }
        else y+=b[v[i].second];
    }
    cout<<x-y<<endl;
    
    
    
    
 
}

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

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

    sort(p, p+N);

    p[N-1] /= 2;

    int ans = 0;

    for(int i = 0; i < N; i++) {
        ans += p[i];
    }

    cout << ans;

    cout << endl;
    return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> mp(H);
    for(int i=0; i<H; i++) cin >> mp[i];

    int ans = 0;
    for(int bit=0; bit < (1<<H); bit++)
    {
        vector<bool> hs(H, false);
        for(int i=0; i<H; i++)
        {
            if(bit & (1<<i))
            {
                hs[i] = true;
            }
        }
        for(int bitw=0; bitw < (1<<W); bitw++)
        {
            vector<bool> ws(W, false);
            for(int j=0; j<W; j++)
            {
                if(bitw & (1<<j))
                {
                    ws[j] = true;
                }
            }

            int numk = 0;
            for(int k=0; k<H; k++)
            {
                if(hs[k]) continue;
                for(int l=0; l<W; l++)
                {
                    if(ws[l]) continue;
                    if(mp[k][l] == '#') numk++;
                }
            }
            if(numk == K) ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descSort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
    int n;
    cin>>n;
    vector<string> s(n);
    vector<int> t(n);
    rep(i,0,n)cin>>s[i]>>t[i];
    string x;
    cin>>x;

    int sum=0;
    rep(i,0,n)sum+=t[i];

    rep(i,0,n){
        if(x!=s[i])sum-=t[i];
        else{
            sum-=t[i];
            break;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 3520
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
typedef long long LL;


LL sum,a[205][205],b[205][205];
int n,m;
int main()
{
	cin>>n>>m;
	for(int i=0;i<10;i++)
	{
		for(int j=0;j<10;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i=0;i<10;i++)
	{
		for(int j=0;j<10;j++)
		{
			for(int k=0;k<10;k++)
			{
				if(i==j||i==k||j==k)
					continue;
				a[j][k]=min(a[j][k],a[j][i]+a[i][k]);
			}
		}
	}
	sum=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cin>>b[i][j];
			if(b[i][j]!=1||b[i][j]!=-1)
			{
				sum+=a[b[i][j]][1];
			}
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 640
/*
PROG: arc84a
LANG: C++
    _____
  .'     '.
 /  0   0  \
|     ^     |
|  \     /  |
 \  '---'  /
  '._____.'
*/
#include <bits/stdc++.h>
 
using namespace std;
 
long long readi()
{
	long long input = 0;
	char c = ' ';
	while (c < '-')
	{
		c = getchar();
	}
	bool negative = false;
	if (c == '-')
	{
		negative = true;
		c = getchar();
	}
	while (c >= '0')
	{
		input = 10 * input + (c - '0');
		c = getchar();
	}
	if (negative)
	{
		input = -input;
	}
	return input;
}
void printi(long long output)
{
	if (output == 0)
	{
		putchar('0');
		return;
	}
	if (output < 0)
	{
		putchar('-');
		output = -output;
	}
	int aout[20];
	int ilen = 0;
	while(output)
	{
		aout[ilen] = ((output % 10));
		output /= 10;
		ilen++;
	}
	for (int i = ilen - 1; i >= 0; i--)
	{
		putchar(aout[i] + '0');
	}
	return;
}
string reads()
{
	string input = "";
	char c = ' ';
	while (c <= ' ')
	{
		c = getchar();
	}
	while (c > ' ')
	{
		input += c;
		c = getchar();
	}
	return input;
}
void prints(string output)
{
	for (int i = 0; i < output.length(); i++)
	{
		putchar(output[i]);
	}
	return;
}

#define MP make_pair
#define PB push_back
#define MT make_tuple
#define LB lower_bound
#define UB upper_bound

#define SINF 10007
#define MOD 1000000007
#define INF 1000000861
#define LLINF 1000000000000000861ll
#define CO 1000861
#define EPS 0.000000000000001
#define PI 3.141592653589793
#define MAXN 300010

typedef int64_t ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int N;
int A[MAXN], B[MAXN], C[MAXN];
map<int, int> compress;
ll ans;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	srand(time(NULL));
//	cout << fixed << setprecision(10);	
//	cerr << fixed << setprecision(10);
//	if (fopen("arc84a.in", "r"))
//	{	
//		freopen ("arc84a.in", "r", stdin);
//		freopen ("arc84a.out", "w", stdout);
//	}
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	for (int i = 0; i < N; i++)
	{
		cin >> B[i];
	}
	for (int i = 0; i < N; i++)
	{
		cin >> C[i];
	}
	sort(A, A + N);
	sort(B, B + N);
	sort(C, C + N);
	for (int i = 0; i < N; i++)
	{
		int val = B[i];
		ll small = lower_bound(A, A + N, val) - A;
		ll big = N - (upper_bound(C, C + N, val) - C);
		ans += (small * big);
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 1408