akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
 
const ll INF = 2e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop
 
ll dx[8]={1,0,-1,0,1,1,-1,-1};
ll dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//↓,→,↑,←

#define endl "\n"
#ifdef ENJAPMA
    #undef endl
#endif
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)(); 
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

// const ll mod = 998244353ll;
const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod){ll x=1;while(b){while(!(b&1)){(a*=a)%=mod;b>>=1;}(x*=a)%=mod;b--;}return x;}
void YES(bool cond){ if(cond){ p("YES");}else{ p("NO");} return;}
void Yes(bool cond){ if(cond){ p("Yes");}else{ p("No");} return;}

/*
ll fact[fact_table + 5],rfact[fact_table + 5]; 
 
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

bool multicase = false;

ll n,m,num,a,b,c,d,e,h,q;
ll w, k, ans;

ll x[500005], y[500005], z[500005];
string s;

void solve(){
    cin >> s;
    p(s.substr(0, 3));
    return;
}

int main(){
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if(multicase){
        cin >> q;
    }else{
        q = 1; 
    }
    while(q--){
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}
















Measured memory_bytes: 3648
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main() {char Tex[99],T;int N=0,i=0;while (scanf("%c",&T)!=EOF) if (T>='0' && T<='9') Tex[i++]=T; else {Tex[i]=0;N+=atoi(Tex);i=0;} printf("%d\n",N);return 0;}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

int main() {
	int n;
	cin >> n;
	vector<int> v(n);
	rep(i,n) cin >> v[i];
	int q;
	cin >> q;
	vector<pii> u(q);
	rep(i,q) cin >> u[i].first >> u[i].second;
	map<int, int> mp;
	ll sum = 0;
	rep(i,n) {
		mp[v[i]]++;
		sum += v[i];
	}

	rep(i,q) {
		sum -= (ll) u[i].first * mp[u[i].first];
		sum += (ll) u[i].second * mp[u[i].first];
		mp[u[i].second] += mp[u[i].first];
		mp[u[i].first] = 0;
		cout << sum << endl;
	}
}

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

typedef long long ll;

int main() {
    int N, M;
    cin >> N >> M;
    pair<ll, ll> drink[N+10];
    for (int i=0; i<N; i++) {
        cin >> drink[i].first >> drink[i].second;
    }

    sort(drink, drink + N);

    ll ans = 0;

    for (int i=0; i<N && M != 0; i++) {
        if (M >= drink[i].second) {
            ans += drink[i].first * drink[i].second;
            M -= drink[i].second;
        }
        else{
            ans += drink[i].first * M;
            M = 0;
        }


    }

    cout << ans << endl;
}


Measured memory_bytes: 1792
# coding: utf-8


def main():
    k = int(input())
    res = 0

    if k % 2 == 0:
        res = (k // 2) ** 2
    else:
        res = (k // 2) * ((k // 2) + 1)

    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import sys

input_line = [int(x) for x in input().split()]
N = input_line[0]
H = input_line[1]
W = input_line[2]

A = [[int(x) for x in input().split()] for x in range(N)]

cnt = 0
#A[[10,3],[5,2],[2,5]]
for _ in range(N):
    if A[_][0] // H > 0 and A[_][1] // W > 0:
        cnt += 1

print(cnt)

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

typedef complex<double> Point;
typedef vector<Point> VP;
const double INF = 1e9;
const double EPS = 1e-9;
const double PI = acos(-1.0);
#define X real()
#define Y imag()


double dot(Point a, Point b){
    return a.X*b.X + a.Y*b.Y;
}

double cross(Point a, Point b){
    return a.X*b.Y - a.Y*b.X;
}

int ccw(Point a, Point b, Point c){
    b -= a; c -= a;
    if(cross(b,c) > +EPS) return +1;
    if(cross(b,c) < -EPS) return -1;
    if(dot(b,c)   < -EPS) return +2;
    if(norm(b) < norm(c)) return -2;
    return 0;
}


bool isecSS(Point a1,Point a2,Point b1,Point b2){
    return ccw(a1,a2,b1)*ccw(a1,a2,b2) <= 0 &&
           ccw(b1,b2,a1)*ccw(b1,b2,a2) <= 0;
}

bool isecSP(Point a1,Point a2,Point b){
    return !ccw(a1,a2,b);
}

Point proj(Point a1, Point a2, Point p){
    return a1 + dot(a2-a1, p-a1)/norm(a2-a1)*(a2-a1);
}

double distSP(Point a1, Point a2, Point p){
    Point r = proj(a1,a2,p);
    if(isecSP(a1,a2,r)) return abs(r-p);
    return min(abs(a1-p),abs(a2-p));
}


double distSS(Point a1,Point a2,Point b1,Point b2){
    if(isecSS(a1,a2,b1,b2)) return 0;
    return min({
        distSP(a1,a2,b1),
        distSP(a1,a2,b2),
        distSP(b1,b2,a1),
        distSP(b1,b2,a2)});
}

VP make_star(double x,double y,double a,double r){
    VP s(5);
    rep(i,5){
        s[i] = Point(x,y) + polar(r, (90+a+144*i)*PI/180.0);
    }
    return s;
}

double dist_star(VP s1, VP s2){
    double res = INF;
    rep(i,5)rep(j,5){
        double dist = distSS(s1[i],s1[(i+1)%5], s2[j],s2[(j+1)%5]);
        res = min(res,dist);
    }
    return res;
}

int main(){
    int N,M,L;
    while(cin>>N>>M>>L, N|M|L){
        vector<VP> st(N);
        rep(i,N){
            double x,y,a,r;
            cin>>x>>y>>a>>r;
            st[i] = make_star(x,y,a,r);
        }
        vector<vector<double>> d(N, vector<double>(N, INF));
        rep(i,N) d[i][i] = 0;
        rep(i,N)rep(j,i){
            double dist = dist_star(st[i],st[j]);
            d[i][j] = dist;
            d[j][i] = dist;
        }
        rep(k,N)rep(i,N)rep(j,N) d[i][j] = min(d[i][j], d[i][k]+d[k][j]);
        printf("%.20f\n",d[M-1][L-1]);
    }
}


Measured memory_bytes: 3824
#include <stdio.h>

int parent(int);
int left(int);
int right(int);


int main(){
int i,n,A[251],p,r,l;

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



for(i=1;i<=n;i++){
printf("node %d: key = %d, ",i,A[i]);


if(i>1) {
p=parent(i);
printf("parent key = %d, ",A[p]);
}


if(n>=2*i){
l=left(i);

printf("left key = %d, ",A[l]);
}

if(n>=2*i+1) {
r=right(i);
printf("right key = %d, ",A[r]);
}


printf("\n");
}


return 0;

}



int parent(int i){
return (i/2);
    
}
  
int left(int i){
return 2*i;
}
  
int right(int i){
return (2*i)+1;
    
}
  

Measured memory_bytes: 600
using System;

namespace AtCoder
{
    class program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int A = int.Parse(input[0]);int B = int.Parse(input[1]);int C = int.Parse(input[2]);

            if(B == C){
                Console.WriteLine(A);
            }else if (A == C){
                Console.WriteLine(B);
            }else{
                Console.WriteLine(C);
            }
        }
    }
}


Measured memory_bytes: 13140
n = int(input())
say = []

for i in range(n):
    a = int(input())
    for j in range(a):
        x,y = map(int,input().split())
        say.append([i,x-1,y])

ans = 0
fm = "0"+str(n)+"b"
for i in range(2**n):
    flag = True
    s = str(format(i,fm))
    for j in say:
        if s[j[0]] == "1" and int(s[j[1]]) + j[2] == 1:
            flag = False
            break
    if flag and ans < s.count("1"):
        ans = s.count("1")

print(ans)
        

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

#define int long long
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a ; i<(int)n ; i++)
#define rf(i,n,a) for(int i=n ; i>=a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
#define fill(a,v) memset(a,v,sizeof(a))
#define d1(a) cout << a << "\n"
#define d2(a,b) cout << a << " " << b << "\n"
#define d3(a,b,c) cout << a << " " << b << " " << c << "\n"
#define d4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << "\n"
#define fast ios:: sync_with_stdio(false),cin.tie(nullptr);

typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;

const int inf = 1e9;
const int inf64 = 1e18;
const int MOD = inf + 7;
const int N = 2e5 + 5;
int a[N];
int n;
map<pii , int> dp;
int solve(int id , int need){
	if(need == 0)	return 0;
	if(need > (n - id + 2)/2 || id > n)	return -inf64;
	if(dp.find({id , need}) != dp.end())	return dp[{id , need}];
	int res = -inf64;
	res = max(res , solve(id + 1 , need));
	res = max(res , solve(id + 2 , need - 1) + a[id]);
	dp[{id , need}] = res;
	return res;
}
int32_t main(){
	fast;
	cin >> n;
	for(int i=1 ; i<=n ; i++){
		cin >> a[i];
	}		
	int ans = solve(1 , n/2);
	cout << ans;
}

Measured memory_bytes: 33340
#include <iostream> 
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define MAX 1000001
ll prime[MAX];
#define FAST           ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define gcd __gcd
// ll rec(vector<vector<ll> >& dp,vector<ll>& arr,int n,int i,int k,int w)
// {
//   ll ans=0;
//   if(i>=n)
//     return 0;

//   if(dp[i][k]!=-1)
//     return dp[i][k];


//   if(k!=0)
//   ans=max(rec(dp,arr,n,i+1,w,w),arr[i]+rec(dp,arr,n,i+1,k-1,w));
//   else
//   ans=max(rec(dp,arr,n,i+1,k,w),rec(dp,arr,n,i+1,w,w));

//   return dp[i][k]=ans;

// }

//ll t[400008];
// void build(vector<ll>& a, int v, int tl, int tr) {
//     if (tl == tr) {
//         t[v] = a[tl];
//     } else {
//         int tm = (tl + tr) / 2;
//         build(a, v*2, tl, tm);
//         build(a, v*2+1, tm+1, tr);
//         t[v] = max(t[v*2] ,t[v*2+1]);
//     }
// }

// ll maxi(int v, int tl, int tr, int l, int r) {
//     if (l > r) 
//         return 0;
//     if (l == tl && r == tr) {
//         return t[v];
//     }
//     int tm = (tl + tr) / 2;
//     return max(maxi(v*2, tl, tm, l, min(r, tm)) ,maxi(v*2+1, tm+1, tr, max(l, tm+1), r));
// }



// void update(int v, int tl, int tr, int pos, ll new_val) {
//     if (tl == tr) {
//         t[v] = new_val;
//     } else {
//         int tm = (tl + tr) / 2;
//         if (pos <= tm)
//             update(v*2, tl, tm, pos, new_val);
//         else
//             update(v*2+1, tm+1, tr, pos, new_val);
//         t[v] = max(t[v*2] ,t[v*2+1]);
//     }
// }


struct hash_pair {
   template <class T1, class T2>
   size_t operator()(const pair<T1, T2>& p) const{
      auto hash1 = hash<T1>{}(p.first);
      auto hash2 = hash<T2>{}(p.second);
      return hash1 ^ hash2;
   }
};


int temp[1000002]={0};

void sieve()
{
  temp[1]=1;
  for(int i=2;i<1000002;i++)
  {
    if(temp[i]==0)
    { temp[i]=i;
      for(int j=i*2;j<1000002;j+=i)
      { 
        if(temp[j]==0)
        temp[j]=i;
      }
    }
  }

}

int dfs(int i,vector<vector<int> > &g,vector<int>& p,vector<int>& c)
{
  int sub=1;
  for(auto x:g[i])
  {
    if(p[i]!=x)
    {
      p[x]=i;
      sub+=dfs(x,g,p,c);
    }
  }

  return c[i]=sub;
}


int main() { 


ll n;
cin>>n;
ll ans1=1,ans2=1,ans3=1,ans4=1;

if(n==1)
  { cout<<0;
    return 0;
}


for(int i=0;i<n;i++)
{
  ans1=(ans1*10)%mod;
}


for(int i=0;i<n;i++)
{
   ans2=(ans2*9)%mod;
}
ans2=(ans2*2)%mod;

for(int i=0;i<n;i++)
{
   ans3=(ans3*8)%mod;
}

ans4=((ans1-ans2+mod)%mod + ans3)%mod;
cout<<ans4;

return 0;
}
/*
1
4
1 2
2 3
3 4
*/


Measured memory_bytes: 3588
import sys
s = sys.stdin.readline().rstrip("\n")
ans = {'SSS': 0,
 'SSR': 1,
 'SRS': 1,
 'SRR': 2,
 'RSS': 1,
 'RSR': 1,
 'RRS': 2,
 'RRR': 3}
print(ans[s])

Measured memory_bytes: 8912
// atcoder/abc155/B/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }
template<typename P, typename Q> inline pair<Q, P> reverse(pair<P, Q> p) { return make_pair(p.second, p.first); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    vector<int> a(n);
    cin >> a;
    bool f = true;
    each (i, a) {
      if (i % 2);
      else {
        f = f && (i % 3 == 0 || i % 5 == 0);
      }
    }
    cout << (f ? "APPROVED" : "DENIED") << endl;
  }

  return 0;
}


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

int main(int argc, char** argv) {
	int n;
	while (cin >> n) {
		bool data[200050] = { 0 };
		for (int j = 4; j < 50200; j = j + 2) {
			data[j] = 1;
		}
		for (int i = 3; i < 50200; i = i + 2) {
			for (int j = 2 * i; j < 50200; j = j + i) {
				data[j] = 1;
			}
		}

		for (int i = n - 1; i >= 2; --i) {
			if (!data[i]) {
				cout << i;
				break;
			}
		}
		for (int i = n + 1; i < 50200; ++i) {
			if (!data[i]) {
				cout << " " << i << endl;
				break;
			}
		}
	}
}

Measured memory_bytes: 3248
#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 <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {

    ll N, K;
    cin >> N >> K;
    vector<ll> h(N);
    REP(i, N) cin >> h[i];
    sort(h.begin(), h.end());
    //REP(i, N) cout << h[i] << " ";
    ll ans = INF;
    REP(i, N-K+1){
        ans = min(ans, h[i+K-1] - h[i]);
    }
    cout << ans << endl;

    return 0;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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; }

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int A, B;
  cin >> A >> B;
  if(A+B >= 10){
    cout << "error" << endl;
  }else{
    cout << A + B << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MS(a) memset(a,0,sizeof(a))
#define MP make_pair
#define PB push_back
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
inline ll read(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
//////////////////////////////////////////////////////////////////////////
const int maxn = 1e5+10;

char s[55][55];
int a[55][30];

int main(){
	int n = read();
	for(int i=0; i<n; i++){
		scanf("%s",s[i]);
		int len = strlen(s[i]);
		for(int j=0; j<len; j++)
			a[i][s[i][j]-'a']++;
	}

	string ans="";
	for(int j=0; j<26; j++){
		int t=100;
		for(int i=0; i<n; i++){
			t = min(a[i][j],t);
		}
		for(int k=0; k<t; k++)
			ans += 'a'+j;
	}
	cout << ans << endl;

    return 0;
}

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


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a,b;cin>>a>>b;
    cout<<(b+a-3)/(a-1)<<endl;
    return 0;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;

int N = 1000;

int lcs(string X, string Y){
    int c[N+1][N+1];
    int m = X.size();
    int n = Y.size();
    int maxl = 0;
    X = ' ' + X;
    Y = ' ' + Y;
    for (int i=1;i<=m;i++) c[i][0] = 0;
    for (int j=1;j<=n;j++) c[0][j] = 0;
    for (int i=1;i<=m;i++){
        for(int j=1;j<=n;j++){
            if (X[i] == Y[j]){
                c[i][j] = c[i-1][j-1] + 1;
            }else{
                c[i][j] = max(c[i-1][j], c[i][j-1]);
            }
            maxl = max(maxl, c[i][j]);
        }
    }
    return maxl;
}

int main(){
    string s1, s2;
    int n; cin >> n;
    rep(i,n){
        cin >> s1 >> s2;
        cout << lcs(s1, s2) << endl;
    }
    return 0;
}


Measured memory_bytes: 7084
M,*a=10**9+7;
*I=r=j=1;
n,*z=`dd`.split.map &:to_i;
(0..n).map{|i|a[k=z[i]]?X=a[k]+n-i:a[k]=i};
(0..n).map{|i|I<<s=i<1?1:M/-~i*-I[M%-~i];p (-j+r=r*(n+1-i)*s%M)%M;j=j*(X-i)*s%M}

Measured memory_bytes: 20992
n,m = map(int,input().split())
A=[input().split(' ') for i in range(m)]
 
ac={i:0 for i in range(1,n+1)}
wa={i:0 for i in range(1,n+1)}
wa2={i:0 for i in range(1,n+1)}
 
for i in range(m):
    if A[i][1]=='AC':
        tmp=int(A[i][0])
        ac[tmp]=1
    else:
        tmp=int(A[i][0])
        if ac[tmp]==1:
            pass
        else:
            wa[tmp]+=1
for i in range(1,n+1):
    if ac[i]==1:
        wa2[i]=wa[i]
    else:
        pass

print(str(sum(ac.values()))+' '+str(sum(wa2.values())))

Measured memory_bytes: 65784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<l_l> vpl;
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=1;i<=(n);i++)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=10100100100100100;
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;
}
ll n;
vl a(200050);
vl to[200050];
vl dp;
vl ans(200050);
void dfs(int now,int last=-1){
    auto i=lower_bound(dp.begin(),dp.end(),a[now])-dp.begin();
    int old=dp[i];
    dp[i]=a[now];
    ans[now]=i;
    if(last!=-1)ans[now]=max(ans[now],ans[last]);
    for(auto nxt:to[now]){
        if(nxt==last)continue;
        dfs(nxt,now);
    }
    dp[i]=old;
    return;
}
int main(){
    cin>>n;
    rep(i,n)cin>>a[i];
    rep(i,n-1){
        ll u,v;cin>>u>>v;
        u--;v--;
        to[u].pb(v);
        to[v].pb(u);
    }
    dp.resize(n+2,INF);
    dp[0]=-INF;
    dfs(0);
    rep(i,n)cout<<ans[i]<<endl;
    return 0;
}

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

#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REP2(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
typedef long long ll;

int main() {
    ll n, m, c;
    cin >> n >> m >> c;
    vector<ll> b(m);
    rep(i, m) cin >> b[i];

    ll ans = 0;
    rep(i, n){
        ll sum = 0;
        rep(j, m){
            ll a; cin >> a;
            sum += a * b[j];
        }
        if(sum + c > 0) ans++;
    }
    OP(ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)     for(long long int i=a; i<n; i++)
#define loop(i,a,n)     for(long long int i=a; i>=n; i--) 

int main()
{
	ios_base :: sync_with_stdio(false),cin.tie(NULL);
	
	string s, t;
	cin>>s>>t;
	int ans=0, mx=200000, flag=0;
	forr(i, 0, s.size())
	{
		string st="";
		ans=0;
		int l=0;
		forr(j, i, i+t.size())
		{
			if(j>=s.size()){
				flag=1;
				break;
			}
			if(s[j]!=t[l++])
				ans++;
		}
		//cout<<ans<<' '<<i<<'\n';
		if(flag)
			break;
		mx=min(mx, ans);
	}
	cout<<mx;
	
	return 0;
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

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

    vector<int> x(n),pos(n),fin(n);
    iota(all(x),0);
    iota(all(pos),0);
    iota(all(fin),0);

    rep(i,q)
    {
        swap(pos[x[a[i]]],pos[x[b[i]]]);
        swap(x[a[i]],x[b[i]]);
    }

    vector<int> ans(n);
    for(int j=-1; j<=1; ++j)
    {
        int nx = pos[0]+j;
        if(0<=nx && nx<n) ans[nx]=1;
    }
    for(int i=q-1; i>=0; --i)
    {
        swap(pos[x[a[i]]],pos[x[b[i]]]);
        swap(fin[a[i]],fin[b[i]]);
        swap(x[a[i]],x[b[i]]);

        for(int j=-1; j<=1; ++j)
        {
            int nx = pos[0]+j;
            if(0<=nx && nx<n) ans[fin[nx]]=1;
        }
    }

    printf("%d\n", accumulate(all(ans),0));
    return 0;
}


Measured memory_bytes: 2688
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		char[] ch = "abcdefghijklmnopqrstuvwxyz".toCharArray();

		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();

		String ans = "None";
		for(int i = 0;i < ch.length;i++) {
			if(!S.contains(String.valueOf(ch[i]))) {
				ans = String.valueOf(ch[i]);
				break;
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 24660
import math
from collections import defaultdict,deque
#from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""

#t=1
t=ii()
d=defaultdict(int)
for _ in range(t):
    k=ip()
    k.sort()
    k="".join(k)
    d[k]+=1
ans=0    
for i in d.keys():
    ans+=(d[i]*(d[i]-1))//2
print(ans)    
    
    

Measured memory_bytes: 102132
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://agc020.contest.atcoder.jp/tasks/agc020_b>
問題文============================================================
 スケートリンクで、一人の大人の司会と N 人の子供がゲームを行います。
 ゲームは K ラウンドからなり、ラウンド i では司会が次のように言います。
 
 Ai 人組を作って！
 
 すると、まだ脱落していない子供たちは Ai 人からなるグループをできるだけ多く組みます。
 一人につき一つのグループにしか入れません。
 グループに入れなかった子供たちは脱落し、その他は次のラウンドに進みます。 ラウンドで誰も脱落しないこともありえます。
 
 最後まで、つまりラウンド K のあとまで残ったのは 2 人で、彼らが勝者となりました。
 
 あなたは A1, A2, ..., AK の値を聞き、N の値は知りませんが、推定してみたくなりました。
 
 ゲームの開始前にいた子供たちの人数として考えられる最小の値と、最大の値を求めてください。
 もしくは、考えられる N の値は存在しないと判定してください。
 

=================================================================

解説=============================================================

 後ろから考える
 
 後ろから考えた時、その時点での最小値と最大値を l,r とすると
 
 
================================================================
*/
void solve(){
    ll K; cin >> K;
    vector<ll> A(K);
    for(auto &in:A) cin >> in;
    if(A[K-1] != 2){ cout << -1 << endl; return; }
    ll l = 2, r = 2;
    for(ll i = K - 1; i >= 0; i--){

        ll t = (l + A[i] - 1)/A[i] * A[i];
        if(t < l || t > r){
            cout << -1 << endl; return;
        }
        
        l = t;
        r = (r/A[i] + 1)*A[i] - 1;
    }
    cout << l << " " << r << endl;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    solve();
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

// #include <boost/multiprecision/cpp_dec_float.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// using Bint = mp::cpp_int;
// using Real = mp::number<mp::cpp_dec_float<1024>>;

int main(){
    // 頂点数と辺数
    int N, M; cin >> N >> M;

    // グラフ入力受取 (ここでは無向グラフを想定)
    vector<vector<int>> G(N);
    for (int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        G.at(a - 1).push_back(b - 1);
        G.at(b - 1).push_back(a - 1);
    }

    // BFS のためのデータ構造
    vector<int> sign(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    sign.at(0) = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for (int nv : G.at(v)) {
            if (sign.at(nv) != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            sign.at(nv) = v;
            que.push(nv);
        }
    }

    // 結果出力 (各頂点の頂点 0 からの距離を見る)
    cout << "Yes" << endl;
    for(int i = 1; i < N; i++) cout << sign.at(i) + 1 << endl;

}

Measured memory_bytes: 10160
#include<stdio.h>

int main(void){
	int a,b;
	char s[12];
	int i;
	int f = 1;


	scanf("%d %d", &a,&b);
	scanf("%s", s);

	for (i = 0; i < a + b + 1; i++){
		if (i == a){
			if ('-' != s[i]){
				f = 0;
			}
//			printf("check:- ,%d \n", f);
		}
		else{
			if (s[i] < 48 || s[i] > 57){
				f = 0;
			}
//			printf("check:num , %d \n", f);
		}
	}
	if (f == 1){
		printf("Yes\n");
	}else{
	printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[100];
    cin>>s;
    int l=strlen(s),cnt=0;
    for(int i=0;i<l;i++)
    {
        cnt^=s[i];
    }
    if(cnt==0)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


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

void solve()
{
    int d, g;
    cin >> d >> g;
    vector<int> p(d), c(d);
    rep(i, d) cin >> p[i] >> c[i];
    reverse(p.begin(), p.end());
    reverse(c.begin(), c.end());
    int ans = 1e9;
    rep(bit, 1 << d)
    {
        int score = 0, cnt = 0;
        rep(i, d)
        {
            if (bit & (1 << i))
            {
                bool ok = true;
                rep(j, p[i])
                {
                    score += (d - i) * 100;
                    cnt++;
                    if (score >= g)
                    {
                        ok = false;
                        ans = min(ans, cnt);
                        break;
                    }
                }
                if (ok)
                {
                    score += c[i];
                    if (score >= g)
                    {
                        ans = min(ans, cnt);
                    }
                }
            }
        }
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 3564
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 998244353
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int main(){
  int n;cin>>n;
  string s[n];
  int i,j,k;
  rep(i,n) cin>>s[i];
  int cnt=0;
  bool tmp=false;
  rep(i,n){
    rep(j,s[i].length()-2){
      if(s[i][j]=='A' and s[i][j+1]=='B') cnt++;
    }
  }

  int x=0,y=0,z=0;
  int t=0;

  rep(i,n){
    int la=s[i].length()-1;
    if(s[i][la]=='A') x++;
  }
  rep(i,n){
    if(s[i][0]=='B') y++;
  }
  rep(i,n){
    int la=s[i].length()-1;
    if(s[i][la]=='A' and s[i][0]=='B') z++;
  }

  //cout<<x<<y<<endl;
  cnt+=min(x,y);
  if(z>0 and x==z and y==z) cnt--;
  cout<<cnt<<endl;

}


Measured memory_bytes: 768
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        n: usize,
        mut a: [usize; n],
    }
    a.sort();
    a.reverse();
    let mut result = 0;
    let mut heap = BinaryHeap::new();
    heap.push(a[0]);
    for i in 1..n {
        result += heap.pop().unwrap();
        heap.push(a[i]);
        heap.push(a[i]);
    }
    println!("{}", result);
}


Measured memory_bytes: 7876
X = int(input())

if X < 600:
    print('8')
elif X < 800:
    print('7')
elif X < 1000:
    print('6')
elif X < 1200:
    print('5')
elif X < 1400:
    print('4')
elif X < 1600:
    print('3')
elif X < 1800:
    print('2')
else:
    print('1')

Measured memory_bytes: 9176
#include <iostream>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int r, c;
    cin >> r >> c;
    int* tc;
    tc = new int[c];
    for (int i = 0; i < r; i++)
        tc[i] = 0;
    int t;
    int v;
    for (int i = 0; i < r; i++) {
        t = 0;
        for (int j = 0; j < c; j++) {
            cin >> v;
            t += v;
            tc[j] += v;
            cout << v << " ";
        }
        cout << t << "\n";
    }
    t = 0;
    for (int i = 0; i < c; i++) {
        t += tc[i];
        cout << tc[i] << " ";
    }
    cout << t << "\n";
}

Measured memory_bytes: 3152
n = gets.to_s.to_i
s = gets.to_s.chomp

ans = 0
('0'..'9').each do |i|
  ('0'..'9').each do |j|
    ('0'..'9').each do |k|
      pos = s.index(i)
      pos ? (pos = s.index(j, pos+1)) : next
      pos ? (pos = s.index(k, pos+1)) : next
      ans += 1 if pos
    end
  end
end

puts ans

Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

// UnionFind
class UF{
public:
    int n;
    vector<int> parent;
    vector<int> size;

    UF(int n){
        parent.resize(n);
        size.resize(n);
        for(int i = 0; i < n; i++){
            parent[i] = i;
            size[i] = 1;
        }
    }

    bool unite(int a, int b){
        int parentA = find(a);
        int parentB = find(b);

        if(parentA == parentB){
            return false;
        }
        else{
            int sizeA = size[parentA];
            int sizeB = size[parentB];
            if(sizeA < sizeB){
                parent[parentA] = parentB;
                size[parentB] += sizeA;
            }
            else{
                parent[parentB] = parentA;
                size[parentA] += sizeB;
            }
            return true;
        }
    }

    int find(int node){
        int p = parent[node];
        if(p == node){
            return p;
        }
        else{
            int newP = find(p);
            parent[node] = newP;
            return newP;
        }
    }
};

int main(){

    int N, M, K;
    cin >> N >> M >> K;

    vector<int> friendCnt(N, 0);
    vector<int> blockCnt(N, 0);

    UF uf(N);

    int a, b;
    for(int i = 0; i < M; i++){
        cin >> a >> b;
        uf.unite(a - 1, b - 1);
        friendCnt[a - 1]++;
        friendCnt[b - 1]++;
    }

    int c, d;
    for(int i = 0; i < K; i++){
        cin >> c >> d;
        if(uf.find(c - 1) == uf.find(d - 1)){
            blockCnt[c - 1]++;
            blockCnt[d - 1]++;
        }
    }

    for(int i = 0; i < N; i++){
        int p = uf.find(i);
        int ans = (uf.size[p] - 1) - friendCnt[i] - blockCnt[i];
        if(i == N - 1){
            cout << ans << endl;
        }
        else{
            cout << ans << " ";
        }
    }

    return 0;
}

Measured memory_bytes: 2432
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define NUM 500000

int count=0;
void merge(int*,int,int,int);
void mergeSort(int*,int,int);
int main(){
  int n,i,left,right,mid,a[NUM];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }

  left=0;
  right=n;
  
  mergeSort(a,left,right);
  for(i=0;i<n;i++){
    printf("%d",a[i]);
    if(i+1!=n){
      printf(" ");
    }
  }
  printf("\n%d\n",count);

  return 0;
}

void merge(int *a,int left,int mid,int right){
  int n1,n2,i,j,k;
  int *L;
  int *R;
  n1=mid-left;
  n2=right-mid;
  L=(int *)malloc((n1+1)*sizeof(int));
  R=(int *)malloc((n2+1)*sizeof(int));
  for(i=0;i<n1;i++){
    L[i]=a[left+i];
    //          printf("%d ",L[i]);
  }
  //      printf("\n");
  for(i=0;i<n2;i++){
    R[i]=a[mid+i];
    //        printf("  %d  ",R[i]);
  }
  //printf("\n");
  L[n1]=INFINITY;
  R[n2]=INFINITY;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(L[i]<=R[j]){
      a[k]=L[i];
      i++;
      count++;
    }else{
      a[k]=R[j];
      j++;
      count++;
    }
  }
  free(L);
  free(R);
}

void mergeSort(int *a,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(a,left,mid);
    mergeSort(a,mid,right);
    merge(a,left,mid,right);
  }
}



Measured memory_bytes: 5468
import java.util.*;

public class Main {
    static long cnt = 0;
    static ArrayList<Integer> G = new ArrayList<>();
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }

        shellSort(A, N);

        String ansG = "";
        for (int i = G.size()-1; i >= 0; i--) {
            ansG += G.get(i) + " ";
        }
        System.out.println(G.size());
        System.out.println(ansG.substring(0,ansG.length()- 1));
        System.out.println(cnt);
        for (int i = 0; i < N; i++) {
            System.out.println(A[i]);
        }
    }

    static void insertionSort(int[] A, int n, int g){
        int v, j;
        for (int i = g; i < n; i++) {
           v = A[i];
           j = i - g;
           while (j >= 0 && A[j] > v){
               A[j+g] = A[j];
               j -= g;
               cnt++;
           }
           A[j+g] = v;
        }
    }

    static void shellSort(int[] A, int n){
        for (int i = 1; i <= n; i = 3*i + 1) {
            G.add(i);
        }

        //System.out.println(G);

        for (int i = G.size()-1; i >= 0; i--) {
            insertionSort(A, n, G.get(i));

        }
    }
}


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

int main(){
   int n,T;
   cin >> n >> T;
   int minc=10000;
   for(int i=0;i<n;i++){
      int c,t;
      cin >> c >> t;
      if(t<=T){
         minc = min(c,minc);
      }
   }
   if(minc == 10000){
      cout << "TLE";
   }else{
      cout << minc;
   }
   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <tuple>
#include <time.h>
#include <random>
#include <unistd.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 1e18;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
//vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "DRUL";
//ll bit[500005];
//↓,→,↑,←


#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<(x)<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define line cout << "----------" << endl;


ll mod = 1000000007;
ll rui(ll number1,ll number2){

    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){

    if(number1 > number2){
        swap(number1,number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1,number1);
    }
}
void YES(bool condition){

    if(condition){
        p("YES");
    }else{
        p("NO");
    }
    return;
}
void Yes(bool condition){

    if(condition){
        p("Yes");
    }else{
        p("No");
    }
    return;
}


//ll fact[800005],rfact[800005];
/*
void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=800000; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
	rfact[800000] = rui(fact[800000],mod - 2);
	for(ll i=800000; i>=1; i--){
	   rfact[i-1] = rfact[i] * i;
	   rfact[i-1] %= mod;
	}
	return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod) * rfact[n-r]) % mod;}
*/

ll n,m,num,sum,ans,a,b,c,d,e,g,h,w,i,j,k,q;
ll x[300005],y[300005],z[100005];
char s[300005],t[300005];

int main(){
	cin >> n;
	p(3*n*n);
	return 0;
}



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

using namespace std;

typedef long long ll;

int32_t main(){

    ll h;
    cin >> h;
    ll tot = 0, cnt = 1;
    while( h > 1 ){
        h = h/2;
        tot += cnt;
        cnt *= 2;  
    }
    tot += cnt;
    cout << tot << endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
k = 0
if n >= 1 and n <= 9 or n % 2 == 0 and n <= 18 or n % 3 == 0 and n <= 27 or n % 4 == 0 and n <= 36 or n % 5 == 0 and n <= 45 or n % 6 == 0 and n <= 54 or n % 7 == 0 and n <= 63 or n % 8 == 0 and n <= 72 or n % 9 == 0 and n <= 81:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
n, m = map(int, input().split())
s = []
g = []
for _ in range(m):
    A, B = map(int, input().split())
    if A == 1 or B == 1:
        s.append(A * B)
    elif A == n or B == n:
        g.append(A + B - n)
if len(set(s) & set(g)) == 0:
    print("IM", end="")
print("POSSIBLE")

Measured memory_bytes: 21816
import java.util.Scanner;

public class Main {
  static char c;

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    c = sc.next().charAt(0);

    boolean isVowel = false;
    switch(c){
      case 'a': case 'e': case 'i': case 'o': case 'u':
        isVowel = true;
    }

    if(isVowel){
      System.out.println("vowel");
    }
    else{
      System.out.println("consonant");
    }
  }
}


Measured memory_bytes: 9556
#include <iostream>
#include <stdlib.h>

using namespace std;

int n;
int x[100005], y[100005], t[100005];

int main(void)
{
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> t[i] >> x[i] >> y[i];
	for(int i = 1; i <= n; i++){
		int d = abs(x[i-1] - x[i]) + abs(y[i-1] - y[i]);
		if(t[i] - t[i-1] < d || (x[i]+y[i]+t[i]) % 2){
			cout << "No" << endl;
			return 0;
		}
		
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1408
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif


#define ROOT_NODE 1

void add(vector<int>& seg, int size, int idx, int val) {
    int node = size + idx;
    while(node) {
        seg[node]++;
        node = node/2;
    }
    return;
}

bool is_overlap(pii r1, pii r2) {
    return r1.second > r2.first && r2.second > r1.first;
}

bool is_contain(pii t, pii box) {
    return box.first <= t.first && t.second <= box.second;
}

int get_sum(vector<int>& seg, pii r, int node, pii nr) {
    if(!is_overlap(r, nr)) return 0;
    if(is_contain(nr, r)) return seg[node];
    pii left = make_pair(nr.first, (nr.first+nr.second)/2);
    pii right = make_pair((nr.first+nr.second)/2, nr.second);
    int s1 = get_sum(seg, r, node*2, left);
    int s2 = get_sum(seg, r, node*2+1, right);
    return s1+s2;
}
#define VAL_MAX 2000
#define VAL2_MAX (1<<11)
int main(void) {
    int num,k;
    cin >> num >> k;
    vector<int> arr(num*2);
    for(int i = 0; i < num; i++) {
        int val;
        cin >> val;
        val--;
        arr[i] = arr[i+num] = val;
    }
    vector<int> seg(VAL2_MAX*2);

    pii whole = make_pair(0, VAL2_MAX);
    vector<int> res(num*2);
    for(int i = 0; i < num*2; i++) {
        int val = arr[i];
        pii range = make_pair(val+1, VAL2_MAX);
        res[i] = get_sum(seg, range, ROOT_NODE, whole);
        debug("[val %d]%d -> %d\n", val, i, res[i]);
        add(seg, VAL2_MAX, val, 1);
    }

    int64_t sum = 0;
    int64_t sum_k = ((int64_t)k * (k-1) / 2)%DIVISOR;
    for(int i = 0; i < num; i++) {
        int64_t init = res[i];
        int64_t d = res[num+i]-init;
        debug("seq init: %d, d: %d, k: %d\n", init, d, k);
        int64_t res = (init*k)%DIVISOR;
        sum = (sum + res)%DIVISOR;
        res = (sum_k * d)%DIVISOR;
        sum = (sum + res)%DIVISOR;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp>
using namespace std;
using ll=long long;
const int MOD=1000000007;

int main() {
  string s;
  cin >> s;
  int size=s.size();
  vector<int> a(size);
  int rs=0;
  int ls=0;
  int r;
  char p='R';
  for(int i=0;i<size;i++){
    if(p=='R'){
      if(s.at(i)=='R')
      rs++;
      else{
        ls++;
        r=i-1;
        p='L';
      }
    }
    else{
      if(s.at(i)=='L')
      ls++;
      else{
        int sum=rs+ls;
        if(sum%2==0){
          a.at(r)=sum/2;
          a.at(r+1)=sum/2;
        }
        else if(rs%2!=0){
          a.at(r)=sum/2+1;
          a.at(r+1)=sum/2;
        }
        else{
          a.at(r)=sum/2;
          a.at(r+1)=sum/2+1;
        }
        rs=1;
        ls=0;
        p='R';
      }
    }
  }
  int sum=rs+ls;
  if(sum%2==0){
    a.at(r)=sum/2;
    a.at(r+1)=sum/2;
  }
  else if(rs%2!=0){
    a.at(r)=sum/2+1;
    a.at(r+1)=sum/2;
  }
  else{
    a.at(r)=sum/2;
    a.at(r+1)=sum/2+1;
  }
  for(int i=0;i<size;i++){
    cout << a.at(i) << " ";
  }
  cout << endl;
}



Measured memory_bytes: 3824
n, m = map(int, input().split())
students = []
checkpoints = []
for _ in range(n):
    students.append(tuple(map(int, input().split())))
for _ in range(m):
    checkpoints.append(tuple(map(int, input().split())))

ans = []
for a, b in students:
    curr_d = 10 ** 10
    curr_i = 0
    for i, (c, d) in enumerate(checkpoints, start=1):
        dist = abs(a - c) + abs(b - d)
        if dist < curr_d:
            curr_d = dist
            curr_i = i
    ans.append(curr_i)

print('\n'.join(map(str, ans)))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
template<class T> inline istream& operator >> (istream & c, vector<T> & A) {rep(i, A.size()) c >> A[i];return c;}
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a, b;
	cin >> n >> a >> b;
	int c1 = 0, c2 = 0, c3 = 0;
	rep(i, n) {
		int p;
		cin >> p;
		if (p <= a) c1++;
		else if (p >= a && p <= b) c2++;
		else c3++;
	}
	int ans = min({ c1,c2,c3 });
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define local
//if you find any bug in my code, please tell me.
int main()
{
#ifdef local
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    char a,b;
    cin>>a>>b;
    if(a==b) printf("H");
    else printf("D");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;
char stck[80];
char NOT(char a){return 98-a;}
char AND(char a,char b){
  return min(a,b);
}
char OR(char a,char b){
  return max(a,b);
}
bool is012(char c){return '0'<=c&&c<='2';}
int main(){ _;
  string s;
  while(cin>>s,s[0]!='.'){
    int sum=0;
    REP(p,3)REP(q,3)REP(r,3){
      int ptr=0;
      for(char c:s){
	stck[ptr]=(c=='P'?p+'0':c=='Q'?q+'0':c=='R'?r+'0':c);
	ptr++;
	while(true){
	  if(ptr>=2&&stck[ptr-2]=='-'&&is012(stck[ptr-1])){
	    stck[ptr-2]=NOT(stck[ptr-1]);
	    ptr--;
	  }else if(ptr>=3&&is012(stck[ptr-3])&&stck[ptr-2]=='*'&&is012(stck[ptr-1])){
	    stck[ptr-3]=AND(stck[ptr-3],stck[ptr-1]);
	    ptr-=2;
	  }else if(ptr>=3&&is012(stck[ptr-3])&&stck[ptr-2]=='+'&&is012(stck[ptr-1])){
	    stck[ptr-3]=OR(stck[ptr-3],stck[ptr-1]);
	    ptr-=2;
	  }else if(ptr>=3&&stck[ptr-3]=='('&&is012(stck[ptr-2])&&stck[ptr-1]==')'){
	    stck[ptr-3]=stck[ptr-2];
	    ptr-=2;
	  }else break;
	}
	//	REP(i,ptr)cout<<stck[i];
	//	cout<<endl;
      }
      if(stck[0]=='2')sum++;
    }
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 1184