akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<vi> vii;
typedef map<int, int> mp;
typedef multiset<int> mset;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
typedef vector<int64> vi64;
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define form(i,j,k,l) for(int i=j;i<int(k);i+=l)
#define rform(i,j,k,l) for(int i=int(j);i>int(l);i-=l)
#define rep(i, j) for(int i=0;i<int(j);i++)
#define rrep(i, j) for(int i=int(j);i>=0;i--)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define forc(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define INF (int)1e9
#define INF64 (int64)1e18
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define read(type) readInt<type>()
#define F first
#define S  second
const double pie = acos(-1.0);
template <typename T>
T Max(T x, T y)
{
  return (x > y) ? x : y;
}
template <typename T>
T Min(T x, T y)
{
  return (x > y) ? y : x;
}
int gcd(int n1, int n2)
{
  if (n2 != 0) return gcd(n2, n1 % n2);
  else return n1;
}
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
clock_t time_p = clock();
void rtime() { time_p = clock() - time_p; cerr << "Time Taken : " << (float)1000 * (time_p) / CLOCKS_PER_SEC << "\n";}
int main()
{ fast;
  int64 s, c;
  cin >> s >> c;
  int64 r = c / 2;
  if (s > r)
    cout << r;
  else
  { int64 ans = s;
    c = c - 2 * s;
    ans = ans + (c / 4);
    cout << ans;
  }


}

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

using namespace std;

using Int  = int_fast64_t;
using UInt = uint_fast64_t;

template <typename T>
using vec1 = vector<T>;

template <typename T>
T cin2var()
{
    T val;
    cin >> val;
    return val;
}

template <typename T>
vec1<T> cin2vec(size_t size)
{
    vec1<T> vec1(size);
    for (auto& v : vec1) {
        v = cin2var<T>();
    }
    return vec1;
}

void sub()
{
    const auto N(cin2var<UInt>());
    cout << static_cast<UInt>(N / 2.0 + 0.5) << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    sub();
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define sz(X) (int)(X).size()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define fornr(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define forab(i, a, b) for(int i = int(a); i < int(b); i++)
#define all(X) X.begin(), X.end()

typedef long long ll;
typedef pair<int, int> pii;
typedef double dbl;
typedef long double ld;
typedef vector<int> vi;
typedef vector<pair<ll, ll>> vpll;


int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vi cnt(n + 1);
    forab(x, 1, 102) {
        forab(y, 1, 102) {
            forab(z, 1, 102) {
                if (x * x + y * y + z * z + x * y + y * z + z * x <= n)
                    cnt[x * x + y * y + z * z + x * y + y * z + z * x]++;
            }
        }
    }
    forn(i, n) cout << cnt[i+1] << "\n";
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

struct Point
{
    double x, y;
    Point(double x, double y): x(x), y(y){}
    Point& operator+=(const Point& point)
    {
        x += point.x;
        y += point.y;
        return *this;
    }
    Point& operator=(const Point& point)
    {
        x = point.x;
        y = point.y;
        return *this;
    }
};

double mysin(double deg)
{
    return sin(M_PI*deg/180);
}

double mycos(double deg)
{
    return cos(M_PI*deg/180);
}

Point rotate(Point p, double deg)
{
    Point res(0, 0);
    res.x = mycos(deg)*p.x - mysin(deg) * p.y;
    res.y = mysin(deg)*p.x + mycos(deg) * p.y;
    return res;
}

vector<Point> res;
void kochCurve(int depth, Point strt, Point end)
{
    // finish condition
    if (depth == 0)
    {
        res.push_back(strt);
        return;
    }
    
    // make curve
    Point vec((end.x-strt.x)/3, (end.y - strt.y)/3);
    Point vec60 = rotate(vec, 60);
    Point vec300 = rotate(vec, 300);

    Point right = strt;
    vector<Point> moves = {vec, vec60, vec300, vec};
    for (auto move: moves)
    {
        Point left = right;
        right += move;
        kochCurve(depth-1, left, right);
    }
}

int main()
{
    // read input
    int depth;
    cin >> depth;

    // initialize res
    res.clear();

    // get curve
    Point strt(0,0);
    Point end(100, 0);
    kochCurve(depth, strt, end);
    res.push_back(end);

    // print out
    for (auto point: res)
        printf("%f %f\n", point.x, point.y);
    return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
#define N 500
//#define int long long
#define INF 1e9
#define rep(i, l, r) for(register int i = l; i <= r; ++ i)
using namespace std;
inline int read()
{
	register char cc = getchar();register int cn(0), flus(1);
	while(cc > '9' || cc < '0') {if(cc == '-') flus = -flus; cc = getchar();}
	while(cc >= '0' && cc <= '9') {cn = cn * 10 + cc - '0'; cc = getchar();}
	return cn * flus; 
}
int e[N][N];
int tmp[N][N];
int a, b;
inline void floyd()
{
	rep(k,1,a * b)
	{
		rep(i,1,a * b)
		{
			rep(j,1,a * b)
			{
				e[i][j]=min(e[i][j],e[i][k]+e[k][j]);
			}
		}
	}
}
signed main()
{
	a = read();
	b = read();
	rep(i, 1, a * b) 
	{
		rep(j, 1, a * b) 
		{
			if(i != j) e[i][j] = 1e9;
		}
	}
	rep(i, 1, a)
	{
		char s[N];
		scanf("%s",s + 1);
		rep(j, 1, b)
		{
			if(s[j] == '.') tmp[i][j] = 1;
		}
	}
	rep(i, 1, a)
	{
		rep(j, 1, b)
		{
			int k = i - 1;
			if(tmp[i][j])
			{
				//printf("i = %d j = %d\n",i,j);
				//printf("tmp[i][j - 1] = %d\n",tmp[i][j - 1]);
				if(tmp[i][j - 1])
				{
					e[k * b + j - 1][k * b + j] = 1;
					e[k * b + j][k * b + j - 1] = 1;
					//printf("added(%d,%d)\n",i * b + j - 1,i * b + j);
				}
				if(tmp[i][j + 1])
				{
					e[k * b + j + 1][k * b + j] = 1;
					e[k * b + j][k * b + j + 1] = 1;
				}  
				if(tmp[i + 1][j]) 
				{
					e[(k + 1) * b + j][k * b + j] = 1;
					e[k * b + j][(k + 1) * b + j] = 1;
				}
				if(tmp[i - 1][j])
				{
					e[(k - 1) * b + j][k * b + j] = 1;
					e[k * b + j][(k - 1) * b + j] = 1;
				}
			}
		}
	}
	floyd();
	int _max = 0;
	/*rep(i, 1, a * b)
	{
		rep(j, 1, b * a)
		{
			printf("%d ",e[i][j]);
		}
		puts("");
	}*/
	rep(i, 1, a * b)
	{
		rep(j, 1, b * a)
		{
			if(e[i][j] > _max && e[i][j] < 1e9) _max = e[i][j];
		}
	}
	printf("%d\n",_max);
	return 0;	
}



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

int main() {

  int a;
  cin >> a;
  
  vector<int> t(a);
  rep(i,a) cin >> t[i];
  
  vector<int> ans(a);
  ans = t;
  sort(ans.begin(), ans.end());
  
  int sum = 0;
  
  rep(i,a) {
    if(ans[i] == t[i]) sum += 1;
  }
  
  if(sum == a-2 || sum == a) cout << "YES" << endl;
  else cout << "NO" << endl;
  
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string s, ans = "";
int main()
{
    cin >> s;
    string tmp = "";
    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == 'A' || s[i] == 'T' || s[i] == 'G' || s[i] == 'C')
        {
            tmp += s[i];
        }
        else
        {
            if (tmp.length() > ans.length())
            {
                ans = tmp;
            }
            tmp = "";
        }
    }
    if (tmp.length() > ans.length())
    {
        ans = tmp;
    }
    cout << ans.length() << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<map>
using namespace std;
#define N 100010
int a[N];
map<int,int> p;
int main()
{
    int n,i,j,k,t,s;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        p[a[i]]++;
    }
    sort(a,a+n);
    s=0;
    for(i=0;i<n;i++)
    {
        j=p[a[i]];
        if(j==0)
        continue;
        if(j>a[i])
        s=s+j-a[i];
        else
        if(j<a[i])
        s=s+j;
        p[a[i]]=0;
        //printf("%d\n",s);
    }
    printf("%d\n",s);
    return 0;
}


Measured memory_bytes: 5120
#include <stdio.h>

int main(){
    
    int x=1;
    int i= 1;
    
    while(1){
        scanf("%d", &x);
        if(x == 0){
            break;
        }
        printf("Case %d: %d\n", i, x);
        i++;
    }
    return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

template<class G>
class Fenwick_tree{
	vector<G> a;
public:
	Fenwick_tree(int n):a(n){}
	void add(int i,G val){
		for(i++;i<=a.size();i+=i&-i) a[i-1]+=val;
	}
	G sum(int l,int r)const{
		if(l==0){
			G res{};
			for(;r>0;r-=r&-r) res+=a[r-1];
			return res;
		}
		return sum(0,r)-sum(0,l);
	}
	int lower_bound(G val)const{
		if(val<=G{}) return 0;
		int x=0,k;
		for(k=1;k<=a.size();k<<=1);
		for(k>>=1;k>0;k>>=1) if(x+k<=a.size() && a[x+k-1]<val) val-=a[x+k-1], x+=k;
		return x;
	}
	int upper_bound(G val)const{
		if(val<G{}) return 0;
		int x=0,k;
		for(k=1;k<=a.size();k<<=1);
		for(k>>=1;k>0;k>>=1) if(x+k<=a.size() && a[x+k-1]<=val) val-=a[x+k-1], x+=k;
		return x;
	}
};

int main(){
	int n,k; scanf("%d%d",&n,&k);
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]);

	Fenwick_tree<double> S(n);
	rep(i,n) S.add(i,(a[i]+1)/2.0);

	double ans=0;
	rep(i,n-k+1) ans=max(ans,S.sum(i,i+k));
	printf("%.9f\n",ans);

	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	ll n,W;
	cin >> n >> W;
	vector<vector<ll> > v(4);
	ll w1,v1;
	cin >> w1 >> v1;
	v[0].push_back(v1);
	for(ll i = 0; i < n-1; i++){
		ll ww,vv;
		cin >> ww >> vv;
		v[ww-w1].push_back(vv);
	}

	for(ll i = 0; i < 4; i++){
		sort(all(v[i]));
		reverse(all(v[i]));
	}
	vector<vector<ll> > sum(4);
	for(ll i = 0; i < 4; i++){
		sum[i].resize(v[i].size()+1,0);
		for(ll j = 0; j < v[i].size(); j++){
			sum[i][j+1] = sum[i][j] + v[i][j];
		}
	}

	ll ans = 0;
	for(ll i0 = 0; i0 <= v[0].size(); i0++){
		for(ll i1 = 0; i1 <= v[1].size(); i1++){
			for(ll i2 = 0; i2 <= v[2].size(); i2++){
				for(ll i3 = 0; i3 <= v[3].size(); i3++){
					ll weight = i0*w1 + i1*(w1+1) + i2*(w1+2) + i3*(w1+3);
					if(weight > W) continue;
					ll res = sum[0][i0] + sum[1][i1] + sum[2][i2] + sum[3][i3];
					ans = max(res,ans);
				}
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int A[2000],n;
int calc(int,int);
int main(){
  int m[2000],i,q,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m[i]);
  }
  j=0;
  for(i=0;i<q;i++){
    if(calc(j,m[i])==0) printf("yes\n");
    else printf("no\n");
  }
  return 0;    
}
int calc(int j, int m){
  int ans;
  if(m==0) return 0;
  else if(j>n) return 1;
  if((calc(j+1,m-A[j])==0) || (calc(j+1,m)==0)) ans = 0;
  else ans = 1;
  return ans;
}



Measured memory_bytes: 2108
#include <iostream>
#include <fstream>
#include <sstream>
#include <random>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <queue>
#include <iostream>
#include <functional>
#include <stdio.h>
#include <string.h>
#include <unordered_map>
#include <set>
#include <iomanip>

#define ll long long
#define mod 1000000007
using namespace std;

int main() {

    int n;
    ll k;
    cin>>n>>k;

    ll h[n];
    ll total_sum = 0;
    for(int i = 0; i < n; i++) {
        cin>>h[i];
        total_sum += h[i];
    }

    priority_queue<int> pq;
    for(int i = 0; i < n; i++) {
        pq.push(h[i]);
    }

    while(k--) {
        total_sum -= pq.top();
        pq.pop();
    }

    if (total_sum < 0) {
        total_sum = 0;
    }

    cout<<total_sum<<'\n';
    return 0;
}


Measured memory_bytes: 2936
//g++ -std=c++11 -Wall test.cpp -o test -lm -g -O2
#include <bits/stdc++.h>
using namespace std;
#define sws                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define qi queue<int>
#define si stack<int>
#define s string
#define ll long long;
bool organiza(pair<int, int> a, pair<int, int> b)
{
    return a.ff < b.ff;
}
int main()
{
    sws;
    int k, ans = 0;
    cin >> k;
    for (int i = 1; i <= k; i++)
    {
        for (int j = 1; j <= k; j++)
        {
            if (i % 2 == 0 && j % 2 == 1)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define fr(i,a,b) for(int i=a;i<b;i++)
#define frr(i,a,b) for(int i=b-1;i>=a;i--)
#define mod 1000000007
#define pb push_back
#define son ll t; cin>>t;while(t--)
#define fst ios_base::sync_with_stdio(false); cin.tie(NULL);
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define mpr make_pair
#define ff first
#define ss second
#define inf 5e18
#define dex(x,y) fixed<<setprecision(x)<<y
void start()
{
    #ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #endif
}

int32_t main()
{
    fst
//    start();
    int n;
  cin>>n;
  int a[10001]={0};
  fr(i,1,101)
  {
    {fr(j,1,101)
    {fr(k,1,101)
    {int x=i*i+j*j+k*k+i*j+i*k+j*k;
     if(x<=10000)
       a[x]++;}}}}
  fr(i,1,n+1)
    cout<<a[i]<<endl;
      
    
}


Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <numeric>
#define INF 100000000
#define MOD 1000000007
using namespace std;



int main(){
    long long a[26]={};
    int N;
    cin >> N;
    for(int i=0; i<N; i++){
        string s;
        cin >> s;
        a[s[0]-'A']++;
    }
    
    long long num[5]={a['M'-'A'], a['A'-'A'], a['R'-'A'], a['C'-'A'], a['H'-'A']};
    
    long long ans=0;
    for(int i=0; i<5; i++){
        for(int j=i+1; j<5; j++){
            for(int k=j+1; k<5; k++){
                long long temp;
                temp=num[i]*num[j]*num[k];
                ans+=temp;
            }
        }
    }
    cout<<ans<<endl;
    
        
    return 0;
}


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

int main(){
  long long a, b, k;
  cin >> a >> b >> k;
  if (a > k){
    cout << a - k << " " << b << endl;
  }
  else{
    if (b > k-a){
    cout << 0 << " " << b - k + a << endl;
    }
    else cout << 0 << " " << 0 << endl;
  }
}


Measured memory_bytes: 3640
a,b=map(str,input().split( ))
a_12 = int(a[0:2])
a_3 = int(a[2])
a_45 = int(a[3:5])
b_12 = int(b[0:2])
b_3 = int(b[2])
b_45 = int(b[3:5])
a_21 = int(a[1]+a[0])
b_21 = int(b[1]+b[0])
ans = (b_12-a_12+1)*10 - a_3 - (10 - b_3 - 1)
if a_21 < a_45:
    ans = ans - 1
if b_21 > b_45:
    ans = ans - 1
print(ans)

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

int main()
{
	ll n;
	cin >> n;
	vector<ll> cnt(n+1);

	for(int i = 1;i*i<=n;i++)
		for(int j = 1;j*j<=n;j++)
			for(int k = 1;k*k<=n;k++)
			{
				ll now = i*i+j*j+k*k+i*j+j*k+i*k;
				if(now>n)continue;
				cnt[now] ++ ;
			}
	for(int i = 1;i<=n;i++)cout << cnt[i] << endl;
}


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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int32_t main()
{
    IOS
    string s;
    cin>>s;
    if (s=="hi"||s=="hihi"||s=="hihihi"||s=="hihihihi"||s=="hihihihihi") cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
	int  A, B, C, K;
	int i = 0;
	int d = 0;
	scanf("%d", &A);
	scanf("%d", &B);
	scanf("%d", &C);
	scanf("%d", &K); 
	while(K - i != 0) {
		if (i < A) {
			i++;
			d++;
		}
		else if (i < A + B) {
			i++;
		}
		else {
			i++;
			d--;
		}
	}
	printf("%d", d);

return 0;
}

Measured memory_bytes: 2156
#include<iostream>
#include<algorithm>
#include<stdio.h>

using namespace std;

int main() {
    int H, W;

    while (cin >> H >> W) {
        if(H==0) return 0;

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }


}


Measured memory_bytes: 3028
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		while (true) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();

			if ((n + m) == 0)
				break;

			int[] t = new int[1000];
			int[] h = new int[1000];

			int sum_t = 0;
			int sum_h = 0;

			for (int i = 0; i < n; i++) {
				t[i] = scanner.nextInt();
				sum_t += t[i];
			}
			for (int j = 0; j < m; j++) {
				h[j] = scanner.nextInt();
				sum_h += h[j];
			}

			int ct = 10000000;
			int ch = 10000000;

			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					if (sum_t - t[i] + h[j] == sum_h - h[j] + t[i]) {
						if (t[i] + h[j] < ct + ch) {
							ct = t[i];
							ch = h[j];
						}
					}
				}
			}
			if (ct == 10000000 && ch == 10000000) {
				System.out.println("-1");
			} else {
				System.out.println(ct + " " + ch);
			}
		}
	}
}

Measured memory_bytes: 23412
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YN(x)         cout << ((x) ? "YES" : "NO") << endl
#define Yn(x)         cout << ((x) ? "Yes" : "No") << endl
#define yn(x)         cout << ((x) ? "yes" : "no") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  // 10^18 くらいまでいける

// for DP
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 ll INF = 1LL << 60;

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

  vector<pair<int, char>> sc(m);
  rep(i, m)cin >> sc[i].first >> sc[i].second;

  int max_v = pow(10, n);
  bool flag=true;
  string tmp;

  // debug(max_v);

  for (int i=0; i<max_v; i++){
    tmp = to_string(i);

    if (tmp.length() != n)
      continue;

    // debug(tmp);
    for (int j=0; j<m; j++){  
      // debug(sc[j].first);
      // debug(sc[j].second);
      if (tmp[sc[j].first-1] == sc[j].second)
        flag=true;
      else
        flag = false;

      if (!flag)
        break;
    }

    if (flag){
      cout << i << endl;
      return 0;
    }
  }

  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
from sys import stdin
#, setrecursionlimit, stdout
#setrecursionlimit(1000000)
#from collections import deque
#from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readline().split())
def fmi(): return map(float, stdin.readline().split())
def li(): return list(mi())
def si(): return stdin.readline().rstrip()
def lsi(): return list(si())
#mod=1000000007
res=['Yes', 'No']
############# CODE STARTS HERE #############


test_case=1
while test_case:
    test_case-=1

    a=si()
    f=0
    if a<='Z':
        f=1
    print(['a', 'A'][f])

Measured memory_bytes: 61880
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <math.h>
#include <time.h>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <tuple>
using namespace std;
typedef long long ll;

int par[100010];
int rnk[100010];
ll sze[100010];

// 初期化
void init(int n) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
        rnk[i] = 0;
        sze[i] = 1;
    }
}

// 親探し
int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
}

// 併合
void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (rnk[x] < rnk[y]) {
        sze[y] = sze[x] + sze[y];
        par[x] = y;
    }
    else {
        sze[x] = sze[x] + sze[y];
        par[y] = x;
        if (rnk[x] == rnk[y]) rnk[x]++;
    }
    
}

// 同じ木にあるか
bool same(int x, int y) {
    return find(x) == find(y);
}

int main(void){
    ll n, m, a[100010], b[100010];
    cin >> n >> m;
    
    init(n);
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        a[i]--;  b[i]--;
    }
    
    ll ans[100010];
    for (int i = m - 1; i >= 0; i--) {
        ans[m] = n * (n - 1) / 2;
        /*if (i == m - 1) {
            ans[i] = n * (n - 1) / 2;
            unite(find(a[i]), find(b[i]));
        }
        else*/ if (!same(a[i], b[i])) {
            ans[i] = ans[i + 1] - sze[find(a[i])] * sze[find(b[i])];
            //cout << i << ": " << sze[find(a[i])] <<" "<< sze[find(b[i])] << endl;
            unite(find(a[i]), find(b[i]));
        }
        else ans[i] = ans[i + 1];
        
        /*for (int j = 0; j < n; j++) cout << "par "<< par[j] << " ";
        cout << endl;
        for (int j = 0; j < n; j++) cout << sze[j] << " ";
        cout << endl;*/
    }
    
    for (int i = 1; i <= m; i++) cout << ans[i] << endl;
    
    
    
}


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

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	int a,b,c;
	cin>>a>>b>>c;
	int x=a*100+b*10+c;
	cout<<(x%4==0?"YES\n":"NO\n");
}




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


int n = 0;

int main(void)
{
    
    int m = 0;
    int a = 0;
    int i = 0;
    
    scanf("%d %d", &n, &m);
    
    for(i = 0; i < m; i++)
    {
        scanf("%d", &a);
        n -= a;
    }
    
    if(n < 0)
    {
        printf("-1");
    }
    else
    {
        printf("%d", n);
    }
    
    return 0;
    
}


Measured memory_bytes: 1688
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
int mod = 1e9+7;

P p[100];
int ok(int mid, int y){
	if(mid*mid >= y)return 0;
	else return 1;
}

int Root(int y){
	int lb = 1, ub = inf;
	while(ub-lb > 1){
		int mid = (ub+lb)/2;
		int f = ok(mid, y);
		if(f)lb = mid;
		else ub = mid;
	}
	return lb;
}

signed main(){
	int n;
	scanf("%lld", &n);
	rep(i,n){
		int x, y;
		scanf("%lld%lld", &x, &y);
		if(x > y)swap(x, y);
		p[i] = P(x, y);
	}
	
	rep(i,n){
		int x = p[i].fi*p[i].se;
		int c = Root(x);
		if(p[i].fi == p[i].se or p[i].fi+1 == p[i].se){
			printf("%lld\n", 2*p[i].fi-2);
			continue;
		}
		if(c*(c+1) >= x)printf("%lld\n", 2*c-2);
		else printf("%lld\n", 2*c-1);
	}
	return 0;
}



Measured memory_bytes: 256
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
pos = "POSSIBLE"
imp = "IMPOSSIBLE"

if max(A) < K:
  print(imp)
  exit()

for i in range(1, N):
  a = A[i - 1]
  b = A[i]
  while a != b:
    if a < b:
      b -= (b // a) * a
      if b == 0:
        b = a
    else:
      a -= (a // b) * b
      if a == 0:
        a = b
  A[i - 1] = a
  A[i] = b

if K % A[-1] == 0:
  print(pos)
else:
  print(imp)

Measured memory_bytes: 14224
#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{

	//int Test=1;; scanf("%d", &Test); while (Test--){
    int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2);

    // (x2 - x1, y2 - y1)
		// (y1 - y2, x2 - x1)
		int x3 = x2 + (y1 - y2);
		int y3 = y2 + (x2 - x1);
		int x4 = x3 + (x1 - x2);
		int y4 = y3 + (y1 - y2);
		printf("%d %d %d %d\n", x3, y3, x4, y4);
	//}

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
using namespace std;

int main(void) {
	int N, P;
	while (cin >> N >> P, N) {
		vector<int> player(N, 0);
		int nowi = 0;
		int wan = P;
		
		while (true) {
			if (wan != 0) {
				wan--;
				player[nowi]++;
			}else {
				wan += player[nowi];
				player[nowi] = 0;
			}

			if (wan == 0) {
				int pi;
				for (pi = 0; pi < N; pi++) {
					if (player[pi] != 0 && nowi != pi){
						break;
					}
				}
				if (pi == N) {
					break;
				}
			}


			nowi = (nowi + 1) % N;
		}

		cout << nowi << endl;
	}

	return 0;
}

Measured memory_bytes: 1196
n,k=map(int, input().split())
S=[0]*n
for i in range(k):
    d=int(input())
    A=list(map(int, input().split()))
    for i in range(d):
        S[A[i]-1]+=1
t=0
for i in range(n):
    if S[i]==0:
        t+=1
print(t)


Measured memory_bytes: 9188
#include<iostream>
int main() {
	int a[28], b[30] = {};
	for (int i = 0; i < 28; i += 1)
		std::cin >> a[i];
	for (int i = 0; i < 28; i += 1) {
		b[a[i] - 1] = 1;
	}
	for (int i = 0; i < 30; i += 1) {
		if (b[i] == 0)
			std::cout << i + 1 << std::endl;
	}
	return 0;
}

Measured memory_bytes: 3112
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

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

int main() {
	int n = ri();
	std::string s;
	std::cin >> s;
	int64_t res = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < i; j++) {
			if (s[i] == s[j]) continue;
			res += j;
			for (int k = 0; k < j; k++) if (s[k] == s[i] || s[k] == s[j]) res--;
			if (j + j - i >= 0 && (s[j + j - i] != s[i] && s[j + j - i] != s[j])) res--;
		}
	}
	printf("%" PRId64 "\n", res);
	return 0;
}


Measured memory_bytes: 3796
import java.util.Scanner;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int[] as = new int[n];
        
        int[] outputs = new int[n];
        
        for (int i = 0; i < n; i ++) {
            as [i] = s.nextInt();
            outputs [as [i] - 1] = i + 1;
        }
        
        for (int i : outputs) {
            System.out.print(i);
            System.out.print(" ");
        }
        
    }
    
}


Measured memory_bytes: 63212
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

from collections import defaultdict, deque
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
# list(map(int, input().split()))
mod = 10 ** 9 + 7

N = getN()
splitlist = [1]
splitsix = 6
while splitsix < 100000:
    splitlist.append(splitsix)
    splitsix *= 6
splitnine = 9
while splitnine < 100000:
    splitlist.append(splitnine)
    splitnine *= 9
splitlist.sort()
# これやらないと再帰が無限に実行される
splitlist.reverse()

ans = float('inf')
dp = [float('inf')] * (N + 1)
dp[0] = 0

# 貰うdp
for i in range(N + 1):
    for k in splitlist:
        if i >= k:
            dp[i] = min(dp[i], dp[i - k] + 1)
print(dp[-1])

Measured memory_bytes: 44368
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())
#define fi first
#define se second

signed main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int n;
    cin >> n;
    pair<string, pair<int, int> > p[n];
    for(int i = 0; i < n; i++) {
        cin >> p[i].fi >> p[i].se.fi;
        p[i].se.fi *= -1;
        p[i].se.se = i + 1;
    }
    sort(p, p + n);
    for(int i = 0; i < n;  i++) {
        cout << p[i].se.se << "\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
const int INF_INT = 2147483647;
const long long INF_LONG = 9223372036854775807;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
     
int main() {
  int n;  cin >> n;
  set<int> s, kesu;
  rep (i, n) {
    int x;  cin >> x;
    if (s.count(x)) kesu.insert(x);
    s.insert(x);
  }

  for (int x : s) {
    for (int i=2; x*i <= *(s.rbegin()); ++i) {
      if (s.count(x*i)) s.erase(x*i);
    }
  }
  
  for (int x : kesu) s.erase(x);

  int ans = s.size();
  cout << ans <<endl;
}

Measured memory_bytes: 13000
#include <stdio.h>
signed main(){
    int N,i;
    int ac=0,wa=0,tle=0,re=0;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        char S[5]={};
        scanf("%s",S);
        if(S[0]=='A'){
            ac++;
        }
        if(S[0]=='W'){
            wa++;
        }
        if(S[0]=='T'){
            tle++;
        }
        if(S[0]=='R'){
            re++;
        }
    }
    printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n",ac,wa,tle,re);
    return(0);
}

Measured memory_bytes: 1708
a = str(input())

ans = []
for i in range(2**3):
    result = int(a[0])
    for j in range(3):
        if (i >> j) & 1:
            result += int(a[j+1])
            ans.append('+')
        else:
            result -= int(a[j+1])
            ans.append('-')
    if result == 7:
        break
    else:
        ans = []

if len(ans) == 0:
    print(-1)
else:
    print(a[0]+ans[0]+a[1]+ans[1]+a[2]+ans[2]+a[3]+'=7')


Measured memory_bytes: 38384
#include <stdio.h>

int main(void) {
	int  i,j,h,w;
	while(1){
		scanf("%d %d",&h,&w);
		if(h==0&&w==0)break;
			
		
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}

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

int main() {
    //freopen("sample.in", "r", stdin);
    string s;
    cin >> s;
    if (s == "Sunny") cout << "Cloudy" << endl;
    if (s == "Rainy") cout << "Sunny" << endl;
    if (s == "Cloudy") cout << "Rainy" << endl;
}

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

#define ll long long
#define lp(i,n) for(int i=0; i<n; i++)
#define pb push_back
const long double pi=3.141592654;
#define OSOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

const ll inf = 1e9 +5, mod = 1e9+7,N = 1e3+5;

	char grid[N][N];
	int dp[N][N];

int main()
{
	OSOS
	int w,h;
	cin>>h>>w;
	for(int i=0; i<h; i++)
		cin>>grid[i];

	memset(dp,0,sizeof(dp));
	if(grid[0][1] != '#')
		dp[0][1] = 1;
	if(grid[1][0] != '#')
		dp[1][0] = 1;

	for(int i=0; i<h; i++)
	{
		for(int j=0; j<w; j++)
		{
			if(grid[i][j] == '.')
			{
				if(i-1 >= 0)
					dp[i][j] += dp[i-1][j];
				if(j-1 >= 0)
					dp[i][j] += dp[i][j-1];
				dp[i][j]%= mod;
			}
		}
	}
	cout<<dp[h-1][w-1];
}



Measured memory_bytes: 5248
#include <iostream>

using namespace std;

int main(void)
{
    int del_detox;
    int bad_detox;
    int poison;
    int del_eaten;

    cin >> bad_detox >> del_detox >> poison;

    del_eaten = del_detox;
    if(del_detox + bad_detox >= poison){
        del_eaten += poison;
    }else{
        del_eaten += bad_detox + del_detox + 1;
    }
    cout << del_eaten << endl;


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main (){
	int N, N1,i;
	int AC, WA, TLE, RE;
	char str[3];

	AC = WA = TLE = RE = 0;

	scanf("%d",&N);

	for(i=0;i<N;i++){
		scanf("%s",str);
		switch(str[0]){
			case 'A':
				AC ++;
				break;
			case 'W':
				WA ++;
				break;
			case 'T':
				TLE ++;
				break;
			case 'R':
				RE ++;
				break;

		}
	}

	printf("AC x %d\n",AC);
	printf("WA x %d\n",WA);
	printf("TLE x %d\n",TLE);
	printf("RE x %d\n",RE);

	return 0;
}

Measured memory_bytes: 2148
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# input=sys.stdin.readline
def resolve():
    s=input()
    if s=="Sunny":
        print("Cloudy")
    elif s=="Cloudy":
        print("Rainy")
    else:
        print("Sunny")

resolve()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  string s; cin >> s;
  ll n = s.size();
  ll x = 0;
  ll cnt = 0;
  REP(i, n){
    if(s[i] == 'S') cnt++;
    else if(cnt == 0){
      continue;
    }else{
      cnt--;
      x++;
    }
  }
  cout << n - 2*x << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll M=1e9+7;
const ll mxx=1e5+7;


int main()
{
	

    int n;
    cin>>n;
    pair<ll,ll> p[n];
    for(int i=0;i<n;i++)cin>>p[i].first>>p[i].second;

    ll a=1e9,b=1e9,c=1e9,d=1e9;
    ll ans=0;
    for(int i=0;i<n;i++){
    	ll ca=p[i].first,cb=p[i].second;
        if(i!=0)
        {
            ans=max({ans,ca+cb-a,-ca-cb-b,ca-cb-c,-ca+cb-d});
        }
        a=min(a,ca+cb);
        b=min(b,-ca-cb);
        c=min(c,ca-cb);
        d=min(d,-ca+cb);
    }
    cout<<ans;

   
}

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

#define mod 1000000007
#define pb push_back
#define bs binary_search
#define bp __builtin_popcountll

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll n,i,j,k,c,s,W;
    cin>>n>>W;
    ll w[n],v[n];
    for(i=0;i<n;i++)
    cin>>w[i]>>v[i];
    ll t[n+1][W+1];
    
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=W;j++)
        {
            if(i==0||j==0)
            t[i][j]=0;
        }
    }
    
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=W;j++)
        {
            if(w[i-1]<=j)
            t[i][j]=max(v[i-1]+t[i-1][j-w[i-1]], t[i-1][j]);
            else
            t[i][j]=t[i-1][j];
        }
    }
    
    cout<<t[n][W];

return 0;
}

Measured memory_bytes: 79104
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
#define F first
#define S second
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
using priority_queue_small = priority_queue<int, vector<int>, greater<int> >;
template<class T>using vv = vector<T>;
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 (b<a) { a = b; return 1; } return 0; }
template<class T>void show(const vector<T> &a) { for (int i = 0; i < (int)a.size(); ++i) cout << a[i] << (i != (int)a.size()-1 ? " " : "\n"); }
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};

int n, m;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n >> m;
    vll a(n), b(n), c(m), d(m);
    rep(i, 0, n) cin >> a[i] >> b[i];
    rep(i, 0, m) cin >> c[i] >> d[i];
    rep(i, 0, n) {
      ll dist = INF, idx = 0;
      ll x = a[i], y = b[i];
      rep(j, 0, m) {
        if (dist > abs(x - c[j]) + abs(y - d[j])) {
          dist = abs(x - c[j]) + abs(y - d[j]);
          idx = j;
        }
      }
      cout << idx + 1 << endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
#include<queue>
#include<stack>
#include<math.h>
#include<map>
typedef long long int ll;
using namespace std;
#define maxn 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
const int mm=1e6;
ll d[mm];
int main()
{
	ll n,m,i,j,k,kk,a,b,t;
    cin>>a>>b>>n;
    if(n>=b)
    n=b-1;
    	
    	printf("%lld\n",a*n/b-a*(n/b));

}

Measured memory_bytes: 3760
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

def h(a,b):
    return a**5-b**5


x = n_in()

for a in range(-1000,1001):
    for b in range(-1000,1001):
        if x==h(a,b):
            print(a,b)
            exit()

print(-1)


Measured memory_bytes: 67140
n,m = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(n)]
AB.sort()
c = 0
ans = 0
i = 0
while c < m:
  if  c + AB[i][1] <= m:
    c += AB[i][1]
    ans += AB[i][0]*AB[i][1]
    i += 1
  else:
    ans += AB[i][0]*(m-c)
    break

print(ans)


Measured memory_bytes: 27760
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

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



int main(){
    int n, q; cin >> n >> q;
    vector<VI> A(n);
    REP(i, q){
        int op; cin >> op;
        int d, x;
        switch(op){
            case 0:
                cin >> d >> x;
                A[d].PB(x);
                break;
            case 1:
                cin >> d;
                REP(i, A[d].size()){
                    if(i) cout << " ";
                    cout << A[d][i];
                }
                cout << "\n";
                break;
            case 2:
                cin >> d;
                A[d].clear();
        }
    }
    return 0;
}



Measured memory_bytes: 5768
p = 10**9+7
S = int(input())

dp = [0]*2001

dp[1] = 0
dp[2] = 0
dp[3] = 1
dp[4] = 1
dp[5] = 1
dp[6] = 2
dp[7] = 3
dp[8] = 4

if S <= 8:
    print(dp[S])
else:
    for i in range(9, S + 1):
        dp[i] = dp[i - 3] * 2 + dp[i - 4] + dp[i - 5]
        dp[i] %= p
    print(dp[S])

Measured memory_bytes: 63864
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <bitset>    // bitset
#include <deque>     // deque
#include <iomanip>   //setprecsion
#include <iostream>  // cout, endl, cin
#include <map>       // map
#include <queue>     // queue, priority_queue
#include <set>       // set
#include <stack>     // stack
#include <string>    // string, to_string, stoi
#include <tuple>     // tuple, make_tuple
#include <utility>   // pair, make_pair
#include <vector>    // vector

#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>  //sin, cos, tan

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define mp(p, q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
    cout << a << endl;
    exit(0);
}

void Main()
{
    ll a, b, c, d; cin >> a >> b >> c >> d;
    ll m = -1000000000000000010;
    m = max(m, a * c);
    m = max(m, b * c);
    m = max(m, a * d);
    m = max(m, b * d);
    if(m < 0&&a <= 0&&b >= 0||m < 0&&c <= 0&&d >= 0) m = 0;
    fin(m);
}

//前処理
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10); //高精度少数表示
    Main();
    return 0;
}


Measured memory_bytes: 3648
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

N,M = myinput()
H = list(myinput())
AB = mylistinput(M)

g = [ [] for _ in range(N) ]
for i in range(M):
    a = AB[i][0] - 1
    b = AB[i][1] - 1
    g[a].append(b)
    g[b].append(a)
# print(g)

count = 0
for i in range(N):
    ls = g[i]
    h = H[i]
    flag = True
    for j in range(len(ls)):
        if H[ls[j]]>=h:
            flag = False
    if flag:
        # print("i={}".format(i))
        count += 1
print(count)    

Measured memory_bytes: 107564
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    qsort(a, 3, sizeof(int), asc);
    cout << a[0] + a[1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
	int n, a;
	int minval = +1000000;
	int maxval = -1000000;
	long long sumval = 0;

	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
	{
		scanf("%d", &a);
		minval = minval < a ? minval : a;
		maxval = maxval > a ? maxval : a;
		sumval += a;
	}
	printf("%d %d %lld\n", minval, maxval, sumval);
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <queue>
#include <utility>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;
using pii = pair<ll,ll>;

bool comp(const pii &a, const pii &b){
    if(a.first < b.first) return true;   
    return false;
}

int main(){
    ll n,m;
    cin >> n >> m;
    vector<pii> vec(n);
    ll a,b;
    rep(i,n){
        cin >> a >> b;
        vec[i] = make_pair(a,b);
    }

    sort(vec.begin(), vec.end(), comp );
    ll ans = 0;

    rep(i,n){
        ans += min(vec[i].second, m)*vec[i].first;
        m -= vec[i].second;
        if(m < 0)break;
    }
    cout << ans << endl;

    return 0;
}

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

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

Measured memory_bytes: 256