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

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if (s == "Sunny") cout << "Cloudy" << endl;
    else if (s == "Cloudy") cout << "Rainy" << endl;
    else cout << "Sunny" << endl; 
    
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    ll n, a, b, c, d, e; cin>>n>>a>>b>>c>>d>>e;
    ll mi = min({a, b, c, d, e});
    cout << (n - 1) / mi + 5 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
#define ll long long
using namespace std; 
int x[100015];
long long num[100010];
int y[3][100015];
int z[3][100015];
int main(){
	int n;
	cin>>n;
		x[0]=20000000;
		x[n+1]=20000000;
		for(int i=1;i<=n;++i){
			scanf("%d",&x[i]);
			int p=i-1;
			while(x[p]<=x[i]){
				p=y[1][p];
			}
			y[1][i]=p;
			p--;
			while(x[p]<=x[i]){
				p=y[1][p];
			}
			y[2][i]=p;
		}

		for(int i=n;i>=1;--i){
			int p=i+1;

			while(x[p]<=x[i]){

				p=z[1][p];

			}

			z[1][i]=p;
			p++;
			while(x[p]<=x[i]){

				p=z[1][p];

			}
			z[2][i]=p;
		}
	for(int i=1;i<=n;i++)
	{
		if(z[1][i]==0) z[1][i]=n+1;
		if(z[2][i]==0) z[2][i]=n+1;
	}
	for(int i=1;i<=n;i++)
	{
		int l1=y[1][i],r1=z[1][i];
		int l2=y[2][i],r2=z[2][i];
		num[i]+=(l1-l2)*(r1-i);
		num[i]+=(r2-r1)*(i-l1);
	}
	long long ans=0;
	for(int i=1;i<=n;i++)
	ans+=num[i]*x[i];
	cout<<ans;
	return 0;

} 


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

int main()
{
  double n;
  cin >> n;
  n /= 3;
  cout << fixed << setprecision(8) << n * n * n << endl;
  return 0;
}


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

char buf[999];
void solve(long long n){
	long long digits=2;
	long long expbase=1;
	long long s=1;
	long long x;
	for(;(x=(digits*8+32)*6*expbase-5)<=n;n-=x){
		digits++;
		expbase*=10;
		s=expbase*10-9;
	}
	if((x=(digits-1)*5+digits*3+32)<=n){
		n-=x;
		s+=15;
	}
	x=digits*8+32;
	s+=n/x*15;
	n-=n/x*x;
	int i=1;
	for(;i<=30;i++){
		if(i%15==0)sprintf(buf+strlen(buf),"FizzBuzz");
		else if(i%3==0)sprintf(buf+strlen(buf),"Fizz");
		else if(i%5==0)sprintf(buf+strlen(buf),"Buzz");
		else sprintf(buf+strlen(buf),"%lld",s+i-1);
	}
	buf[n+20]=0;
	puts(buf+n);
}
 
int main(int argc,char **argv){
	long long n;
	scanf("%lld",&n);
	solve(n-1);
	return 0;
}

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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

using _loop_int = int;
#define REP(i, n) for (_loop_int i = 0; i < (_loop_int)(n); i++)
#define FOR(i, a, b) for (_loop_int i = (_loop_int)(a); i < (_loop_int)(b); i++)
#define FORR(i, a, b) \
  for (_loop_int i = (_loop_int)(b)-1; i >= (_loop_int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))
#define ALL(v) (v).begin(), (v).end()

#define DEBUG(x) cerr << #x << ": " << (x) << endl
#define DEBUG_VEC(v)                               \
  cerr << #v << ": ";                              \
  REP(__i, (v).size()) cerr << ((v)[__i]) << ", "; \
  cerr << endl

const ll MOD = 1000000007ll;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << max(0, c - a + b);
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#define int long long
using namespace std;
string s;
int k;
vector<pair<char,int> > V;
main()
{
	ios_base::sync_with_stdio(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin >> s >> k;
	
	int cnt = 0;
	for (int i=0; i<s.size(); i++)
	{
		if (cnt==0 or s[i]==s[i-1])
			cnt++;
		else
		{
			V.push_back(make_pair(s[i-1],cnt));
			cnt = 1;
		}
	}
	
	V.push_back(make_pair(*s.rbegin(),cnt));
	
	if (V.size()==1)
	{
		cout << ((int) s.size()*k)/2;
		return 0;
	}
	
	if (s[0]==*s.rbegin())
	{
		int res = 0;
		for (int i=1; i+1<V.size(); i++)
			res+=V[i].second/2;
		res*=k;
		
		int res2 = 0;
		res2 = ((V[0].second+(*V.rbegin()).second)/2)*(k-1);
		
		res+=res2;
		
		res+=(V[0].second/2);
		res+=((*V.rbegin()).second)/2;
		
		cout << res;
		
	}
	else
	{
		int res = 0;
		for (pair<char,int> p: V)
		{
			res+=p.second/2;
		}
		
		cout << res*k;
	}
	
	return 0;
}


Measured memory_bytes: 256
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

# # # # unionfind.py # # # #

# usage: uf = Unionfind(n) ; x = uf.root(y); uf.conn(a,b)

class Unionfind:

  def __init__(s,n):
    s.sz = [1] * n
    s.ances = [i for i in range(n)]

  def root(s,x):
    a = []
    y = x
    while s.ances[y] != y:
      a.append(y)
      y = s.ances[y]
    for z in a:
      s.ances[z] = y
    return y

  def conn(s,x,y):
    i = s.root(x)
    j = s.root(y)
    if i==j:
      return
    #k  = [i,j].min
    k  = j if (s.sz[i]<s.sz[j]) else i
    if k==j:
      s.ances[i] = j
    else:
      s.ances[j] = i
    s.sz[k] = s.sz[i] + s.sz[j]

# # # # end unionfind.py # # # #

n,m = inm()
uf = Unionfind(n+1)
for i in range(m):
    x,y,z = inm()
    uf.conn(x,y)
a = [0]*(n+1)
for i in range(1,n+1):
    a[uf.root(i)] = 1
print(sum(a))


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

int main() {
  int N, K, S;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    int x, a, b;
    cin >> x;
    a = x * 2;
    if (x <= K){
      b = (K - x) * 2;
    } else {
      b = (x - K) * 2;
    }
    if (a <= b) {
      S += a;
    } else {
      S += b;
    }
  }
  cout << S << endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
X, Y, Z = [], [], []
for i in range(N):
    x, y, z = map(int, input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)

num = -float("inf")
for i in [-1, 1]:
    for j in [-1, 1]:
        for k in [-1, 1]:
            tmp = []
            for l in range(N):
                tmp.append(X[l] * i + Y[l] * j + Z[l] * k)

            tmp = sorted(tmp, reverse=True)
            num = max(num, sum(tmp[:M]))

print(num)




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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)

using LL  = long long;
// }}}

int main() {
    std::ios::sync_with_stdio(false);
    int n;cin >> n;
    vector<LL> a(n);
    for(int i=0;i<n;i++) cin >> a[i];
    LL ans[2] = {0, 0};
    for(int i=0;i<2;i++){
        LL sum = 0LL;
        for(int j=0;j<n;j++){
            if(j%2 == i && sum+a[j] <= 0){
                ans[i] += 1-(sum+a[j]);
                sum = 1;
            }else if(j%2 == 1-i && sum+a[j] >= 0){
                ans[i] += 1+(sum+a[j]);
                sum = -1;
            }else{
                sum += a[j];
            }
        }
    }
    cout << min(ans[0], ans[1]) << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    if(k==0){
        cout<<n*n<<endl;
        return 0;
    }
    for(ll b=k+1;b<=n;b++){
        ll m=(n-k)/b;
        ans+=m*(b-k);
        ans+=min(n,(m+1)*b-1)-(m*b+k)+1;
        //cout<<"b="<<b<<" "<<ans<<endl;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	string s;
	cin >> n >> s;

	int cnt=0;
	for(int i=0; i<n-2; ++i){
		if(s.substr(i,3)=="ABC") ++cnt;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  char b;
  cin >> b;
    if(b == 'A')b = 'T'; 
    else if(b == 'T')b = 'A';
    else if(b == 'C')b = 'G';
    else if(b == 'G')b = 'C';
  cout << b << endl;
}


Measured memory_bytes: 3584
x , y ,z = input().split( )
a= int(x)
b= int(y)
c= int(z)

if a< b< c:
    print(f"{a} {b} {c}")
elif a < c < b:
    print(f"{a} {c} {b}")
elif b < a < c:
    print(f"{b} {a} {c}")
elif b < c < a:
    print(f"{b} {c} {a}")
elif c < a < b:
    print(f"{c} {a} {b}")
elif c < b < a:
    print(f"{c} {b} {a}")
elif a == b == c:
    print(f"{a} {b} {c}")
elif a < b == c:
    print(f"{a} {b} {c}")
elif a > b == c:
    print(f"{c} {b} {a}")
elif a == b > c:
    print(f"{c} {a} {b}")
elif a == c < b:
    print(f"{a} {c} {b}")
else:
    print(f"{b} {a} {c}")


Measured memory_bytes: 5616
const processData = (lines) => {
  const [a, b, n] = lines[0].split(' ').map(x => +x)
  const mul = Math.min(n, b-1)
  console.log(Math.floor(a*mul/b))
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})


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

using namespace std;

typedef long long  ll;
typedef int  Weight;

const int INF = 1e8;

struct Edge {
    int src, dst;
    Weight weight;
    int rev;
    Edge(int f, int t, Weight c, int rev = 0) :
        src(f), dst(t), weight(c), rev(rev) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void AddEdge(Graph &g, int s, int dst, Weight cap){
    g[s].push_back(Edge(s, dst, cap, g[dst].size()));
    g[dst].push_back(Edge(dst, s, 0, g[s].size()-1));
}

class Dinic {
private:
    void Bfs(const Graph &g, vector<int> &level, int s){
        level[s]=0;
        queue<int> que;
        que.push(s);
        while(!que.empty()){
            int v = que.front();
            que.pop();
            for (auto &e : g[v]) {
                if(e.weight > 0 && level[e.dst] < 0){
                    level[e.dst] = level[v] + 1;
                    que.push(e.dst);
                }
            }
        }
    }

    Weight Dfs(Graph &g, vector<int> &level, vector<int> &iter,
               int v, int t, Weight flow) {
        if(v == t)
            return flow;
        for (int &i = iter[v], N = g[v].size(); i < N; ++i) {
            Edge &e = g[v][i];

            if(e.weight > 0 && level[v] < level[e.dst]){
                Weight d = Dfs(g, level, iter, e.dst, t, min(flow, e.weight));
                if(d > 0){
                    e.weight -= d;
                    g[e.dst][e.rev].weight += d;
                    return d;
                }
            }
        }
        return 0;
    }

public:
    Weight DinicSolve(Graph &g, int s, int t){
        Weight flow = 0;

        while(true){
            vector<int> level(g.size(), -1);
            vector<int> iter(g.size(), 0);
            Bfs(g, level, s);

            if(level[t] < 0)
                break; // ??????????????????
            Weight f = 0;
            while((f = Dfs(g, level, iter, s, t, INF)) > 0)
                flow += f;
        }

        return flow;
    }
};

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

    int X, Y, E, x, y;

    cin >> X >> Y >> E;
    int s = X + Y, t = s + 1;
    Graph g(t + 1);

    for (int i = 0; i < E; ++i) {
        cin >> x >> y;
        AddEdge(g, x, y + X, 1);
    }

    for (int i = 0; i < X; ++i)
        AddEdge(g, s, i, 1);
    for (int i = 0; i < Y; ++i)
        AddEdge(g, X + i, t, 1);

    Dinic dn;
    cout << dn.DinicSolve(g, s, t) << endl;

    return 0;
}

Measured memory_bytes: 1524
using System;
using System.Collections;
class main{
	public static void Main(){
		string[] str = Console.ReadLine().Split(' ');
		int a = int.Parse(str[0]), b = int.Parse(str[1]), c = int.Parse(str[2]);
		int count = 0;
		if (a <= b)
		{
			for (int i = a; i <= b; i++)
			{
				if(c % i == 0) count++;
			}
			Console.WriteLine(count);
		}
	}
}

Measured memory_bytes: 9244
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void)
{
	int m, f, r;
	for (;;) {
		scanf("%d %d %d", &m, &f, &r);

		if (m == -1 && f == -1 && r == -1) { break; }

		if (m == -1 || f == -1) {
			printf("F\n");
		}
		else if (m + f >= 80) {
			printf("A\n");
		}
		else if (m + f >= 65) {
			printf("B\n");
		}
		else if (m + f >= 50) {
			printf("C\n");
		}
		else if (m + f >= 30) {
				if (r >= 50) { printf("C\n"); }
				else { printf("D\n"); }
		}
		else {
			printf("F\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1808
s = list(input())
n = len(s)

check = False
for i in range(n-2):
    temp = s[i:i+3]
    temp.sort()
    if temp[1] == temp[0] or temp[1] == temp[2]:
        check = True
        print(i+1,i+1+2)
        break
if n == 2 and s[0] == s[1]:
    check = True
    print("1 2")
if check == False:
    print('-1 -1')

Measured memory_bytes: 3956
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define Khela ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define llu long long unsigned int
#define pf printf
#define sf scanf
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define pii pair<int ,int>
#define PII pair<ll ,ll>
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
 
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
int Set(int N,int pos){return N=N | (1<<pos);}
int reset(int N,int pos){return N= N & ~(1<<pos);}
bool check(int N,int pos){return (bool)(N & (1<<pos));}
const int Max=1e9+100;
const ll  MAX=1e18+500;
const int sz=3e5+100;
const ll mod=1e9+7;

ll pr[70];
string binary(ll p)
{
   string test="";
   while(p){
       if(p & 1ll) test=test+"1";
       else test=test+"0";
       p>>=1;
   }
   return test;
}
int main()
{
    Khela
    ll a,b,c,i,j,k,q,p,x,y,ct,ct1,m,l,r,x1,y1,mn,h,sum1,in,z,mid,n,mx;
    char ch;
    double d;
    string str1,str2,str;
    bool bl,bl1;
    int t,cs=1;
    pr[0]=1;
    for(i=1;i<70;i++) pr[i]=((((pr[i-1]*2ll)%mod)+mod)%mod);
    while(cin>>n)
    {
         int zr[70],one[70];
         memset(zr,0,sizeof zr);
         memset(one,0,sizeof one);

         ll ans=0;
         for(j=0;j<n;j++){
             cin>>x;

             str=binary(x);
             ll len=str.length();
             //cout<<str<<endl;
             for(i=0;i<len;i++){
                     if(str[i]=='1'){
                         ans=(ans+((((zr[i]*pr[i])%mod)+mod)%mod))%mod;
                     }
                     else  ans=(ans+((((one[i]*pr[i])%mod)+mod)%mod))%mod;
             }
             
             for(;i<70;i++) ans=(ans+((((one[i]*pr[i])%mod)+mod)%mod))%mod;

            for(i=0;i<len;i++){
                if(str[i]=='1') ++one[i];
                else ++zr[i];
            }
            for(;i<70;i++) ++zr[i];

         }

         cout<<ans<<endl;
    }





}

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

const int INF=0x3f3f3f3f;
int a[55];

int main(){
    int n,idx1,idx2;
    int MAX=-1,MIN=INF;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(a[i]<MIN) {MIN=a[i];idx1=i;}
        if(a[i]>MAX) {MAX=a[i];idx2=i;}
    }
    /*if(MIN>=0){
        cout<<n-1<<endl;
        for(int i=1;i<n;i++){
            cout<<i<<" "<<i+1<<endl;
        }
    }
    else if(MAX<=0){
        cout<<n-1<<endl;
        for(int i=n;i>1;i--){
            cout<<i<<" "<<i-1<<endl;
        }
    }*/
    if(abs(MAX)>=abs(MIN)){
        cout<<2*n-1<<endl;
        for(int i=1;i<=n;i++){
            cout<<idx2<<" "<<i<<endl;
        }
        for(int i=1;i<n;i++){
            cout<<i<<" "<<i+1<<endl;
        }
    }
    else{
        cout<<2*n-1<<endl;
        for(int i=1;i<=n;i++){
            cout<<idx1<<" "<<i<<endl;
        }
        for(int i=n;i>1;i--){
            cout<<i<<" "<<i-1<<endl;
        }
    }
    return 0;
}


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

using namespace std;
#define sf(n) scanf("%d", &n)
#define pd(n) printf("%.12lf", n)
#define pf(n) printf("%d", n)
#define p() printf("\n")
#define ps() printf(" ")
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define mod 1000 * 1000 * 1000 + 7
#define pi 3.1415926536
#define ex 1e18
#define dbl 2e09
#define qu(q) queue<int> q
#define pqu(q) priority_queue<int> q
#define len(s) s.length()
#define sz(x) int(x.size())
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;

int cnt[5];
int main()
{
    string s;
    cin >> s;
    for (int i = 0; i < sz(s); ++i)
    {
        cnt[s[i] - '0'] += 1;
    }
    int res = min(cnt[0], cnt[1]) * 2;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 512
(defn input []
  (->> (clojure.string/split (read-line) #"\s")
    (map #(Integer/parseInt %))))

(defn RuinedSquare [[x1 y1 x2 y2]]
  (println
    (- (+ x2 y1) y2)
    (- (+ y2 x2) x1)
    (- (+ x1 y1) y2)
    (- (+ y1 x2) x1)))

(RuinedSquare  (input))

Measured memory_bytes: 70672
#include <iostream>

using namespace std;

int main(){

  int A,B,C,X,ans = 0;
  // A/B/C = 500/100/50
  
  cin >> A >> B >> C >> X;

  for(int i = 0; i <= A ; i++){
    for(int j = 0; j <= B; j++){
      for(int k = 0; k <= C; k++){
	if(500 * i + 100 * j + 50 * k == X){
	  ans++;
	}
      }
    }
  }

  cout << ans << "\n";

  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    while( n != 0){
        int x = n%10;
        if(x == 7){
            cout << "Yes" <<endl;
            return 0;
        }
        n = n/10;
    }
    cout << "No" << endl;
    return 0;
}

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

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

      int x=0,ans=0;
      for(int i=0;i<N;i++){
         if(s[i]=='I') x++;
         else x--;
         ans=max(ans,x);
      }
      cout<<ans<<endl;
}


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

int main(){
  char S[3];
  for(int i=0;i<3;i++){cin >> S[i];}
  if(S[0] == S[1] && S[1]== S[2]){
    cout << "No" << endl;
  }
  else{cout << "Yes" << endl;}
}


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

#define rep(ver,n) rep2(ver,0,n)
#define rep2(ver,m,n) for(int ver=m;ver<(n);ver++)
#define loop while(true)
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(v) (v).begin(), (v).end()
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

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

int n,m;
vector<int> f[300000];
bool check[300000];

int main(){
  cin>>n>>m;
  
  rep(i,n){
    check[i]=false;
  }
  
  rep(i,m){
    int a,b;
    scanf("%d %d",&a,&b);
    a-=1;b-=1;
    f[a].push_back(b);
    f[b].push_back(a);
  }
  
  int max_num=1;
  
  rep(i,n){
    if(check[i]){
      continue;
    }
    queue<int> q;
    q.push(i);
    check[i]=true;
    int c=0;
    while(!q.empty()){
      int s=q.front();q.pop();
      c++;
      rep(j,(int)f[s].size()){
        int a=f[s][j];
        if(!check[a]){
          check[a]=true;
          q.push(a);
        }
      }
    }
    
    max_num=max(max_num,c);
  }
  
  cout<<max_num;
  
  return 0;
}


Measured memory_bytes: 17508
n=int(input())
t_p,h_p=0,0
for i in range(n):
    t,h=map(str,input().split())
    if t==h:
        t_p+=1
        h_p+=1
    else:
        cmp=[t,h]
        cmp_sort=sorted(cmp)

        if cmp==cmp_sort:
            h_p+=3
        else:
            t_p+=3

print(t_p,h_p)



Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 10000000000000009
//#define INF 9223372036854775807
typedef long long ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define ORREP(i,n) for(int i=(n);i>=1;--i)
#define ZREP(i,n) for(int i=1;i<(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define rollcall cout<<"I'm Sucu."<<endl;
#define YES(s) s?cout << "YES" << endl:cout << "NO" << endl
#define Yes(s) s?cout << "Yes" << endl:cout << "No" << endl
#define Taka(s) s?cout << "Takahashi" << endl:cout << "Aoki" << endl
#define out(s,t,u) s?cout << t << endl:cout << u << endl
#define int ll
#define Endl endl


signed main(){
    int N,K;
    int P=0;
    int A[114514];
    int plus[114514]={};
    int minus[114514]={};
    int tadanokuzira[114514]={};
    int u_n_owen[114514]={};
    cin >> N >> K;
    REP(i,N){
        cin >> A[i];
        if(A[i]>0){
            P+=A[i];
            u_n_owen[i]=A[i];
        }else{
            tadanokuzira[i]=-1*A[i];
        }
        plus[i+1]=plus[i]+u_n_owen[i];
        minus[i+1]=minus[i]+tadanokuzira[i];
    }
    int R=INF;
    REP(i,N-K+1){
        R=min(R,minus[i+K]-minus[i]);
    }
    int Ans=P-R;
    R=INF;
    REP(i,N-K+1){
        R=min(R,plus[i+K]-plus[i]);
    }
    Ans=max(Ans,P-R);
    cout << Ans << endl;
    return 0;
}   


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

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

Measured memory_bytes: 640
def mapt(fn, *args):
    return tuple(map(fn, *args))
  

def Vector(line):
    return mapt(Atom, line.split(" "))


def Atom(segment):
    try:
        return float(segment)
    except ValueError:
        try:
            int(segment)
        except ValueError:
            return segment

def main():
    n = int(input())
    data = [Vector(input()) for _ in range(n)]
    total = 0
    for amount, currency in data:
        if currency == "JPY":
            total += amount
        else:
            total += amount * 380000
    print(total)

main()

Measured memory_bytes: 9140
#include <bits/stdc++.h>
using namespace std;
 
long long gcd(long a, long b){
  if(b == 0) return a;
  return gcd(b, a%b);
}
 
int main(){
  long long a, b;
  cin >> a >> b;
  long long n = gcd(a, b);
  
  int ans = 1;
  for(long long i = 2; i*i <= n; i++){
  
  	if(n%i == 0){
    
    	ans++;
    	while(n%i == 0) n /= i;
    
    }
  
  }
  
  if(n != 1) ans++;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
import sys

# sys.stdin = open('a1.in')


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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


s1, s2, s3 = read_str_list()
res = s1[0]+s2[0]+s3[0]
res = res.upper()
print(res)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define int long long int
#define gif(a,b) (a/b +(a%b?1:0))
using namespace std;

int32_t main()
{   
    int t;
    cin >> t;
    int a, b;
    cin >> a >> b;
    if(a < t && b>=t)
    { a+=t;
      b+=t;
    }
    int rem =a % t;
    a /= t;
    a *= t;
    if(rem)
    a+=t;
    if(a <= b)
    cout << "OK";
    else 
    cout << "NG";
   return 0;
}


Measured memory_bytes: 3616
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func parseInt(s string) (n int) {
	n, _ = strconv.Atoi(s)
	return
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return (a * b) / gcd(a, b)
}

func main() {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)

	n := make([]int, 4)

	for i := range n {
		s.Scan()
		n[i] = parseInt(s.Text())
	}
	total := n[1] - n[0] + 1

	var a, b, c, d, e, f, x, y, z int
	if n[0]%n[2] == 0 {
		a = n[1] / n[2]
		b = n[0]/n[2] - 1
		x = a - b
	} else {
		a = n[1] / n[2]
		b = n[0] / n[2]
		x = a - b
	}

	if n[0]%n[3] == 0 {
		c = n[1] / n[3]
		d = n[0]/n[3] - 1
		y = c - d
	} else {
		c = n[1] / n[3]
		d = n[0] / n[3]
		y = c - d
	}

	if n[0]%(n[2]*n[3]) == 0 {
		e = n[1] / lcm(n[2], n[3])
		f = n[0]/lcm(n[2], n[3]) - 1
		z = e - f
	} else {
		e = n[1] / lcm(n[2], n[3])
		f = n[0] / lcm(n[2], n[3])
		z = e - f
	}

	ans := total - x - y + z
	fmt.Println(ans)
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <set>
#include <algorithm>

#define rep(idx, max)			for(int idx = 0, idx##Max = (max); idx < idx##Max; idx ++)
#define rrep(idx, min, max)	for(int idx = (min), idx##Max = max; idx < idx##Max; idx ++)
#define erep(idx, min, max)	for(int idx = (min), idx##Max = max; idx <= idx##Max; idx ++)

#define rev(idx, max)			for(int idx = (max) - 1; idx >= 0; idx --)
#define rrev(idx, min, max)	for(int idx = (max) - 1, idx##Min = (min); idx >= idx##Min; idx --)
#define erev(idx, min, max)	for(int idx = (max), idx##Min = (min); idx >= idx##Min; idx --)

typedef std::string	STR;

int Reverse(STR &dst)
{
	int len = dst.size();
	rep(i, dst.size() >> 1)
	{
		std::swap(dst[i], dst[len - 1 - i]);
	}
}

int main()
{
	int n;
	std::cin >> n;
	
	while(n --)
	{
		std::set<STR>	st;
		STR str;
		
		std::cin >> str;
		
		int len = str.size();
		rep(i, str.size() - 1)
		{
			STR s1 = str.substr(0, i + 1);
			STR s2 = str.substr(i + 1, len - 1 - i);
			STR r1 = s1;
			STR r2 = s2;
			Reverse(r1);
			Reverse(r2);
			
		/*	std::cout << "[*]" << s1 << "+" << s2 << std::endl;
			std::cout << s1 + s2 << std::endl;
			std::cout << s1 + r2 << std::endl;
			std::cout << r1 + s2 << std::endl;
			std::cout << r1 + r2 << std::endl;
			std::cout << s2 + s1 << std::endl;
			std::cout << s2 + r1 << std::endl;
			std::cout << r2 + s1 << std::endl;
			std::cout << r2 + r1 << std::endl;
		*/	st.insert(s1 + s2);
			st.insert(s1 + r2);
			st.insert(r1 + s2);
			st.insert(r1 + r2);
			st.insert(s2 + s1);
			st.insert(s2 + r1);
			st.insert(r2 + s1);
			st.insert(r2 + r1);
		}
		
//		for(std::set<STR>::iterator it = st.begin(), itEnd = st.end(); it != itEnd; it ++)
//		{	std::cout << *it << std::endl;	}
		std::cout << st.size() << std::endl;
	}
}

Measured memory_bytes: 1292
// A recursive C++ program to check whether a given number is 
// palindrome or not 
#include <iostream> 
  using namespace std; 
// A function that reurns true only if num contains one digit 
int oneDigit(int num) 
{ 
    // comparison operation is faster than division operation. 
    // So using following instead of "return num / 10 == 0;" 
    return (num >= 0 && num < 10); 
} 
  
// A recursive function to find out whether num is palindrome 
// or not. Initially, dupNum contains address of a copy of num. 
bool isPalUtil(int num, int* dupNum) 
{ 
    // Base case (needed for recursion termination): This statement 
    // mainly compares the first digit with the last digit 
    if (oneDigit(num)) 
        return (num == (*dupNum) % 10); 
  
    // This is the key line in this method. Note that all recursive 
    // calls have a separate copy of num, but they all share same copy 
    // of *dupNum. We divide num while moving up the recursion tree 
    if (!isPalUtil(num/10, dupNum)) 
        return false; 
  
    // The following statements are executed when we move up the 
    // recursion call tree 
    *dupNum /= 10; 
  
    // At this point, if num%10 contains i'th digit from beiginning, 
    // then (*dupNum)%10 contains i'th digit from end 
    return (num % 10 == (*dupNum) % 10); 
} 
  
// The main function that uses recursive function isPalUtil() to 
// find out whether num is palindrome or not 
int isPal(int num) 
{ 
    // If num is negative, make it positive 
    if (num < 0) 
       num = -num; 
  
    // Create a separate copy of num, so that modifications made 
    // to address dupNum don't change the input number. 
    int *dupNum = new int(num); // *dupNum = num 
  
    return isPalUtil(num, dupNum); 
} 
 
// Driver program to test above functions 
int main() 
{ 
    int n,m,t=0; 
    cin>>n>>m;
    for(int i=n;i<=m;i++)
         if(isPal(i))
          t++;
          
          
   cout<<t;}

Measured memory_bytes: 6384
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>
 
// #include <unordered_set>
// #include <unordered_map>
 
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
 
#define pb push_back
#define mp make_pair
 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
 
typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;
 
const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
 
using namespace std;
 
#define N 1000000
int arr[N];
int a[N];
 
void eratosthenes(){
    REP(i,N){
        arr[i]=1;
    }
 
    for(int i=2;i<sqrt(N);i++){
        if(arr[i]){
            for(int j=0;i*(j+2)<N;j++){
                arr[i*(j+2)]=0;
            }
        }
    }
    arr[0]=0;
    arr[1]=0;
}
 
signed main(){
 
    int a,b;
    cin>>a>>b;

    if((a*b)%2==0){
        cout<<"Even"<<endl;
    }else{
        cout<<"Odd"<<endl;
    }
 
 
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>

using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> Q;

int main() {
	int n, m, a;
	while (cin >> n >> m >> a) {
		if (n == 0 && m == 0 && a == 0) {
			break;
		}
		vector<int> dd(n);
		for (int i = 0; i < n; i++) {
			dd[i] = i + 1;
		}
		int h, p, q;
		vector<Q> hh(m);
		for (int i = 0; i < m; i++) {
			cin >> h >> p >> q;
			hh[i] = Q(h, P(p-1, q-1));
		}
		sort(hh.begin(), hh.end(), greater<Q>());
		for (int i = 0; i < m; i++) {
			//cout << hh[i].first << endl;
			swap(dd[(hh[i].second).first], dd[(hh[i].second).second]);
		}
		for (int i = 0; i < n; i++) {
			if (dd[i] == a) {
				cout << i+1 << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3076
#include <iostream>

using namespace std;

int main(){
  int N,K,x,y,count=0;
  cin >> N >> K;
  int Arr[N];
  for(int d=0;d<N;d++){
    Arr[d]=0;
  }
  for(int a=0;a<K;a++){
    cin >> x;
    for(int b=0;b<x;b++){
      cin >> y;
      Arr[y-1]++;
    }
  }
  for(int c=0;c<N;c++){
    if(Arr[c]==0){
      count++;
    }
  }
  cout << count;
}


Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
int N,M;
int a[100002];
int main(){
	int c=0;
	cin >> N >> M;
	for(int i=1;i<=M;i++){
		int l,r;
		cin >> l >> r;
		a[l]++;
		a[r+1]--;
	}
	for(int i=1;i<=N;i++)a[i]+=a[i-1];
	for(int i=1;i<=N;i++){
		if(a[i]==M)c++;
	}
	cout << c << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    string s; cin>>s;
    int N=s.size();

    int f,b;
    REP(i,N){
        if(s[i]=='A'){
            f=i; break;
        }
    }
    for(int i=N-1;i>=0;i--){
        if(s[i]=='Z'){
            b=i; break;
        }
    }
    cout<<b-f+1<<endl;

}


Measured memory_bytes: 640
// include all standard library.
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(int argc, char const *argv[]) {
  int k;
  string s;
  cin >> k;
  cin >> s;

  if (s.length() <= k) {
    cout << s << endl;
    return 0;
  }

  for (int i = 0; i < k; i++) {
    cout << s[i];
  }
  cout << "..." << endl;

  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i=(a); i<(b); i++)

int main() {
  int N;
  cin >> N;
  bool ans = false;
  FOR(i, 0, 30) {
    FOR(j, 0, 20) {
      if ((4*i + 7*j) == N) {
        ans = true;
      }
    }
  }
  if (ans) cout << "Yes" << endl;
  else cout << "No" << endl;
return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>

typedef long long int int64;

const int mod=1000000000+7;

int *tmp=NULL;
void mul(int *c,int *a,int *b,int n){
  int i,j,k;
  for(i=0;i<n;i++) for(j=0;j<n;j++) tmp[i*n+j]=0;
  for(i=0;i<n;i++){
    for(k=0;k<n;k++){
      for(j=0;j<n;j++){
	tmp[i*n+j]=(tmp[i*n+j]+(int64)a[i*n+k]*b[k*n+j])%mod;
      }
    }
  }
  for(i=0;i<n;i++) for(j=0;j<n;j++) c[i*n+j]=tmp[i*n+j];
}

void run(void){
  int n;
  int64 k;
  scanf("%d%lld",&n,&k);
  int *a=(int *)calloc(n*n,sizeof(int));
  int i,j;
  for(i=0;i<n*n;i++) scanf("%d",a+i);
  tmp=(int *)calloc(n*n,sizeof(int));
  int *t=(int *)calloc(n*n,sizeof(int));
  for(i=0;i<n;i++) t[i*n+i]=1;
  while(k>0){
    if(k&1) mul(t,t,a,n);
    mul(a,a,a,n);
    k>>=1;
  }
  int ans=0;
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      ans=(ans+t[i*n+j])%mod;
    }
  }
  printf("%d\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>

using namespace std;

#define C_MAX(a, b) ((a)>(b)?(a):(b))
#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v) {std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

int main() {

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

    vector<int> b(N);
    for (int i = 0; i < N; i++) cin >> b[i];

    vector<int> p(M);
    for (int i = 0; i < M; i++) cin >> p[i];

    int count0 = 0, count1 = 0;
    for (int i = 0; i < N; i++) if (b[i] == 0) count0++; else count1++;

    int even = 0, odd = 0;
    for (int i = 0; i < M; i++) if (i % 2 == 0) even += p[i]; else odd += p[i];

    //初手0
    int ans0 = INT_MAX;
    if (count0 == even && count1 == odd) {
        vector<int> a = b;
        ans0 = 0;
        int pos = 0;
        for (int i = 0; i < M; i++) {
            while (true) {
                bool good = true;
                for (int j = 0; j < p[i]; j++) if (a[pos + j] != i % 2) good = false;
                if (good) break;
                for (int j = pos; j < N - 1; j++) {
                    if (a[j] == ((i + 1) % 2) && a[j + 1] == (i % 2)) {
                        ans0++;
                        swap(a[j], a[j + 1]);
                        break;
                    }
                }
            }
            pos += p[i];
        }
    }

    //初手1
    int ans1 = INT_MAX;
    if (count1 == even && count0 == odd) {
        vector<int> a = b;
        ans1 = 0;
        int pos = 0;
        for (int i = 0; i < M; i++) {
            while (true) {
                bool good = true;
                for (int j = 0; j < p[i]; j++) if (a[pos + j] != (i + 1) % 2) good = false;
                if (good) break;
                for (int j = pos; j < N - 1; j++) {
                    if (a[j] == (i % 2) && a[j + 1] == ((i + 1) % 2)) {
                        ans1++;
                        swap(a[j], a[j + 1]);
                        break;
                    }
                }
            }
            pos += p[i];
        }
    }

    cout << min(ans0, ans1) << endl;

    return 0;
}














































Measured memory_bytes: 3160
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
#define vi vector<int>
#define pi pair<int, int>
#define pb push_back
#define ppb pop_back

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

const int N = 1e5 + 667;

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

    string a;
    cin >> a;
    int n = a.size();
    for(int i = 0;i<n/2;i++){
        if(a[i] != a[n-i-1]){
            cout << "No";
            return 0;
        }
    }
    int cnt = ((n-1) / 2);
    for(int i = 0;i<cnt/2;i++){
        if(a[i] != a[cnt-i-1]){
            cout << "No";
            return 0;
        }
    }
    for(int i = cnt;i<n/2;i++){
        if(a[i] != a[n-i-1]){
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>){
    val N = readLine()!!.toInt()

    val c = Array(10){ IntArray(10) }
    for(i in 1..N){
        c[i.toString().first().toString().toInt()][i.toString().last().toString().toInt()]++
    }

    var ans = 0L
    for(i in 0 until 10){
        for(j in 0 until 10){
            ans += c[i][j] * c[j][i]
        }
    }
    println(ans)
}

Measured memory_bytes: 43064
def main() :
    a, b, c = [int(i) for i in input().split()]

    if a > b :
        a, b = b, a
    if b > c :
        b, c = c, b
    if a > b :
        a, b = b, a

    print(a, b, c)



if __name__ == '__main__' :
    main()

Measured memory_bytes: 7760
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    vector<string> day(7);
    day[0] = "SUN";
    day[1] = "MON";
    day[2] = "TUE";
    day[3] = "WED";
    day[4] = "THU";
    day[5] = "FRI";
    day[6] = "SAT";

    int ans;
    rep(i, 7) {
        if(s == day[i]) {
            ans = 7 - i;
        }
    }

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

Measured memory_bytes: 256
#include <cstdlib>
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<cmath>
#define ll long long
const ll INF=0x3f3f3f3f;
#define mod 1000000007
#define mem(a,b) memset(a,b,sizeof(a))
#define  INF 0x3f3f3f3f
//__builtin_popcount
using namespace std;
//priority_queue
const ll MAX=100000;
ll gcd(ll a,ll b)
{
    return b==0?a:gcd(b,a%b);
}
ll kc(ll a,ll b)
{
    ll c=1;
    while(b)
    {
        if(b&1)c=(c*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return c;
}

ll F[100003];
ll Find(ll a)
{
    return F[a]<0?a:F[a]=Find(F[a]);
}
ll same(ll a,ll b)
{
    if(Find(a)==Find(b))return 1;
    return 0;
}
void up(ll a,ll b)
{
    ll x,y;
    x=Find(a);
    y=Find(b);//cout<<F[x]<<" "<<F[y]<<endl;
    if(x!=y)
        F[y]+=F[x],F[x]=y;


}
int a[100003],b[200003];
set<int>q;
int main()
{
  int n;
  cin>>n;
  for(int i=1;i<=n;i++)
   scanf("%d",&a[i]);
   int sum=0;
 for(int i=1;i<=n;i++)
 {
      if(sum==0)
      {
          b[sum++]=-a[i];
      }
      else {

        int z=upper_bound(b,b+sum,-a[i])-b;
        if(z!=sum)
        {
            b[z]=-a[i];
        }
        else {
            b[sum++]=-a[i];
        }
      }
 }
  cout<<sum;
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();

        char[] arr = sc.next().toCharArray();

        long ans = 0;

        long cntR = 0;
        long cntG = 0;
        long cntB = 0;

        for (int i=0; i<n; i++) {
            if (arr[i]=='R') ++cntR;
            if (arr[i]=='G') ++cntG;
            if (arr[i]=='B') ++cntB;
        }

        ans = cntR * cntG * cntB;

        for (int i=0; i<n-2; i++) {
            inner:
            for (int j=i+1; j<n-1; j++) {
                int idx = j+(j-i);
                if (idx>=n) continue inner;
                if (arr[i]!=arr[j] && arr[j]!=arr[idx] && arr[idx]!=arr[i]) ans--;
            }
        }

        System.out.println(ans);
    }

}


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

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

  int r;
  if (X < 600){
    r = 8;
  }else if (X < 800){
    r = 7;
  }else if (X < 1000){
    r = 6;
  }else if (X < 1200){
    r = 5;
  }else if (X < 1400){
    r = 4;
  }else if (X < 1600){
    r = 3;
  }else if (X < 1800){
    r = 2;
  }else{
    r = 1;
  }
  cout << r << endl;
  
  return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<set>
#include<algorithm>

using namespace std;

//Tµ½¢¯ÀmAT·f[^n
int n,m;

int m_data[200][2];		//Tµ½¢¯ÀÌÀWf[^
int dxdy[200][2];		//¶[Ì¯©ç©½Ï»Ê
int n_data[1000][2];	//Ê^ÉÊé¯

set<pair<int,int> > star;

int main_x, main_y;		//¶[Ì¯ÌÀWçµ¢
int ans_x,ans_y;		//¦ÆÈé¶[Ì¯

int main()
{
	for(;;){
		int temp;
		int t_x, t_y;
		bool notFind = false;
		cin >> m;
		
		if(m == 0){
			break;
		}
		
		//Tµ½¢¯À
		for(int i = 0; i < m; i++){
			cin >> m_data[i][0];
			cin >> m_data[i][1];
		}
		
		cin >> n;
		
		//T·éó
		for(int i = 0; i < n; i++){
	
			cin >> n_data[i][0];		//x
			cin >> n_data[i][1];		//y
			star.insert(make_pair(n_data[i][0],n_data[i][1]));
		}
		 
		//Tµ½¢¯ÀÌêÔ¶Ì¯ð©Â¯é
		
		temp = m_data[0][0];
		main_x = m_data[0][0];
		main_y = m_data[0][1];
		
		for(int i = 0; i < m; i++){
			if(m_data[i][0] < temp){
				temp = main_x = m_data[i][0];
				main_y = m_data[i][1];
			}
	//		cout << "main_x:main_y >>" << main_x << " "<<main_y << endl; 
		}
		
	//	printf("+%d  %d\n",main_x,main_y);
		
		//»ê¼êÌ¯ÉÎ·éÏ»ÊðZo
		for(int i = 0; i < m; i++){
			dxdy[i][0] = -1*(main_x - m_data[i][0]);
			dxdy[i][1] = -1*(main_y - m_data[i][1]);
		}
		
		//·×ÄÌ¯ÉÎµÄÏ»Êð©Ä¢­
		for(int i = 0;i < n;i++){
	//		printf("îÆµÄÝÄé¯ >> (%d, %d)\n",n_data[i][0],n_data[i][1]);
			for(int j = 0; j < m; j++){
				t_x = n_data[i][0] + dxdy[j][0];
				t_y = n_data[i][1] + dxdy[j][1];
	//			printf("(%d,%d)Í(%d,%d)ÌÏ»Ê\n",n_data[i][0],n_data[i][1],dxdy[j][0],dxdy[j][1]);
				if(star.count(make_pair(t_x,t_y)) == 0){
	//				cout << "È¢" << endl;
					notFind = true;
					break;
				}
	//			cout << " Á½" << endl;
			}
			if(notFind == false){
	//			printf("*%d  %d\n",n_data[i][0],n_data[i][1]);
				ans_x = n_data[i][0];
				ans_y = n_data[i][1];
			}
			notFind = false; 
		}
		printf("%d %d\n",ans_x-main_x,ans_y-main_y);
	}
}

Measured memory_bytes: 0
#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 h,w,a,b;cin>>h>>w>>a>>b;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            if((i<b)^(j<a))cout<<1;
            else cout<<0;
        }
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 1280
n , x = map(int,input().split())
L =list(map(int,input().split()))
ans = 1
D = [0]*(n+2)
for i in range(2,n+2):
    D[i] = D[i-1] + L[i-2]
    if D[i] <=x:
        ans+=1
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#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++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x,y;
  cin>>x>>y;
  vector<int>gr={0,1,2,1,3,1,3,1,1,3,1,3,1};
  if(gr[x]==gr[y])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;

}


Measured memory_bytes: 256
n,m=map(int,input().split())
x=list(map(int,input().split()))
if n>=m:
    print(0)
    exit()
x.sort()
l=[]
for i in range(m-1):
    l.append(x[i+1]-x[i])
l.sort(reverse=True)
ans=x[m-1]-x[0]
for i in range(n-1):
    ans-=l[i]
print(ans)


Measured memory_bytes: 20480
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  vi A(3);for(auto &a:A)cin>>a;sort(ALL(A));;
  ll a=A[0],b=A[1],c=A[2];
  if((b-a)%2){
    cout<<c-b+(b-a)/2+2<<endl;
  }else{
    cout<<c-b+(b-a)/2<<endl;
  }
  return 0;
}

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

int main(){
  int cunt=0;
  int len;
  string s;
  char cu='A';

  cin>>s;
  len=s.length();

  for(int i=0;i<len;i++){
    if(cu>=s[i])
      cunt++;
    cu=s[i];  
  }

  cout<<cunt<<endl;
  return 0;
}



Measured memory_bytes: 3224
#include <iostream>
using namespace std;
int main()
{
    char a;
    cin >> a;
    switch (a)
    {
        case 'A':
            cout << 'T';
            break;
        case 'G':
            cout << 'C';
            break;
        case 'C':
            cout << 'G';
            break;
        default:
            cout << 'A';
    }
    cout << endl;
}

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

const string key = "keyence";

int main(){

    string s;

    cin >> s;

    int x = 0,y = 0;

    while(x < (int)s.size() && s[x] == key[x]){
        x++;
    }

    while(y < (int)s.size() && s[(int)s.size() - 1 - y] == key[(int)key.size() - 1 - y]){
        y++;
    }

    cout << (x + y >= (int)key.size() ? "YES":"NO");

    return 0;
}


Measured memory_bytes: 256