akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=16000+7;
const int var=8000;
bool dpx[2][maxn],dpy[2][maxn];
int main()
{
    string s;
    cin>>s;
    int x,y;
    cin>>x>>y;
    int p=0;
    int cx=0;
    while(p<s.length()&&s[p]=='F')
    {
        cx++;
        p++;
    }
    p++;
    dpx[0][cx+var]=1;
    dpy[0][var]=1;
    int curx=0,cury=0;
    vi X,Y;
    cx=0;
    int f=1;
    int n=s.length();
    s+='T';
    while(p<s.length())
    {
        if(s[p]=='T')
        {
            if(cx)
            {
                if(f) Y.push_back(cx);
                else X.push_back(cx);
                cx=0;
            }
            f^=1;
        }
        else
            cx++;
        p++;
    }
    //dbg(X,Y);
    for(auto u:X)
    {
        for(int i=0;i<maxn;i++)
        {
            dpx[curx^1][i]=0;
            dpx[curx^1][i]=(i+u<maxn?dpx[curx][i+u]:0)|(i-u>=0?dpx[curx][i-u]:0);
        }
        curx^=1;
    }
    for(auto u:Y)
    {
        for(int i=0;i<maxn;i++)
        {
            dpy[cury^1][i]=0;
            dpy[cury^1][i]=(i+u<maxn?dpy[cury][i+u]:0)|(i-u>=0?dpy[cury][i-u]:0);
        }
        cury^=1;
    }
    if(dpx[curx][var+x]&&dpy[cury][var+y]) cout<<"Yes\n";
    else cout<<"No\n";

}

Measured memory_bytes: 384
import sys
input = sys.stdin.buffer.readline
from collections import deque

def main():
    N,u,v = map(int,input().split())
    con = [[] for _ in range(N)]
    for _ in range(N-1):
        a,b = map(int,input().split())
        con[a-1].append(b-1)
        con[b-1].append(a-1)

    aq = deque([v-1])
    adist = [0 for _ in range(N)]
    edge = []
    go = [True for _ in range(N)]
    go[v-1] = False
    while aq:
        now = aq.pop()
        for fol in con[now]:
            if go[fol]:
                adist[fol] = adist[now] + 1
                go[fol] = False
                if con[fol] == [now]:
                    edge.append(fol)
                else:
                    aq.append(fol)
    
    tq = deque([u-1])
    tdist = [0 for _ in range(N)]
    _go = [True for _ in range(N)]
    _go[u-1] = False
    while tq:
        now = tq.pop()
        for fol in con[now]:
            if _go[fol]:
                tdist[fol] = tdist[now] + 1
                _go[fol] = False
                tq.append(fol)

    ans = 0
    for num in edge:
        a,t = adist[num],tdist[num]
        if a <= t:
            continue
        else:
            ans = max(ans,a-1)
                
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 31072
import java.util.Scanner;

class Main{
public static void main(String[] args){
 
Scanner scan = new Scanner(System.in);
 
int a = scan.nextInt();
int b = scan.nextInt();
 
int d,r;
double f;

d = a / b ;
r = a % b ;
f = (double)a / b;
 
System.out.printf("%d %d %.5f\n",d,r,f);

    }
}

Measured memory_bytes: 17372
#include<bits/stdc++.h>
using namespace std;
int main(void){
  long long n; cin>>n;
  long long p,q;
  for(long long i=1; i*i<=n; ++i){
    long long r=n/i;
    if(r*i==n) p=i,q=r;
  }
  cout<<p+q-2;
  return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
    if(a%b==0)
    return b;
    return gcd(b,a%b);
}
int lcm(int a,int b){
   return a*b/gcd(a,b);
}
int main(){
    int ans=0;
    string s;
    cin>>s;
    for(int i=0;i<4;i++){
        if(s.at(i)=='+')
        ans++;
        else
        ans--;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3568
#include <iostream>

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>

class EdgeInfo {
public:
  EdgeInfo(int cap): cap_(cap), orig_cap_(cap) {}

  int cap_;
  int orig_cap_;
};

class Edge {
public:
  Edge(unsigned int s, unsigned int t, EdgeInfo ei):
      s_(s), t_(t), ei_(ei) {}

  unsigned int s_, t_;
  EdgeInfo ei_;
};

// unordered graph
class Graph {
public:
  // key: to
  using Edges = std::map<unsigned int, EdgeInfo>;

  // n_v: number of verteces
  Graph(unsigned int n_v);

  // add edge
  // return true: success, false: failed
  bool add_edge(unsigned int from,
                unsigned int to,
                EdgeInfo ei);

  void show() const {
    for(auto it = edges_.begin(); it != edges_.end(); it++) {
      auto idx = std::distance(edges_.begin(), it);
      std::for_each(it->begin(), it->end(),
                    [idx](auto& item) -> void
                    {
                      std::cout << idx << ","
                                << item.first << ","
                                << item.second.cap_
                                << std::endl;
                    });
    }
  }

  // number of vertexes
  unsigned int n_v_;
  // edge information
  // Be arere edges_[i][j] results in compile error
  // because EdgeInfo default constructor is not defined.
  // Access it edges[i].at[j].
  // ([] with missing key allocate default instance).
  std::vector<Edges> edges_;
};

Graph::Graph(unsigned int n_v)
    : n_v_(n_v)
{
  edges_.resize(n_v);
}

bool Graph::add_edge(
    unsigned int from,
    unsigned int to,
    EdgeInfo ei)
{
  if(from >= n_v_ || to >= n_v_ ||
     edges_[from].find(to) != edges_[from].end()) {
    std::cout << "add_edge failed: " << from << ", " << to << std::endl;
    return false;
  }

  edges_[from].insert(std::make_pair(to, ei));
  return true;
}

int reverse(int i)
{
  return i == 0 ? 1 : 0;
}

/**
 * color -1: undef, 0 or 1
 */
void set_color_dfs(
    unsigned int s,
    const Graph &g,
    std::vector<bool> &seen,
    std::vector<int> &color)
{
  Graph::Edges edges = g.edges_[s];
  seen[s] = true;
  for(const auto &e: edges) {
    auto to = e.first;
    auto ei = e.second;

    if(seen[to]) continue;
    seen[to] = true;
    color[to] = ei.cap_ % 2 == 0 ? color[s] : reverse(color[s]);
    set_color_dfs(to, g, seen, color);
  }
}


int main()
{
  int N;
  std::cin >> N;
  Graph g(N);

  for(int i=0; i<N-1; i++) {
    unsigned int u, v, w;
    std::cin >> u >> v >> w;
    u--; v--;   // 0-origin
    g.add_edge(u, v, w);
    g.add_edge(v, u, w);
    // std::cout << "inserted " << i << "-th edges"
    //           << " u = " << u
    //           << " v = " << v
    //           << std::endl;
    // g.show();
  }

  std::vector<bool> seen(N);
  std::vector<int> color;
  color.assign(N, -1);
  color[0] = 0;
  set_color_dfs(0, g, seen, color);

  for(auto c: color) {
    std::cout << c << std::endl;
  }

  return 0;
}


Measured memory_bytes: 34172
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,Ans,a[100005],b,h[100005],ans,sum[200005],tot[100005];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	for(int i=1;i<=n-1;i++)
	{
		int l=a[i],r=a[i+1];
		if(l>r) r+=m;
		ans+=r-l;
		l+=2;
		//printf("l=%d r=%d\n",l,r);
		if(l>r) continue;
		sum[l]++,sum[r+1]-=r-l+2,sum[r+2]+=r-l+1;
	}
	for(int i=1;i<=m+m;i++) sum[i]+=sum[i-1];
	//for(int i=1;i<=m+m;i++) printf("sum(%d)=%d\n",i,sum[i]);
	for(int i=1;i<=m+m;i++) sum[i]+=sum[i-1];
	//for(int i=1;i<=m+m;i++) printf("sum(%d)=%d\n",i,sum[i]);
	for(int i=1;i<=m;i++) tot[i]=sum[i]+sum[i+m];
	Ans=ans;
	//for(int i=1;i<=m;i++) printf("tot(%d)=%d\n",i,tot[i]);
	for(int i=1;i<=m;i++) Ans=min(Ans,ans-tot[i]);
	printf("%lld\n",Ans);
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstring>
#include <fstream>
#include <numeric>
#include <algorithm>

using namespace std;

int main(int argc, char **argv) {
  int temp, b;
  for (int i = 0; i < 3; i++) {
    b <<= 1;
    cin >> temp;
    b += temp;
  }

  if (b % 2 || b == 6)
    cout << "Open" << endl;
  else
    cout << "Close" << endl;
  return 0;
}

Measured memory_bytes: 1156
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val pList = readLine()!!.split(' ').map(String::toInt)
    var min = Int.MAX_VALUE
    var count = 0
    for (p in pList) {
        if (min >= p) {
            min = p
            count++
        }
    }
    println(count)
}

Measured memory_bytes: 61644
/*
Written By mafailure
*/
//In the name of God
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less
using namespace std;
using namespace __gnu_pbds;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
//#define int long long 
// int dx[]={-1,1,0,0}; int dy[]={0,0,1,-1};
// int dx[]={2,2,-2,-2,1,1,-1,-1}; int dy[]={1,-1,1,-1,2,-2,2,-2};
const long long mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> ii;
typedef vector< pair< int, int > > vii;
typedef map<int, int> mii;
typedef pair<int, ii> pip;
typedef pair<ii, int> ppi;
#define arrinp(arr,init,final,size,type) type* arr=new type[size];for(int i=init;i<final;i++)cin>>arr[i];
#define cr2d(arr,n,m,t) t**arr=new t*[n];for(int i=0;i<n;i++)arr[i]=new t[m];
#define w(t) int t;cin>>t; while(t--)
#define takeInp(n) int n;cin>>n;
#define fr(i,init,final) for(int i=init;i<final;i++)
#define frr(i,init,final) for(int i=init;i>=final;i--)
#define Fr(i,final) for(int i=0;i<final;i++)
#define Frr(i,first) for(int i=first;i>=0;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define debug(x) cerr<<">value ("<<#x<<") : "<<x<<endl;
#define setb __builtin_popcount
#define lsone(n) (n&(-n))
#define rlsone(n) (n&(n-1))

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>  nds; 
vi init(string s)
{
	istringstream sin(s);
	int n;
	vi arr;
	while(sin>>n)arr.push_back(n);
	return arr;
}
int power(int x, int y)
{ 
	if(y==0)return 1;
	int u=power(x,y/2);
	u=(u*u)%mod;
	if(y%2)u=(x*u)%mod;
	return u;
    
}
int gcd(int a,int b)
{
	if(a<b)return gcd(b,a);
	return (b==0?a:(a%b?gcd(b,a%b):b));
}
int gcd_e(int a,int b,int &x,int &y)
{
	
	if(b==0){x=1; y=0; return a;}
	int x1,y1;
	int p=gcd_e(b,a%b,x1,y1);
	x=y1;
	y=x1-(a/b)*y1;
	return p;
}
signed main()
{
	IOS
	int n;
	 cin>>n;
	 vi a(n);
	 fr(i,0,n) cin>>a[i];
	 sort(all(a));
	 int ans=0;
	 
		fr(i,0,n)fr(j,i+1,n)fr(k,j+1,n)if(a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i]&&a[i]+a[j]>a[k])ans++;
		cout<<ans<<endl;
	
}



Measured memory_bytes: 3656
def examA():
    S = SI()
    ans = "No"
    flag = False
    for s in S:
        if flag:
            if s=="F":
                ans = "Yes"
                break
        else:
            if s=="C":
                flag = True
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()


Measured memory_bytes: 38384
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
 
typedef struct{
    double x,y;
} point;
 
int main(void)
{
    point p[4];
    double s[4];
    char str[100];
    int i;
    for( ;fgets(str,sizeof(str),stdin)!=NULL; ){
	sscanf(str,"%lf %lf %lf %lf %lf %lf %lf %lf",&p[0].x,&p[0].y,&p[1].x,&p[1].y,&p[2].x,&p[2].y,&p[3].x,&p[3].y);
        double total = 0;
        for (i = 0; i < 3; i++) {
            point a = {(p[i % 3].x - p[3].x), (p[i % 3].y - p[3].y)};
            point b = {((p[(i + 1) % 3]).x - p[3].x), ((p[(i + 1) % 3]).y - p[3].y)};
            s[i] = fabs(a.x * b.y - a.y * b.x);
            total += s[i];
        }
        point fa = {(p[0].x - p[2].x), (p[0].y - p[2].y)};
        point fb = {(p[1].x - p[2].x), ((p[1]).y - p[2].y)};
        s[3] = fabs(fa.x * fb.y - fa.y * fb.x);
        if (total == s[3]) puts("YES");
        else puts("NO");
    }
    return 0;
}

Measured memory_bytes: 624
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, atan2, degrees
from operator import mul
from functools import reduce
sys.setrecursionlimit(10**8)

INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


h, w, a, b = LI()
n = h + w

fac = [1] * (n + 1)
inv = [1] * (n + 1)
for j in range(1, n + 1):
    fac[j] = fac[j-1] * j % mod


inv[n] = pow(fac[n], mod-2, mod)
for j in range(n-1, -1, -1):
    inv[j] = inv[j+1] * (j+1) % mod


def comb(n, r):
    if r > n or n < 0 or r < 0:
        return 0
    return fac[n] * inv[n - r] * inv[r] % mod


ans = comb(w + h - 2 - b, h - 1)
pre = 1
for i in range(1, h - a):
    ans += (comb(b + i, i) - pre) * comb(w + h - 2 - b - i, h - 1 - i) % mod
    ans %= mod
    pre = comb(b + i, i)


print(ans)

Measured memory_bytes: 45160
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str = br.readLine();
		int acute = 0;
		int right = 0;
		int obtuse = 0;
		while (true) {
			String[] sidestr = str.split(" ");
			int[] sides = new int[3];
			for (int i = 0; i < 3; i++)
				sides[i] = Integer.parseInt(sidestr[i]);
			sides = Sort(sides);
			if (sides[0] >= sides[1] + sides[2])
				break;
			else if (Math.pow(sides[0], 2) > Math.pow(sides[1], 2)
					+ Math.pow(sides[2], 2))
				obtuse++;
			else if (Math.pow(sides[0], 2) == Math.pow(sides[1], 2)
					+ Math.pow(sides[2], 2))
				right++;
			else
				acute++;
			str = br.readLine();
		}
		System.out.println((acute + right + obtuse) + " " + right + " " + acute
				+ " " + obtuse);
	}

	private static int[] Sort(int[] num) {
		for (int i = 1; i < 3; i++) {
			for (int j = 0; j < 3 - i; j++) {
				if (num[j] < num[j + 1]) {
					int tmpnum = num[j];
					num[j] = num[j + 1];
					num[j + 1] = tmpnum;
				}
			}
		}
		return num;
	}
}

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

int main(){
  int m, f, r;
  do {
    cin >> m >> f >> r;
    if(m == -1 && f == -1 && r == -1){
      break;
    }else if(m == -1 || f == -1){
      //F
      cout << 'F' << endl;
    } else if(m + f >= 80){
      //A
      cout << 'A' << endl;
    } else if(m + f >= 65 && m + f < 80){
      //B
      cout << 'B' << endl;
    } else if(m + f >= 50 && m + f < 65){
      //C
      cout << 'C' << endl;
    } else if(m + f >= 30 && m + f < 50){
      //D
      if(r >= 50){
        cout << 'C' << endl;
      } else {
        cout << 'D' << endl;
      }
    } else {
      //F
      cout << 'F' << endl;
    }
  } while(!(m == -1 && f == -1 && r == -1));

  return 0;
}



Measured memory_bytes: 3092
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define ll long long
using namespace std;
const ll N=2e3+20;

inline ll read()
{
    ll x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
    while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch&15);ch=getchar();}
    return x*f;
}

ll n,x,ans=1LL<<60LL;
ll a[N],f[N][N];
//f[i][j]表示取得第i种颜色，使用k次魔法的最小代价 

int main()
{
    n=read(),x=read();
    for(int i=1;i<=n;i++) a[i]=read();
    
    for(int i=1;i<=n;i++)
    {
    	f[i][0]=a[i];
    	for(int j=1;j<n;j++)
    	{
    		int pos=i-j;
    		if(pos<=0) pos=n-abs(pos);
    		f[i][j]=min(f[i][j-1],a[pos]);
    	}
    }
    for(int j=0;j<n;j++)
    {
    	ll tmp=0;
    	for(int i=1;i<=n;i++) tmp+=f[i][j];
		ans=min(ans,tmp+x*j); 
    }
    
    printf("%lld\n",ans);return 0;
}

Measured memory_bytes: 31872
#define _GLIBCXX_DEBUG
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;
    

int main() {
    ll N;
    ll Min = 	9223372036854775800;
    cin >> N;
    for(int i = 0; i < 1000000; i++){
       ll a = N;
       a /= (i+1);
       if(N % (i+1) == 0 && Min > a + (i-1)){
           Min = a + (i-1);
           //cout << i << " " << a << endl;
       }
       if(N == (i+1)){
           break;
       }
    }
    cout << Min <<endl;
}


Measured memory_bytes: 256
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, x;
    cin >> n >> x;

    int res = 0;
    long long h = 0;
    if (h <= x) {
        ++res;
    }
    for (int i = 0; i < n; ++i) {
        int d;
        cin >> d;
        h += d;
        if (h <= x) {
            ++res;
        }
    }

    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <utility>
#include <set>
#include <bitset>
#define ls x<<1
#define rs x<<1|1
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(x) scanf("%d", &x)
#define scdd(x,y) scanf("%d%d", &x, &y)
#define scddd(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define eb emplace_back
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define IOS std::ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<pii, pii> ppp;

const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double pi = 2*acos(0.0);
const double eps = 1e-13;
const ll mod = 998244353;
const int maxn = 1e5 + 10;
const int maxm = 50000 + 10;

void solve() {
    int n,m,a,b;
    scdd(n, m); scdd(a, b);
    for(int i=0; i<b; i++){
        for(int j=0; j<a; j++) printf("0");
        for(int j=a; j<m; j++) printf("1");
        puts("");
    }
    for(int i=b; i<n; i++){
        for(int j=0; j<a; j++) printf("1");
        for(int j=a; j<m; j++) printf("0");
        puts("");
    }
}

int main() {
#ifdef LOCAL
    freopen("in.txt","r",stdin);
    //freopen("ans.txt","w",stdout);
#endif
    //IOS;
    solve();

    return 0;
}


Measured memory_bytes: 1280
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($A,$B) = explode(" ",trim(fgets(STDIN)));
//$a = explode(" ",trim(fgets(STDIN)));
//$b = explode(" ",trim(fgets(STDIN)));
$res = "";
for($i=0;$i<strlen($N);$i++) {
  if ($N[$i]=="1") {
    $res .= "9";
  }
  if ($N[$i]=="9") {
    $res .= "1";
  }
}
printf("%s\n",$res);


Measured memory_bytes: 3828
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
from bisect import bisect_left
def resolve():
    n, m = map(int,input().split())
    A = list(map(int,input().split()))
    A.sort()

    def count(x): # the number of (i, j)s s.t. A[i] + A[j] >= x
        res = 0
        for a in A:
            idx = bisect_left(A, x - a)
            res += n - idx
        return res

    left = 0
    right = 200001
    while right - left > 1:
        mid = (left + right) // 2
        if count(mid) < m:
            right = mid
        else:
            left = mid

    x = right
    res = 0
    for a in A:
        idx = bisect_left(A, x - a)
        res += 2 * a * (n - idx)
    res += (x - 1) * (m - count(x))
    print(res)
resolve()

Measured memory_bytes: 54380
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

int main() {
  int n;
  cin >> n;
  vector<string> ss(n);
  for (int i = 0; i < n; i++) cin >> ss[i];

  map<string, ll> m;
  for (int i = 0; i < n; i++) {
    auto s = ss[i];
    sort(s.begin(), s.end());
    if (m.count(s) == 0) m[s] = 0;
    m[s]++;
  }

  ll ans(0);
  for (auto ele : m) {
    ans += ele.second * (ele.second - 1) / 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 14004
#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main(){
    int n,q;
    cin >> n >> q;
    string S;
    cin >> S;
    for(int i=1;i<n;i++){
        a[i+1]+=a[i];
        if(S[i-1]=='A' && S[i]=='C')a[i+1]++;
    }
    int l,r;
    for(int i=0;i<q;i++){
        cin >> l >> r;
        cout << a[r]-a[l] << endl;
    }   
}

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

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

int t, d, s;

int main(){
    d = read(), t = read(), s = read();
    if (d <= s * t)
        puts("Yes");
    else
        puts("No");
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define pf push_front
#define F first
#define S second
#define ll long long
#define f(i) return cout<<i<<"\n",0;
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define lp(i,a,b) for (int i=(a);i<=(int)(b);++i)
#define lp2(i,a,b) for (int i=(a);i>=(b);--i)
#define clr(c,x) memset(c,x,sizeof(c))
#define allr(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end()
const int N=2e5+5,mod=(int)1e9+7;

int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n,k;
    cin>>n>>k;
    int x=0;
    if (!k)
    {
        lp(i,0,(1<<n)-1) cout<<i<<" "<<i<<" ";
        return 0;
    }
    lp(i,0,(1<<n)-1) if (i!=k)x^=i;
    if (x!=k) f(-1);
    cout<<0<<" "<<k<<" "<<0<<" ";
    lp(i,1,(1<<n)-1)
    {
        if (i!=k)
            cout<<i<<" ";
    }
    cout<<k<<" ";
    lp2(i,(1<<n)-1,1) if (i!=k) cout<<i<<" ";
    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>

const int MAXN = 100 + 10;
const int dx[] = {0, -1, 1, 0, 0, -1, -1, 1, 1};
const int dy[] = {0, 0, 0, -1, 1, -1, 1, -1, 1};

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    static char s[MAXN][MAXN];
    for (int i = 1; i <= n; i++)
        scanf("%s", s[i] + 1);
    
    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            if (s[i][j] == '.')
            {
                int cnt = 0;
                for (int k = 1; k <= 8; k++)
                    if (s[i + dx[k]][j + dy[k]] == '#')
                        cnt++;
                printf("%d", cnt);
            }
            else
                printf("#");
        }

        puts("");
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
 
using namespace std;
 
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define ll	long long
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ios	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell 1000000007
#define PI 3.141592653589793

int main() 
{	
	int t = 1;
	//cin>>t;
	while (t--) {
		double A, B, H, M;
		cin>>A>>B>>H>>M;
		double deg = abs(0.5 * (60 * H - 11 * M));
		//cout<<deg;
		if (deg > 180.0) deg = 360 - deg;
		double rad = deg * PI / 180;
		//cout<<"deg = "<<deg<<" rad = "<<rad<<endl;
		double ans = sqrt (A*A + B*B - 2 * A * B * cos(rad));
		cout<<setprecision(20)<<ans;
		cout<<"\n";
	}
    return 0; 
} 


Measured memory_bytes: 4292
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	string s;
	cin>>s;
	int n=s.size();
	vector<int> pf(n+1,0);
	for(int i=0;i<n;++i)
		pf[i+1]=pf[i]+(s[i]=='0');
	int k=n;
	while(pf[n-k]-pf[k]!=0&&pf[n-k]-pf[k]!=n-2*k) k--;
	cout<<k<<'\n';
}




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

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
ll l, r;
ll dp[2][2][2][62];

ll f(int d, int msb, int lt, int rt) {
  if(d == -1) return msb == 1;
  if(dp[msb][lt][rt][d] >= 0) return dp[msb][lt][rt][d];

  ll ret = 0;

  for(int a=0;a<2;++a) {
    for(int b=0;b<2;++b) {
      if(a == 0 && lt && (l & (1ll<<d)) > 0) continue;
      if(b == 1 && rt && (r & (1ll<<d)) == 0) continue;
      if(a>b) continue;
      if(msb == 0 && a != b) continue;
      int nlt = lt && (((l>>d)&1)==a);
      int nrt = rt && (((r>>d)&1)==b);
      int nmsb = msb || (a == 1 && b == 1);
      ret += f(d-1, nmsb, nlt, nrt);
    }
  }

  return dp[msb][lt][rt][d] = ret % MOD;
  
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  cin >> l >> r;
  
  for(int i=0;i<2;++i) {
    for(int j=0;j<2;++j) {
      for(int k=0;k<2;++k) {
        for(int l=0;l<62;++l) {
          dp[i][j][k][l] = -1;
        }
      }
    }
  }
  cout << f(61, 0, 1, 1) << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<deque>

using namespace std;

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

struct edge{int to, cost;};

int main(){
    int k;
    cin >> k;
    vector<edge> G[k];
    rep(i, k){
        edge g;
        g.to = (i + 1) % k;
        g.cost = 1;
        G[i].push_back(g);
        g.to = (i * 10) % k;
        g.cost = 0;
        G[i].push_back(g);
    }
    // rep(i, k){
    //     rep(j, G[i].size()){
    //         cout << G[i][j].to << ":" <<G[i][j].cost << " ";
    //     }
    //     cout << endl;
    // }
    deque<P> q;
    q.push_back(P(1, 1));
    int d[k];
    rep(i, k) d[i] = -1;
    while(q.size() > 0){
        P p = q.front();
        q.pop_front();
        int t = p.first;
        int c = p.second;
        if(d[t] != -1) continue;
        d[t] = c;
        for (int i = 0; i < G[t].size(); i++){
            if(d[G[t][i].to] != -1) continue;
            if (G[t][i].cost == 0){
                q.push_front(P(G[t][i].to, c));
            }else{
                q.push_back(P(G[t][i].to, c + 1));
            }
        }
    }
    cout << d[0] << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
int a[100005],total=0;
int main()
{
	long long n,k;
	cin>>n>>k;
	for (int i=1;i<=n;i++)  cin>>a[i];
	for (int i=1;i<=n;i++)
	{
		if (a[i]>=k)  total++;
	}
	cout<<total<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
#include <unordered_map>
#include <queue>
using namespace std;
int N, K;
int arr[200005];
unordered_map <int, int> numCount;
queue <int> rem;
int fromLeft[200005];
int main() {
    cin >> N >> K;
    for (int i=1; i<=N; i++) scanf("%d", &arr[i]);
    int increment = 0;
    for (int i=1; i<=N; i++){
        increment += arr[i]-1;
        increment %= K;
        int p = (increment-(arr[i]-1)) % K;
        if (p < 0) p += K;
        rem.push(p);
        numCount[p]++;
        if (i >= K) {
            int r = rem.front();
            rem.pop();
            numCount[r]--;
        }
        fromLeft[i] = numCount[increment];
    }
    long long ans = 0;
    for (int i=1; i<=N; i++) ans += fromLeft[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 10824
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCpder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const ll INF = 2e9;
const ll large_P = 1e9 + 7;





//target が素数かどうか判定する。
void prime_judge(vector<bool> & prime_or_not, ll target) {

	prime_or_not.at(0) = false;
	prime_or_not.at(1) = false;

	ll n = prime_or_not.size() - 1;
	ll region = sqrt(n) + 1;

	for (ll i = 2; i <= n / 2; i++) {
		prime_or_not.at(2 * i) = false;
	}


	for (ll i2 = 1; i2 < n / 2; i2++) {
		//target が素数でないことが分かったので、判定を打ち切る。(素数の数を数えているときは入れられない)
		//if (!prime_or_not.at(target)) break;


		ll i = 2 * i2 + 1;  //ここからは奇数のみ探索
		if (i < region && prime_or_not.at(i)) {
			ll j = i * i;
			while (j < n + 1) {
				prime_or_not.at(j) = false;
				j += 2 * i;
			}
		}
	}
};





signed main() {
	ll X; cin >> X;
	vector<bool> prime_or_not(1e5 + 200, true);


	prime_judge(prime_or_not, 1e5 + 150);

	int i = X;
	while (!prime_or_not.at(i)) {
		i++;
	}

	cout << i << endl;



}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define MAX (int)(1e5+1)
typedef long long i64;

int n,a[MAX],b[MAX],c[MAX],k=0;
vector<int> ve[MAX];
vector<int> vn[MAX];

int max(int x,int y){
  return x<y ? y : x;
}

void f(int from,int e,int co){
//  printf("%d %d %d\n",from,e,co);
  int d=0;
  for(int i=0;i<vn[e].size();i++){
    if(vn[e][i]==from)continue;
    d = (d+1==co)?d+2:d+1;
    c[ve[e][i]] = d;
    k = max(k,c[ve[e][i]]);
    f(e,vn[e][i],c[ve[e][i]]);
  }
}

int main(){
  scanf("%d",&n);
  for(int i=0;i<n-1;i++){
    scanf("%d%d",&a[i],&b[i]);
    ve[a[i]].push_back(i);
    vn[a[i]].push_back(b[i]);
    ve[b[i]].push_back(i);
    vn[b[i]].push_back(a[i]);
  }
  
  for(int i=0;i<vn[1].size();i++) {
    c[ve[1][i]]=i+1;
    k = max(k,i+1);
    f(1,vn[1][i],i+1);
  }
  printf("%d\n",k);
  for(int i=0;i<n-1;i++){
    printf("%d\n",c[i]);
  }
  return 0;
}

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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}

ll BinarySearch(ll ng, ll ok, function<bool(ll)> judge){
    while(abs(ok - ng) > 1){
        ll mid = (ok + ng) / 2;
        if(judge(mid)) ok = mid;
        else ng = mid;
    }
    return ok;
}

signed main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> v(n);
    for(auto& i : v) cin >> i;
    sort(all(v));
    vector<ll> rv(v);
    sort(rall(rv));

    auto fn = [&](ll x){
        ll cnt = 0;
        REP(i, n){
            ll a = v[i];
            int ok = -1, ng = n;
            auto& u = (a >= 0 ? v : rv);

            if(a >= 0) ok = i;
            else ng = n - 1 - i;

            int l = ok;
            while(abs(ok - ng) > 1){
                ll mid = (ok + ng) / 2;
                if(a * u[mid] <= x) ok = mid;
                else ng = mid;
            }
            cnt += ok - l;
        }
        return cnt >= k;
    };

    cout << BinarySearch(-1e18, 1e18, fn) << endl;
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
        cin >> A[i];
    sort(A.begin(), A.end());

    long long res = 0;
    int cnt = 0, pre = 0;
    for (int i = 0; i < N; i++) {
        if (A[i] == pre) {
            cnt++;
        } else {
            if (cnt >= pre) res += cnt - pre;
            else res += cnt;
            cnt = 1;
        }
        pre = A[i];
    }

    if (cnt >= pre) res += cnt - pre;
    else res += cnt;

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 768
//$0=$2+($1>10?0:(10-$1)*100)
#include <stdio.h>
int main(void)
{
  int n, r;
  scanf("%d%d", &n, &r);
  int ans = r;
  if(n < 10) ans += (10 - n) * 100;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 1696
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>

using namespace std;

typedef long long ll;

void solver_main()
{
	ll n;
	cin >> n;
	vector<ll> h(n);

	for (ll i = 0; i < n; i++) {
		cin >> h[i];
	}

	ll max = 0;
	ll cnt = 0;
	for (ll i = 0; i < n - 1; i++) {
		if (h[i] >= h[i + 1]) {
			cnt++;
		}
		else {
			cnt = 0;
		}

		if (max < cnt) {
			max = cnt;
		}
	}

	cout << max << endl;
}

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

Measured memory_bytes: 1024
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	string s; int m;
	cin >> s >> m;
	vector<string> lis;
	for (int i = 0; i < s.size(); ++i) {
		for (int j = 1; j <= m; ++j) {
			lis.push_back(s.substr(i, j));
		}
	}
	sort(lis.begin(), lis.end());
	unique(lis.begin(), lis.end());
	cout << lis[--m] << '\n';
	return 0;
}

Measured memory_bytes: 1660
n, k, c = map(int, input().split())
s = input()

if c == 0:
    o = s.count('o')
    if o == k:
        for i in range(n):
            if s[i] == 'o':
                print(i + 1)
    exit()

pr = [0] * n
for i in range(n):
    if s[i] == 'o':
        pr[i] = 1
for i in range(n):
    if i >= 1:
        pr[i] = max(pr[i - 1], pr[i])
    if s[i] == 'o' and i >= c + 1:
        pr[i] = max(pr[i], pr[i - (c + 1)] + 1)
sf = [0] * n
for i in range(n):
    if s[i] == 'o':
        sf[i] = 1
for i in range(n - 1, -1, -1):
    if i + 1 < n:
        sf[i] = max(sf[i + 1], sf[i])
    if s[i] == 'o' and i + (c + 1) < n:
        sf[i] = max(sf[i], sf[i + (c + 1)] + 1)

b = [0] * (n + 1)
for i in range(n + c + 1):
    j = i - (c + 1)
    u = sf[i] if 0 <= i < n else 0
    v = pr[j] if 0 <= j < n else 0
    if u + v < k:
        b[min(max(0, i), n)] -= 1
        b[max(0, min(n, j + 1))] += 1

cb = 0
for i in range(n):
    cb += b[i]
    if cb >= c and s[i] == 'o':
        print(i + 1)

Measured memory_bytes: 51276
#include<stdio.h>

int main()
{
	int m, f, r;
	while (1)
	{
		scanf("%d %d %d", &m, &f, &r);
		if (m == -1 && f == -1 && r == -1) break;
		int total = m + f;
		if (m == -1 || f == -1) printf("F\n");
		else if(total >= 80) printf("A\n");
		else if (total >= 65) printf("B\n");
		else if (total >= 50) printf("C\n");
		else if (total >= 30)
		{
			if (r >= 50) printf("C\n");
			else printf("D\n");
		}
		else printf("F\n");
	}
	return 0;

}

Measured memory_bytes: 1012
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 4*1001001001001001001;
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;

int main () {

    int n,a; cin >>n>>a;

    cout << n*n - a << endl;

    return 0;
}


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

//--------------------------------------------
#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(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

//--------------------------------------------
const double EPS = 1e-14;
const double PI  = acos(-1.0);

//--------------------------------------------

int main(){
  int w,a,b;

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

  if (a <= b && b <= a + w) printf("0\n");
  else printf("%d\n",min(abs(b - (a + w)), abs(a - (b + w))));
}


Measured memory_bytes: 256
/*input
10 4 8
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, x, y; cin >> n >> x >> y;
    vector<int> ans(n);
    vector<pair<pii, int>> v;
    for(int i = 1; i <= n; i++)
    {
    	queue<pii> bfs;
    	vector<bool> visited(n + 1);
    	bfs.push(make_pair(i, 0));
    	while(!bfs.empty())
    	{
    		int c = bfs.front().first;
    		int d = bfs.front().second;
    		bfs.pop();
    		if(visited[c]) continue;
    		visited[c] = 1;
    		v.push_back(make_pair(make_pair(i, c), d));
    		if(c == x) bfs.push(make_pair(y, d + 1));
    		if(c + 1 <= n) bfs.push(make_pair(c + 1, d + 1));
    		if(c - 1) bfs.push(make_pair(c - 1, d + 1));
    	}
    }
    for(int i = 0; i < v.size(); i++) if(v[i].first.first < v[i].first.second) ans[v[i].second]++;
    for(int i = 1; i < n; i++) cout << ans[i] << endl;

    return 0;
}

Measured memory_bytes: 51424
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define All(a) a.begin(),a.end()
#define INF 1000000007
const int MOD = 1000000007;
//accumulate(vec.begin(), vec.end(), 0)
//std::sort(v.begin(), v.end(), std::greater<Type>());
//set_intersection(x, x+7, y, y+6, back_inserter(v));
//set_union(x, x+7, y, y+6, back_inserter(v));
//set_difference(x, x+7, y, y+6, back_inserter(v));

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

bool isPrime(int n){
  if(n < 2) return false;
  else if(n == 2) return true;
  else if(n%2==0) return false;

  for(int i=3;i<=sqrt(n);i++){
    if(n%i==0) return false;
  }
  return true;
}


int main(){
  int n;
  cin >> n;
  int sum = 0;
  for(int i=0;i<=25;i++){
    for(int j=0;j<=14;j++){
      if(n==4*i+7*j){
        cout<< "Yes" <<endl;
        return 0;
      }
    }
  }
  cout<< "No" <<endl;
}


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

int main() 
{
    string s;
    cin >> s;
    int sum = 0;
    for (int i = 1; i < s.size()-1; i++) {
        sum++;
    }
    cout << s[0] << sum << s[s.size()-1] << endl;
}

Measured memory_bytes: 3596
# https://atcoder.jp/contests/abc167/tasks/abc167_b

A, B, C, k = gets.split.map(&:to_i)

ans = 0
k -= (a = [A, k].min)
ans += a * 1
k -= (b = [B, k].min)
ans += b * 0
k -= (c = [C, k].min)
ans += c * -1
puts ans


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

using namespace std;

/*  テンプレここから */
typedef long long ll;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
#define INF (1e9)
#define add_mod(a, b, x) ( (ll)(a) + (ll)(b) ) % (ll)(x)
#define mul_mod(a, b, x) ( ((ll)(a) % (ll)(x)) * ((ll)(b) % (ll)(x)) ) % (ll)(x)
#define out(x) cout << (x) << endl;
#define outyes(bool_val) cout << (bool_val ? "yes" : "no") << endl;
#define outYes(bool_val) cout << (bool_val ? "Yes" : "No") << endl;
#define outYES(bool_val) cout << (bool_val ? "YES" : "NO") << endl;
#define outPossible(bool_val) cout << (bool_val ? "Possible" : "Impossible") << endl;
#define outPOSSIBLE(bool_val) cout << (bool_val ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll sub_mod(ll a, ll b, ll x){
    ll tmp = (a - b) % x;
    if(tmp < 0) tmp += x;
    return tmp;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    else return gcd(b, a % b);
}

int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
/*  テンプレここまで */

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

    int a, b;
    cin >> a >> b;

    cout << (a + b) % 24 << endl;
}

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





int main(){
	int ans;
	char s[4];
	cin >> s;

	ans = 0;

	for (int i = 0; i < 4; i++) {
		if (s[i] == '+') {
			++ans;
		}
		else if (s[i] == '-') {
			--ans;
		}
	}


	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import Data.List


toInt :: (String -> Int)
toInt x = read x ::Int

getInts :: IO [Int]
getInts = do
  x <- getLine
  let y = (map$toInt)$words x
  return y



solve :: Int -> [Int] -> Integer
solve k h = f0 k $ reverse (sort h)

f0 :: Int -> [Int] -> Integer
f0 0 [] = 0 :: Integer
f0 0 (h:hs) = toInteger h + f0 0 hs
f0 n [] = 0 :: Integer
f0 n (h:hs) = f0 (n-1) hs




main = do
  nk <- getInts
  h <- getInts
  let k = nk !! 1
  putStrLn $ show (solve k h)


Measured memory_bytes: 82812
x[100],y[100];i,j,k;float p[101],s,P=2*acos(-1);c(a,b)float*a,*b;{return*a<*b?-1:*a>*b;}main(n){for(scanf("%d",&n);~scanf("%d%d",x+j++,y+j););for(;i<n;i++){for(k=j=0;j<n;j++)i-j&&(p[k++]=atan2(y[j]-y[i],x[j]-x[i]));qsort(p,k,4,c);for(p[k]=p[j=s=0]+P;++j<n;)s=fmax(s,(p[j]-p[j-1])/P-.5);printf("%f\n",s);}}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+b,(a).begin()+c // コンテナ a の 要素 b から c へのイテレータ
#define MOD 1000000007
#define INF 1000000000000
typedef pair<int64_t, int64_t> PII;
typedef vector<int64_t> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

int N; cin >> N;
vector<bool> color(8, false);
int free = 0;
rep(i, 0, N) {
    int a; cin >> a;
    if (a > 3199) ++free;
    else color[a / 400] = true;
}

int cntcolor = accumulate(ALL(color), 0);

cout << max(cntcolor, 1) << " " << cntcolor + free << endl;

}
// 書いて考える
// 境界，出力文字列 チェック
// 可読性優先．高速化次点．
// まずは全探索，分割統治，次にDP
// 制限を見る．境界に注意．求めたい量の変域．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり



Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int n,i,count=0,pl=-1,num;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  for(i=0;i<n;i++){
    if(a[i]!=i+1 && count==0){
      count++;
      num = a[i];
    }else if(a[i]!=i+1 && count==1){
      count++;
      pl = i+1;
    }
    else if(a[i]!=i+1) count++;
  }
  if((count==2 && pl==num) || count==0) printf("YES\n");
  else printf("NO\n");
  return 0;
}

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

int main(void){
    string s;
    cin >> s;
    bool flag = true;
    int tmp = 0;
    int max = 0;
    int i, f, e;

    for(f=0; f<s.size(); f++){
        for(e=0; e<s.size()-f; e++){
            flag = true;
            tmp = 0;
            for(i=f; i<s.size()-e; i++){
                //cout << s[i];
                if(s[i]!='A' && s[i]!='C' && s[i]!='G' && s[i]!='T'){
                    flag = false;
                }
                else tmp++;
            }
            //cout << endl;
            if(flag && max<tmp){
                max = tmp;
            }
        }
    }

    cout << max << endl;

}

Measured memory_bytes: 256
x,y=map(int,input().split())

if x*y==0:
    if x==0 and y<0:
        ans=abs(y)+1
    elif x==0 and y>0:
        ans=y
    elif y==0 and x>0:
        ans=x+1
    else:
        ans=abs(x)
elif x*y>0:
    if y>x:
        ans=y-x
    else:
        ans=abs(y-x)+2
else:
    ans=abs(x+y)+1
print(ans)


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

using namespace std;

int main() {
    string theString, subString;
    cin >> theString >> subString;

    int sizeOfSubString = int(subString.size());
    int bestCount = sizeOfSubString;

    for (int i = 0; i <= theString.size() -sizeOfSubString; i++ ){
        string compared = theString.substr(i, sizeOfSubString);

        int diffCount = 0;
        for (int j = 0; j < sizeOfSubString; j++) {
            if (compared[j] != subString[j]) {
                diffCount++;
            }
        }

        if (diffCount) {
            if (diffCount < bestCount) {
                bestCount = diffCount;
            }
        } else {
            cout << 0 << endl;
            return 0;
        }
    }

    cout << bestCount << endl;

    return 0;
}

Measured memory_bytes: 3612
# https://atcoder.jp/contests/abc131/tasks/abc131_d

n = gets.to_i

tasks = []

n.times do
  cost, deadline = gets.split.map(&:to_i)
  tasks << [cost, deadline]
end

tasks.sort_by! { |i| i[1] }

current_time = 0

valid = true
tasks.each do |i|
  current_time += i[0]
  if current_time > i[1]
    valid = false
    break
  end
end

puts valid ? 'Yes' : 'No'



Measured memory_bytes: 22520
n,m = map(int,input().split())
h = list(map(int,input().split()))
a=[0]*m
b=[0]*m
for i in range(m):
    a[i],b[i]=map(int,input().split())

maxn = [0]*n

for i in range(m):
    maxn[a[i]-1]= max(maxn[a[i]-1], h[b[i]-1])
    maxn[b[i]-1]= max(maxn[b[i]-1], h[a[i]-1])

ans=0
# print(maxn)
for i in range(n):
    if maxn[i] < h[i]:
        ans +=1

print(ans)

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<pair<int, int>> V, W;
    for (int i = 0; i < N; i++) {
        int a, b; cin >> a >> b;
        V.emplace_back(a, b);
        W.emplace_back(b, a);
    }
    sort(V.begin(), V.end());
    sort(W.rbegin(), W.rend());
    if (N % 2) {
        int a = V[N/2].first;
        int b = W[N/2].first;
        cout << b - a + 1 << "\n";
    } else {
        int a = V[N/2-1].first + V[N/2].first;
        int b = W[N/2-1].first + W[N/2].first;
        cout << b - a + 1 << "\n";
    }
    return 0;
}

Measured memory_bytes: 6696
#include <iostream>
using namespace std;
//C - Grand Garden
int main(void){
    int N;
    std::cin >> N;
    int f;
    std::cin >> f;
    int cnt=0;
    for (int i = 1; i < N; i++) {
        int h;
        std::cin >> h;
        if(f>h){
            cnt+=f-h;
        }
        f=h;
    }
    std::cout << cnt+f << std::endl;
}


Measured memory_bytes: 256