akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int>mochi(N);

  for(int i = 0; i < N; i++){
    int d_i;
    cin >> d_i;

    mochi.at(i) = d_i;
  }

  for(int j = 0; j < N; j++){
    for(int k = j + 1; k < N; k++){
      if(mochi.at(j) == mochi.at(k)){
        mochi.at(k) = 0;
      }

    }
  }

  int sum = 0;
  for(int l = 0; l < N; l++){
    if(mochi.at(l) != 0){
      sum++;
    }
  }

  cout << sum << endl;


}

Measured memory_bytes: 3604
#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<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#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)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
int main(){
    int a,b,c,d,e,f;cin >> a >> b >> c >> d >> e >> f;
    vector<bool> water(31,false),sugar(3001,false);
    int ans_sum=100*a;
    int ans_sugar=0;
    for(int i=0;i<=(f/(a*100));i++){
        for(int j=0;j<=(f/(b*100));j++){
            if(100*a*i+100*b*j>f) continue;
            if(i==0&&j==0) continue;
            water[a*i+b*j]=true;
        }
    }
    for(int i=0;i*c<=30*e;i++){
        for(int j=0;i*c+j*d<=30*e;j++){
            sugar[i*c+j*d]=true;
        }
    }
    for(int i=1;i<=(f/100);i++){
        for(int j=0;j<=i*e;j++){
            if(water[i]==false||sugar[j]==false) continue;
            if(i*100+j>f) continue;
            if(((1.0*(double)j)/((double)i*100.0+(double)j))>((double)ans_sugar/(double)ans_sum*1.0)){
                ans_sum=100*i+j;
                ans_sugar=j;
            }
        }
    }
    cout << ans_sum << " " << ans_sugar << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define pb push_back
#define sz size()
ll n,m,l;
string s;
  
int main(){
  cin >> n >> m >>l;

  if(n<=l && n+m>=l) cout << "YES"  << endl;
  else cout << "NO"  << endl;

  

  return 0;
}

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

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)
#define ROP(i, n)       for(int i = 1 ; i <= n ; i++)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define SORT(obj) sort(ALL(obj))
#define GSORT(obj) sort(ALL(obj) , greater<int>())
#define VLL vector<long long>
#define M map<int, int>
#define S set<int>
#define V vector<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

	ios::sync_with_stdio(false);	cin.tie(0);
    int N;  cin >> N;
    ll ans = 0;
    for(int i = 1 ; i <= N ; i++)
      if(i % 3 != 0 && i % 5 != 0)  ans += i;

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


Measured memory_bytes: 3660
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#define ll long long
using namespace std;
ll h,w;
ll ans;
int main()
{
	scanf("%lld%lld",&h,&w);
	ans=h*w;
	if(ans%2!=0)
	{
		ans=ans/2+1;
	}else{
		ans=ans/2;	
	}
	if(h==1||w==1)
	{
		ans=1;	
	}
	printf("%lld\n",ans);
	return 0;
}



Measured memory_bytes: 256
from collections import deque

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

black_idx = []
for h in range(H):
    for w in range(W):
        if A[h][w] == "#":
            black_idx.append([h,w])

distance = [[float("inf")]*W for _ in range(H)]
for b in black_idx:
    distance[b[0]][b[1]] = 0

d = deque(black_idx)
ans = 0

while d:
    y, x = d.popleft()
    for new_y, new_x in ([y+1, x], [y, x+1], [y-1, x], [y, x-1]):
        if 0 <= new_y <= H-1 and 0 <= new_x <= W-1 and distance[y][x] + 1 < distance[new_y][new_x]:
            distance[new_y][new_x] = distance[y][x] + 1
            ans = max(ans, distance[y][x] + 1)
            d.append([new_y, new_x])

print(ans)


Measured memory_bytes: 184192
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main(){
  int n;
  cin >>n;
  ll ans=1;
  vector<ll> b(n);
  rep(i,n)
    cin >> b.at(i);
  rep(i,n){
    if(b.at(i)==0){
      cout << 0 << endl;
      return 0;
    }
  }
  rep(i,n){
    if(ans>1000000000000000000/b.at(i)){
      cout << -1 << endl;
      return 0;
    }
    if(ans*b.at(i)>1000000000000000000){
      cout << -1 << endl;
      return 0;
    }
    ans*=b.at(i);
  }
  cout << ans << endl;
}

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

int main(){
    int a,b;
    cin >> a >> b;
    
    string s;
    cin >> s;
    
    rp(i,a){
        if(s.at(i)=='-'){
            cout << "No" << endl;
            goto Exit;
        }
    }
    rep(i,a+1,s.size()){
        if(s.at(i)=='-'){
            cout << "No" << endl;
            goto Exit;
        }
    }
    if(s.at(a)=='-'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
Exit:
    ;
    return 0;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include<algorithm>
using namespace std;
 
int main(){
  int N;
  int L;
  cin >> N >> L;
  string S[N];
  for(int i=0;i<N;i++){
   cin >> S[i]; 
  }
  sort(S,S+N);
  string ans;
  ans=S[0];
  for(int i=1;i<N;i++){
   ans+=S[i]; 
  }
  cout << ans << endl;
  return 0;}

Measured memory_bytes: 256
N, Y = gets.split.map(&:to_i)
0.upto(N) do |n1|
    0.upto(N-n1) do |n2|
        n3 = N-n1-n2
        sum = 10000 * n1 + 5000 * n2 + 1000 * n3
        if sum == Y
            print("#{n1} #{n2} #{n3}")
            exit
        end
    end
end
print("-1 -1 -1")

Measured memory_bytes: 3836
#include <algorithm>
#include <cstdio>
#define INF 1e9
#define eps 1e-6
typedef long long ll;
using namespace std;

int n;
ll a[200010], A[200010], B[200010], l, r, ans;

int main(){

	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		scanf("%lld", &a[i]);
		A[i] = a[i] + i;
		B[i] = a[i] - i;
	}
	sort(B + 1, B + n + 1);
	for(int i = 1; i <= n; i++){
		l = lower_bound(B + 1, B + n + 1, -A[i]) - B;
		r = upper_bound(B + 1, B + n + 1, -A[i]) - B;
		ans += r - l;
	}
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 6388
#include<cstdio>
#define REP(i,a) for(int i=0;i<a;i++)
using namespace std;

int n,u,f,y,x;
int h[80][80],s[80][80],res[7];
int d[6],tmp[6];
int dy[] = {0,1,-1,0}, dx[] = {-1,0,0,1};

int rot[4][6] = { {4,0,2,3,5,1},
		  {3,1,0,5,4,2},
		  {2,1,5,0,4,3},
		  {1,5,2,3,0,4} };

int die[6][6] = { {0,2,4,1,3,0},
		 {3,0,0,5,0,2},
		 {1,5,0,0,0,4},
		 {4,0,0,0,5,1},
		 {2,0,5,0,0,3},
		 {0,3,1,4,2,0} };

int main(){
  while(scanf("%d",&n),n){
    REP(i,80)REP(j,80)h[i][j] = s[i][j] = -1;

    while(n--){
      scanf("%d %d",&u,&f);
      u--; f--;
      d[0] = u; d[5] = 5-u;
      d[1] = f; d[4] = 5-f;
      d[2] = die[u][f]; d[3] = 5-die[u][f];
      
      f = true;
      y = x = 40;
      while(f){
	f = false;
	for(int i=5;i>=3 && !f;i--){
	  REP(j,4){
	    if(d[j+1] == i && h[y][x] > h[y+dy[j]][x+dx[j]]){
	      y = y+dy[j]; x = x+dx[j];
	      for(int k=0;k<6;k++)tmp[k] = d[rot[j][k]];
	      for(int k=0;k<6;k++)d[k] = tmp[k];
	      f = true;
	      break;
	    }
	  }
	}
      } 
      h[y][x]++; s[y][x] = d[0];
    }
    
    REP(i,7)res[i] = 0;
    REP(i,80)REP(j,80)res[s[i][j]+1]++;
    REP(i,5)printf("%d ",res[i+1]);
    printf("%d\n",res[6]);
  }
}

Measured memory_bytes: 0
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

int main() {
    int N;
    int H[20];
    int hmax =0;
    int view_count = 0;
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> H[i];
    }

    for(int i =0;i<N; i++){
        if(hmax <= H[i]){
            hmax = H[i];
            view_count++;
        }
    }
    cout << view_count << endl;
    return 0;
}

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

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_poizcy.hpp>
typedef long long  ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define mem(a,h)          memset(a, (h), sizeof(a))
#define se second
#define fi first
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef double lldb;
typedef pair<ll, ll>  ii;
typedef vector<int>  vi;
typedef pair<ii, ll>  iii;
typedef pair<double, double>  iidb;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9+7;
const double PI = acos(-1);
#define initseg ll new_nodo=(nodo*2)+1,mid=(iz+der)/2;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define offset 9000

const ll MOD=1e9+7;

#define cmplog 20
#define tam 600000


using namespace std;

int main()
{	
	ios::sync_with_stdio(false);cin.tie(0);
	int n,c,iz,der;
	cin>>n;
	c=0;int maxx=0;
	forr(i,0,n)
	{
		cin>>iz>>der;
		if (iz==der)c++;
		else{
			maxx=max(maxx,c);
			c=0;
		}
	}
	maxx=max(maxx,c);
	if (maxx>=3)
		cout<<"Yes\n";
	else
		cout<<"No\n";
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define INF_MAX INT_MAX
#define INF_MIN ((int)1<<31)-1
using namespace std;
class Segtree{
    vector<int> tree;
    int n=1,m,Inf;
    void Set(vector<int> vec){
        rep(i,n*2-2)tree[i+1]=Inf;
        rep(i,vec.size())tree[i+n]=vec.at(i);
        update(0,n-1);
    }
    int sum(int a,int b){
        if(m==0)return max(a,b);
        else if(m==1)return min(a,b);
        else if(m==2)return a+b;
        else return a*b;
    }
    int query(int a,int b,int x,int l,int r){
        if(r<a||b<l)return Inf;
        if(a<=l&&b>=r)return tree[x];
        return sum(query(a,b,x*2,l,(l+r)/2),query(a,b,x*2+1,(l+r)/2+1,r));
    }
    void update(int l,int r){
        l+=n,r+=n;
        l/=2,r/=2;
        while(1){
            if(l==0)break;
            int xl=l;
            for(;xl<=r;xl+=2){
                tree[xl]=sum(tree[xl*2],tree[xl*2+1]);
            }
            l/=2,r/=2;
        }
    }
public:
    void Max(vector<int> vec){
        m=0;
        Inf=INF_MAX;
        Set(vec);
    }
    void Min(vector<int> vec){
        m=1;
        Inf=INF_MIN;
        Set(vec);
    }
    void Add(vector<int> vec){
        m=2;
        Inf=0;
        Set(vec);
    }
    void Multiply(vector<int> vec){
        m=3;
        Inf=1;
        Set(vec);
    }
    Segtree(int in){
        for(;in>n;n*=2);
        tree.resize(n*2);
    }
    void Set(int a,int b){
        tree[a+n]=b;
        update(a,a);
    }
    int query(int a,int b){
        return query(a,b,1,0,n-1);
    }
};
class Union_Find{
private:
    vector<int> t,s;
public:
    Union_Find(int max_length){
        rep(i,max_length+1){
            t.push_back(i);
            s.push_back(1);
        }
    }
    void Union(int x,int y){
        if(same(x,y))return;
        int tx=Find(x),ty=Find(y);
        if(s[tx]<s[ty]){
            s[ty]+=s[tx];
            t[tx]=ty;
        }
        else if(s[tx]>s[ty]){
            s[tx]+=s[ty];
            t[ty]=tx;
        }
        else if(tx>ty){
            t[tx]=ty;
            s[ty]+=s[tx];
        }
        else{
            t[ty]=tx;
            s[tx]+=s[ty];
        }
    }
    int Find(int n){
        if(t[n]==n)return n;
        else return t[n]=Find(t[n]);
    }
    bool same(int x,int y){
        return Find(x)==Find(y);
    }
};
signed main(){
    double a,b;
    cin>>a>>b;
    double c=a/b;
    printf("%.8f\n",c);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
*/
#define fast            ios_base::sync_with_stdio(false)
#define mems(x, y)      memset(x, y, sizeof x)
#define pii             pair < int, int >
#define prec(x)         << fixed << setprecision(x)
#define itf             it->first
#define its             it->second
#define it(x)           it = x.begin(); it != x.end(); it++
#define pq_max(x)       priority_queue < x >
#define pq_min(x)       priority_queue < x, vector < x >, greater < x > >
#define ll              long long
#define nl              << "\n"
#define spc             << " "
#define pb              push_back
#define inf             0x3f3f3f3f
#define PI              3.14159265358979323846
#define E               2.71828182845904523536
#define gamma           0.5772156649
#define EPS             1e-9
#define toint(st, x)    stringstream ss(st); ss >> x
// =======Debug========//
#define watch(x)        cout << (#x) spc << x nl
//int fx[] = {1, -1, 0, 0};
//int fy[] = {0, 0, 1, -1};
const int mod=1e9+7;
const int mxn=1e5+9;
int cases = 1;
//ll BigMod(ll n,ll power) {ll ans=1;assert(power>=0);n%=mod;while(power>0){if(power&1) ans=(ans*n)%mod;n=(n*n)%mod;power>>=1;}return ans%mod;}
//ll ModInverse(int n)  { return BigMod(n, mod - 2); }
int sz1, sz2;
int dp[3004][3004];
bool fl[3004][3004];
string st1, st2, ans = "";
int func(int i, int j)
{
    if(i >= sz1 || j >= sz2)    return 0;
    if(fl[i][j])    return dp[i][j];
    fl[i][j] = 1;
    if(st1[i] == st2[j])    return dp[i][j] = 1 + func(i + 1, j + 1);
    else {
        int t1 = func(i + 1, j);
        int t2 = func(i, j + 1);
        return dp[i][j] = max(t1, t2);
    }

}
void printLCS(int i, int j)
{
    if(i >= sz1 || j >= sz2){
        cout<<ans<<endl;
        return;
    }
    if(st1[i]==st2[j])  {
        ans += st1[i];
        printLCS(i + 1, j + 1);
    }
    else    {
        if(dp[i + 1][j] > dp[i][j + 1])     printLCS(i + 1, j);
        else    printLCS(i, j + 1);
    }
}
int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("out.txt", "w", stdout);

    cin >> st1 >> st2;
    sz1 = st1.size();
    sz2 = st2.size();
    int ans = func(0, 0);
    printLCS(0, 0);
    return 0;
}


Measured memory_bytes: 44544
#include<iostream>
#include<sstream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf = (int)1e9;
const double INF = 1e12, EPS = 1e-9;

const int MX = 1000000;
bool p[MX];
int cnt[MX];

int main(){
	for(int i = 2; i * i < MX; i++) if(!p[i]) for(int j = i * i; j < MX; j += i) p[j] = 1;
	for(int i = 2; i < MX; i++) cnt[i] = cnt[i - 1] + !p[i];
	
	int n;
	while(cin >> n, n){
		cout << cnt[2 * n] - cnt[n] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 6044
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    int A;
    cin >> A;
    if (A % 2 == 0) {
      if (A % 3 != 0 and A % 5 != 0) {
	cout << "DENIED" << endl;
	return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque
input = sys.stdin.readline
N, M = map(int, input().split())
graph = [[] for _ in range(N+1)]
for _ in range(M):
    u, v = map(int, input().split())
    graph[u].append(v)

S, T = map(int, input().split())

inf = 10**6
ans = [[inf, inf, inf] for i in range(N+1)]

q = deque([S])
ans[S][0] = 0
while q:
    now = q.popleft()
    for next in graph[now]:
        flag = 0
        for i in range(3):
            if ans[now][i] != inf:
                if ans[next][(i+1)%3] > ans[now][i] + 1:
                    flag = 1
                    ans[next][(i+1)%3] = ans[now][i] + 1
        if flag == 1:
            q.append(next)

if ans[T][0] == inf:
    print(-1)
else:
    print(ans[T][0]//3)


Measured memory_bytes: 68528
#include <bits/stdc++.h>
#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)
typedef long long ll;
long long mod = 1e9 + 7;
const int iINF = 0x3f3f3f3f;
const long long INF = 1LL << 60;
using namespace std;

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

int main()
{
  int R;
  cin >> R;
  cout << 2 * R * M_PI << endl;
  return 0;
}

Measured memory_bytes: 3784
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
const ll mod=1000000007;

ll powmod(ll x,ll y) {
    ll res = 1;
    for(ll i=0; i<y; i++) {
        res = res * x % mod;
    }
    return res;
}

int main(){
    ll n;
    cin >> n;
    ll ans=powmod(10,n)-powmod(9,n)-powmod(9,n)+powmod(8,n);
    ans %= mod;
    if(ans < 0) ans += mod;
    cout << ans << endl;
}

Measured memory_bytes: 3620
#!/usr/bin/env python
N = int(input())
S = input()

if S.count('#') == N or S.count('.') == N:
    print(0)
else:
    l = 0
    r = S.count('.')
    min = l+r
    for n in range(1,N+1):
        if S[n-1] == '#':
            l += 1
        else:
            r -= 1
        if l+r < min:
            min = l+r
    print(min)

Measured memory_bytes: 3500
import sys
 
stdin = sys.stdin

mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

a, b = na()

if a > 8 or b > 8:
    print(":(")
else:
    print("Yay!")

Measured memory_bytes: 38256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<set>
#include<cstdlib>
#include<cctype>
#include<ctime>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll maxn = 1e5 + 5;
const ll maxm = 1e3 + 5;
template<class T>
inline T qread(T &IEE){
	register T x = 0, f = 1;
	register char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-'){
			f = -f;
		}
		ch = getchar();
	}
	while(isdigit(ch)){
		x = (x << 1) + (x << 3) + (ch ^ 48);
		ch = getchar();
	}
	return IEE = x * f;
}
template<class T>
inline void qwrite(T a){
	if(!a){
		putchar('0');
		return ;
	}
 	if(a < 0){
		putchar('-');
		a = -a;
	}
	if(a > 9) qwrite(a / 10);
	putchar(a % 10 + 48);
	return ;
}
template<class T>
inline T ab(T a){
	return (a > 0) ? a : -a;
}
template<class T>
inline void swa(T &a, T &b){
	a ^= b ^= a ^= b;
	return ;
}
string s;
int main(){
//	freopen("1.in", "r", stdin);
//	freopen("1.out", "w", stdout);
	cin >> s;
	if(s == "ABC"){
		puts("ARC");
	} else {
		puts("ABC");
	}
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//do {
//    print(v);
//  } while (std::next_permutation(v.begin(), v.end()));


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

	int N, T;
	cin >> N >> T;
	VI A(N);
	VI cnt(N);
	int mi = INF;
	REP(i, N) {
		cin >> A[i];
		cnt[i] = mi;
		mi = min(mi, A[i]);
	}
	int income=0;
	REP(i, N) {
		//cout << cnt[i] << endl;
		income = max(income, A[i]-cnt[i]);
	}
	int ans = 0;
	//cout << income << endl;
	REP(i, N) {
		if (income == A[i]-cnt[i])ans++;
	}
	cout << ans << endl;
	return 0;
}



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


#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pf push_front
#define pb2 pop_back
#define pf2 pop_front
#define line printf("\n")
#define pq priority_queue
#define rep(k,i,j) for(int k = (int)i;k<(int)j;k++)
#define repd(k,i,j) for(int k = (int)i;k>=(int)j;k--)
#define ll long long
#define ALL(a) a.begin(),a.end()
#define vi vector<int>

using namespace std;

double EPS = 1e-9;
int INF = 1e9+7;;
long long INFLL = 1e17;
double pi = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

clock_t first_attempt = clock();
inline void cek_time(){
	clock_t cur = clock()- first_attempt;
	cerr<<"TIME : "<<(double) cur/CLOCKS_PER_SEC<<endl;
}
inline void OPEN (string s) {
	freopen ((s + ".in").c_str (), "r", stdin);
	freopen ((s + ".out").c_str (), "w", stdout);
}

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> bbst;
//find_by_order(idx) : i-th index 
//order_of_key(val)  : val has which index

//end of template

int n, a, b;
int main() {
	cin >> n >> a >> b;
	
	if (a + b > n + 1)
		puts("-1");
	else if ((ll) b * a < n) 
		puts("-1");
	else{
		int sisa = n - a;
		int now = 1;
		vi arr;
		rep(up, 1, a + 1){
			if (sisa >= b - 1){
				vi cur;
				cur.pb(now);
				rep(k, 0, b - 1)
					cur.pb(now + k + 1);
				reverse(ALL(cur));
				for (auto a : cur)
					arr.pb(a);
				
				sisa -= b - 1;
				now += b;
			}
			else {
				vi cur;
				cur.pb(now);
				rep(k, 0, sisa)
					cur.pb(now + k + 1);
				reverse(ALL(cur));
				for (auto a : cur)
					arr.pb(a);
				
				
				now += sisa + 1;
				sisa = 0;
			}
		}
		
		
		for (auto a : arr) 
			printf("%d ",a);
		line;
	}
}

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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(lint i = x ; i < n ; i++)
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) for(lint i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())

const int IINF = 1e9 + 10;
const lint LLINF = (lint)1e18 + 10;
const lint MOD = (lint)1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

lint gcd(lint x, lint y){
    lint r = x % y;
    while(r != 0LL){
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}

lint lcm(lint x, lint y){
    return x / gcd(x, y) * y;
}

lint solve(string s, string t, lint l){
    map<lint, char> ans;
    set<lint> st;
    lint n = s.size();
    lint m = t.size();
    rep(i, n){
        ans[i * (l / n)] = s[i];
        st.insert(i * (l / n));
    }
    rep(i, m){
        if(st.count(i * (l / m))  && ans[i * (l / m)] != t[i]){
            return -1;
        }
    }
    return l;
}

int main(){
    lint n, m;
    cin >> n >> m;
    string s, t;
    cin >> s >> t;
    lint l = lcm(n, m);
    lint ans = solve(s, t, l);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10496
#include <stdio.h>
#define INF 10000000
#define MAX(a,b) ((a>b)?(a):(b))
typedef struct{
    int node;
    int cost;
} List;
 
int dist[401]; 
List list[401][801]; 
int p[401]; 
int rp[401]; 
int ed[401];
int n,m;
 
void walk(int x,int step){
    dist[x]=MAX(dist[x],step);
	ed[x]++;
	if(rp[x]>ed[x])return; 
    for(int i=0;i<p[x];i++){
        walk(list[x][i].node,dist[x]+list[x][i].cost);
    }
}
 
int main(void){
    int i,j,w;
    int num,start,end,cost;
    scanf("%d%d",&n,&m);
	for(i=0;i<n;i++) p[i]=rp[i]=ed[i]=0;

    for(i=0;i<m;i++){
		scanf("%d%d%d",&start,&end,&cost);
		list[start][p[start]].node=end;
		list[start][p[start]].cost=cost;
		p[start]++;
		rp[end]++;
    }
    for(i=0;i<n;i++) dist[i]=0;
    walk(0,0);
     
    printf("%d\n",dist[n-1]);
    return 0;
}

Measured memory_bytes: 2628
def main():

    s = input()
    Cidx = -1
    for i in range(len(s)):
        if s[i] == "C":
            Cidx = i
            break
    if Cidx == -1:
        return "No"

    for i in range(Cidx+1, len(s)):
        if s[i] == "F":
            return "Yes"
    return "No"

if __name__ == '__main__':
    print(main())

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

int ord(int x){
  int y=0;
  while(x!=0){
    x=x/2;
    y=y+x;
  }
  return y;
}

int main(void){
  int n,i;
  vector<int> s(1000001);
  string S;
  cin >> n >> S;
  
  int p=0;
  for(i=0;i<n;i++){
    if(S.at(i)=='1'){
      s.at(i)=0;
    }else if(S.at(i)=='2'){
      s.at(i)=1;
      p=1;
    }else{
      s.at(i)=2;
    }
  }
  
  vector<int> c(1000001);
  for(i=0;i<n;i++){
    c.at(i)=ord(i);
  }
  
  int j=0;
  if(p==1){
    for(i=0;i<n;i++){
      if(c.at(n-1)==c.at(i)+c.at(n-i-1)){
        j=j+s.at(i);
      }
    }
    if(j%2==1){
      cout << 1 << endl;
    }else{
      cout << 0 << endl;
    }
  }else{
    for(i=0;i<n;i++){
      if(c.at(n-1)==c.at(i)+c.at(n-i-1)){
        j=j+s.at(i);
      }
    }
    if(j%4==2){
      cout << 2 << endl;
    }else{
      cout << 0 << endl;
    }
  }
}

Measured memory_bytes: 9220
N,M = map(int,input().split())
a = list(map(int,input().split()))
import heapq
heap = []
for i in range(N):
    heapq.heappush(heap, -a[i])

for i in range(M):
    buf = heapq.heappop(heap)
    buf = -buf
    buf = buf//2
    heapq.heappush(heap,-buf)
    
print(-sum(heap))

Measured memory_bytes: 14224
#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 drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
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;}
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


int main()
{
    string s;
    cin >> s;
    vi cnt(3);
    rep(i,SZ(s)) cnt[int(s[i]-'a')]++;
    int m = *min_element(all(cnt));
    rep(i,3) {
        if(cnt[i] > m + 1) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
int main(){
   char S[3];
   int cnt=0;
   scanf("%s",S);
   for(int i=0;i<3;i++){
      if(S[i]==S[i+1]){
         cnt++;
      }
   }
   if(cnt==2){
      printf("No");
   }else{
      printf("Yes");
   }
   return 0;
}


Measured memory_bytes: 1716
if __name__ == '__main__':
    N = int(input()) #引き出したい金額

    res = N #全部1円で引き出したときの回数
    for A in range(N+1):
        temp = 0
        tot = A
        while tot > 0:
            temp += tot % 6
            tot = tot // 6

        tot = N - A
        while tot > 0:
            temp += tot % 9
            tot = tot // 9
        if(res > temp):
            res = temp

    print(res)

Measured memory_bytes: 3064
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <queue>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <deque>

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int MAXN = 1234;
const LL MOD = (LL)1e9 + 7;
struct edge {
       int s, t;
       LL w;
       edge(int a, int b, LL c) : s(a), t(b), w(c) {}
       bool operator < (const edge &t) const {
            return w < t.w;
       }
};
vector<pii> G[MAXN];
vector<edge> edges;
vector<int> cand;
int par[MAXN];

void init(int n) {
     for (int i = 1; i <= n; i++) par[i] = i;
}

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

bool merge(int x, int y) {
     x = find(x);
     y = find(y);
     if (x == y) return false;
     par[x] = y;
     return true;
}

bool dfs(int cur, int tg, int par) {
     if (cur == tg) return true;
     bool OK = false;
     for (auto &i : G[cur]) {
         if (i.first != par && dfs(i.first, tg, cur)) {
            OK = true;
            cand.push_back(i.second);
         }
     }
     return OK;
}
LL q_pow(LL n) {
   if (n == 0) return 1;
   if (n == 1) return 2;
   LL tmp = q_pow(n / 2);
   if (n % 2) return (((tmp * tmp) % MOD) * 2) % MOD;
   else return ((tmp * tmp) % MOD);
}

int solve(edge &i, int N, LL sum, LL X) {
    cand.clear();
    dfs(i.s, i.t, i.s);
    sort(cand.begin(), cand.end());
    LL tmp = sum - cand.back() + i.w;
    if (tmp == X) return 1;
    else if (tmp > X) return 2;
    return 0;
}

int main() {
    int N, M;
    LL X;
    scanf("%d %d", &N, &M);
    scanf("%lld", &X);
    init(N);
    for (int i = 0; i < M; i++) {
        int s, t;
        LL w;
        scanf("%d %d %lld", &s, &t, &w);
        edges.push_back(edge(s, t, w));
    }
    sort(edges.begin(), edges.end());
    LL sum = 0, cnt = 0;
    for (auto &i : edges) {
        if (merge(i.s, i.t)) {
           sum += i.w;
           cnt++;
           G[i.s].push_back(make_pair(i.t, i.w));
           G[i.t].push_back(make_pair(i.s, i.w));
        }
    }
    LL cnt0 = 0, cnt1 = 0;
    for (auto &i : edges) {
        int tmp = solve(i, N, sum, X);
        if (tmp == 1) cnt0++;
        else if (tmp == 2) cnt1++;
    }
    if (cnt0 == 0 || M < 2) puts("0");
    else {
       LL ans = q_pow(cnt0);
       if (sum == X) {
          ans -= 2;
          ans = (ans * q_pow(cnt1)) % MOD;
       } else {
          ans = ((2 * (ans - 1) % MOD) * q_pow(cnt1)) % MOD;
       }
       printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 384
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
  input! {
      n: usize,
      k: usize,
      h: [usize; n]
  }
  let mut ans = 0;
  for i in h {
    if i >= k {
      ans += 1;
    }
  }
  println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-11
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int mp[16][16];

int main(){
  while(true){
    int n;
    cin>>n;
    if(!n)break;
    REP(i,n)REP(j,n)mp[i][j]=0;
    int iter = 1;
    int y=n/2+1;
    int x=n/2;
    while(true){
      mp[y][x] = iter++;
      if(iter==n*n+1)break;
      ++y; ++x;
      while(x<0 || x>=n || y>=n || mp[y][x]!=0){
        if(x<0)x=n-1;
        else if(x>=n)x=0;
        else if(y>=n)y=0;
        else{
          --x;
          ++y;
        }
      }
    }
    REP(j,n){
      REP(i,n){
        printf("%4d",mp[j][i]);
      }
      printf("\n");
    }
  }
  return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<int, int> P;


int main(){
    string s; cin >> s;
    int res = 0;
    for(int i = 0; i < s.length(); i++){
        for(int j = i; j < s.length(); j++){
            bool ok = true;
            for(int k = i; k <= j; k++){
                if(s[k] == 'A' || s[k] == 'C' || s[k] == 'G' || s[k] == 'T'){
                    continue;
                }
                else    ok = false;
            }
            if(ok){
                res = max(res, j - i + 1);
            }
        }
    }

    cout << res << endl;


    return 0;
}


Measured memory_bytes: 256
# A - Can't Wait for Holiday
S =str(input())
if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
else:
    print(1)

Measured memory_bytes: 38492
#include <stdio.h>
int main(void){static char prime[1000001];int i, j;int n;for (i = 3; i <= 1000000; i += 2){prime[i] = 1;}prime[2] = 1;for (i = 3; i <= 1000; i += 2){if (prime[i] == 1){for (j = 3; j <= 1000000 / i; j += 2){prime[i * j] = 0;}}}while (scanf("%d", &n) != EOF){j = 0;for (i = 2; i <= n; i++){if (prime[i] == 1){j++;}}printf("%d\n", j);}return (0);}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int main(void){
	int x,y,t;
	while(1){
		int i=0;
		cin >> x >> y;
		if(x == 0 && y == 0) break;
		else if(x < y){
			t = x;
			x = y;
			y = t;
		}while(y !=0){
			x %=y;
			t = x;
			x = y;
			y = t;
			i +=1;
		}cout << x << " " << i << endl;
		
	}
}

Measured memory_bytes: 1160
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};
#define yes cout<<"Yes\n"
#define no cout<<"No\n"

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

	int n,k;
    cin>>n>>k;
    vi in(n+1);
    rep(i,n)cin>>in[i+1],in[i+1]+=in[i];
    int ma=0;
    rep(i,n)if(i+k<=n)cmax(ma,in[i+k]-in[i]);
    cout<<shosu(9)<<(ma+k)/2.<<endl;
}


Measured memory_bytes: 1792
a = list(map(int,input().split()))
b = [list(map(int,input().split())) for i in range(a[0])]
c = 0

for i in range(a[0]):
  for j in range(i):
      d = 0
      for k in range(a[1]):
        d+=(b[j][k]-b[i][k])**2
      else:
        e=d**(1/2)
        if e.is_integer():
          c+=1
else:
  print(c)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC094_B();
        }

        static void ABC094_B()
        {
            var NMX = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            var N = NMX[0];
            var X = NMX[2];
            var masu = new int[N + 1];
            var AM = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

            foreach (var a in AM)
            {
                masu[a] = 1;
            }

            var left = Enumerable.Range(1, X).Sum(x => masu[x]);
            var right = Enumerable.Range(X, N+1-X).Sum(x => masu[x]);
            Console.WriteLine(Math.Min(left, right));
        }
    }
}

Measured memory_bytes: 13524
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

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

using namespace std;

int main()
{
	int n;
	while(cin >> n && n)
	{
		int ans = 0,res = 0;
		rep(i,n)
		{
			int a,b,c;
			cin >> a >> b >> c;
			
			if(i == 0)
			{
				ans = a;
				res = b + c;
			}

			if(res < b + c)
			{
				ans = a;
				res = b + c;
			}
		}

		cout << ans << " " << res << endl;
	}
}

Measured memory_bytes: 1160
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        FastScanner sc = new FastScanner();

        double a = sc.nextDouble();
        double b = sc.nextDouble();
        int d = (int)a/(int)b, r = (int)a%(int)b;
        double f = a/b;
        System.out.println(d+" "+r+" "+String.format("%.6f",f));

    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}



Measured memory_bytes: 24764
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
using ull = unsigned long long;
using P = pair<int, int>;

static constexpr ull MOD = 1000000007;
static constexpr double pi = 3.14159265359;

int main() {
    int N, M;
    cin >> N >> M;
    map<int, vector<pair<ull, int>>> D;
    for (int i = 1; i <= M; ++i) {
        int P;
        ull Y;
        cin >> P >> Y;
        D[P].push_back({Y, i});
    }
    map<int, pair<int, int>> D2;
    for (auto&& i : D) {
        sort(i.second.begin(), i.second.end());
        for (int j = 0; j < i.second.size(); ++j) {
            D2[i.second[j].second] = {i.first, j + 1};
        }
    }
    for (auto&& it : D2) {
        printf("%06d%06d\n", it.second.first, it.second.second);
    }
}


Measured memory_bytes: 17152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x;
int main()
{
   ll ans=0;
    cin>>x;
    int a,b;
    a=x/500,b=x%500;
    ans+=a*1000;
    ans+=(b/5)*5;
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>


int main(void){
	for(int i=1;i<10;i++){
		for(int j=1;j<10;j++){
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}

    return 0;
}


Measured memory_bytes: 1984
N = int(input())
s = [''] * N
for i in range(N):
  s[i] = input()
M = int(input())
t = [''] * M
for i in range(M):
  t[i] = input()
  
p = {si: s.count(si) for si in set(s)}
for ti in t:
  if ti in p:
    p[ti] -= 1
print(max(max(p.values()), 0))


Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int x[50];
ll dp[51][50][2501] = { 0 };

int main()
{
	int N, A, total = 0;
	ll ans = 0;

	cin >> N >> A;
	rep(i, N) {
		cin >> x[i];
		total += x[i];
	}

	repc(num, 1, N) {
		repc(until, num - 1, N - 1) {
			if (until == 0) {
				dp[num][until][x[until]] = 1;
				continue;
			}

			repc(sum, 1, total) {
				if (num == 1) {
					dp[num][until][sum] += dp[num][until - 1][sum];

					if (x[until] == sum)
					dp[num][until][x[until]]++;
					continue;
				}

				dp[num][until][sum] += dp[num][until - 1][sum];
				if (sum - x[until] > 0) dp[num][until][sum] += dp[num - 1][until - 1][sum - x[until]];
			}
		}
	}

	repc(num, 1, N) {
		int sum = A * num;
		ans += dp[num][N - 1][sum];
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 48384
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

from itertools import accumulate

def main():
    N, Q = LI()
    S = SI()
    LR = []
    for _ in range(Q):
        LR.append(LI_())

    AC = [0] * (N + 1)
    for i in range(N - 1):
        if S[i:i + 2] == 'AC':
            AC[i] = 1
    acc = [0] + list(accumulate(AC))
    for l, r in LR:
        print(acc[r] - acc[l])

    return 0

main()


Measured memory_bytes: 26952
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
using ll = long long;

const long double PI = acos(-1.0);
const int MOD = 1e9 + 7;

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

    cout << s[0] << s[1] << s[2] << endl;


    return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;


public class Main {
	
	private int n;
	
	public static void main(String[] args) {
		new Main().solve();
	}
	
	
	public void solve(){
		Scanner scanner = new Scanner(System.in);
		
		double[] start = {0,0};
		double[] end = {100,0};
		n = scanner.nextInt();
		System.out.println(start[0]+" "+start[1]);
		koch(n,start,end);
	}
	
	public void koch(int i,double[] start,double end[]){
		
		if(i==0){
			System.out.println(end[0] + " "+end[1]);
			return;
		}
		double[] s = new double[2];
		double[] t = new double[2];
		double[] u = new double[2];
		for(int j=0;j<2;j++){
			s[j] = (2*start[j]+end[j])/3.0;
			t[j] = (start[j]+2*end[j])/3.0;
		}
		u[0]=(s[0]+t[0])/2 + Math.sqrt(3.0)*(s[1]-t[1])/2.0;
		u[1]=Math.sqrt(3.0)*(-s[0]+t[0])/2.0 +(s[1]+t[1])/2.0;
		koch(i-1, start,s);
		koch(i-1, s, u);
		koch(i-1, u, t);
		koch(i-1, t, end);	
	}
}

Measured memory_bytes: 29212
#include <iostream>
#include <cstdint>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
using namespace std;

int main(int argc, char const* argv[])
{
  int64_t N;
  scanf("%ld", &N);

  string S;
  int64_t P;
  vector<tuple<string, int64_t, int32_t>> vtup(N);
  for (int i = 0; i < N; i++) {
    cin >> S;
    scanf("%ld", &P);
    vtup[i] = make_tuple(S, P, i + 1);
  }

  sort(vtup.begin(), vtup.end(), [](tuple<string, int64_t, int32_t> p, tuple<string, int64_t, int32_t> q) {
    int res = get<0>(p).compare(get<0>(q));
    if (!res) 
      return get<1>(p) > get<1>(q);
    else 
      return (res < 0);
  });

  /*
  for (auto tup : vtup)
    cout << '[' << get<2>(tup) << "] " << get<0>(tup) << ' ' << get<1>(tup) << '\n';
  */
  for (auto tup : vtup) printf("%d\n", get<2>(tup));

  return 0;
}



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

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

using ll = long long;
using namespace std;

int
main ()
{
    array<pair<int, bool>, 9> a;
    rep (9, i) {
      cin >> a[i].first;
      a[i].second = false;
    }
    int n;
    cin >> n;
    rep (n, _) {
      int m;
      cin >> m;
      rep (9, i) {
        if ( a[i].first == m )
          a[i].second = true;
      }
    }

    bool anyBingo = false;
    auto bingo = [&a](int p, int q, int r){
      return a[p].second && a[q].second && a[r].second;
    };
    if ( bingo(0, 1, 2) ) anyBingo = true;
    if ( bingo(3, 4, 5) ) anyBingo = true;
    if ( bingo(6, 7, 8) ) anyBingo = true;
    if ( bingo(0, 3, 6) ) anyBingo = true;
    if ( bingo(1, 4, 7) ) anyBingo = true;
    if ( bingo(2, 5, 8) ) anyBingo = true;
    if ( bingo(0, 4, 8) ) anyBingo = true;
    if ( bingo(2, 4, 6) ) anyBingo = true;

    cout << (anyBingo ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256