akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict
H, W, M = map(int, input().split())
r = defaultdict(int)
c = defaultdict(int)
rc = defaultdict(int)
for i in range(M):
    h, w = map(int, input().split())
    rc[(h, w)] += 1
    r[w] += 1
    c[h] += 1

ri, rmax = 0, 0
ci, cmax = 0, 0
for i in r.keys():
    v = r[i]
    if v > rmax:
        ri = i
        rmax = v
for i in c.keys():
    v = c[i]
    if v > cmax:
        ci = i
        cmax = v

rml, cml = [], []
for i, v in r.items():
    if v == rmax:
        rml.append((i, v))
for i, v in c.items():
    if v == cmax:
        cml.append((i, v))


ans = rmax+cmax-1
for i, vi in rml:
    find = False
    for j, vj in cml:
        if not (j, i) in rc:
            ans += 1
            find = True
            break
    if find:
        break
print(ans)


Measured memory_bytes: 191396
n = int(input())
A = []
for i in range(1, n+1):
    A.append(int(input()))
A_srt = sorted(A)
A1, A2 = A_srt[-1], A_srt[-2]
for i in A:
    if i == A1:
        print(A2)
    else:
        print(A1)

Measured memory_bytes: 14112
#include <iostream>

using namespace std;

int main()
{
    int n, k, x;
    int ans = 0;
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> x;
        int a = x * 2;
        int b = (k - x) * 2;
        ans += (a < b) ? a : b;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
    int N;
    cin>>N;
    vector<int> d(N);
    for(int i=0; i<N; i++){
        cin>>d[i];
    }
    sort(d.begin(),d.end());
    cout<< d[N/2]-d[N/2-1]<<endl;
}

Measured memory_bytes: 640
#include<cstring>
#include<cstdio>
#include<string>
#include<iostream>

using namespace std;
typedef long long ll;
const int maxn=1e6+5;
int main()
{
    ll a,b;
    cin>>a>>b;
    if((a+b)&1)
    {
        printf("IMPOSSIBLE");
    }
    else
        printf("%lld",(a+b)>>1);
    return 0;
}


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


int main(){
  ll K,N;
  cin >> K >> N;
  vector<ll> A(N),B(N);
  for(ll i=0;i<N;++i) cin >> A[i];
  for(ll i=0;i<N-1;++i){
    B[i] = A[i+1] - A[i];
  }
  B[N-1] = K - A[N-1] + A[0];
  ll ans = K;
  sort(B.begin(),B.end());
  ans = K - B[N-1];
  cout << ans << endl;
}

Measured memory_bytes: 3328
n, m = list(map(int, input().split()))
k = []

for i in range(m):
    ki = list(map(int, input().split()))
    s = [0] * n
    for j in range(1, len(ki)):
        s[ki[j]-1] = 1

    k.append(int("".join(map(str, s)), 2))

p = list(map(int, input().split()))

def count1s(n):
    cnt = 0
    while n > 0:
        cnt += n & 1
        n >>= 1

    return cnt

cnt = 0
for i in range(2**n):
    sol = True
    for j in range(m):
        if count1s(i & k[j]) % 2 == p[j]:
            pass
        else:
            sol = False
            break

    if sol:
        cnt += 1

print(cnt)

Measured memory_bytes: 9184
import itertools
n,m,q = list(map(int, input().split()))
abcd = [[0] * 4 for _ in range(q)]
for i in range(q):
  abcd[i] = list(map(int, input().split()))

M = itertools.combinations_with_replacement(range(m),n)
ans = 0
for A in M:
  for i in range(1,n):
    if A[i] <= A[i-1]:break
  temp = 0
  for i in range(q):
    a = A[abcd[i][0]-1]
    b = A[abcd[i][1]-1]
    c = abcd[i][2]
    d = abcd[i][3]
    if b - a == c:
      temp += d
  ans = max(ans,temp)

print(ans)

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { cout << p.first << ' ' << p.second; return os; }

void solve() {
  int N, C; cin >> N >> C;
  vector<vector<pair<int, int>>> chans(C);
  rep(i, N) {
    int s, t, c; cin >> s >> t >> c;
    c--;
    chans[c].emplace_back(s, t);
  }
  rep(i, C) sort(all(chans[i]));

  vector<vector<pair<int, int>>> cons(C);
  rep(i, C) {
    if (chans[i].size() == 0) continue;
    int s, t;
    tie(s, t) = chans[i][0];
    reps(j, chans[i].size() - 1) {
      int rs, rt;
      tie(rs, rt) = chans[i][j];
      if (t == rs) t = rt;
      else {
        cons[i].emplace_back(s, t);
        s = rs, t = rt;
      }
    }
    cons[i].emplace_back(s, t);
  }

  vi32 imos(100010);
  rep(i, C) {
    each(p, cons[i]) {
      int s, t;
      tie(s, t) = p;
      imos[s - 1]++, imos[t]--;
    }
  }
  rep(i, 100005) imos[i + 1] += imos[i];

  int ans = 0;
  rep(i, 100010) amax(ans, imos[i]);
  cout << ans << '\n';
}


Measured memory_bytes: 2816
#include<iostream>
#include<string>
#include<cstring>

using namespace std;

int main()
{
	string str_main;
	string str_input;

	int n = 0;
	int ans = 0;

	cin >> str_main;
	cin >> n;

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

		//文字列連結
		str_input += str_input;

		//文字列が見つかった(nposは見つからなかったとき)
		if (str_input.find(str_main) != string::npos)
		{
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string ch;
	cin>>n>>ch;
	int len=ch.size();
	for(int i=0;i<len;i++)
	{
		char t=ch[i]+n;
		if(t<='Z')
		  cout<<t;
		else
		  cout<<(char)(t-26);
	}
	
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ll long long
#define lld long double
#define MOD 1000000007
#define inf 1000000000000000000ll
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll power(ll x,ll y, ll md=inf){ll res = 1;x%=md;while(y){if(y&1)res = (res*x)%md;x *= x; if(x>=md) x %= md; y >>= 1;}return res;}
 
using namespace std;


#define endl '\n'
#define int ll

signed main() {
	fast;

	int h,w;
	cin>>h>>w;

	vector<pii> v(h);
	for(int i=0;i<h;i++) cin>>v[i].f>>v[i].s;

	map<int,int> mp;
	for(int i=1;i<=w;i++) mp[i] = 0;

	multiset<int> mini;
	for(int i=0;i<w;i++) mini.insert(0);

	for(int i=0;i<h;i++) {
		int l = v[i].f;
		int r = v[i].s;

		auto it = mp.lower_bound(l);
		int mn = inf;

		while(it!=mp.end()) {
			if(it->f > r) break;
			mn = min(mn, r+1-(it->f)+(it->s));
			auto it1 = it;
			it++;
			// cout<<"$$"<<it1->s<<endl;
			mini.erase(mini.lower_bound(it1->s));
			mp.erase(it1);
		}

		if(r+1<=w && mn<inf) {	
			// cout<<"$$$$"<<r+1<<mp.count(r+1)<<mp[r+1]<<mn<<endl;
			if(mp.count(r+1) && mp[r+1] > mn) {
				// cout<<"$$h\n";
				mini.erase(mini.lower_bound(mp[r+1]));
				mini.insert(mn);
				mp[r+1] = mn;
			}
			else if(!mp.count(r+1)){
				// cout<<"$$fh\n";
				mp[r+1] = mn;
				mini.insert(mn);
			}
		}

		// cout<<" ----- \n";
		// for(auto x: mp) cout<<x.f<<" -- "<<x.s<<endl;
		// cout<<*mini.begin()<<endl;

		// cout<<"#"; for(auto x: mini) cout<<x<<" "; cout<<endl;

		if(mini.size()) cout<<*mini.begin()+i+1<<endl;
		else cout<<-1<<endl;

	}
}

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

bool cmpstring(const string &l, const string &r) {
  if(l.size() != r.size()) return l.size() < r.size();
  for(int i = 0; i < l.size(); ++i)
    if(l[i] != r[i]) return l[i] < r[i];
  return 0;
}

struct data {
  int x, y;
  string s;
};

bool operator<(const data &l, const data &r) {
  if(l.s != r.s) return cmpstring(l.s, r.s);
  if(l.x != r.x) return l.x > r.x;
  return l.y > r.y;
}

int w, h;
vector<string> s;
string dist[80][80];
int d[2] = {0, 1};
priority_queue<data> pq;

string solve();
bool ch(const data &now) {
  return now.x >= 0 && now.x < h && now.y >= 0 &&
         now.y < w && s[now.x][now.y] >= '0' &&
         s[now.x][now.y] <= '9';
}

int main() {
  while(1) {
    cin >> w >> h;
    if(w + h == 0) break;
    s.resize(h);
    for(int i = 0; i < h; ++i) cin >> s[i];
    cout << solve() << endl;
  }
  return 0;
}

string solve() {
  string ans = "";
  for(int i = 0; i < h; ++i)
    for(int j = 0; j < w; ++j) {
      dist[i][j] = "X";
      if(s[i][j] >= '1' && s[i][j] <= '9') {
        string pushs;
        pushs += s[i][j];
        dist[i][j] = pushs;
        pq.push({i, j, pushs});
        ans = max(ans, pushs);
      }
      else if(s[i][j] == '0') {
        dist[i][j] = "";
        ans = "0";
        pq.push({i, j, ""});
      }
    }
  while(!pq.empty()) {
    data now = pq.top();
    pq.pop();
    if(dist[now.x][now.y] != now.s) continue;
    for(int i = 0; i < 2; ++i) {
      data nextp = now;
      nextp.x += d[i];
      nextp.y += d[1 ^ i];
      if(!ch(nextp)) continue;
      if(nextp.s.size() != 0 || s[nextp.x][nextp.y] != '0')
        nextp.s += s[nextp.x][nextp.y];
      if(dist[nextp.x][nextp.y] == "X" ||
         cmpstring(dist[nextp.x][nextp.y], nextp.s)) {
        dist[nextp.x][nextp.y] = nextp.s;
        pq.push(nextp);
        if(cmpstring(ans, nextp.s)) ans = nextp.s;
      }
    }
  }
  return ans;
}


Measured memory_bytes: 3488
n,t = [int(x) for x in input().split()]
d = [int(x) for x in input().split()]

def check(x) -> bool:
    while x>0:
        a = x%10
        if a in d:
            return False
        x//=10
    return True

while check(n)==False:
    n+=1
print(n)

Measured memory_bytes: 9040
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        String str = "";
        int ACCount = 0;
        int WACount = 0;
        int TLECount = 0;
        int RECount = 0;

        for(int i = 0; i <= N; i++) {
        	str = sc.nextLine();
        	if("AC".equals(str)) {
        		ACCount++;

        	} else if("WA".equals(str)) {
        		WACount++;
        	} else if("TLE".equals(str)) {
        		TLECount++;
        	} else if("RE".equals(str)) {
        		RECount++;
        	}
        }

        System.out.println("AC x \n" + ACCount);
        System.out.println("WA x \n" + WACount);
        System.out.println("TLE x \n" + TLECount);
        System.out.println("RE x \n" + RECount);

    }
}

Measured memory_bytes: 60384
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
cnt = Counter(a)
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    cnt_b = cnt[b]
    cnt[b], cnt[c] = 0, cnt[c] + cnt_b
    s += (c - b)*cnt_b
    print(s)

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

using namespace std;
using ll = long long;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long A, long long B){
  if(A-2*B<0)
    std::cout << 0 << std::endl;
  else
    std::cout << A-2*B << std::endl;
}

int main(){
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  solve(A, B);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
//#define uint __int128_t
 
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<vint> vvint;
typedef vector<pint>vpint;
typedef pair<pint,int> P1;
typedef pair<int,pint> P2;
typedef pair<pint,pint> PP;
const ll MOD=1000000007;
const ll INF=1e18;

int a,b,c,d;
int ans=0;
signed main() {
    IOS();
    //(1ll<<N)シフト演算のオーバーフローに気をつける
    //MOD同士の引き算に注意
    rep(i,0,2){
        cin>>a>>b>>c>>d;
        chmax(ans,a+b+c+d);
    }
    cout<<ans<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
long long n, q, ans, x, y;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> q;
	q*=q;
	for(int i=0;i<n;i++)
	{
		cin >> x >> y;
		long long tmp=x*x+y*y;
		//cout << tmp << endl;
		if(tmp<=q)
			++ans;
	}
	cout << ans << endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr double eps = 1e-9;
constexpr ll MOD = 1000000007LL;
template <typename T>
bool chmin(T& a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
bool chmax(T& a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
};
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for(int i = 0; i < v.size(); i++) {
        os << v[i] << (i + 1 == v.size() ? "\n" : " ");
    }
    return os;
}
template <typename T>
vector<T> make_v(size_t a) {
    return vector<T>(a);
}
template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type fill_v(T& t, const V& v) {
    t = v;
}
template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type fill_v(T& t, const V& v) {
    for(auto& e : t) {
        fill_v(e, v);
    }
};
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = INF;
    vector<int> c(n + 10);
    for(int i = n - 1; i >= 0; i--) {
        c[i] += c[i + 1];
        if(s[i] == '.') {
            c[i]++;
        }
    }
    int c2 = 0;
    for(int i = 0; i <= n; i++) {
        chmin(ans, c[i] + c2);
        if(i < n && s[i] == '#') {
            c2++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1428
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define ALL(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

int ctoi(const char c) {
	return c - '0';
}
int keta(int a) {
	return to_string(a).size();
}
int a[100010];
signed main() {
	int n;
	cin>>n;
	int cnt=0,ans=0;
	rep(i,n){
		cin>>a[i];
	}
	rep(i,n){
		if(a[i]!=0){cnt+=a[i];}
		else{
			ans+=cnt/2;
			cnt=0;
		}
	}
	ans+=cnt/2;
	cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll n,ans=0;
    cin >> n;
    for(ll i=1;i<=n;i++){
        string s=to_string(i);
        if(s.size()%2!=0) ans++;
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  rep(i,3){
    if(s[i] == s[i+1]){
      puts("Bad");
      return 0;
    }
  }
  puts("Good");
  return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<utility>
#include<cstring>
using namespace std;
int n,x,y,ans;
int cnt[10020];
int main()
{
    cin>>n;
    vector<pair<pair<int,int>,int>> a;
    //make_pair  生成pair，融合为一个单元;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        a.push_back(make_pair(make_pair(x,y),0));
    }
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        a.push_back(make_pair(make_pair(x,y),1));
    }
    sort(a.begin(),a.end());
    memset(cnt,0,sizeof(cnt));
    for(int i=0;i<a.size();i++)
    {
        if(!a[i].second)
            cnt[a[i].first.second]++;
        else
        {
            for(int j=a[i].first.second-1;j>=0;j--){
                if(cnt[j]>0)
                {
                    cnt[j]--;
                    ans++;
                    break;
                }
            }
        }
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

struct UnionFind {
  vector<int> par, rank;

  UnionFind(int n = 1) : par(n), rank(n, 0) {
    iota(begin(par), end(par), 0);
  }
  int root(int x) {
    if (par[x] == x) {
      return x;
    } else {
      int r = root(par[x]);
      return par[x] = r;
    }
  }
  bool isSame(int x, int y) { return root(x) == root(y); }
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;

    if (rank[x] < rank[y]) swap(x, y);
    rank[x] += rank[y];
    par[y] = x;
  }
};

vector<int> out;
vector<vector<int>> g;

struct Kruskal {
  struct Edge {
    int s, t;
  };
  int n;
  vector<Edge> es;
  Kruskal(int n = 0) : n(n) {}

  void addEdge(int u, int v) {
    n = max(n, max(u, v) + 1);
    es.push_back({u, v});
  }
  UnionFind build() {
    UnionFind uf(n);
    for (auto&& e : es) {
      int u = e.s;
      int v = e.t;
      if (!uf.isSame(u, v)) {
        uf.unite(u, v);
        g[u].push_back(v);
        g[v].push_back(u);
      } else {
        cout << u + 1 << ' ' << v + 1 << endl;
        out[u]++;
      }
    }
    return uf;
  }
};

Kruskal kr;

void dfs(int s, int p) {
  for (auto t : g[s]) {
    if (t == p) continue;
    dfs(t, s);
  }
  if (p == -1) return;
  if (out[s] % 2 == 0) {
    cout << p + 1 << ' ' << s + 1 << endl;
    out[p]++;
  } else {
    cout << s + 1 << ' ' << p + 1 << endl;
    out[s]++;
  }
}

int main() {
  int n, m;
  cin >> n >> m;
  out.assign(n, 0);
  g.resize(n);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b, a--, b--;
    kr.addEdge(a, b);
  }
  if (m % 2 != 0) {
    cout << -1 << endl;
    return 0;
  }
  auto uf = kr.build();
  dfs(0, -1);
}


Measured memory_bytes: 14068
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	int N;
	cin >> N;
	vector<int> a(N);
	rep(i, N) {
		cin >> a[i];
	}
	int cnt = 1, ans = 0;
	rep1(i, N) {
		if (a[i] == a[i - 1]) {
			cnt++;
			if (i == N - 1) {
				ans += cnt / 2;
			}
		}
		else {
			ans += cnt / 2;
			cnt = 1;
		}

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

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N, H;
    cin >> N >> H;
    vector<int> A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];
    sort(All(A));
    sort(B.rbegin(), B.rend());
    vector<ll> sum(N + 1);
    rep(i, N) sum[i + 1] = sum[i] + B[i];
    int res = INF;
    for(int i = 0; i <= N; i++) {
        int tmp = i;
        int rest = H - sum[i];
        if(rest > 0)
            tmp += rest / A[N - 1] + !!(rest % A[N - 1]);
        res = min(res, tmp);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
use proconio::marker::Chars;
use proconio::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        s: Chars,
    }

    let mut r = 0;
    let mut g = 0;
    let mut b = 0;

    for i in 0..n {
        match s[i] {
            'R' => r += 1,
            'G' => g += 1,
            'B' => b += 1,
            _ => unreachable!(),
        }
    }

    let mut ans: u64 = 0;
    ans += r * g * b;

    for i in 0..n {
        for j in 1..n {
            let i0 = i;
            let i1 = i + j;
            let i2 = i + 2 * j;
            if i2 < n && s[i0] != s[i1] && s[i1] != s[i2] && s[i2] != s[i0] {
                ans -= 1;
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 2204
N = gets.to_i
fs = []
ps = []
N.times do
  fs << gets.split.map(&:to_i)
end
N.times do
  ps << gets.split.map(&:to_i)
end

ans = -10 ** 20
(1...2**10).each do |x|
  t = 0
  fs.each_with_index do |f, ix|
    cnt = 0
    (0..9).each do |i|
      if (x & (1<<i)) > 0 && f[i] == 1
        cnt += 1
      end
    end
    t += ps[ix][cnt]
  end
  ans = [ans, t].max
end
puts ans

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
using Graph=vector<vector<int>>;
ll INF=1000000000000000001;
ll mod=1000000007;

int i,j,k;

int n,m,q;
int ans;
vector<int> a,b,c,d;

void dfs(vector<int> A){
    if(A.size()==n+1){//n桁になったら終わり
        //calculate score
        int now=0;//現在のscore

        for(i=0;i<q;i++){//scoreを加算できる条件
            if(A[b[i]]-A[a[i]]==c[i]){now+=d[i];}
        }
        ans=max(ans,now);
        return;
    }

    A.push_back(A.back());//直前の数以上になるように追加　かつ　m以下（桁が上がると広義単調増加）
    while(A.back()<=m){
        dfs(A);
        A.back()++;//一つ加算
    }
}

int main(){
    cin>>n>>m>>q;
    a.resize(q);
    b.resize(q);
    c.resize(q);
    d.resize(q);

    for(i=0;i<q;i++){
        cin>>a[i]>>b[i]>>c[i]>>d[i];

    }

    dfs(vector<int>(1,1));//dfsでA.backを使うので一つ入れておく

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

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;


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


int main(){
  int n,m;
  cin >> n >> m;
  vector<int> broken(n+1);
  REP(i,m){
    int a;
    cin >> a;
    broken[a] = 1;

  }
  vector<int> dp(n+2);
  const int mod = 1000000007;
  dp[n] = 1;
  REPR(i,n-1){
    if(broken[i]){
      dp[i] = 0;
      continue;
    }
    dp[i] = (dp[i+1] + dp[i+2]) % mod;
  }
  cout << dp[0]<<endl;
}


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

int main(){
	char ch;
	int count[26] = {0};

	while(cin>>ch){
		if(isupper(ch)) ch = tolower(ch);
		count[ch-'a']++;
	}
	
	for(int i=0;i<26;i++){
		cout<<(char)(i+'a')<<" : "<<count[i]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1140
#!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():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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

#A
def A():
    h,w = LI()
    a = SR(h)
    d = [(1,0),(0,1)]
    bfs = [[1]*w for i in range(h)]
    for y in range(h):
        for x in range(w):
            if a[y][x] == "#":
                bfs[y][x] = 0
                q = deque([(y,x)])
                while q:
                    i,j = q.popleft()
                    k = 0
                    for dy,dx in d:
                        ni = i+dy
                        nj = j+dx
                        if 0 <= ni < h and 0 <= nj < w:
                            if a[ni][nj] == "#":
                                if k:
                                    print("Impossible")
                                    return
                                k = 1
                                bfs[ni][nj] = 0
                                q.append((ni,nj))
                for i in range(h):
                    for j in range(w):
                        if a[i][j] == "#" and bfs[i][j]:
                            print("Impossible")
                            return
                print("Possible")
                return
    return

#B
def B():
    n = I()
    p = LI()
    a = [0]*n
    b = [0]*n
    for i in range(n):
        a[p[i]-1] += i
        b[p[i]-1] += i
    for i in range(n-1):
        a[i+1] += a[i]
    for i in range(n-1)[::-1]:
        b[i] += b[i+1]
    for i in range(n):
        a[i] += i+1
        b[i] += n-i
    print(*a)
    print(*b)
    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

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


Measured memory_bytes: 46384
#coding:utf-8

N = int(input())

D = []

for i in range(N):
    d1,d2 = map(int,input().split())

    D.append(d1==d2)
    
for i in range(N-2):
    if D[i] and D[i+1] and D[i+2]:
        print("Yes")
        break

    if i == N-3:
        print("No")

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

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

    sort(a, a+N, less<int>());

    int sum = 0;
    int index = 0;
    for(int i = 0; i < N; i++){
        sum += a[i];
        if(sum > x) break;
        index++;
    }

    bool flag = true;
    if((sum < x) && (index == N)) flag = false;

    if(flag) cout << index << endl;
    else cout << N-1 << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, l = map(int,input().split())
    s = []

    for i in range(N):
        s.append(input())

    s_sorted = sorted(s)
    answer = ""

    for i in range(N):
        answer += s_sorted[i]

    print(answer)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
from collections import Counter

N = int(input())
A = Counter(list(map(int, input().split())))

flg = False
if N % 2 ==0:
  cnt = 0
  for i in range(N // 2):
    if A[2*i+1] != 2 or A[2*i] != 0:
      flg = True
      break
    else:
      cnt += 2
  if cnt != N:
    flg = True
  else:
    print ((2 ** (N//2)) % (10 ** 9 + 7))
else:
  if A[0] != 1:
    flg = True
  else:
    cnt = 1
    for i in range(N // 2):
      if A[2*(i+1)] != 2 or A[2*i+1] != 0:
        flg =True
        break
      else:
        cnt += 2
    if cnt != N:
      flg = True
    else:
      print ((2 ** (N //2)) % (10 ** 9 + 7))
if flg: print(0)


Measured memory_bytes: 14820
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>
#include <random>


#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	int64_t n, b, r; cin >> n >> b >> r;
	int64_t v = (b + r);

	cout << (n / v) * b + min(n % v, b) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr ll INF = 1ll << 55;

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

// multi-dimensional vector (require c++14)
template <typename T, typename U>
static inline vector<U> make_nd_vector(T &&n, U &&val) noexcept {
  static_assert(is_integral<T>::value,
                "[make_nd_vector] 1st argument must be an integer type");
  return vector<U>(forward<T>(n), forward<U>(val));
}
template <typename T, typename... Args>
static inline decltype(auto) make_nd_vector(T &&n, Args &&... args) noexcept {
  static_assert(is_integral<T>::value,
                "[make_nd_vector] 1st argument must be an integer type");
  return vector<decltype(make_nd_vector(forward<Args>(args)...))>(
      forward<T>(n), make_nd_vector(forward<Args>(args)...));
}
//
// Print from Iterator
template <typename ite>
void print_ite(ite start, ite end, char sp = ' ', char en = '\n') {
  for (auto i = start; i != end; i++)
    cout << *i << sp;
  cout << en;
}
//
inline void Yes(bool condition) { cout << (condition ? "Yes\n" : "No\n"); }

constexpr int MAX_A = 1000000;

int main() {
  int n;
  vector<int> count(MAX_A + 5, 0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    count[a]++;
  }
  int ans = 0;
  for (int i = 1; i < MAX_A + 3; i++) {
    if (count[i] > 0) {
      if (count[i] == 1)
        ans++;
      for (int j = i; j < MAX_A + 3; j += i) {
        count[j] = 0;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 6624
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long d = sc.nextLong();
        d = d * d;

        int ans = 0;
        for (int i = 0; i < n; i++) {
            long x = sc.nextLong();
            long y = sc.nextLong();
            
            long dist = x * x + y * y;
            
            if (dist <= d) {
                ans++;
            }
        }
        
        System.out.println(ans);
    }
}

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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	int a = ri() - 1;
	int b = ri() - 1;
	std::pair<int, int> pts[n];
	for (auto &i : pts) {
		int x = ri();
		int y = ri();
		i = {x + y, x - y};
	}
	
	auto dist = [&] (int i, int j) { return std::max(std::abs(pts[i].first - pts[j].first), std::abs(pts[i].second - pts[j].second)); };
	int d = dist(a, b);
	
	std::vector<bool> reachable(n);
	{
		std::queue<int> que;
		que.push(a);
		reachable[a] = true;
		
		std::map<int, std::map<int, int> > r0, r1;
		for (int i = 0; i < n; i++) {
			r0[pts[i].first][pts[i].second] = i;
			r1[pts[i].second][pts[i].first] = i;
		}
		
		while (que.size()) {
			int i = que.front();
			que.pop();
			auto &map0 = r0[pts[i].first - d];
			auto &map1 = r0[pts[i].first + d];
			auto &map2 = r1[pts[i].second - d];
			auto &map3 = r1[pts[i].second + d];
			for (auto itr = map0.lower_bound(pts[i].second - d); itr != map0.end() && itr->first <= pts[i].second + d; map0.erase(itr++))
				if (!reachable[itr->second]) reachable[itr->second] = true, que.push(itr->second);
			for (auto itr = map1.lower_bound(pts[i].second - d); itr != map1.end() && itr->first <= pts[i].second + d; map1.erase(itr++))
				if (!reachable[itr->second]) reachable[itr->second] = true, que.push(itr->second);
			for (auto itr = map2.lower_bound(pts[i].first - d); itr != map2.end() && itr->first <= pts[i].first + d; map2.erase(itr++))
				if (!reachable[itr->second]) reachable[itr->second] = true, que.push(itr->second);
			for (auto itr = map3.lower_bound(pts[i].first - d); itr != map3.end() && itr->first <= pts[i].first + d; map3.erase(itr++))
				if (!reachable[itr->second]) reachable[itr->second] = true, que.push(itr->second);
		}
	}
	
	std::map<int, std::vector<int> > r0, r1;
	for (auto i : pts) {
		r0[i.first].push_back(i.second);
		r1[i.second].push_back(i.first);
	}
	for (auto &i : r0) std::sort(i.second.begin(), i.second.end());
	for (auto &i : r1) std::sort(i.second.begin(), i.second.end());
	auto count = [&] (auto &a, int l, int r) {
		return std::lower_bound(a.begin(), a.end(), r) - std::lower_bound(a.begin(), a.end(), l);
	};
	int64_t res = 0;
	for (int i = 0; i < n; i++) if (reachable[i]) {
		res += count(r0[pts[i].first - d], pts[i].second - d, pts[i].second + d);
		res += count(r1[pts[i].second + d], pts[i].first - d, pts[i].first + d);
		res += count(r0[pts[i].first + d], pts[i].second - d + 1, pts[i].second + d + 1);
		res += count(r1[pts[i].second - d], pts[i].first - d + 1, pts[i].first + d + 1);
	}
	printf("%" PRId64 "\n", res / 2);
	return 0;
}


Measured memory_bytes: 48208
#include <bits/stdc++.h>
#define MOD 998244353
#define pb push_back
#define ll long long int
#define con 1000000007
using namespace std;


int main()
{    ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     cout.tie(NULL);
     ll i,j,k,n,m;
     ll t;
     cin>>n;
     ll a[n];
     unordered_map<ll,ll> u,v;
     for(i=0;i<n;i++)
     {
         cin>>a[i];
         u[i-a[i]]++;
         v[i+a[i]]++;
     }
     ll ans=0;
     for(auto l:u)
     {   
         ans+=l.second*(v[l.first]);
     }
     cout<<ans;
}  


Measured memory_bytes: 27780
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
using namespace std;

int main()
{
    int x;
    cin >> x;
    if(x < 4){
        cout << '1' << endl;
        return 0;
    }
    int n = sqrt(x);
    vector<int> ans(n+1,1);
    int i;
    for(i = 2;i <= n;++i){
        while(ans.at(i) <= x){
            ans.at(i) *= i;
        }
        ans.at(i) /= i;
    }
    int max = ans.at(2);
    for(i = 2;i <= n;++i){
        if(max < ans.at(i)){
            max = ans.at(i);
        }
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import math, itertools

SIZE=100010; MOD=10**9+7 #ここを変更する

inv = [0]*(SIZE+1)# inv[j] = j^{-1} mod MOD
fac = [0]*(SIZE+1)# fac[j] = j! mod MOD
inv[1] = 1
fac[0] = fac[1] = 1
for i in range(2,SIZE+1):
    inv[i] = MOD -(MOD//i)*inv[MOD%i]%MOD
    fac[i] = fac[i-1]*i%MOD

n=int(input())
a=[int(i) for i in input().split()]

acc = list(itertools.accumulate(inv))# acc[j] = 1^{-1} + \cdot + j^{-1}
#print(a)
#print(acc[:10])
#print(fac[:10])
c=0
for k in range(n):
    g=fac[n]*(1+acc[k+1]+acc[n-k]-2*acc[1])%MOD
#    print(g)
    c+=a[k]*g
    c%=MOD

print(c)
            
        
        






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

int main(){
  
  int d,n;
  cin >> d >> n;
  
  if(d==0&&n!=100){
    cout << n << endl;
  }else if(d==0&&n==100){
    cout << 101 << endl;
  }else if(d==1&&n!=100){
    cout << 100*n << endl;
  }else if(d==1&&n==100){
    cout << 10100 << endl;
  }else if(d==2&&n!=100){
    cout << 10000*n << endl;
  }else{
    cout << 1010000 << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#define int long long
#define all(x) (x).begin(), x.end()
#define allr(x) (x).rbegin(), x.rend()

using namespace std;

const int MOD = 1e9 + 7;
const int INF = 1e9;

void fast()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

signed main()
{
	fast();
	string s;
	cin >> s;
	cout << s[0] << s[1] << s[2] << '\n';
	return 0;
}


Measured memory_bytes: 3612
n = int(input())
a = list(map(int, input().split()))

ans, cnt, node = 0, sum(a), 1
for i in range(n + 1):
    ans += node
    cnt -= a[i]
    node = min(cnt, (node - a[i]) * 2)
    if node < 0:
        print(-1)
        break
else:
    print(ans)


Measured memory_bytes: 83412
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
#define ALL(x) (x).begin(), (x).end()
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
char toSmall(char c) { // 大文字を小文字へ
    return (c + 0x20);
}
char toLarge(char c) { // 小文字を大文字へ
    return (c - 0x20);
}
float myPower(int a, int n) { // aのn乗の計算
    float x = 1;
    while (n > 0) { // 全てのbitが捨てられるまで
        if (n & 1) { // 一番右のbitが１のとき
            x *= a;
        }
        a *= a;
        n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
    }
    return x;
}
bool is_prime(const unsigned n) {
    switch (n) {
    case 0: // fall-through
    case 1: return false;
    case 2: // fall-through
    case 3: return true;
    } // n > 3 が保証された

    if (n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である
    // 6の倍数前後の数を使って試し割りをする
    for (unsigned i = 5; i * i <= n; i += 6) {
        if (n % i == 0) return false; // (6の倍数)-1
        if (n % (i + 2) == 0) return false; // (6の倍数)+1
    }

    return true;
}
int a, b, k;
int main(void){
    cin >> a >> b >> k;
    for (int i = a; i <= min(b, a + k-1); ++i) {
        cout << i << endl;
    }
    for (int i = max(b - k+1,a+k); i < b+1; ++i) {
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 3588
#include<cstdio>
#define min(a,b) (a<b?a:b)
int main()
{
	int ans=1;
	int n,k;
	scanf("%d %d",&n,&k);
	for(int i=1;i<=n;i++){
		ans+=min(ans,k);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
# ABC 125: B – Resale
n = int(input())
v = [int(s) for s in input().split()]
c = [int(s) for s in input().split()]
subtract_c_from_v = [v[i] - c[i] for i in range(n)]

maximum = 0

for subtraction in subtract_c_from_v:
    if subtraction > 0:
        maximum += subtraction

print(maximum)

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

using namespace std;

int main(){
	int n;
	
	cin >> n;
	
	int ac = 0, wa = 0, tle = 0, re = 0;
	
	for(int i = 0; i < n; i++){
		string s;
		cin >> s;
		
		if(s == "AC"){
			ac++;
		}else if(s == "WA"){
			wa++;
		}else if(s == "TLE"){
			tle++;
		}else re++;
	}
	
	
	printf("AC x %d\n", ac);
	printf("WA x %d\n", wa);
	printf("TLE x %d\n", tle);
	printf("RE x %d\n", re);
	
}


Measured memory_bytes: 3720
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<complex>
#include<vector>
#include<cstdio>
#include<string>
#include<bitset>
#include<ctime>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<set>
#define Cpy(x,y) memcpy(x,y,sizeof(x))
#define Set(x,y) memset(x,y,sizeof(x))
#define FILE "a"
#define mp make_pair
#define pb push_back
#define RG register
#define il inline
using namespace std;
typedef unsigned long long ull;
typedef vector<int>VI;
typedef long long ll;
typedef double dd;
const int N=100010;
const int mod=19940417;
const int base=26;
const dd eps=1e-6;
const int inf=2147483647;
const ll INF=1ll<<60;
const ll P=100000;
il ll read(){
  RG ll data=0,w=1;RG char ch=getchar();
  while(ch!='-'&&(ch<'0'||ch>'9'))ch=getchar();
  if(ch=='-')w=-1,ch=getchar();
  while(ch<='9'&&ch>='0')data=data*10+ch-48,ch=getchar();
  return data*w;
}

il void file(){
  srand(time(NULL)+rand());
  freopen(FILE".in","r",stdin);
  freopen(FILE".out","w",stdout);
}

int n,t[2][N],pre[2][N],suf[2][N],ans;

int main()
{
  n=read();ans=n;
  for(RG int i=1;i<=n;i++)t[i&1][read()]++;
  for(RG int i=1;i<=100000;i++)
    pre[0][i]=max(pre[0][i-1],t[0][i]),pre[1][i]=max(pre[1][i-1],t[1][i]);
  for(RG int i=100000;i;i--)
    suf[0][i]=max(suf[0][i+1],t[0][i]),suf[1][i]=max(suf[1][i+1],t[1][i]);
  for(RG int i=1;i<=100000;i++)
    ans=min(ans,n-(t[0][i]+max(pre[1][i-1],suf[1][i+1])));
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 2560
s=input()
if len(s)!=1:
	count = 0
	n=len(s)-1
	for i in range(2**n):
		op = ["" for _ in range(n)]
		for j in range(n):
			if ((i>>j)&1):
				op[j] = "+"
		formula = ""
		for j in range(n):
			formula += s[j] + op[j]
		formula += s[n]
		count += eval(formula)
	print(count)
else:
	print(s)

Measured memory_bytes: 3064
#include <stdio.h>

int main(){
  int n;
  int max=0,sum=0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int l;
    scanf("%d", &l);
    sum += l;
    if (l > max) {
      max = l;
    }
  }
  sum -= max;
  if (sum > max) {
    printf("Yes\n");
  }else{
    printf("No\n");
  }
}


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;

int a[510][510];
int main()
{
	int H, W;
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> a[i][j];
		}
	}
	int cnt = 0;
	vector<vector<int>> V;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W - 1; j++) {
			if (a[i][j] % 2 == 1) {
				cnt++;
				vector<int> v;
				v.push_back(i);
				v.push_back(j);
				v.push_back(i);
				v.push_back(j + 1);
				V.push_back(v);
				a[i][j]--;
				a[i][j + 1]++;
			}
		}
	}
	for (int i = 0; i < H - 1; i++) {
		if (a[i][W - 1] % 2 == 1) {
			cnt++;
			vector<int> v;
			v.push_back(i);
			v.push_back(W - 1);
			v.push_back(i + 1);
			v.push_back(W - 1);
			V.push_back(v);
			a[i][W - 1]--;
			a[i + 1][W - 1]++;
		}
	}
	cout << cnt << endl;
	for (vector<int> v : V) {
		for (int j = 0; j < v.size(); j++) {
			if (j != 0) cout << " ";
			cout << v[j] + 1;
		}
		cout << endl;
	}
}

Measured memory_bytes: 11168