akhauriyash/Code-Regression huggingface dataset:
n=int(input())
r=[[0]*3 for i in range(n)]
b=[[0]*2 for i in range(n)]
for i in range(n):
    r[i]=list(map(int,input().split()))+[0]
for i in range(n):
    b[i]=list(map(int,input().split()))

r.sort(key=lambda x:x[1],reverse=True)
b.sort()

psum=0
for i in range(n):
    for ii in range(n):
#        print("b:",i,b[i][0],b[i][1],"r:",ii,r[ii][0],r[ii][1])
        if b[i][0]>r[ii][0] and b[i][1]>r[ii][1] and r[ii][2]==0:
            r[ii][2]=1
            psum+=1
            break
print(psum)
            


Measured memory_bytes: 3188
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
long long N;

const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  int H, W, A, B; cin >> H >> W >> A >> B;
  ll ans = 0;
  COMinit();
  ans+=COM(H+W-2, W-1); ans%=mod;
  ll hiku;
  rep(i, B){
    hiku = COM(H-A+B-1, i)*COM(W+A-B-1, W-1-i);
    hiku%=mod;
    ans-=hiku;
    if(ans<0) ans+=mod;
  }
  cout << ans << endl;
}

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


int main(){
  ll x,k,d;
  cin >> x >> k >> d;
  x = abs(x);
  if(x/d>k) cout << x - k*d << endl;
  else{
    if((k-x/d)%2==0){
      cout << x%d << endl;
    }
    else{
      cout << d-x%d << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF=(ll)1e9;
const ll MOD=(ll)1e9+7;
vector<int> dx={1,0,-1,0},dy={0,1,0,-1};

int main(){
  int K;
  cin>>K;
  ll a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout<<a[K-1]<<endl;
}


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

int main() {
  int n;
  cin >> n;
  set<string> s;
  for(int i=0; i<n; i++){
    string si;
    cin >> si;
    s.insert(si);
  }

  cout << s.size() << endl;

}


Measured memory_bytes: 19160
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
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(a > b){ a = b; return 1; } return 0; }
typedef long long ll;
//*******************************************************
// Tree
//*******************************************************

// status of edge
template <typename X>
struct Edge{
  int from;
  int to;
  X cost;

  Edge() = default;

  Edge(int from, int to, X cost) : from(from), to(to), cost(cost) {}

  bool operator != (const Edge& r) const {
    return !(*this == r);
  }

  bool operator < (const Edge& r) const {
    return to < r.to;
  }

  bool operator > (const Edge& r) const {
    return to > r.to;
  }
  
};

//status of node
template <typename X>
struct Node{
  int idx;
  int par;
  X depth;
  vector<Edge<X>> edge;
  
  Node() = default;

  explicit Node(int idx) : idx(idx) {
  }
  
};

// tree
template <typename X>
class Tree{
private:
  int n; // number of node
  vector<Node<X>> node;

  void Init_Node() {
    rep(i,n) node.emplace_back(i);    
  }
  
public:
  Tree() = default;

  explicit Tree(int n) : n(n) {
    Init_Node();
  }

  // no-weight
  Tree(int n, vector<int> a, vector<int> b) : n(n) {
    Init_Node();
    rep(i,n-1) {
      add_edge(a[i], b[i]);
      add_edge(b[i], a[i]);  // indirected edge
    }
  }

  Tree(int n, vector<int> a, vector<int> b, vector<X> c) : n(n) {
    Init_Node();
    rep(i,n-1) {
      add_edge(a[i], b[i], c[i]);
      add_edge(b[i], a[i], c[i]);  // indirected edge
    }
  }  

  void add_edge(int from, int to, X cost = 1) {
    node[from].edge.emplace_back(from, to, cost);
  }

  void DFS_Init(int v, int p, int d) {
    node[v].par = p;
    node[v].depth = d;
    for(auto next: node[v].edge) {
      int w = next.to;
      X cost = next.cost;
      if(w == p) continue;
      DFS_Init(w, v, d + cost);
    }
  }

  // make rooted tree
  void Make_root(int root) {
    DFS_Init(root, -1, 0);
  }

  void Solve() {
    rep(v,n) {
      sort(node[v].edge.begin(), node[v].edge.end());
    }
    ll res = 0;
    ll sum = 0;
    for (int v = n - 1; v >= 0; --v) {
      bool f = true;
      ll tmp = sum + 1;
      for(auto next: node[v].edge) {
	int w = next.to;
	if(w > v) {
	  if(f) {
	    tmp += w - v - 1;
	    f = false;
	  }
	  else {
	    tmp -= n - w;
	  }
	}
      }
      if(f) tmp += n - v - 1;
      sum = tmp;
      res += tmp;
    }
    cout << res << "\n";
  }

  
};

int main()
{
  int n; cin >> n;
  vector<int> u(n-1), v(n-1);
  rep(i,n-1) {
    cin >> u[i] >> v[i];
    u[i]--; v[i]--;
  }
  Tree<int> tr(n, u, v);
  tr.Solve();
  
  return 0;
}


Measured memory_bytes: 22824
#include <bits/stdc++.h>
#define INF 100100100
#define MOD 1000000007

using namespace std;
using ll = long long;
using ull = unsigned long long ;

#define FOR(i,n) for(ll i=0;i<n;i++)

int main(int argc, char const* argv[]){
   ios::sync_with_stdio(false);
   cin.tie(0); 
   ull N,M;
   cin >> N >> M;
   ull ans = 0;
   if(2.*N >= 1.*M){
      cout << M/2 << endl;
      return 0;
   }
   ans += N;
   ans += (M-2*N)/4;
   cout << ans << endl;
   return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef unsigned long long ull;
int b=67280421310721,n,a,c;
ull ans;
map<ull,ull>m;
vector<int>v[100009];
ull dfs(int x){
  ull res=1;
  r(i,v[x].size()) res+=dfs(v[x][i]);
  res*=b;
  ans+=m[res]++;
  return res;
}
signed main(){b=21387612863821;
  cin>>n;
  r(i,n-1){
    cin>>a>>c;
    v[a].push_back(c);
  }
  dfs(1);
  cout<<ans<<endl;
}


Measured memory_bytes: 21128
import math

N = int(input())

count = 0

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr
    
soinsu = factorization(N)

def sosu(n):
  if n != 1:
    for i in range(2, int(pow(n, 0.5)) + 1, 1):
      if n % i != 0:
        pass
      else:
  	    break
    else:
      return 1
  	
  return 0

for i in soinsu:
  num = 1
  if sosu(i[0]):
    while 1:
      #print(soinsu, i)
      if i[1] - num >= 0:
        i[1] -= num
        num += 1
        count += 1
      else:
  	    break
  	  
print(count)

Measured memory_bytes: 9508
#include <stdio.h>
int main(void)
{
  int n,i,j,k,l[101],count = 0;
  scanf("%d",&n);
  for(i = 1 ; i <= n ; i++)
  {
    scanf("%d",&l[i]);
  }
  for(i = 1 ; i <= n-2 ; i++)
  {
    for(j = i+1 ; j <= n-1 ; j++)
    {
      for(k = j+1 ; k <= n ; k++)
      {
        if(l[i] != l[j] && l[j] != l[k] && l[k] != l[i])
        {
          if(l[i] + l[j] > l[k] && l[i] + l[k] > l[j] && l[k] + l[j] > l[i])
          {
            count++;
          }
        }
      }
    }
  }
  printf("%d\n",count);
  return 0;
}

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

typedef long long LL;

int gcd(int a, int b)
{
    int i=min(a, b);
    for(; i>=1; --i)
        if( !(a%i)&&!(b%i) )
            break;
    return i;
}
int main()
{
    int i, j, k, n, sum=0, gij;

    ios::sync_with_stdio(false);
    cin>>n;

    for(i=1; i<=n; ++i)
    for(j=1; j<=n; ++j){
        gij = gcd(i, j);
        for(k=1; k<=n; ++k)
            sum += gcd(gij, k);
    }
    cout<<sum;

    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
#include <vector>
  using namespace std;
   
  #define ff              first
  #define ss              second
  #define ll             long long
  #define pb              push_back
  #define mp              make_pair
  #define pii             pair<int,int>
  #define vi              vector<int>
  #define mii             map<int,int>
  #define pqb             priority_queue<int>
  #define pqs             priority_queue<int,vi,greater<int> >
  #define setbits(x)      __builtin_popcountll(x)
  #define zrobits(x)      __builtin_ctzll(x)
  #define mod             1000000007
  #define inf             1e18
  #define ps(x,y)         fixed<<setprecision(y)<<x
  #define mk(arr,n,type)  type *arr=new type[n];
  #define w(x)            int x; cin>>x; while(x--)
   


   
  long long d[1000010];
  int main()
  {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    for(int i = 1;i<=5;i++){
      int n;
      cin >> n;
      if(n==0){
        cout << i;
        return 0;
      }
    }
}
    

  	
      
      	


    


Measured memory_bytes: 3568
import math
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=[a%10,b%10,c%10,d%10,e%10]
g=[]
if len(f)-f.count(0)==0:
    print(10*math.ceil(a/10)+10*math.ceil(b/10)+10*math.ceil(c/10)+10*math.ceil(d/10)+10*math.ceil(e/10))
else:
    for i in f:
        if i >0:
            g.append(i)
    print(10*math.ceil(a/10)+10*math.ceil(b/10)+10*math.ceil(c/10)+10*math.ceil(d/10)+10*math.ceil(e/10)-10+min(g))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 2e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n, k;
    cin >> n >> k;
    int h[n];
    rep(i, 0, n) cin >> h[i];

    vector<int> dp(n + 1000, INF);
    dp[0] = 0;
    rep(i, 0, n) {
        rep(j, 1, k + 1) {
            dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
        }
    }
    cout << dp[n - 1] << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(int)(m);(i)<(int)(n);++(i))
#define rREP(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 1000000001;
constexpr ll mod = 1000000007;
constexpr double PI = 3.1415926535897932;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N; cin >> N;
	vector<int>vec(N);
	rep(i, 0, N)cin >> vec[i];
	int ans = 0;
	rep(i, 0, N) {
		int x = vec[i];
		bool ok = true;
		for (int j = 2;j * j <= x;++j) {
			if (x % j == 0)ok = false;
		}
		if (ok)++ans;
	}
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3184
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n; cin>>n;
	cout<<(n*n*n)<<endl;
	return 0;
}


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

using namespace std;

int main()
{
//    freopen("in.txt","r",stdin);

    int n,x;
    int a[110][110];
    int col[110];
    int row[110];
    while(cin>>n>>x)
    {
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<x;j++)
            {
                cin>>a[i][j];
                col[i]+=a[i][j];
                row[j]+=a[i][j];
            }
        }
        int sum=0;
        for(int i=0;i<n;i++)
            sum+=col[i];

        for(int i=0;i<n;i++)
        {
            for(int j=0;j<x;j++)
            {
                cout<<a[i][j]<<" ";
                if(j==x-1)
                    cout<<col[i];
            }
            cout<<endl;
        }
        for(int i=0;i<x;i++)
            cout<<row[i]<<" ";
        cout<<sum<<endl;
    }
}



Measured memory_bytes: 3144
// ========================================================================================================
// Library
// ========================================================================================================
#define _CRT_SECURE_NO_WARNINGS

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

// competitive macro
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i ,n) for (int i = (n) - 1; i >= 0; i--)
#define LL long long
#define ULL unsigned long long

void fastIOS()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}
// ========================================================================================================
// ========================================================================================================

int main()
{
	fastIOS();

	LL h; cin >> h;
    LL cnt = 0;
    while(h)
    {
        cnt++;
        h /= 2;
    }
    
    cout << (1ll << cnt) - 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#define LL long long
using namespace std;
LL get(LL x){
    LL ans=0;
    while (x){ans+=x%10;x/=10;}
    return ans;
}
int main() {
    LL k;
    scanf("%lld",&k);
    LL x=1,p=1;
    while (k--){
        printf("%lld\n",x);
        LL nx1=x+p;
        LL nx2=x+10*p;
        if (nx1*get(nx2)<=nx2*get(nx1)) x = nx1;
        else {x=nx2;p*=10;}
    }
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#define re register
using namespace std;

inline int read() {
    int X=0,w=1; char c=getchar();
    while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
    while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
    return X*w;
}

const int N=2000+10;

struct Edge { int v,nxt; } e[N];
int head[N];

inline void addEdge(int u,int v) {
    static int cnt=0;
    e[++cnt]=(Edge){v,head[u]},head[u]=cnt;
}

int n;
int a[N],vis[N],deg[N];
int G[N][N];

inline void dfs(int u) {
    vis[u]=1;
    for (re int i=1;i<=n;++i) {
        if (vis[i]||!G[u][i]) continue;
        ++deg[i],addEdge(u,i);
        dfs(i);
    }
}

inline void topsort() {
    priority_queue<int> Q;
    for (re int i=1;i<=n;++i)
        if (!deg[i]) Q.push(i);
    while (!Q.empty()) {
        int u=Q.top(); Q.pop();
        printf("%d ",a[u]);
        for (re int i=head[u];i;i=e[i].nxt) Q.push(e[i].v);
    }
}

int main() {
    n=read();
    for (re int i=1;i<=n;++i) a[i]=read();
    sort(a+1,a+n+1);
    for (re int i=1;i<=n;++i)
        for (re int j=i+1;j<=n;++j) {
            if (__gcd(a[i],a[j])==1) continue;
            G[i][j]=G[j][i]=1;
        }
    for (re int i=1;i<=n;++i)
        if (!vis[i]) dfs(i);
    topsort();
    return 0;
}

Measured memory_bytes: 16128
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const int maxn = 3e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;

int a[maxn];

int main() {
    int n=read(), m=read();
    int s=0;
    for(int i=1; i<=n; ++i) a[i]=read(), s+=a[i];
    sort(a+1,a+1+n,greater<int>());
    if(ll(4)*m*a[m]>=s) printf("Yes\n");
    else printf("No\n");
}

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

using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;

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

int main() {
  ll n, x;
  cin >> n >> x;
  vector<ll> a;
	ll r = 0;
  for (int i = 0; i < n; i++) {
		ll v;
    cin >> v;
		r = gcd(r, abs(v - x));
  }
	cout << r << endl;
}


Measured memory_bytes: 3636
#include<cstdio>
#include<cstdlib>

struct Node{
	int key;
	Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int k)
{
	Node *y = NIL;
	Node *x = root;
	Node *z = (Node *)malloc(sizeof(Node));
	z->key = k;

	while(x != NIL)
	{
		y = x;
		if(z->key < x->key)
			x = x->left;
		else
			x = x->right;
	}

	z->parent = y;
	if(y == NIL)
		root = z;
	else
	{
		if(z->key < y->key)
			y->left = z;
		else
			y->right = z;
	}
}

bool find(int k)
{
	Node *x = root;
	while(x != NIL)
	{
		if(k < x->key)
			x = x->left;
		else if(k == x->key)
			return true;
		else
			x = x->right;
	}

	return false;
}

void Inorder(Node *u)
{
	if(u == NIL) return;

	Inorder(u->left);
	printf(" %d", u->key);
	Inorder(u->right);
}

void Preorder(Node *u)
{
	if(u == NIL) return;

	printf(" %d", u->key);
	Preorder(u->left);
	Preorder(u->right);
}

int main()
{
	int n;
	char s[10];
	int x;
	scanf("%d", &n);
	for(int i=0; i<n; i++)
	{
		scanf("%s", s);
		if(s[0] == 'i')
		{
			scanf("%d", &x);
			insert(x);
		}
		else if(s[0] == 'p')
		{
			Inorder(root);
			printf("\n");
			Preorder(root);
			printf("\n");
		}
		else{
			scanf("%d", &x);
			if(find(x))
				printf("yes\n");
			else
				printf("no\n");
		}
	}

	return 0;

}


Measured memory_bytes: 21516
/* 
    Reverse the problem: Imagine we have stick of length N and are told to cut it in the specified places
*/
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <bitset>
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
 
#define LSOne(S) (S & (-S))
#define EPS 1e-9
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pd;
typedef tree<pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
 

int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0); // BEFORE SUBMIT DON'T FORGET TO UNCOMMENT THIS
    int n;
    cin >> n;
    vector<int> vec(n+5);
    for(int i = 1; i <= n; ++i) cin >> vec[i];
    vector<ll> psum(n+5);
    for(int i = 1; i <= n; ++i) psum[i] = vec[i] + psum[i-1];

    vector<vector<ll>> dp(n+5, vector<ll>(n+5, 1e15L));
    // Base case
    for(int i = 1; i <= n; ++i) dp[i][i] = 0;

    for(int len = 1; len <= n; ++len)
    {
        for(int left = 1; left+len-1 <= n; ++left)
        {
            int right = left+len-1;
            for(int cut = left; cut < right; ++cut)
            {
                ll sumLeft = psum[cut] - psum[left-1];
                ll sumRight = psum[right] - psum[cut];
                dp[left][right] = min(dp[left][right], sumLeft + sumRight + dp[left][cut] + dp[cut+1][right]);
            }
        }
    }
    cout << dp[1][n] << "\n";
    return 0; 
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[100000];
    gets(a);
    for(int i=0;i<strlen(a);i++)
    {
        if(a[i]=='C')
        {
            for(int j=i+1;j<strlen(a);j++)
            {
                if(a[j]=='F')
                {
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
int n,m,i,s=0;
cin>>n>>m;
vector<int> A(m);
for(i=0;i<m;i++)
{
cin>>A[i];
s+=A[i];
}
if(n<s)
cout<<"-1"<<endl;
else
cout<<n-s<<endl;
}

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

using namespace std;

int main() {
  int N, K;
  cin >> N >> K;

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

  map<int, int> m;
  for (int i = 0; i < N; i++) {
    m[a[i]]++;
  }

  if (K >= m.size()) {
    cout << 0 << endl;
    return 0;
  }

  vector<pair<int,int> > vec(m.size());
  int num = 0;
  for( auto i = m.begin(); i != m.end() ; ++i ) {
    vec[num] = {i->second, i->first};
    num++;
  }
  sort(vec.begin(), vec.end());

  int sum = 0;
  for (int i = 0; i < m.size() - K; i++) {
    sum += vec[i].first;
  }

  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
template<class T> struct rge { T b, e; };
template<class T> rge<T> range(T i, T j) { return rge<T>{i, j}; }
struct debug {
#ifdef LOCAL
	~debug(){cerr<<endl;}
	template<class T> debug& operator<<(T x){cerr<<boolalpha<<x; return *this;}
	template<class B, class C> debug& operator<<(pair<B, C> x){return *this<<"("<<x.first<<", "<<x.second<<")";}
	template<class T> debug& operator<<(rge<T> x){*this<<"[";for(auto it=x.b;it!=x.e;it++){*this<<", "+2*(it==x.b)<<*it;}return *this<<"]";}
	template<class T> debug& operator<<(vector<T> x){ return *this<<range(x.begin(),x.end());}
#else
	template<class T> debug& operator <<(const T&){return *this;}
#endif
};
#define nav(...) << "[ " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " ] "
using ll = long long;


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

    int n, k;
    cin >> n >> k;
    vector<int> none(n, 1);
    for(int i = 0; i < k; i++) {
        int m;
        cin >> m;
        for(int j = 0; j < m; j++) {
            int x;
            cin >> x;
            none[--x] = 0;
        }
    }
    
    int ans = 0;
    for(int x : none) {
        ans += x;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(){
int n,b[10],f,i;
while(cin>>n){
for(i=0;i<10;i++){b[i]=n%2;n/=2;}
for(f=0,n=1,i=0;i<10;i++){
if(b[i]==1){
if(f==0){cout<<n;f=1;}
else cout<<" "<<n;
}
n*=2;
}
cout<<endl;
}
return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int> >
#define mp make_pair
#define all(v) (v).begin(),(v).end()
using namespace std;
int gcd(int x,int y){
    return y?gcd(y,x%y):x;
}

signed main(){
    string s,t;
    cin>>s>>t;
    rep(i,s.length()){
        if(s.substr(i,s.length()-i)+s.substr(0,i)==t){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
package main
import "fmt"
func main() {
  var p []int = num(100000)
  var q,l,r int
  fmt.Scan(&q)
  for i:=0;i<q;i++ {
    fmt.Scan(&l,&r)
    if l == 1 { l = 2 }
    fmt.Println(p[r-1]-p[l-2])
  }
}
func num(n int) []int {
  var m []int = make([]int,n)
  for i:=0;i<n;i++ {
    m[i] = i+1
  }
  m[0] = -1
  for i:=1;i<n;i++ {
    if m[i] < 0 { continue }
    for j:=i+m[i];j<n;j+=m[i] {
      m[j] = -1
    }
  }
  var p []int = make([]int,n)
  for i:=1;i<n;i++ {
    p[i] = p[i-1]
    if m[i] < 0 { continue }
    if m[(m[i]+1)/2-1] < 0 { continue }
    p[i]++
  }
  return p
}

Measured memory_bytes: 5888
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;

bool vis[N];

int main()
{
    int t=1,te=0;
    //Int(t);
    while(t--){
        int x,n,xx;
        Int(x,n);

        for(int i=1;i<=n;++i){
            Int(xx);
            vis[xx]=true;
        }     
        int mi=INT_MAX,ans;
        for(int i=-1;i<=101;++i){
            if(!vis[i] and abs(x-i)<mi){
                mi=abs(x-i);
                ans=i;
            }
        }
        printf("%d\n", ans);

        //printf("Case %d: ",++te);
    }
    return 0;
}






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

typedef long long int ll;

int main()
{
    ll n;
    cin >> n;
    vector<tuple<ll,ll,bool>> a(n);
    for(ll i = 0;i < n;i++){
        cin >> get<0>(a[i]);
        get<2>(a[i]) = true;
    }

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

    ll cnt = get<0>(a[0]);
    get<1>(a[0]) = cnt;
    for(ll i = 1;i < n;i++){
        cnt += get<0>(a[i]);
        get<1>(a[i]) = cnt;
    }
    for(ll i = n - 1;i >= 1;i--){
        //cout << get<0>(a[i]) <<" "<< get<1>(a[i - 1])*2;
        if(get<0>(a[i]) <= get<1>(a[i - 1]) * 2){
        }
        else{
            get<2>(a[i - 1]) = false;
        }
    }

    ll ans = 0;
    for(ll i = n - 1;i >= 0;i--){
        if(get<2>(a[i]) == false){
            break;
        }
        ans++;
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
int calc(int n) {
    int ret=0;
    while(n%100==0) {
        n/=100;
        ++ret;
    }
    return ret;
}
int main() {
    int d, n;
    cin >> d >> n;
    int cnt=0, ans=0;
    int i=0;
    while(cnt<n) {
        ++i;
        if(calc(i)==d) ++cnt;
        if(cnt==n) {
            ans=i;
            break;
        }
    }
    cout << ans << endl;
    
}
    


Measured memory_bytes: 256
N, M = map(int, input().split())

ac = 0
wa = 0

penaltyTemp = [0] * (N + 1)
Correct  = [0] * (N + 1)

for i in range(M):
    tp, S = input().split()
    P = int(tp)
    if Correct[P] == 1:
        continue
    if S == "WA":
        penaltyTemp[P] += 1
    else:
        ac += 1
        wa += penaltyTemp[P]
        Correct[P] += 1

print(ac, wa)

Measured memory_bytes: 4596
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
//#define ls x<<1
//#define rs x<<1|1
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-8;
const ull hashp=131;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=11092019;
const int maxn=1e5+100;
char s[maxn];
void solve(){
	int k;scd(k);
	scanf("%s",s+1);
	int n=strlen(s+1);
	rep1(i,min(n,k))printf("%c",s[i]);
	if(n>k)printf("...");
}
int main(){
    //IOS;
    //freopen("D:\\data.txt","r",stdin);
    //freopen("D:\\out.txt","w",stdout);
    solve();

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	;;                                             ;;
	;;         ;;            ;;;;;;;;;       ;;    ;;
	;;        ;; ;;        ;;                ;;    ;;
	;;       ;;   ;;       ;;                ;;    ;;
	;;      ;;;;;;;;;      ;;                ;;    ;;
	;;     ;;       ;;     ;;                      ;;
    ;;    ;;         ;;      ;;;;;;;;;       ;;    ;;
    ;;                                             ;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    return 0;
}

Measured memory_bytes: 3152
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static long mainVertex;
static long n = long.Parse(Console.ReadLine());
static long[] howlong = new long[n];//頂点kからの距離
static List<long>[] nextList = new List<long>[n];//隣接リスト（リストの入った配列）

	static void Main()
	{
    for(int i = 0; i < n; i++) howlong[i] = -1;
    for(int i = 0; i < n; i++) nextList[i] = new List<long>();
    for(int i = 0; i < n-1; i++)
    {
    long[] nums = Array.ConvertAll(Console.ReadLine().Split(' '),long.Parse);//１行ごとに受け取る
    nextList[nums[0]-1].Add(nums[1]-1);//隣接リストへ追加。第2成分は距離。
    nextList[nums[0]-1].Add(nums[2]);
    nextList[nums[1]-1].Add(nums[0]-1);
    nextList[nums[1]-1].Add(nums[2]);
    }

    string[] inputSub = Console.ReadLine().Split(' ');
	  long q = long.Parse(inputSub[0]);
	  long k = long.Parse(inputSub[1]);
    k--;
    mainVertex = k;
    howlong[k] = 0;
    Length(k,0);//頂点kの、頂点kからの距離は０
    for(int i = 0; i < q; i++)
    {
    string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
    long xx = long.Parse(input[0]);
    long yy = long.Parse(input[1]);
    Console.WriteLine(howlong[xx-1]+howlong[yy-1]);
    }
	
	}

  static void Length(long vertexNum, long length)//頂点番号と、頂点kからの距離
  {
    for(int i = 0; i < nextList[vertexNum].Count(); i+=2)
    {
      long x = howlong[nextList[vertexNum][i]];
      long y = nextList[vertexNum][i+1];
      if(x == -1)
      {
        howlong[nextList[vertexNum][i]] = y + length;
        Length(nextList[vertexNum][i],howlong[nextList[vertexNum][i]]);
      }
    }
  }
  
}

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

int main(){
  int N, K, p[1000], sum;
  std::cin >> N >> K;
  for (int i = 0; i < N; i++) {
    std::cin >> p[i];
  }
  std::sort(p, p + N);
  std::cout << std::accumulate(p,p + K, 0) << std::endl;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <cmath>
using namespace std;
int N, P[10], Q[10]; bool used[10];
int dfs(int* X, int n, bool ok) {
    if(n > N) return 1;
    int cnt = 0;
    for(int i = 1; i <= N; ++i) {
        if(used[i]) continue;
        bool same = (ok && X[n] == i);
        used[i] = true;
        cnt += dfs(X, n+1, same);
        used[i] = false;
        if(same) break;
    }
    return cnt;
}
int main() {
  scanf("%d", &N);
  for(int i = 1; i <= N; ++i) scanf("%d", &P[i]);
  for(int i = 1; i <= N; ++i) scanf("%d", &Q[i]);
  int a = dfs(P, 1, true), b = dfs(Q, 1, true);
  printf("%d\n", (int) abs(a-b));
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

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

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
    long long x;
public:
    mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
    mint operator-() const {
        return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD - 2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res /= a;
    }

    friend ostream& operator<<(ostream& os, const mint& m) {
        os << m.x;
        return os;
    }
};

///////////////////////////

ll light(ll a, ll b) {
    if (a < b) { return light(b, a); }
    if (a % b == 0) { return b * (2 * a / b - 1); }

    return light(b, a % b) + 2 * (a / b) * b;
}


int main() {
    ll N, X;
    cin >> N >> X;

    cout << light(X, N - X) + N;
	
	system("PAUSE");
}


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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")

int main()
{
int N, K;
	cin >> N >> K;
	vec(A);
	fx(N) {
		vecp(A);
	}

	for (int x = 0; x + K < N;x++) {
		if (A[x]<A[x+K]) {
			cey;
		}
		else {
			cen;
		}
	}
    return 0;
}



Measured memory_bytes: 4316
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rrep(i, n) for(int i = n-1; i >= 0; --i)
#define fi first
#define se second
using namespace std;
using lint = long long;
using uint = unsigned int;
using ulint = unsigned long long;
using ldouble = long double;
using pii = pair<int, int>;
using pli = pair<lint, lint>;
using pdd = pair<double, double>;
using pld = pair<ldouble, ldouble>;
using v1i = vector<int>;
using v1li = vector<lint>;
using v2i = vector<vector<int>>;
using v2li = vector<vector<lint>>;
using v3i = vector<vector<vector<int>>>;
using v3li = vector<vector<vector<lint>>>;
using v1b = vector<bool>;
using v2b = vector<vector<bool>>;
using v3b = vector<vector<vector<bool>>>;
using v1c = vector<char>;
using v2c = vector<vector<char>>;
using v3c = vector<vector<vector<char>>>;
constexpr lint mod1 = 1e9+7;
constexpr lint mod2 = 998244353;

lint gyaku(lint a, lint mod){
  lint s = 1, tmp = a, t = mod - 2;
  while(t > 0){
    if(t % 2 == 1){
      s *= tmp;
      s %= mod;
    }
    t /= 2;
    tmp *= tmp;
    tmp %= mod;
  }
  return s;
}

int main() {
  lint n, k;
  cin >> n >> k;
  rep(i, k){
    lint s = 0;
    if(i < n-k+1 && i < k){
      s = 1;
      rep(j, i){
        s *= k-1-j;
        s %= mod1;
        s *= gyaku(j+1, mod1);
        s %= mod1;
      }
      rep(j, i+1){
        s *= n-k+1-j;
        s %= mod1;
        s *= gyaku(j+1, mod1);
        s %= mod1;
      }
    }
    cout << s << endl;
  }
  return 0;
}

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

#define MOD_1000000007 (1000000007LL)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)

using std::cerr;
using std::cout;
using std::endl;
using std::make_pair;
using std::map;
using std::pair;
using std::priority_queue;
using std::set;
using std::string;
using std::vector;
typedef long long ll;

struct DisjointSet {
  std::map<int, int> parent, rank, num;
  int groupSize = 0;

  void makeSet(int x) {
    parent[x] = x;
    rank[x] = 0;
    num[x] = 1;
    groupSize++;
  }

  bool same(int x, int y) {
    return findSet(x) == findSet(y);
  }

  void unite(int x, int y) {
    link(findSet(x), findSet(y));
  }

  void link(int x, int y) {
    if(rank[x] < rank[y]) {
      parent[x] = y;
      num[y] += num[x];
    } else {
      parent[y] = x;
      num[x] += num[y];
      if(rank[x] == rank[y]) rank[x]++;
    }
    groupSize--;
  }

  int numberOf(int x) {
    return num[findSet(x)];
  }

  int findSet(int x) {
    if(x == parent[x]) return x;
    else return parent[x] = findSet(parent[x]);
  }
};

int N, M;
DisjointSet ds;

int main() {
  scanf("%d %d", &N, &M);
  rep(i, N) ds.makeSet(i);
  rep(i, M) {
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    --x;
    --y;
    if(!ds.same(x, y)) ds.unite(x, y);
  }
  cout << ds.groupSize << endl;
  return 0;
}

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

int main() {
	string s; cin >> s;
  	if (s=="SUN") cout << "7\n";
  	else if (s=="MON") cout << "6\n";
  	else if (s=="TUE") cout << "5\n";
  	else if (s=="WED") cout << "4\n";
  	else if (s=="THU") cout << "3\n";
  	else if (s=="FRI") cout << "2\n";
  	else if (s=="SAT") cout << "1\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main() {
    int K, T; cin >> K >> T;

    int m = 0;
    REP(i, 0, T) {
        int a; cin >> a;
        m = max(m, a);
    }

    int other = K - m;
    if (other >= m) {
        cout << 0 << endl;
    } else {
        cout << m - other - 1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
double dp[3001][3001],a[3001],Ans;
int main()
{
    cin >> n;
    for(int i=1; i<=n; i++)
        cin >> a[i];
    dp[0][0] = 1;
    for(int i=1; i<=n; i++)
    {
        for(int j=0; j<=n; j++)
        {
            if(j > i) break;
            if(!j) dp[i][j] = dp[i-1][j] * (1 - a[i]);
            else dp[i][j] = dp[i-1][j-1] * a[i] + dp[i-1][j] * (1 - a[i]);
        }
    }
    for(int i=n/2+1; i<=n; i++) Ans += dp[n][i];
    cout << setprecision(10) << Ans;
}

Measured memory_bytes: 68992
x, k, d = map(int,input().split())
max_length = k * d
xx = abs(x)
answer = 0
if xx >= max_length:
    answer = xx - max_length
else:
    if (k - xx // d) % 2 == 0:
        answer = xx - xx // d * d
    else:
        answer = xx - (xx // d + 1) * d
print(abs(answer))

Measured memory_bytes: 9152
#define _DEBUG 1
#define _GLIBCXX_DEBUG

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

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                         \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#define rep(i, n) for (ll i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

void solve(ll N) {
  ll v = (ll)sqrt(N);
  cout << v * v << endl;
}

int main() {
  ll N;
  scanf("%lld", &N);
  solve(N);
  return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *AB = map(int, read().split())
    G = [[] for _ in range(N)]
    for a, b in zip(AB[::2], AB[1::2]):
        G[a - 1].append(b - 1)
        G[b - 1].append(a - 1)

    COM_MAX = K

    fac, finv, inv = [0] * (COM_MAX + 1), [0] * (COM_MAX + 1), [0] * (COM_MAX + 1)
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1

    for i in range(2, COM_MAX + 1):
        fac[i] = fac[i - 1] * i % MOD
        inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
        finv[i] = finv[i - 1] * inv[i] % MOD

    def mod_perm(n, r):
        if n < r:
            return 0
        if n < 0 or r < 0:
            return 0
        return fac[n] * (finv[n - r] % MOD) % MOD

    stack = deque([0])
    order = []
    parent = [-1] * N
    while stack:
        v = stack.pop()
        order.append(v)
        for nv in G[v]:
            if nv != parent[v]:
                stack.append(nv)
                parent[nv] = v

    A = [0] * N
    for v in reversed(order):
        tmp = 1
        child = 0
        for nv in G[v]:
            if nv != parent[v]:
                tmp = tmp * A[nv] % MOD
                child += 1

        colors = K if v == 0 else K - 2
        nodes = child + 1 if v == 0 else child

        A[v] = tmp * mod_perm(colors, nodes) % MOD

    print(A[0])
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 50124
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
using namespace std;
typedef long long ll;

int main()
{
  int w,a,b;
  int res=0;
  cin >> w>>a>>b;

  if(a+w<b) res=max(0,b-(a+w));
  else if(b+w<a) res=max(0, a-(b+w));

  cout << res << endl;
}

Measured memory_bytes: 256
a = 1

n, m = map(int, input().split())
ans_r = 10 ** 5

l_list = []
r_list = []
for i in range(m):
    l, r = map(int, input().split())
    l_list.append(int(l))
    r_list.append(int(r))
for r in r_list:
    if ans_r > r:
        ans_r = r
for l in l_list:
    if a < l:
        a = l

if ans_r >= a:
    print(ans_r - a + 1)
else:
    print(0)


Measured memory_bytes: 10996
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  int c = a * b;
  if (c % 2 == 0) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
N, W = map(int, input().split())
goods = [list(map(int, input().split())) for i in range(N)]
v_sum = sum([i[0] for i in goods])
dp = [float("inf") for i in range(v_sum+1)]
dp[0] = 0
for i in range(N):
    for j in range(v_sum, -1, -1):
        dp[j] = min(dp[j-goods[i][0]]+goods[i][1], dp[j])
for i in range(v_sum,-1,-1):
    if dp[i] <= W:
        print(i)
        break


Measured memory_bytes: 5900
#include<bits/stdc++.h>
#define taskname "A"
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
const int maxn = 1e2 + 5;

int n;
ii a[maxn] , b[maxn];
int match[maxn];
vector<int> unmatch;
int lv[maxn];
vector<int> adj[maxn];

bool BFS(){
    fill_n(lv,maxn,0);
    queue<int> q;
    for(int x : unmatch){
        for(int y : adj[x]){
            if(lv[y] == 0){
                lv[y] = 1;
                q.push(y);
            }
        }
    }
    while(q.size()){
        int y = q.front();q.pop();
        int x = match[y];
        if(x == -1)return 1;
        for(int c : adj[x]){
            if(lv[c] == 0){
                lv[c] = lv[y] + 1;
                q.push(c);
            }
        }
    }
    return 0;
}
int found = 0;
void DFS(int x , int level){
    for(int y : adj[x]){
        if(lv[y] == level + 1){
            if(match[y] == -1)found = 1;
            else DFS(match[y] , level + 1);
            if(found){
                match[y] = x;
                return;
            }
        }
    }
}
int main(){
    if(fopen(taskname".INP","r")){
        freopen(taskname".INP","r",stdin);
        freopen(taskname".OUT","w",stdout);
    }
    cin >> n;
    for(int i = 1 ; i <= n ; ++i){
        cin >> a[i].first >> a[i].second;
    }
    for(int i = 1 ; i <= n ; ++i){
        cin >> b[i].first >> b[i].second;
    }
    fill_n(match,maxn,-1);
    for(int i = 1 ; i <= n ; ++i){
        unmatch.pb(i);
        for(int j = 1 ; j <= n ; ++j){
            if(a[i].first < b[j].first && a[i].second < b[j].second){
                adj[i].pb(j);
            }
        }
    }
    int sz = 0;
    while(BFS()){
        for(int i = unmatch.size() - 1 ; i >= 0 ; --i){
            found = 0;
            DFS(unmatch[i] , 0);
            if(found){
                unmatch[i] = unmatch.back();
                unmatch.pop_back();
            }
            sz += found;
        }
    }
    cout << sz;
}



Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		if( s.equals("AAA") || s.equals("BBB") ){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int INF = 1LL << 60;

signed main(){

  int n, k; cin >> n >> k;
  vector<int> a(n);
  int sum = 0;
  for(int i = 0; i < n; i++){
    cin >> a[i];
    sum += a[i];
  }

  vector<int> vec;
  for(int i = 1; i <= sqrt(sum); i++){
    if(sum % i == 0){
      vec.push_back(i);
      vec.push_back(sum / i);
    }
  }

  int ans = 0;
  for(int p : vec){
    auto v = a;
    for(int i = 0; i < n; i++){
      v[i] = a[i] % p;
    }
    sort(v.begin(),v.end());
    vector<int> left(n+1, v[0]), right(n+1, 0);
    for(int i = 1; i < n; i++){
      left[i] = left[i-1] + v[i];
    }
    for(int i = n-1; i >= 0; i--){
      right[i] = right[i+1] + p - v[i];
    }
    for(int i = 1; i <= n; i++){
      int res = max(left[i-1], right[i]);
      if(res <= k) ans = max(ans, p);
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256