akhauriyash/Code-Regression huggingface dataset:
a = gets.to_i
b = gets.to_i
c = gets.to_i
x = gets.to_i

ans = 0

(0..a).each do |i|
  (0..b).each do |j|
    r = x - ( 500 * i + 100 * j )
    break if r < 0
    ans += 1 if r / 50 <= c
  end
end

puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define getbit(x, i) (((x) >> (i)) & 1)
using namespace std;
typedef pair<int, int> pii;
#define hashset unordered_set
#define hashmap unordered_map
#define unify(arr) arr.resize(unique(arr.begin(), arr.end()) - arr.begin())
#define getbit(x, i) (((x) >> (i)) & 1)

template <typename T>
vector<T> readvector(size_t sz) {
    vector<T> res(sz);
    for (size_t i = 0; i < sz; ++i) {
        cin >> res[i];
    }
    return res;
}
template <typename T>
std::ostream& operator<<(std::ostream& out, const std::vector<T>& v) {
    std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, " "));
    return out;
}

int mylog(int n) {
    return 63 - __builtin_clzll(n);
}

inline int binPow(int x, int deg, int mod) {
    int ans = 1;
    for (int i = sizeof(deg) * CHAR_BIT - 1; i >= 0; i--) {
        ans *= ans;
        ans %= mod;
        if (getbit(deg, i)) ans *= x;
        ans %= mod;
    }
    return ans;
}

// ====================== END ======================
const int MAXN = 1e5 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int L = 1e6;



void solve() {
    int n;
    cin >> n;
    auto arr = readvector<int>(n);
    int prev = arr[0];
    int sum = 0;
    for (auto e : arr) {
        sum += max(0ll, prev - e);
        prev = max(prev, e);
        // cout << sum << endl;
    }
    cout << sum << endl;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; ++i) {
        // cout << "Case #" << i << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 4784
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <list>

int main()
{
    int n;
    std::cin >> n;

    int hanako = 0,taro = 0;
    for (int i = 0; i < n; ++i) {
        std::string h,t;
        std::cin >> h >> t;

        if(h < t){
            hanako += 3;
        }else if(h > t){
            taro +=3;
        }else{
            ++hanako;
            ++taro;
        }

    }

    std::cout << taro << " " << hanako << std::endl;

    return 0;
}


Measured memory_bytes: 3176
let f s =
  let len = String.length s in
  let rec aux i c =
    if i >= len then c
    else if s.[i] = '1' then aux (i + 1) (c + 1)
    else aux (i + 1) c
  in
  aux 0 0

let () = f @@ read_line () |> Printf.printf "%d\n"

Measured memory_bytes: 2432
#include<bits/stdc++.h>
#define lf double
#define ll long long
#define cc pair<char,char>
#define ull unsigned ll
#define ii pair<int,int>
#define li pair<ll,int>
#define iii pair<ii,int>
#define iiii pair<ii,ii>
#define iiii2 pair<int,iii>
#define lii pair<ll,ii>
#define lolo pair<ll,ll>
#define heap priority_queue
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define all(x) x.begin(),x.end()
#define len(x) strlen(x)
#define sz(x) (int) x.size()
#define orta ((bas+son)/2)
#define min3(x,y,z) min(min(x,y),z)
#define max3(x,y,z) max(max(x,y),z)
#define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" "
#define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar()
#define MOD 1000000000
#define inf 1000000000
#define N 2005
#define LOG 20
#define magic 100
#define KOK 250
#define EPS 0.0025
#define pw(x) (1<<(x))
#define PI 3.1415926535
#define dec anan
using namespace std;
 
int n,k,q,a[N],sz[N],reg[N],tot,ans=inf,fb[N];
vector<ii> v;
 
void forbid(int ind) {

	fb[ind]=1;
 
}
 
bool valid(int plc) {
 
	if(sz[reg[plc]]<k) return false;
 
	return true;
 
}  
 
int main() {
 
	#if 0
	freopen("input.txt","r",stdin);
	#endif
		
	scanf("%d %d %d",&n,&k,&q);
 
	for(int i=1;i<=n;i++) {
 
		scanf("%d",&a[i]);
 
		v.pb({a[i],i});
 
	}
 
	sort(all(v));
 
	for(int i=0;i<sz(v)-q+1;i++) {
 
		memset(sz,0,sizeof(sz));
		memset(reg,0,sizeof(reg));
 
		tot=0;
 
		for(int j=1;j<=n;j++) {
 
			if(fb[j]) continue ;
 
			++tot;
 
			int tut=j;
 
			while(j+1<=n && !fb[j+1]) {
 
				reg[j]=tot;
 
				j++;
 
			}
 
			sz[tot]=j-tut+1;
 
			reg[j]=tot;
 
		}
 
		int now=0;
		int last;
 
		for(int j=i;j<sz(v);last=j,j++) {
 
			if(now==q) break ;

			if(valid(v[j].nd)) {
 
				sz[reg[v[j].nd]]--;
				now++;
 
			} 
			else {
 	
 				continue ;
 
			}
 
		}
 
		if(now==q) ans=min(ans,v[last].st-v[i].st);
 
		forbid(v[i].nd);
 
	}
 
	printf("%d",ans);
 
}

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

int min(int a,int b)
{
  if(a>b)
    return b;
  return a;
}

int main()
{
  int n;
  cin>>n;
  int h[n];
  for(int i=0;i<n;i++)
    cin>>h[i];
  
  int dp[n];
  
  dp[0]=0;
  dp[1]=abs(h[0]-h[1]);
  
  for(int i=2;i<n;i++)
  {
   dp[i]=min(dp[i-1]+abs(h[i-1]-h[i]),dp[i-2]+abs(h[i-2]-h[i])); 
  }
  
  cout<<dp[n-1];
  
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long
inline int read(){
    int num=0,w=0;
    char ch=0;
    while(!isdigit(ch)){
        w|=ch=='-';
        ch=getchar();
    }
    while(isdigit(ch)){
        num=(num<<3)+(num<<1)+(ch^48);
        ch=getchar();
    }
    return w?-num:num;
}

//快速写
inline void write(int x)
{
    if(x<0){
        putchar('-');
        x=-x;
    }
    if(x>9)write(x/10);
    putchar(x%10+'0');
}

int arr[1000];
int main()
{
   string s ;
   cin >>s;
   int len = s.size();
   int len1 = len-1 ;
   int sum =0 ;
   if(len%2==1)len++;
   for(int i=0;i<(len)/2;i++){
       if(s[i]!=s[len1]){
           sum++;
          // cout<<i<<endl;
           len1--;
       }else {
           len1--;
       }
   }
   cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [-int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))

    X, N = LI()
    p = LI()

    sa = 1000000
    ans = 0
    for i in range(102):
        if abs(i-X) < sa and (not i in p):
            sa = abs(i-X)
            ans = i
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 68780
import sys


#s = sys.argv[1]
s = input()
if len(s) == 4:
    if s.count(s[0]) == 2:
        if s.count(s[1]) == 2:
            if s.count(s[2]) == 2:
                if s.count(s[3]) == 2:
                    print("Yes")
                    exit()
print("No")
exit()


Measured memory_bytes: 2940
from fractions import gcd
from collections import defaultdict as dd
from collections import Counter as C
a = input()
b = input()
a = sorted(a)
b = sorted(b)
a = C(a)
b = C(b)
p,q = [],[]
for k in dict(a):
    p.append(a[k])
for k in dict(b):
    q.append(b[k])
p = sorted(p)
q = sorted(q)
if p==q:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9664
#include <stdio.h>

int main(void)
{
  int n;
  int a, b, c, d;
  int sum;

  while (scanf("%d", &n) != EOF) {
    sum = 0;
    for (a = 0; a <= 9; a++) {
      for (b = 0; b <= 9; b++) {
        for (c = 0; c <= 9; c++) {
          for (d = 0; d <= 9; d++) {
            if (n == a + b + c + d) {
              sum++;
            }
          }
        }
      }
    }
    printf("%d\n", sum);
  }

  return 0;
}

Measured memory_bytes: 596
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 500 + 5;
ll k,cnt;
int main()
{
	string s;
	cin>>s;
	int len = s.length();
	for(int i = 0; i<len; i++) {
		if(s[i] != '1') break;
		cnt++;
	}
	cin>>k;
	if(k <= cnt) printf("1\n");
	else printf("%c\n",s[cnt]);
	
	
	return 0 ;
 }


Measured memory_bytes: 256
import collections

n = int(input())
a = list(map(int,input().split()))

q = collections.deque()
a.sort(reverse=True)

ans = a[0]
q.append(a[1])
q.append(a[1])
for i in range(2,n):
    ans += q.popleft()
    q.append(a[i])
    q.append(a[i])

print(ans)



Measured memory_bytes: 32496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define make_unique(x) \
    sort(all((x)));    \
    (x).resize(unique(all((x))) - (x).begin())
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " = " << arg1 << " | ";
    __f(comma + 1, args...);
}

ll max(ll a, ll b) { return (a > b ? a : b); }
ll min(ll a, ll b) { return (a < b ? a : b); }
ll dx[4] = {1, 0, -1, 0};
ll dy[4] = {0, 1, 0, -1};
void yes_or_no(ll x)
{
    if (x)
        cout << "Yes\n";
    else
        cout << "No\n";
}
void solve_test()
{
    ll ans = 0;
    string s;
    ll n;
    cin >> n;
    vector<ll> d(n + 1, 1);
    for (ll i = 2; i <= n; i++)
    {
        for (ll j = i; j <= n; j += i)
        {
            d[j]++;
        }
    }
    for (ll i = 1; i < n; i++)
    {
        ans += d[n - i];
    }
    cout << ans << "\n";
}
int main()
{
    cin.sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    // cin >> t; while (t--)
    solve_test();
    return 0;
}


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

const ll MOD=1e9+7;
const double EPS=1e-9;
const double PI=acos(-1.0);
//const long double PI=acos(-1.0L);

struct Point{
    double x,y;
    Point(){}
    Point(double x,double y):x(x),y(y){}

    Point operator +(const Point &b) const {return Point(x+b.x,y+b.y);}
    Point operator -(const Point &b) const {return Point(x-b.x,y-b.y);}
    Point operator *(const double b) const {return Point(x*b,y*b);}
    Point operator /(const double b) const {return Point(x/b,y/b);}
};

struct Line{
    Point a,b;
    Line(){}
    Line(Point a,Point b):a(a),b(b){}
};

double dot(const Point &a,const Point &b) {return (a.x*b.x+a.y*b.y);}
double cross(const Point &a,const Point &b) {return (a.x*b.y-a.y*b.x);}
double norm(const Point &p) {return dot(p,p);}
double abs(const Point &p) {return sqrt(norm(p));}

Point projection(const Point &p,const Line &l){
    double r=dot(p-l.a,l.b-l.a)/norm(l.b-l.a);
    return l.a+(l.b-l.a)*r;
}

Point reflection(const Point &p,const Line &l){
    return p+(projection(p,l)-p)*2;
}

int main(){
    Point P1,P2;
    cin>>P1.x>>P1.y>>P2.x>>P2.y;
    int Q;
    cin>>Q;

    Line L(P1,P2);
    for(int q=0;q<Q;q++){
        Point p;
        cin>>p.x>>p.y;

        Point ans=reflection(p,L);
        cout<<fixed<<setprecision(10)<<ans.x<<" "<<ans.y<<endl;
    }

    return 0;
}



Measured memory_bytes: 3296
'''
Created on 2020/08/20

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,A,B=map(int,pin().split())
  t=0
  if N<=A+B:
    t=abs(N-A-B)
  print(f"{min(A,B)} {t}")
  return 

main()  

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ep emplace_back
#define st first
#define sc second

using namespace std;

const ll mod = 998244353;
const int e = 1e6 + 69;
const int base = 311;

// dung igt thay cho gt luc tinh giai thua
// 3
// cach tao hoan vi tu n so : n*(n+1)/2;

ll d[11];
map<ll, ll>kt;

bool check(ll n)
{
    while(n > 0)
    {
        ll x = n%10;
        if(kt[x] > 0) return false;
        n/=10;
    }
    return true;
}

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

    for(int i=1; i<=k; i++)
    {
        cin >> d[i];
        kt[d[i]]++;
    }
    while(check(n) == false)
    {
        n ++;
    }
    cout << n;
}


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

#define INF 100000000
#define fs first
#define sc second
typedef pair<int,int> P;
typedef pair<P,P> P2;

int w,h,f,m,o;
int g[20][20];
int dp[20][20][100];
int dis[10][2<<10][100];

int main(){
  while(cin >> w >> h,w||h){
    cin >> f >> m >> o;
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++)cin >> g[i][j];


    for(int i=0;i<=h;i++)
      for(int j=0;j<w;j++)
	for(int k=0;k<=m;k++)
	  if(!i && k == o)dp[i][j][k] = 0;
	  else dp[i][j][k] = INF;

    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++)
	for(int k=0;k<(1<<w);k++)
	  for(int l=0;l<=m;l++)dis[j][k][l] = INF;

      priority_queue<P2,vector<P2>,greater<P2> > q;
      
      for(int j=0;j<w;j++)
	for(int k=2;k<=m;k++)
	  if(g[i][j]>0){
	    dis[j][1<<j][min(k+g[i][j]-1,m)] = min(dis[j][1<<j][min(k+g[i][j]-1,m)],dp[i][j][k]);
	    q.push(P2(P(dis[j][1<<j][min(k+g[i][j]-1,m)],j),P(1<<j,min(k+g[i][j]-1,m))));
	  }else{
	    dis[j][1<<j][k-1] = min(dis[j][1<<j][k-1],dp[i][j][k] - g[i][j]);
	    q.push(P2(P( dis[j][1<<j][k-1],j),P(1<<j,k-1)));
	  }

      while(q.size()){
	P2 p = q.top(); q.pop();
	int cost = p.fs.fs, tw = p.fs.sc, st = p.sc.fs, air = p.sc.sc;

	if(air<=1)continue;

	int nw = tw - 1, nst,ncost,nair;
	if(0<=nw && nw<w){
	  ncost = cost; nair = air-1;
	  if( !((st>>nw)&1) ){
	    if(g[i][nw]>0)nair = min(air + g[i][nw]-1, m);
	    else ncost -= g[i][nw];
	  }
	  nst = st | (1<<nw); 
	  if(dis[nw][nst][nair] > ncost){
	    dis[nw][nst][nair] = ncost;
	    q.push(P2(P(ncost,nw),P(nst,nair)));
	  }
	}
	
	nw = tw + 1;
	if(0<=nw && nw<w){
	  ncost = cost; nair = air-1;
	  if( !((st>>nw)&1) ){
	    if(g[i][nw]>0)nair = min(air + g[i][nw]-1, m);
	    else ncost -= g[i][nw];
	  }
	  nst = st | (1<<nw);
	  if(dis[nw][nst][nair] > ncost){
	    dis[nw][nst][nair] = ncost;
	    q.push(P2(P(ncost,nw),P(nst,nair)));
	  }
	}
      }
      for(int j=0;j<w;j++){
	for(int k=0;k<(1<<w);k++){
	  for(int l=1;l<=m;l++){
	    dp[i+1][j][l] = min(dp[i+1][j][l],dis[j][k][l]);
	  }
	}
      }
    }

    int ans = INF;
    for(int i=0;i<w;i++)
      for(int j=1;j<=m;j++)ans = min(ans,dp[h][i][j]);
    if(ans<=f)cout << ans << endl;
    else cout << "NA" << endl;
  }
}

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

int main(){
    int N,min=1001,max=0;
    cin >> N;
    vector<int> a(N);
    for(int i=0;i<N;i++)cin >> a.at(i);
    for(int i=0;i<N;i++){
        if(a.at(i) > max)max=a.at(i);
        if(a.at(i) < min)min=a.at(i);
    }
    cout << max-min << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FS r = new FS();
		String aa = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		int H = r.nextInt();
		int W = r.nextInt();
		for(int i=0; i<H; i++) {
			for(int j=0; j<W; j++) {
				String s = r.next();
				if(s.equals("snuke")) {
					System.out.println(String.valueOf(aa.charAt(j)) + (i+1));
				}
			}
		}
	}
	
	public static void solver() {
		// write logic
	}
	
	// Read Class
	static class FS {
		private final InputStream in = System.in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;
		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}
	
		private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
		private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
		private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
	
		public boolean hasNext() { skipUnprintable(); return hasNextByte();}
		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while(isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}
		public int nextInt() {
			return (int)nextLong();
		}
		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while(true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if(b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}
	}
}

Measured memory_bytes: 8400
#include "bits/stdc++.h"
using namespace std;
typedef long long int lint;
typedef pair<lint, lint> plint;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(lint i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(lint i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<class T>bool chmax(T & a, const T & b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T & a, const T & b) { if (b < a) { a = b; return 1; } return 0; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2>& l, const pair<T1, T2>& r) { return make_pair(l.first - r.first, l.second - r.second); }
const lint MOD = 1e9 + 7, MAX = LLONG_MAX;

const lint MAX_N = 100000;
lint dt[MAX_N * 4 - 1], sz;
const lint INIT = (1ll << 31) - 1;

void init(int n) {
	sz = 1;
	while (sz < n) sz *= 2;
	REP(i, 2 * sz - 1) dt[i] = INIT;
}

void update(int k, int a) {
	k += sz - 1;
	dt[k] = a;
	while (k > 0) {
		k = (k - 1) / 2;
		dt[k] = min(dt[k * 2 + 1], dt[k * 2 + 2]);
	}
}

lint query(lint a, lint b, lint k = 0, lint l = 0, lint r = sz) {
	if (r <= a || b <= l) return INIT;
	if (a <= l && r <= b) return dt[k];
	else {
		lint vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		lint vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vr, vl);
	}
}

lint N, Q, A, B, C;
int main() {
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >> N >> Q;
	init(N);
	vector<lint> ans;
	REP(i, Q) {
		cin >> C >> A >> B;
		if (C == 0) {
			update(A, B);
		}
		else {
			ans.push_back(query(A, B+1));
		}
	}
	REP(i, SZ(ans)) {
		cout << ans[i] << endl;
	}
}



Measured memory_bytes: 5512
import sys

def minCheck(X):
  if X in L:
    return minCheck(X-1)
  else:
    return X

def maxCheck(X):
  if X in L:
    return maxCheck(X+1)
  else:
    return X

X, N = map(int,input().split())
if N == 0:
  print(X)
  sys.exit()

A = input().split()
L = [int(b.strip()) for b in A]  

#print(L)
if X in L:
  minA = minCheck(X-1)
  maxB = maxCheck(X+1)
  a = abs(X - minA)
  b = abs(X - maxB)
  if a > b:
    print(maxB)
  else:
    print(minA)
else:
  print(X)

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

main() {
    int a,b,c; cin >> a >> b >> c;
    map<int,int>m;
    m[a];m[b];m[c];
    cout << m.size() << endl;

    return 0;
}

Measured memory_bytes: 256
D = gets.to_i
C,*S = (0..D).map{gets.split.map &:to_i}
1 < (I=(0..25).select{C[_1]==0}).size and S.each {|s;z|
  I.each {|i| if i!=(z||=i); s[z]<s[i] ? z = i+s[z]=0 : s[i]=0 end }
}
L,M,N = [-1]*27,3,5
def calc(d,n)
  s,x = S[d],0
  n = D-d  if n > D-d
  t = (0..25).map {s[_1] > 0 ? C[_1]*(d-L[_1])*n+s[_1] : 0}
  i = (0..25).max_by(M){t[_1]}.max_by {|i|
    0 == (c=t[i])*(n-1) and next c
    l,L[i] = L[i],d
    c += calc(d+1,n-1) >> 5
    L[i] = l
    x < c ? x=c : c
  }
  ((x>0 ? x : t[i]) << 5) + i
end
D.times { p 1 + i=calc(_1,N)&31; L[i]=_1 }

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

using ll = long long;
ll n, k, c, repeat_time, pre_repeat_time;
int main() {
    bool repeat_exist = false;
    std::cin >> n >> k;
    std::vector<ll> vec(n+1, 0);
    std::vector<long long int> b(n+1, -1);
    for (ll i = 1; i <= n; i++) {
        cin >> vec[i];
    }
    ll j = 1;
    c = 1;
    while (c <= k) {
        if (b[j] != -1) {
            repeat_time = c - b[j];
            pre_repeat_time = b[j] - 1;
            repeat_exist = true;
            break;
        }
        b[j] = c;
        j = vec[j];
        c++;
    }
    if (repeat_exist) {
        ll x = (k - pre_repeat_time) % repeat_time;
        for (ll p = 0; p < x; p++) {
            j = vec[j];
        }
        std::cout << j << std::endl;
    }
    else {
        std::cout << j << std::endl;
    }

}

Measured memory_bytes: 6424
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int n,m;
		cin>>n>>m;
		if(n==m) cout<<"Yes";
		else cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
-- vim: set fdm=marker : -- {{{
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Control.Monad.Fix (fix)
import Data.Maybe
import Data.Array.Unboxed (Array, Ix, array, (!), range)
import qualified Data.ByteString.Char8 as BS

type Index = Int
type Value = Integer
type Data  = Array Index Value

tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

--Input functions with ByteString
readInt :: Num a => BS.ByteString -> a
readInt = fromIntegral . fst . fromJust . BS.readInteger
readIntTuple :: Num a => BS.ByteString -> (a, a)
readIntTuple = tuplify2 . map readInt . BS.words
readIntList :: Num a => BS.ByteString -> [a]
readIntList = map readInt . BS.words

getInt :: Num a => IO a
getInt = readInt <$> BS.getLine
getIntList :: Num a => IO [a]
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents

genArray n xs = array (0, n-1) [x | x <- zip [0..n] xs]
-- }}}

main = do
    n <- getInt
    print $ 180 * (n-2)



Measured memory_bytes: 380
n = int(input())
s = input()

es,ws = [],[]
if s[0] == 'E':
    es.append(1)
    ws.append(0)
else:
    es.append(0)
    ws.append(1)

for i in range(1,n):
    if s[i] == 'E':
        es.append(es[i-1]+1)
        ws.append(ws[i-1])
    else:
        es.append(es[i-1])
        ws.append(ws[i-1]+1)

ans = 9999999
for i in range(n):
    if i == 0:
        ans = min(ans,es[n-1] - es[0])
    else:
        ans = min(ans,ws[i-1] + es[n-1] - es[i])
print(ans)


Measured memory_bytes: 17976
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll n,x;
    ll a[101];
    cin >> n >> x;
    for (size_t i = 0; i < n; i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    ll result = 0;
    for (size_t i = 0; i < n; i++)
    {
        if(x>=a[i]){
            result++;
            x-=a[i];
        }else{
            cout<<result<<endl;
            return 0;
        }
    }
    if(x==0){
        cout<<result<<endl;
    }else{
        cout<<result-1<<endl;
    }
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LL long long
#define LD long double
#define pb push_back
#define mp make_pair
#define ss(x) (int) x.size()
#define fi first
#define se second
#define cat(x) cerr << #x << " = " << x << endl
#define rep(i, j, n) for (int i = j; i <= n; ++i)
#define per(i, j, n) for (int i = n; j <= i; --i)
#define all(x) x.begin(), x.end()

using namespace std;

int n, m;
int a[110];

int main() {
	scanf ("%d%d", &n, &m);
	int sum = 0;
	rep(i, 1, n) {
		scanf ("%d", a + i);
		sum += a[i];
	}
	int res = 0;
	rep(i, 1, n) {
		res += (a[i] >= (LD) sum / (4 * m));
	}
	if (res >= m) printf ("Yes\n");
	else printf ("No\n");
	
    return 0;
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);    
    
	long long a,b,c;
	
	cin>>a>>b>>c;
	long long d = c - a - b;
	
	if(d > 0 && d * d > 4*a*b)
		cout<<"Yes";
		
	else 
		cout<<"No";
	
	
	return 0;
}

Measured memory_bytes: 256
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long ;

int main(){
	ll x ;
	cin >> x ;
	ll ans = x / 11 * 2;
	if ( x % 11 > 6 ) ans+=2 ;
	else if ( x % 11 > 0 ) ans++ ;
	cout << ans << endl;
	return 0 ;
}


Measured memory_bytes: 256
//
// Created by dina on 05/07/20.
//

#include<bits/stdc++.h>
using namespace std;

vector<int> col_count;
vector<int> row_count;
int total_back = 0;

int find_ways(vector<vector<char>>& grid, int k, int h, int w){
    int ans = 0;
    for(int rows = 0; rows < (1<<h); rows++){
        for(int cols = 0; cols < (1<<w); cols++){
            int black_count = total_back;
            int i, j;
            for(i=0; i<h; i++) {
                if (rows & (1 << i)) { // that means ith row is selected to paint red
                    black_count -= row_count[i];
               }
            }
            for(j=0; j<w; j++){
                if(cols&(1<<j)){ // that means jth col is selected to paint red
                    black_count -= col_count[j];
                }
            }
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    if(rows&(1<<i) and cols&(1<<j) and grid[i][j] == '#') black_count++;
                }
            }
            if(black_count == k) ans++;
        }
    }
    return ans;
}

int main(){
    int h, w, k; cin >> h >> w >> k;
    total_back = 0;
    vector<vector<char>> grid(h, vector<char>(w));
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> grid[i][j];
            if(grid[i][j] == '#') total_back++;
        }
    }
    col_count.resize(w,0);
    row_count.resize(h,0);
    for(int i=0; i<h; i++){
        int count = 0;
        for(int j=0; j<w; j++){
            if(grid[i][j] == '#') count++;
        }
        row_count[i] = count;
    }
    for(int i=0; i<w; i++){
        int count = 0;
        for(int j=0; j<h; j++){
            if(grid[j][i] == '#') count++;
        }
        col_count[i] = count;
    }
    int ways = find_ways(grid,k,h,w);
    cout << ways << "\n";
    return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;

int main(){ 
    Int A,B,C,X,Y;
    cin >> A >> B >> C >> X >> Y;

    Int all_A_B, all_AB, A_or_B_and_AB1, A_or_B_and_AB2, ans;
  
  	all_A_B = X * A + Y * B;
  
  	all_AB = min(X,Y) * 2 * C + (X + Y - 2 * min(X,Y)) * 2 * C;
  
  	A_or_B_and_AB1 = min(X,Y) * 2 * C + (X - min(X,Y)) * A + (Y - min(X,Y)) * B;
  
  	A_or_B_and_AB2 = min(X,Y) * 2 * C + (X - min(X,Y)) * 2 * C + (Y - min(X,Y)) * 2 * C;
  
  	ans = min(all_A_B, min(all_AB, min(A_or_B_and_AB1, A_or_B_and_AB2)));
  
  	cout << ans << endl;



}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>

typedef long long ll;

#define rep(i,n) for(int i = 0; i < n; i++)
#define debug(x) cerr << #x << ": " << x << "\n";

using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

int main(){
  int N, A[200010] = {};
  cin >> N;
  int x;
  rep(i,N-1){
    cin >> x;    
    A[x]++;
  }
  for(int i=1; i<=N; i++)
    cout << A[i] << endl;  
}


Measured memory_bytes: 4400
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
using namespace std;
int a[205000],b[205000];int ans,sum;
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	int x;
	for(int i=1;i<=n;i++) {
		scanf("%d",&x);
		if(a[x]==0) sum++; 	
		a[x]++;
	}
	if(sum<=k) return 0*printf("0\n");
	for(register int i=1;i<=n;i++){
		if(a[i]==0) a[i]=(1<<30);
	}
	sort(a+1,a+1+n);
	for(register int i=1;i<=n;i++){
		if(sum>k){
			sum--;ans+=a[i];
		}
		else break;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
 char A, B, C;
 scanf("%c%c%c", &A, &B, &C);
 if(A, B != C){
  printf("Yes\n");
 }else if(A, C != B){
  printf("Yes\n");
 }else if(B, C != A){
  printf("Yes\n");
 }else if( A==B, B==C){
  printf("No\n");
 }
 return 0;
}

Measured memory_bytes: 3100
N, K = map(int, input().split())
ans = 0
for i in range(1, N + 1):
    cur_score = i
    heads_no = 0
    win_prob = 1
    while(cur_score < K):
        heads_no += 1
        win_prob /= 2
        cur_score *= 2
    ans += 1 / N * win_prob
print(ans)

Measured memory_bytes: 2940
def d_dice_in_line():
    from itertools import accumulate
    N, K = [int(i) for i in input().split()]
    P = [int(i) for i in input().split()]

    expected_value = [0] + [(p + 1) / 2 for p in P]
    cumsum = list(accumulate(expected_value))
    return max([cumsum[j + K] - cumsum[j] for j in range(N - K + 1)])

print(d_dice_in_line())

Measured memory_bytes: 28620
#include <bits/stdc++.h>
using namespace std;
int main()

{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int number_of_problems,time_for_each_problem,sum =0;

	cin >>number_of_problems;

	int a[number_of_problems];

	for(int i = 0;i<number_of_problems;i++)
			{
				cin >> a[i];
			}
	int kinds_of_drinks;

	cin >> kinds_of_drinks;
	int a2[number_of_problems];
	for(int j=0,i=0;j<number_of_problems,i<number_of_problems;j++,i++)
	
	{
		a2[j]=a[i];
	}	
		
	

	while(kinds_of_drinks--)

		{   
			int p,x;

			cin >> p  >> x;
		
			a[p-1]  = x;
			

			for(int i = 0;i<number_of_problems;i++)
			{
				sum = sum + a[i];
			}
			
			cout << sum <<"\n";
			
			   sum=0;
			   a[p-1]=a2[p-1];
			   
			
		}

}	

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
using namespace std;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    rep(i, s.length() / 2) {
        if (s[i] != s[s.length() - 1 - i]) ans++;
    }

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



Measured memory_bytes: 256
program AGC001A
    implicit none
    integer(8)::N,i,ans
    integer(8),allocatable,dimension(:)::L
    read(5,*)N
    allocate(L(2*N))
    ans=0
    read(5,*)(L(i),i=1,2*N)
    L=iqsort(L)

    do i=1,N
        ans=ans+L(2*i-1)
    end do
    print'(i0)',ans
contains
    recursive function iqsort(ix) result(ires)
      integer(8), allocatable :: ires(:)
      integer(8), intent(in)  :: ix(:)
      integer :: k
      if (size(ix) <= 1) then 
        ires = ix
      else  
        k = ix(size(ix) / 2)
        ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] 
      end if
    end function iqsort
end program AGC001A

Measured memory_bytes: 384
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
typedef long long ll;
ll n;
int main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	cout << (n & 1 ? (n << 1) : n);
	return 0;
}

Measured memory_bytes: 256
# include <iostream>

using namespace std;
 
int main() {
  int A,B;
  cin>>A>>B;
  if (A==1 and B==2) cout<<(3);
  else if (A==1 and B==3) cout<<(2);
  else if (A==2 and B==3) cout<<(1);
  else if (A==2 and B==1) cout<<(3);
  else if (A==3 and B==1) cout<<(2);
  else cout<<(1);
  
  



}

Measured memory_bytes: 256
import math
N = int(input())
a = list(map(int, input().split()))
number = 0
sign = True
while sign:
  for i in range(N):
    if a[i] % 2 != 0:
      sign = False
      print(number)
      break
    else:
      a[i] /= 2
  number += 1



Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
    int m, f, b;
    cin >> m >> f >> b;

    if (m >= b) {
        cout << 0 << endl;
    }
    else if ((m + f) < b) {
        cout << "NA" << endl;
    }
    else {
        cout << (b - m) << endl;
    }
}


Measured memory_bytes: 3108
#include <functional>
#include <iostream>
#include <utility>
#include <vector>

template <class F> class rec_lambda {
  F f;

public:
  rec_lambda(F &&f) : f(std::move(f)) {}
  template <class... Args> auto operator()(Args &&... args) const {
    return f(*this, std::forward<Args>(args)...);
  }
};
template <class F> auto make_rec(F &&f) { return rec_lambda<F>(std::move(f)); }

using i64 = long long;

i64 f(i64 n) {return n * (n + 1) / 2;}

int main() {

  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int n;
  std::cin >> n;
  std::vector<int> c(n);
  for (int &e : c) {
    std::cin >> e;
    e -= 1;
  }
  std::vector<std::vector<int>> g(n);
  for (int i = 0; i != n - 1; i += 1) {
    int a, b;
    std::cin >> a >> b;
    a -= 1;
    b -= 1;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  std::vector<i64> size(n, 1);

  make_rec([&](auto &&dfs, int v, int p) -> void {
    for (int e : g[v]) {
      if (e == p)
        continue;
      dfs(e, v);
      size[v] += size[e];
    }
  })(0, n);

  std::vector<i64> count(n, n), ans(n, f(n));

  make_rec([&](auto &&dfs, int v, int p) -> void {
    i64 prev = count[c[v]];
    for (int e : g[v]) {
      if (e == p)
        continue;
      count[c[v]] = size[e];
      dfs(e, v);
      ans[c[v]] -= f(count[c[v]]);
    }
    count[c[v]] = prev - size[v];
  })(0, n);

  for (int i = 0; i != n; i += 1) {
    ans[i] -= f(count[i]);
    std::cout << ans[i] << "\n";
  }
}


Measured memory_bytes: 38156
import java.util.*;
public class Main{
	public static void main(String[] args) { 
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		for(int i=0;i<n;i++){
			double x1=sc.nextDouble();
			double y1=sc.nextDouble();
			double x2=sc.nextDouble();
			double y2=sc.nextDouble();
			double x3=sc.nextDouble();
			double y3=sc.nextDouble();
			//r^2=(x-a)^2+(y-b)^2
			double a1=2*(x2-x1);
			double a2=2*(x3-x1);
			double b1=2*(y2-y1);
			double b2=2*(y3-y1);
			double c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
	        double c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
	        double x = (b1*c2 - b2*c1) / (a1*b2 - a2*b1);
	        double y = (c1*a2 - c2*a1) / (a1*b2 - a2*b1);
	        double r = Math.sqrt((x1-x)*(x1-x) + (y1-y)*(y1-y));
			System.out.printf("%.3f %.3f %.3f\n",x ,y, r);
		}
	}
}

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

#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n"
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define rev(a) (a).rbegin(),(a).rend()
#define pll pair<ll,ll>
#define rep(i,a,b) for(long long i = (a); i <= (b); i++)

const int mod = 1e9+7;
const int N = 1e5+5; 

int main(){
	fast;
	ll k,a,b; cin >> k >> a >> b;
	bool f = false;
	rep(i,a,b){
	    if( i % k == 0) f = true;
	}
	
	if(f) cout << "OK\n";
	else cout << "NG\n";
}

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

char S[ 5100 ];
char T[ 5100 ];
vector<string> A;
set<string> X;

int main()
{
int i;
int j;
int K;
int iLen;

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> S;
	cin >> K;

	i = 0;
	while( S[ i ] != '\0' )
	{
		A.push_back( S + i );
		i++;
	}

	iLen = i;
	sort( A.begin(), A.end() );
	for( i = 0; i < iLen; i++ )
	{
		j = 0;
		while( A[ i ][ j ] != '\0' )
		{
			j++;
			strcpy( T, A[ i ].c_str() );
			T[ j ] = '\0';
			X.insert( T );
			if( X.size() == K )
			{
				cout << T << endl;

				return 0;
			}
		}
	}

	return 0;
}






Measured memory_bytes: 16128
#include <stdio.h>

int main() {
    int h,w,n;
    scanf("%d", &h);
    scanf("%d", &w);
    scanf("%d", &n);
    int counter = 0;
    int sum = 0;
    while (n > sum){
        if(w >= h){
            sum += w;
            counter++;
        }else if(h > w){
            sum+= h;
            counter++;
        }
    }
    printf("%d\n",counter);
    
    return 0;
}

Measured memory_bytes: 1708
# 69

import itertools
import bisect

q = int(input())
lr_l = [[int(x) for x in input().split()] for y in range(q)]

n_max = max(itertools.chain.from_iterable(lr_l))

isp_l = [True] * (n_max+1)
isp_l[0] = False
isp_l[1] = False

for i in range(2, int(n_max ** 0.5 + 2)):
    if not isp_l[i]:
        continue
    for j in range(i * 2, n_max + 1, i):
        isp_l[j] = False

p_l = [int(x) for x in range(n_max+1) if isp_l[x]]

l_l = []
for i in range(len(p_l)):
    if (p_l[i]+1)//2 in p_l:
        l_l.append(p_l[i])

for i in range(q):
    _l,_r = lr_l[i]
    _s = bisect.bisect_left(l_l, _l)
    _e = bisect.bisect_right(l_l, _r)
    print(_e-_s)


Measured memory_bytes: 27268
#include<stdio.h>
int main()
{
int a,b,pro=0,x,y;
  scanf("%d%d",&a,&b);
  if(a>b)
    {
        x=a;
        y=b;
    }
    else
    {
        y=a;
        x=b;
    }
  for(int i=y;i<=x;i++)
  {
      if((a*b*i)%2!=0)
        pro++;
  }
  if(pro!=0)
    printf("Yes");
  else
    printf("No");

}



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

int main() {
  char c[3];
  cin >> c[0] >> c[1] >> c[2];

  bool _a = false, _b = false, _c = false;
  for(int i = 0; i < 3; i++) {
    if(c[i] == 'a') _a = true;
    if(c[i] == 'b') _b = true;
    if(c[i] == 'c') _c = true;
  }

  if(_a && _b && _c) cout << "Yes";
  else cout << "No";
}


Measured memory_bytes: 256
from math import factorial
n, a, b = map(int, input().split(" "))
mod = pow(10, 9) + 7
ans = pow(2, n, mod)
ans = (ans - 1) % mod

def reduce(ans, r):
    c = n % mod
    for i in range(1, r):
        c *= ((n - i) % mod) * pow(i + 1, mod - 2, mod)
        c %= mod
    ans -= c
    if ans < 0:
        ans += mod
    return ans % mod
    
ans = reduce(ans, a)
ans = reduce(ans, b)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll          long long int
#define ld          double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         1000000000000000000
#define MAXN        200005
#define LOG         20
#define mod         1000000007
using namespace std;
 
 ll fun(ll x,ll y){
     ll ans=1;
     while(y>0){
         if(y%2==1){
             ans=(ans*1ll*x)%mod;
         }
         y=y/2;
         x=(x*1ll*x)%mod;
     }
     return ans;
 }
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll fac[MAXN],i,x,y,p,q,z,r,ans=0,sum;
    fac[0]=1;
    for(i=1;i<MAXN;i++){
        fac[i]=fac[i-1]*1ll*i;
        fac[i]=fac[i]%mod;
    }
    ll in[MAXN];
    for(i=0;i<MAXN;i++){
        in[i]=fun(fac[i],mod-2);
    }
    ll n,k;
    cin>>n>>k;
    ll a[n+1],pre[n+1];
    pre[0]=0;
    for(i=1;i<=n;i++){
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    for(i=1;i<=n;i++){
        pre[i]=a[i];
        pre[i]+=pre[i-1];
    }
    for(i=k-1;i<=n-1;i++){
        x=pre[i];
        y=pre[n]-pre[n-i];
        sum=y-x;
        sum=sum%mod;
      //  cout<<x<<" "<<y<<" "<<sum<<" ";
        p=i-1;
        q=k-2;
        z=fac[p];
        z=z*1ll*in[q];
        z=z%mod;
        z=z*1ll*in[p-q];
        z=z%mod;
       // r=n-i;
       // cout<<z<<" "<<r<<endl;
        //z=z*1ll*r;
        z=z%mod;
        z=z*1ll*sum;
        z=z%mod;
        ans+=z;
        ans=ans%mod;
    }
    cout<<ans;
}

Measured memory_bytes: 4992
#include <iostream>
#include <list>
#include <string>
#include <algorithm>
 
typedef std::list<std::uint64_t> DType;
 
int main() {
    DType D;
    std::uint64_t N;
    std::uint64_t C;
    std::string S;
    std::cin >> C;
 
    for (std::size_t i = 0; i < C; i++) {
        if (!(std::cin >> S)) break;
        if (S[0] == 'i' ||S[0] == 'I') {//insert
            std::cin >> N;        
            D.insert(D.begin(),N);
            continue;
        }
        if (S.size() == 6) {//delete
            std::cin >> N;    
            auto it=std::find(D.begin(), D.end(), N);
            if(it!= D.end())D.erase(it);
            continue;
        }
        if (S.size() == 11) {//deletefirst
            D.pop_front();
            continue;
        }
        if (S.size() == 10) {//deletelast
            D.pop_back();
            continue;
        }
    }
 
    for (auto it = D.begin(); it != D.end(); it++) {
        if(it!=D.begin())std::cout << ' ';
 
        std::cout << *it;
    }
 
    std::cout<<std::endl;
 
    return 0;
}

Measured memory_bytes: 34476
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin >> n;
    long long int sum = 0;
    for (long long int i = 1; i <= n; i++)
    {
        for (long long int j = 1; j <= n; j++)
        {
            long long int t;
            t = __gcd(i, j);
            for (long long int k = 1; k <= n; k++)
            {
                sum = sum + __gcd(t, k);
                //cout << sum << " ";
            }
        }
    }
    cout << sum << endl;
}

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

int main(void){
    int N;
    cin >> N;
    vector<int> s(N);
    for(int i=0; i<N; i++) cin >> s[i];

    sort(s.begin(), s.end());

    int sum=0;
    for(int i=0; i<N; i++){
        sum+=s[i];
    }

    int not10n=0;
    for(int i=0; i<N; i++){
        if(s[i]%10 != 0){
            not10n = s[i];
            break;
        }
    }

    if(not10n == 0) cout << 0 << endl;
    else if(sum%10 != 0) cout << sum << endl;
    else cout << sum-not10n << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n, k, h, a, b = 0;
	scanf("%d %d", &n, &k);
	for (a = 1; a <= n; a++) {
		scanf("%d", &h);
		if (h >= k) {
			b++;
		}
	}
	printf("%d", b);
}

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

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

	string s;
	cin >> s;
	if(s[0] != 'A'){
		cout << "WA";
		return 0;
	}
	int count_c = 0;
	for(int i=2; i<s.length()-1; i++){
		if(s[i]=='C'){
			count_c++;
		}
	}
	if(count_c != 1){
		cout << "WA";
		return 0;
	}
	string strcopy = s;
	transform(s.begin(), s.end(), s.begin(), ::tolower);
    
	for(int i=1; i<s.length(); i++){
		if(strcopy[i]=='C') continue;
		else{
			if(strcopy[i] != s[i]){
				cout << "WA";
				return 0;
			}
		}
	}
	cout << "AC";
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#define Mod 1000000007
#define INF 1e14
typedef long long int ll;
ll fast(ll n,ll a)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll res=fast(n/2,a)%Mod;
        if(n%2==0)
        {
            return (((res%Mod)*(res%Mod))%Mod);
        }
        else{
            return (((((res%Mod)*a)%Mod)*res)%Mod);
        }
    }
}

int main()
{
   ll n,i;
   cin>>n;
   ll b[n-1];
   for(i=0;i<n-1;i++)
   {
       cin>>b[i];
   }
   ll a[n];
   a[0]=b[0];
   for(i=0;i<n-2;i++)
   {
       if(b[i]<=b[i+1])
       {
           a[i+1]=b[i];
       }
       else
       {
           a[i+1]=b[i+1];
       }
   }
   if(b[n-2]>=b[n-3])
   {
       a[n-1]=b[n-2];
   }
   else
   {
       a[n-1]=b[n-2];
       a[n-2]=a[n-1];
   }
   ll ans=0;
   for(i=0;i<n;i++)
    ans+=a[i];

   cout<<ans;
}


Measured memory_bytes: 256
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def main():
    a = list(map(int, input().split()))
    print(sum(a) - max(a))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include<stdio.h>
#include <string.h>
int main()
{
	int n,i,j;
	int k=0;
	scanf("%d",&n);
	for(i=0;i<25;i++){
		if(k==1){
			break;
		}
		for(j=0;j<18;j++){
			if(n==(4*i)+(7*j)){
				printf("Yes");
				k=1;
        		break;
			}
		}
	}
	if(k==0){
		printf("No");
	}
	return 0;
}


Measured memory_bytes: 128
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return input().rstrip().decode()
def II(): return int(input())
def FI(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()



def main():
	n=II()
	A=LI()

	s=0
	x=0
	r=-1

	ans=0

	for l in range(n):
		while s==x and r<n:
			r+=1
			if r==n:
				break
			s+=A[r]
			x^=A[r]
			#print(s,x,r)
		#print(l,r,s,x,11111)
		ans+=r-l

		s-=A[l]
		x^=A[l]
	print(ans)







if __name__ == "__main__":
	main()


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

using namespace std;

int N;
vector<int> graph[100005];
int vec[100005];
int qu[100005];
int par[100005];
int ans[100005];

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> N;
    for(int i = 1; i<N; i++){
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    for(int i = 1; i<=N; i++){
        cin >> vec[i];
    }
    sort(vec+1, vec+N+1);
    reverse(vec+1, vec+N+1);
    int l = 1, r = 1;
    qu[1] = 1;
    int idx = 0;
    while(l <= r){
        int n = qu[l++];
        for(int e : graph[n]){
            if(e != par[n]){
                qu[++r] = e;
                par[e] = n;
            }
        }
    }
    int tot = 0;
    for(int i = 1; i<=N; i++){
        if(i-1){
            tot += vec[i];
        }
        ans[qu[i]] = vec[i];
    }
    cout << tot << "\n";
    for(int i = 1; i<=N; i++){
        cout << ans[i] << " ";
    }
}


Measured memory_bytes: 3200
#include <stdio.h>

int main(void){
  int R;
  scanf("%d", &R);
  if(0 <= R && R < 1200){
    printf("ABC\n");
  }else if(1200 <= R && R < 2800){
    printf("ARC\n");
  }else{
    printf("AGC\n");
  }
  return 0;
}


Measured memory_bytes: 128