akhauriyash/Code-Regression huggingface dataset:
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

N=gets.to_i
1.upto(3500) do|h|
    1.upto(3500) do|n|
        w=-1
        w=N*h*n/(4*h*n-N*n-N*h) if (4*h*n-N*n-N*h).nonzero? and ((N*h*n)% (4*h*n-N*n-N*h)).zero?
        if w>0
            puts [h,n,w].join(" ")
            exit
        end
    end
end

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

typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;

#define endl '\n'
#define ff first
#define ss second
#define int long long
#define pb push_back
#define f(i,l,r) for(ll i=l;i<=r;i++)
#define rf(i,r,l) for(ll i=r;i>=l;i--)
#define Max 5000001
#define inf 2147483647
#define llinf 9223372036854775807
#define all(v) v.begin(),v.end()
#define bp(n) __builtin_popcountll(n)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

#define d0(a) cout<<a<<' ';
#define d1(a) cout<<a<<endl;
#define d2(a,b) cout<<a<<' '<<b<<endl;
#define d3(a,b,c) cout<<a<<' '<<b<<' '<<c<<endl;
#define d4(a,b,c,d) cout<<a<<' '<<b<<' '<<c<<' '<<d<<endl;
#define d5(a,b,c,d,e) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<endl;
#define d6(a,b,c,d,e,f) cout<<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<endl;

const ll N=2e5+5,mod=1e9+7,bit=61;

ll powerm(ll a,ll b,ll m=mod)
{
	a%=m;
	ll res=1%m;
	while(b>0)
	{
		if(b & 1)
		{
			res=(res*a)%m;
		}
		b>>=1;
		a=(a*a)%m;
	}
	return res;
}

signed main()
{
    fast;

    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll n,k;
        cin>>n>>k;
        ll dp[k+1];
        ll ans=0;
        rf(i,k,1)
        {
            dp[i]=powerm((k/i),n);
            for(int j=2;j*i<=k;j++)
            {
                dp[i]=(dp[i]-dp[j*i]+mod)%mod;
            }
            ans=(ans + (i*dp[i])%mod)%mod;
        }
        cout<<ans<<endl;
    }
    return 0;
}
















Measured memory_bytes: 4384
N = int(input())
ans = 0
a = - (1 << 100)
X = []
for _ in range(N):
    x, l = map(int, input().split())
    X.append((x, l))
X = sorted(X)
for x, l in X:
    if a > x - l:
        a = min(a, x + l)
    else:
        a = x + l
        ans += 1
print(ans)

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

int main(){
   int a,b; cin>>a>>b;
   if(b%a==0) cout<<a+b<<endl;
   else cout<<b-a<<endl;
   return 0;
}

   


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
    public static void main(String [] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        double money = 0;
        for (int i = 0; i < n; ++i) {
            double x = scanner.nextDouble();
            String currency = scanner.next();
            if ("BTC".equals(currency)) {
                money += 380000.0 * x;
            } else {
                money += x;
            }
        }
        System.out.println(money);
    }
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define ALL(a) (a).begin(), (a).end()
#define rALL(a) (a).rbegin(), (a).rend()
#define SZ(x) ((int)(x).size())
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;

template <class T>inline bool chmin(T &a, const T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline bool chmax(T &a, const T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
template <class T>inline void line_out(const vector<T> vec) {
  int n = SZ(vec);
  rep(i, n) {
    cout << vec[i];
    if(i < n-1) cout << " ";
  }
  cout << endl;
  return;
}

struct mint
{
  ll x; // typedef long long ll;
  mint(ll 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++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  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;
  }
};

int main()
{
  ll n; cin >> n;
  vector<ll> x(5);
  rep(i, 5) cin >> x[i];
  ll min_x = *min_element(ALL(x));

  ll ans = 4+(ll)ceil((double)n / min_x);
  cout << ans << endl;
}

Measured memory_bytes: 3644
MOD=10**9+7

n=int(input())

# 全通りの計算
#print(10**n)

# 0と9の値が存在しない通りの計算
#print(8**n)

# 9の値が存在しない通りの計算
#print(9**n)

# 0の値が存在しない通りの計算
#print(9**n)

# 0もしくは9のどちらか一方も存在しない通りの計算
#print(9**n+9**n-8**n)

# 0、9が共に存在する通りの計算
sum=10**n-(9**n+9**n-8**n)
#print(10**n-(9**n+9**n-8**n))

# 答えの出力
print(sum%MOD)

Measured memory_bytes: 11272
#include<vector>
#include<iostream>
#include<map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<deque>
#define ll long long
using namespace std;
#define BUF_SIZE 1048576
char _buf[BUF_SIZE],*_is=_buf,*_it=_buf;
inline char rdc(){
	if (_is==_it) _it=(_is=_buf)+fread(_buf,1,BUF_SIZE,stdin);
	return *_is++;
}
inline void rdi(int &x){
	int f=0;
	register char ch=rdc();
	while ((ch<'0' or ch>'9') and (ch^'-')) ch=rdc();
	if (ch=='-') f=1,ch=rdc();
	while (ch>='0' and ch<='9') x=(x<<3)+(x<<1)+(ch^'0'),ch=rdc();
	if(f) x=-x;
}
inline void rdi(ll &x){
	ll f=0;
	register char ch=rdc();
	while ((ch<'0' or ch>'9') and (ch^'-')) ch=rdc();
	if (ch=='-') f=1,ch=rdc();
	while (ch>='0' and ch<='9') x=(x<<3)+(x<<1)+(ch^'0'),ch=rdc();
	if(f) x=-x;
}
inline void write(int x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
inline void _write(int x){
	write(x);
	putchar(' ');
}
inline void print(int x){
	write(x);
	putchar('\n');
}
inline void write(ll x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
inline void _write(ll x){
	write(x);
	putchar(' ');
}
inline void print(ll x){
	write(x);
	putchar('\n');
}
#define int ll
int res,n,d;
int a[200005];
int dpl[200005],dpr[200005]; 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>d;
	int i,j;
	for(i=0;i<n;++i) cin>>a[i],res+=a[i];
	res+=(n-1)*d;
	dpr[0]=a[0];
	for(i=1;i<n;++i) dpr[i]=min(a[i],dpr[i-1]+d);
	dpl[n-1]=a[n-1];
	for(i=n-2;~i;--i) dpl[i]=min(a[i],dpl[i+1]+d);
	for(i=1;i<n-1;++i) res+=min(dpl[i],dpr[i]);
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 5120
import heapq


class MST:
    """Given weighted graph, find minimum spanning tree.

    >>> mst = MST([[-1, 2, 3, 1, -1], \
                   [2, -1, -1, 4, -1], \
                   [3, -1, -1, 1, 1], \
                   [1, 4, 1, -1, 3], \
                   [-1, -1, 1, 3, -1]]);
    >>> mst.weight()
    5
    """
    MAX_WEIGHT = 2001

    def __init__(self, graph):
        self.graph = graph
        self.size = len(graph)
        self.tree = []
        self._search()

    def weight(self):
        return sum([self.graph[i][j] for i, j in self.tree])

    def _search(self):
        visited = [0]

        while len(visited) < self.size:
            h = []
            for node in visited:
                for i, w in enumerate(self.graph[node]):
                    if w == -1:
                        continue
                    if i in visited:
                        continue
                    heapq.heappush(h, (w, node, i))

            weight, src, dst = heapq.heappop(h)
            visited.append(dst)
            self.tree.append((src, dst))


def run():
    n = int(input())

    nodes = []
    for _ in range(n):
        nodes.append([int(i) for i in input().split()])

    mst = MST(nodes)
    print(mst.weight())


if __name__ == '__main__':
    run()



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

int main(){
  string S;
  cin >> S;
  
  string T="ATCG";
  
  int ans = 0;//ATCGの文字列の最大長
  int now = 0;//今見ている文字を末尾とするATCGの文字列の最大長
  for (int i=0;i<S.size();++i){
    bool isATCG = false;
    for (int j=0;j<T.size();++j){
       if (S[i]==T[j]) isATCG = true;
    }
    
    if (!isATCG){
      //違う場合は０にする
      now = 0;
    }
    else {
      //ATCG文字の場合は、前の文字列に1つ文字を足せる
      now++;
      //最大値を更新する
      ans=max(ans,now);
    }
  }
  cout << ans << endl;
}


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

class Program
{
    static void Main()
    {
        new Program().Solve();
    }
    
    public void Solve()
    {
        var n=Console.ReadLine();
        if(n[0]=='9'||n[1]=='9')
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 13140
import math
a,b,h,m=map(int,input().split())
h=h+m/60
h=h/12*360
m=m/60*360
d=abs(h-m)
if d>180:
	d=360-d
print((a**2+b**2-2*a*b*math.cos(math.radians(d)))**(1/2))

Measured memory_bytes: 9516
'use strict';

function main(stdin) {
  const input = stdin.split(' ').map(v => parseInt(v, 10));
  const X = input[0];
  const A = input[1];
  let ans = 10;
  if (X < A) ans = 0;
  
  console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
# include <iostream>
# include <cmath>

/*
int main() {
    int K;
    std::cin >> K;

    int N[] = { 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 };

    std::cout << N[K-1];

    return 0;
}
*/


int main() {
    long long W, H;

    std::cin >> H >> W;

    if (W == 1 || H == 1) {
        std::cout << 1;
    } else {
        long long ans = ceil(W / 2.0) * ceil(H / 2.0) + (W / 2) * (H / 2);

        std::cout << ans;
    }
}


/*
int main() {
    long long a, b, c;

    std::cin >> a >> b >> c;

    if (a + b + 2 * sqrt(a) * sqrt(b) < c) {
        std::cout << "Yes";
    } else {
        std::cout << "No";
    }
}
*/


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <string>
#include <queue>
#include <algorithm>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
using P = pair<ll,ll>;

int main() {
    ll N;
    cin >> N;
    for(ll i=0;i<=N;i++){
        ll tmp = (i+1)*i/2;
        if(tmp-N<i && tmp-N>=0){
            for(int j=1;j<=i;j++){
                if(j==tmp-N)continue;
                else cout << j << endl;
            }
            return 0;
        } 
    }
}

Measured memory_bytes: 256
while True:
    n, p = map(int, input().split())
    if n == 0 or p == 0:
        break
    stones = [0] * n
    i = 0
    num = p
    while True:
        if num == 0:
            num += stones[i]
            stones[i] = 0
        else:
            stones[i] += 1
            num -= 1
            if stones[i] == p:
                print(i)
                break
        i = (i + 1) % n



Measured memory_bytes: 5592
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

class Edge
{
public:
    int to, cost;
    Edge(){};
    Edge(int to0, int cost0){to = to0; cost = cost0;}
};

long long minSpanningTree(const vector<vector<Edge> >& edges)
{
    int n = edges.size();
    vector<bool> used(n, false);
    int usedNum = 0;
    vector<int> minCost(n, INT_MAX);
    priority_queue<pair<int,int> ,vector<pair<int,int> >, greater<pair<int,int> > > q;
    q.push(make_pair(0, 0));

    long long ret = 0;
    while(!q.empty()){
        pair<int, int> p = q.top();
        q.pop();
        int v = p.second;
        if(used[v])
            continue;
        ret += p.first;
        used[v] = true;
        if(++usedNum == n)
            return ret;
        for(unsigned i=0; i<edges[v].size(); ++i){
            Edge e = edges[v][i];
            if(!used[e.to] && e.cost < minCost[e.to]){
                minCost[e.to] = e.cost;
                q.push(make_pair(e.cost, e.to));
            }
        }
    }
    return -1;
}

int main()
{
    int n;
    cin >> n;
    vector<vector<pair<int, int> > > v(2, vector<pair<int, int> >(n));
    for(int i=0; i<n; ++i){
        for(int j=0; j<2; ++j){
            cin >> v[j][i].first;
            v[j][i].second = i;
        }
    }

    vector<vector<Edge> > edges(n);
    for(int i=0; i<2; ++i){
        sort(v[i].begin(), v[i].end());
        for(int j=0; j<n-1; ++j){
            int a = v[i][j].second;
            int b = v[i][j+1].second;
            int c = v[i][j+1].first - v[i][j].first;
            edges[a].push_back(Edge(b, c));
            edges[b].push_back(Edge(a, c));
        }
    }
    cout << minSpanningTree(edges) << endl;

    return 0;
}


Measured memory_bytes: 11888
#include <bits/stdc++.h>
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//const int N = 1000000;
const ll mod = 1000000007;
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
  
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * (B / gcd(A, B));
}
  
/*------------------------------------------------------------------*/

int main(){
    double a, b, x; cin >> a >> b >> x;
    if(a * a * b / 2.0 <= x){
        cout << setprecision(10) << atan((b - (x / (a * a))) / (a / 2)) * (180.0 / M_PI) << endl;
    }else{
        cout << setprecision(10) <<  (M_PI / 2.0 - atan((2 * x / (a * b)) / b)) * (180.0 / M_PI) << endl;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	char[][] c;

	void init() {
		c = new char[10][];
		c[1] = new char[5];
		c[2] = new char[3];
		c[3] = new char[3];
		c[4] = new char[3];
		c[5] = new char[3];
		c[6] = new char[3];
		c[7] = new char[4];
		c[8] = new char[3];
		c[9] = new char[4];
		int i, j;
		i = 2;
		j = 0;
		for (int alphabet = 'a'; alphabet <= 'z'; alphabet++) {
			c[i][j] = (char)(alphabet);
			j++;
			if (c[i].length <= j) {
				i++;
				j = 0;
			}
		}
		c[1][0] = '.';
		c[1][1] = ',';
		c[1][2] = '!';
		c[1][3] = '?';
		c[1][4] = ' ';
	}

	void run() {
		Scanner sc = new Scanner(System.in);

		init();

		for (int T = sc.nextInt() - 1; 0 <= T; T--) {
			char[] f = sc.next().toCharArray();
			int i, j;
			i = j = -1;
			for (int k = 0; k < f.length; k++) {
				if (f[k] != '0') {
					if (k != 0 && f[k] == f[k - 1]) {
						j++;
						j %= c[i].length;
					} else {
						i = f[k] - '0';
						j = 0;
					}
				} else {
					if (i != -1 && j != -1) {
						System.out.print(c[i][j]);
					}
					i = -1;
					j = -1;
				}
			}
			System.out.println();
		}
	}

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

Measured memory_bytes: 23848
#include<stdio.h>
#define M 100000

int p(int i){return i/2;}
int l(int i){return i*2;}
int r(int i){return i*2 +1;}

int main()
{
  int N,i,S[M+1];

  scanf("%d",&N);

  for(i=1;i<=N;i++)
  {
    scanf("%d",&S[i]);
  }
  for(i=1;i<=N;i++)
  {
    printf("node %d: key = %d, ",i,S[i]);
    if(p(i)>=1)printf("parent key = %d, ",S[p(i)]);
    if(l(i)<=N)printf("left key = %d, ",S[l(i)]);
    if(r(i)<=N)printf("right key = %d, ",S[r(i)]);
    printf("\n");
  }
  return 0;
}

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

int main(){
  int N, M, i;
  cin >> N >> M;
  
  i = N;
  int a, b, c, d, sum = 0;
  for(;i <= M; i++){
    a = i / 10000;
    b = (i / 1000) % 10;
    c = (i / 10) % 10;
    d = i % 10;
    if(a == d)
      if(b == c)
        sum++;
    
  }
  cout << sum << endl;
}
        

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

// コンテスト中のみ
#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
int MOD = 1000000007;
const ll INF = 1LL << 60;



signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n; ll k; cin >> n >> k;
	vector<ll>p(n), c(n); rep(i, n)cin >> p[i];
	rep(i, n)cin >> c[i];
	rep(i, n)p[i]--;
	if (k <= n) {
		int ans = -INF;
		rep(i, n) {
			int now = i;
			int s = 0;
			rep(j, k) {
				now = p[now];
				s += c[now];
				ans = max(ans, s);
			}
		}
		cout << ans << endl;
	}
	else {
		vector<vector<int>>next(45, vector<int>(n)), sum(45, vector<int>(n));
		rep(i, n)next[0][i] = p[i];
		for (int i = 1; i < 45; i++) {
			rep(j, n) {
				next[i][j] = next[i - 1][next[i - 1][j]];
			}
		}
		rep(i, n) {
			sum[0][i] = c[p[i]];
		}
		for (int i = 1; i < 45; i++) {
			rep(j, n) {
				sum[i][j] = sum[i - 1][next[i - 1][j]] + sum[i - 1][j];
			}
		}
		int ans = -INF;
		rep(i, n) {
			int now = i;
			int s = 0;
			rep(j, n) {
				now = p[now];
				s += c[now];
				ans = max(ans, s);
			}
			now = i; s = 0;
			rep(j, 45) {
				if ((k - n) >> j & 1) {
					s += sum[j][now];
					now = next[j][now];
				}
			}
			ans = max(ans, s);
			rep(j, n) {
				now = p[now];
				s += c[now];
				ans = max(ans, s);
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 6868
#include  <iostream>
#include  <cstdlib>

using namespace std;

int main()
{
	int n, l;
	int a[201];
	cin >> n >> l;

	for (int i = 1; i <= n; i++) {
		a[i] = l + i - 1;
	}
	int m = a[1];
	for (int i = 1; i <= n; i++) {
		if (abs(m) > abs(a[i]))  m = a[i];
	}

	int sum = 0;
	for (int i = 1; i <= n; i++)  sum += a[i];
	cout << sum - m << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#include <cmath>
#include <random>
#include <climits>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <stack>

#define mod 1000000007
#define INF2 9999999999
#define INF (1<<30)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define P pair<int, int>

using namespace std;
using ll = long long;

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

struct edge {int from, to, cost; };

void solve(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a+b >= c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

int main(){
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[1010];
int main() {
    int n;
    cin>>n;
    a[0] = 2;
    a[1] = 1;
    for(int i = 2;i <= n;i++) {
        a[i] = a[i - 1] + a[i - 2];
    }
    cout<<a[n]<<"\n";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int p,q;
	int i,j,k;
	int result[100];
	int amari[100];
	while(scanf("%d%d",&p,&q)==2) {
		amari[0]=p;
		for(i=0;i<100;i++) {
			result[i]=(p*10)/q;
			p=(p*10)%q;
			amari[i+1]=p;
			if(p==0) {
				for(j=0;j<=i;j++)printf("%d",result[j]);
				putchar('\n');
				break;
			}
			for(j=0;j<=i;j++) {
				if(amari[j]==p) {
					for(k=0;k<=i;k++)printf("%d",result[k]);
					putchar('\n');
					for(k=0;k<j;k++)putchar(' ');
					for(;k<=i;k++)putchar('^');
					putchar('\n');
					i=100000;//break outer loop
					break;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 0
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List

main = do
    [n, m, l] <- map read . words <$> getLine
    a <- replicateM n $ map read . words <$> getLine
    b <- transpose . map (map read . words) <$> replicateM m getLine
    mapM_ putStrLn [unwords [show . foldr1 (+) . map (uncurry (*)) $ zip u v  | v <- b] | u <- a]

Measured memory_bytes: 12272
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for (ll i=0; i<n; ++i)
#define all(c) begin(c),end(c)
#define PI acos(-1)
#define oo LLONG_MAX
template<typename T1, typename T2>
bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
template<typename T1, typename T2>
bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
/*

*/
int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  
  ll N, ans = 0;
  cin >> N;
  vector<ll> L(N, 0);
  rep(i, N)
    cin >> L[i];
  sort(all(L));
  rep(i, N-2){
    for(ll j = i+1; j < N-1; j++){
      for(ll k = j+1; k < N; k++){
        ll a=L[i];
        ll b=L[j];
        ll c=L[k];
        if (a==b || b==c || c==a)
          continue;
        if (a + b > c){
          ans++;
//          cout<<a<<" "<<b<<" "<<c<<endl;
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3664
num = list(map(int,list(input())))

for i in range(len(num) ** 2):
  op = []
  for j in range(len(num)):
    if (i >> j) & 1:
      op.append("+")
    else:
      op.append("-")
  sum = num[0]
  for k in range(len(num)-1):
    if op[k] == "+":
      sum += num[k+1]
    elif op[k] == "-":
      sum -= num[k+1]
  if sum == 7:
    print("{}{}{}{}{}{}{}=7".format(num[0],op[0],num[1],op[1],num[2],op[2],num[3]))
    break

Measured memory_bytes: 3064
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#ifdef __GXX_EXPERIMENTAL_CXX0X__
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif


using namespace std;

string saiki(int N,string str)
{
	if (N == 0)return str;
	char memo=0;
	int count = 0;
	string ans = "";
	for (auto x : str)
	{
		if (x == memo)
		{
			count++;
		} else
		{
			if (memo == 0)
			{
				memo = x;
				count = 1;
			} else
			{
				ans += to_string(count);
				ans += memo;
				memo = x;
				count = 1;
			}
		}
	}
	ans += to_string(count);
	ans += memo;
	return saiki(N-1,ans);
}

int main()
{
	int N;
	string str;
	while (1)
	{
		cin >> N;
		if (!N)break;
		cin >> str;
		cout << saiki(N, str)<<endl;
	}
}

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

using namespace std;

string s;
long long res,cnt[10000];

int main() {
  //  freopen("in.txt","r",stdin);
    ios_base::sync_with_stdio(0);
    cin>>s;
    res=1;
    for (int i=0;i<s.length();i++) {
        res+=(i-cnt[(int)s[i]]);
        cnt[(int)s[i]]++;
       // cout<<res<<" "<<s[i]<<" "<<cnt[(int)s[i]]<<endl;
    }
    cout<<res;
}


Measured memory_bytes: 720
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = Integer.parseInt(scanner.next());

        Long[][] ab = new Long[N][2];

        for (int i = 0; i < N; i++) {
            ab[i][0] = Long.parseLong(scanner.next());
            ab[i][1] = Long.parseLong(scanner.next());
        }
        scanner.close();

        // 締め切りの昇順
        Arrays.sort(ab, (a, b) -> (int) (a[1] - b[1]));

        int currentTime = 0;
        for (int i = 0; i < N; i++) {
            long time = ab[i][0];
            long limit = ab[i][1];

            currentTime += time;
            if (limit < currentTime) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 87336
#include <stdio.h>
int main(void){
    /* 変数宣言，ちゃんと初期化しよう */
    int A = 0;
    int B = 0;
    int C = 0;
    int ans = 0;
    /* 変数宣言終わり */
    
    /* 入力を受け付ける部分*/
    
    // %dはdecimalの略．つまり，入力を10進数として扱うよという意味．
    scanf("%d %d %d", &A, &B, &C);
    
    /* 入力を受け付ける部分終わり*/
    
    
    /* 何か処理*/
    
    
    
    if(A + B + C  >= 22){
      /* 真の場合の処理 */
      printf("bust");
    }else{
      /* 偽の場合の処理 */
      printf("win");
    }
    
    for(int i = 0; i < 10; i++){ 
      // i = 0,1,2,3,4,5,6,7,8,9のとき処理される
      
    }
    
    /* 何か処理終わり*/
    
    
    /* 出力する部分*/
    
    // printf("%d", ans); // %dの部分にansの値が表示される
    
    /* 出力する部分*/
    
    
    
    return 0;
}


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

int main() {

	vector<int> ans;
	int a, b;
	//int cnt = 0;

	while (1) {
		cin >> a >> b;
		if (cin.eof()) { break; }
		ans.push_back(a + b);
	}

	for (int i = 0; i < ans.size(); i++)
	{
		string str = to_string(ans[i]);
		cout << str.size() << endl;
	}

	return 0;
}

Measured memory_bytes: 3228
#include <iostream>
#include <algorithm>
#include <bitset>
#include <vector>
using namespace std;
int main(void) {
  int n, k;
  cin >> n >> k;
  vector<int> a;
  int need = 0;
  for (int i = 0; i < n; i++) {
    int b;
    cin >> b;
    if (b < k) {
      a.push_back(b);
    }
  }
  bitset<5000> bs;
  sort(a.begin(), a.end());
  int lhs = 0, rhs = a.size();
  while(rhs != lhs) {
    bs.reset();
    bs[0] = 1;
    int i = (lhs + rhs) / 2;
    for (int j = 0; j < a.size(); j++) {
      if (j != i) {
        bs = bs | bs << a[j];
      }
    }
    bool isneed = 0;
    for (int j = k - a[i]; j < k; j++) {
      isneed |= bs[j];
    }
    if (isneed) {
      rhs = i;
    } else {
      lhs = i + 1;
    }
  }
  cout << rhs << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
using LL = long long;
using P = pair<int,int>;
const int INF=1e9;

int main(){
	int N;
	cin >> N;
	vector<int> a(N);
	rep(i,N) cin >> a[i];
	int ans=INF;
	for(int i=-100; i<=100; i++){
		int res=0;
		rep(j,N) res+=(i-a[j])*(i-a[j]);
		ans=min(ans,res);
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N, Q;
ll u, v;
vector<ll> adj[200005];
ll A, B;
map<ll, ll> mp;
ll cost[200005];
ll vis[200005];

void dfs(int ind, int currCost) {
	vis[ind] = 1;
	currCost += mp[ind];
	cost[ind] = currCost;

	for(int i = 0; i < adj[ind].size(); i++) {
		if(!vis[adj[ind][i]]) {
			dfs(adj[ind][i], currCost);
			vis[adj[ind][i]] = 1;
		}
	}

}


int main() {
	scanf("%lld %lld", &N, &Q);
	for(int i = 0; i < N - 1; i++) {
		scanf("%lld %lld", &u, &v);
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	for(int i = 0; i < Q; i++) {
		scanf("%lld %lld", &A, &B);
		mp[A] += B;
	}
	dfs(1, 0);
	for(int i = 1; i <= N; i++) {
		cout << cost[i] << " ";
	}

	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 41472
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;

struct Task {
    int A;
    int B;
};

bool operator<(const Task& left, const Task& right) {
    return left.B < right.B;
}

int main() {
    int N; cin >> N;
    vector<Task> T(N);
    for (int i = 0; i < N; i++) {
        cin >> T[i].A >> T[i].B;
    }
    sort(T.begin(), T.end());
    long sum_val = 0;
    for (int i = 0; i < N; i++) {
        sum_val += T[i].A;
        if (sum_val > T[i].B) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


int main() {
  int n,m;
  cin>>n;
  vector<int> t(n);
  ll sum=0;
  rep(i,n){
    cin>>t[i];
    sum+=t[i];
  }
  cin>>m;

  rep(i,m){
    int p,x;
    cin>>p>>x;
    p--;
    ll ans=sum-t[p]+x;
    cout<<ans<<"\n";
  }


  return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]

A = [flatten for inner in A for flatten in inner[1:]]
#print(A)
import collections
A_cnt = collections.Counter(A)
print(sum([l[1]==N for l in A_cnt.most_common()]))


Measured memory_bytes: 3444
package main

import "fmt"

func main() {
	var (
		n int
		s string
	)
	fmt.Scan(&n, &s)

	countRed := 0
	for i := range s {
		if s[i] == 'R' {
			countRed++
		}
	}

	if countRed > len(s)/2 {
		fmt.Println("Yes")
		return
	}
	fmt.Println("No")
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef pair<int,int>P;
typedef pair<P,P>Q;
queue<Q>que;
int dx[]={0,1,0,-1};
int dy[]={-1,0,1,0};
int d[1009][1009];

int main(){
  int h,w;
  char mp[1009][1009];
  memset(d,-1,sizeof(d));
  cin>>h>>w;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>mp[i][j];
      if(mp[i][j]=='#'){
	que.push(Q(P(j,i),P(0,0)));
	d[i][j]=0;
      }
    }
  }

  while(!que.empty()){
    Q now=que.front();que.pop();
    int x=now.fi.fi;
    int y=now.fi.se;
    int cnt=now.se.fi;

    for(int i=0;i<4;i++){
      int nx=x+dx[i];
      int ny=y+dy[i];
      if(0<=nx&&nx<w&&0<=ny&&ny<h&&d[ny][nx]==-1){
	que.push(Q(P(nx,ny),P(cnt+1,0)));
	d[ny][nx]=cnt+1;
      }
    }
  }

  int ans=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      ans=max(ans,d[i][j]);
    }
  }

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


Measured memory_bytes: 21556
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
class segtree
{
  public:
  int depth;//セグ木の深さ(最上部が0）
  int size;
  vector<P> node;//セグ木本体

  //コンストラクタ
  //初期値の代入もする
  segtree(int n/*,vector<int> v*/)
  {
    depth=0;
    size=1;
    while(n>size)
    {
      size*=2;
      depth++;
    }
    size*=2;
    node.resize(size,P(1e8-1,1e8-1));
    //最下段に値を入れたあとに、下の段から順番に値を入れる
    //値を入れるには自分の子の2値を参照する
    // for(int i=0;i<n;i++)
    //   node[i+(1<<depth)]=v[i];
    
    // for(int d=depth-1;d>=0;d--)
    // {
    //   for(int i=0;i<(1<<d);i++)
    //   {
    //     int ind=i+(1<<d);
    //     node[ind]=min(node[ind*2],node[ind*2+1]);
    //   }
    // }
  }

  //値の更新
  //node[k]をaにする
  void update(int k,P a)
  {
    k+=(1<<depth);//セグ木上のインデックスに読み替え
    node[k]=a;
    while(k>0)
    {
      k/=2;
      node[k]=min(node[k*2],node[k*2+1]);
    }
    return;
  }
  
  //値の取得
  //閉区間[l,r]の最小値
  P get(int l,int r)
  {
    l+=(1<<depth);
    r+=(1<<depth);
    if(l==r)
      return node[l];
    int ret=l;
    while(l<=r)
		{
			if(!(r&1))
			{
				if(node[ret]>node[r])
					ret=r;
				r--;
			}
			if(l&1)
			{
				if(node[ret]>node[l])
					ret=l;
				l++;
			}
			l/=2;r/=2;
		}
    return node[ret];
  }
};
string s;
int main()
{
  int n,m;
	cin>>n>>m;
	segtree seg=segtree(n+1);
	cin>>s;
	//可能か調べておく
	for(int i=0;i<s.size();i++)
	{
		int cnt=0;
		while(s[i]=='1')
		{
			cnt++;i++;
		}
		if(cnt>=m)
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	seg.update(n,P(0,n));
	//構築
	for(int i=n-1;i>-1;i--)
	{
		if(s[i]=='1')
			continue;
		//先のマスから求める
		P tmp=seg.get(i+1,min(i+m,n));
		//cerr<<tmp.first<<" "<<tmp.second<<endl;
		seg.update(i,P(tmp.first+1,i));
	}
	//復元
	vector<int> ans;
	ans.push_back(0);
	while(ans[ans.size()-1]<n)
	{
		int tmp=ans[ans.size()-1];
		ans.push_back(seg.get(tmp+1,min(tmp+m,n)).second);
	}
	for(int i=1;i<ans.size();i++)
		cout<<ans[i]-ans[i-1]<<" ";
	cout<<endl;
  return 0;
}

Measured memory_bytes: 3192
from sys import stdin, exit

N = int(stdin.readline().rstrip())
s = [int(stdin.readline().rstrip()) for _ in range(N)]
dp = [0] * (100 * N)
dp[0] = 1
for n in range(N):
    for p in range(len(dp) - 1, 0, -1):
        if p - s[n] >= 0:
            if dp[p - s[n]] == 1 and 0 <= p:
                dp[p] = 1
for k in range(len(dp)):
    if dp[len(dp) - k - 1] == 1 and (len(dp) - k - 1) % 10 != 0:
        print(len(dp) - k - 1)
        exit()
print('0')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
#define pll pair<ll,ll>
using ll=long long;
using ld=long double;
const ll INF = 1LL<<60;
const ll mod=1e9+7;
using namespace std;
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

string s;
map<string,ll> p;
int main(){
    ll n;
    cin>>n;
    rep(i,0,n){cin>>s;p[s]++;}
    cout<<"AC x "<<p["AC"]<<endl;
    cout<<"WA x "<<p["WA"]<<endl;
    cout<<"TLE x "<<p["TLE"]<<endl;
    cout<<"RE x "<<p["RE"]<<endl;
}




Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,mx=0;
vector<pair<int,int> >v;
cin>>n;
int a[n+1],b[n+1];
for(int i=0;i<n;i++){
    cin>>a[i];
}
int sum=0;
for(int i=0;i<n;i++){
    cin>>b[i];
    sum+=(a[i]-b[i]);
}
for(int i=0;i<n;i++){
    if(a[i]-b[i]<0){
        sum-=(a[i]-b[i]);
    }
}
cout<<sum;
}

Measured memory_bytes: 3636
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template <class T> inline T gcd(T a, T b) {if(a==0) return b; return gcd(b%a,a);}
template <class T> inline T lcm(T a, T b) {return a * b / gcd(a,b);}
template <class T> inline T sum(vector<T> &vec) {T res=0; for (int i = 0; i < vec.size(); i++) res += vec[i]; return res;}
template <class T> inline T mpow(T a, T b) {if(b==0)return 1; T c = mpow(a,b/2);if(b%2==1)return c*c*a; return c*c;}
const int INF = 1 << 30;
const long long INFLL = 1LL << 60;
typedef pair<int, int> P;

#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define FOR(i,n) for (int (i)=0;(i)<(n);(i)++)
#define REPB(i,n) for (int (i)=((n)-1);(i)>=0;(i)--)
#define FORB(i,n) for (int (i)=((n)-1);(i)>=0;(i)--)
#define SORT(A) sort((A).begin(),(A).end())

vector<ll> fac = {1}; 
vector<ll> ifac = {1}; 

ll mpow(ll x, ll n, ll mod){ 
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % mod;
        x = x*x % mod;
        n = n >> 1;
    }
    return ans;
}

void init(ll n, ll mod) {
    for (ll i = 0; i < n; i++) {
        fac.push_back(fac[fac.size()-1] * (i+1) % mod);
        ifac.push_back(ifac[ifac.size()-1] * mpow(i+1,mod-2,mod) % mod);
    }
}

ll cmb(ll n, ll r, ll mod){ //aCbをmod計算
    if (n == 0 && r == 0) return 1;
    if (n < r || n < 0) return 0;
    ll tmp = ifac[n-r]* ifac[r] % mod;
    return tmp * fac[n] % mod;
}

int main() {
    ll N, K; cin >> N >> K;
    vll A(N);
    FOR(i,N) cin >> A[i];
    SORT(A);
    ll D = 1e9+7;
    init(N+1,D);
    ll res = 0;
    FOR(i,N) {
        ll b = 0;
        if (i+1 >= K) b += cmb(i,K-1,D);
        if (N-i >= K) b -= cmb(N-i-1,K-1,D);
        res += b * A[i] % D; 
    }
    cout << res % D << endl;
}

Measured memory_bytes: 2804
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;

int main() {
	string A, B, a, b;
	cin >> A >> B;
	if (A.size() > B.size()) {
		cout << "GREATER\n";
		return 0;
	}
	else {
		if (A.size() < B.size()) {
			cout << "LESS\n";
			return 0;
		}
		else {
			for (int i = 0;i < A.size();i++) {
				a = A[i], b = B[i];
				if (stoi(a) > stoi(b)) {
					cout << "GREATER\n";
					return 0;
				}
				else if (stoi(a) < stoi(b)) {
					cout << "LESS\n";
					return 0;
				}
			}
			cout << "EQUAL\n";
			return 0;
		}
	}

	return 0;

}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>

bool ton[200001];

int main()
{
  int n, m;
  scanf("%d%d", &n, &m);
  std::vector<int> v;
  for (int i = 0; i < m; ++i)
  {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a == 1)
    {
      v.emplace_back(b);
    }
    else if (b == n)
    {
      ton[a] = true;
    }
  }
  for (auto a : v)
  {
    if (ton[a])
    {
      puts("POSSIBLE");
      return 0;
    }
  }
  puts("IMPOSSIBLE");
  return 0;
}

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

int main(){
  int H, W;
  cin >> H >> W;
  
  vector<vector<char>> mine(H, vector<char>(W));
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      cin >> mine.at(i).at(j);
    }
  }
  
  vector<vector<int>> ans(H, vector<int>(W));
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      ans.at(i).at(j) = 0;
    }
  }
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(mine.at(i).at(j) == '#'){
        continue;
      }
      else{
        if(i != 0){
          if(mine.at(i-1).at(j) == '#'){
            ans.at(i).at(j) ++;
          }
        }
        if(i != H - 1){
          if(mine.at(i+1).at(j) == '#'){
            ans.at(i).at(j) ++;
          }
        }
        
        if(j != 0){
          if(mine.at(i).at(j-1) == '#'){
            ans.at(i).at(j) ++;
          }
          if(i != 0){
            if(mine.at(i-1).at(j-1) == '#'){
              ans.at(i).at(j) ++;
            }
          }
          if(i != H - 1){
            if(mine.at(i+1).at(j-1) == '#'){
              ans.at(i).at(j) ++;
            }
          }
        }
        if(j != W - 1){
          if(mine.at(i).at(j+1) == '#'){
            ans.at(i).at(j) ++;
          }
          if(i != 0){
            if(mine.at(i-1).at(j+1) == '#'){
              ans.at(i).at(j) ++;
            }
          }
          if(i != H - 1){
            if(mine.at(i+1).at(j+1) == '#'){
              ans.at(i).at(j) ++;
            }
          }
        }
      }
    }
  }
  
  char output = '0';
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      if(mine.at(i).at(j) == '#'){
        cout << '#';
      }
      else{
        output += ans.at(i).at(j);
        cout << output;
        output = '0';
      }
    }
    cout << endl;
  }
  
}


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

int main(){
  string s;cin >> s;
  map<char,int> m;
  for(int i=0;i<4;++i){
    m[s[i]] += 1;
    if(m[s[i]] > 2){
      cout << "No" << endl;
      return 0;
    }
  }
  for(int i=0;i<4;++i){
    if(m[s[i]] == 1){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define mp make_pair
#define IP pair<int,int>
#define enld endl

int main() {
	double V;
	double g = 9.8;
	while (cin >> V) {
		double a = (V * V / g / 2 + 5)/5;
		cout << int(a) + bool(a - int(a)) << enld;
	}
}


Measured memory_bytes: 3164
function Main(input) {
	// 1行目がinpt[0], 2行目がinpt[1], …に入る
	// var inpt = input.split("\n");

	// 1つめがinpt[0], 2つめがinpt[1], …に入る
	var inpt = input.split(' ');

	// 出力
	console.log(yesOrNo(matchGroupe(inpt[0],inpt[1])));
}

function matchGroupe(x,y) {
	var g1 = [1,3,5,7,8,10,12];
	var g2 = [4,6,9,11];
	return (isMatch(x,g1) && isMatch(y,g1)) || (isMatch(x,g2) && isMatch(y,g2));
}

function isMatch(num, arr) {
	if (arr.indexOf(+num) === -1) {
		return false;
	} else {
		return true;
	}
}

function yesOrNo(bol) {
	return bol ? 'Yes' : 'No';
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
#include<stdio.h>

int main(void){
	int n,x,y,mo,cnt;
	char c;
	int m[21][21];
	for(;;){
		scanf("%d",&n);
		if(n==0)break;
		cnt=0;
		for(int i=0;i<21;i++)for(int j=0;j<21;j++)m[i][j]=0;
		for(int i=0;i<n;i++){
			scanf("%d%d",&x,&y);
			if(x!=10&&y!=10){
				m[x][y]=1;
				cnt++;
			}
		}
		scanf("%d",&n);
		x=y=10;
		for(int i=0;i<n;i++){
			scanf(" %c%d",&c,&mo);
			for(int j=0;j<mo;j++){
				if(c=='N')y++;
				else if(c=='E')x++;
				else if(c=='W')x--;
				else if(c=='S')y--;
				if(m[x][y]==1){
					m[x][y]=0;
					cnt--;
				}
			}
		}
		puts(cnt==0?"Yes":"No");
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <math.h>
#include <algorithm>
#include <queue>
#include <map>
#include <list>
//#include <bits/stdc++.h>


using namespace std;

#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
typedef long long ll;

int main(){
    int N;
    cin >> N;
    ll ans = 0;
    FOR(i, 1, N + 1){
        if(i % 3 != 0 && i % 5 != 0){
            ans += i;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	string s;cin>>s;
	for(ll i=1;i<4;i++)
	{
		if(s[i]==s[i-1])
		{
			cout<<"Bad";
			return 0;
		}
	}
	cout<<"Good";
	return 0;
}


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

long long a[1005], b[1005];
long long x, y, n, m, aa;

long long read(){
	long long x, f = 1;
	char c = getchar();
	while (c < '0' || c > '9'){
		if (c == '-') f = -1;
		c = getchar();
	}
	x = c ^ '0';
	c = getchar();
	while (c >= '0' && c <= '9'){
		x = (x << 1) + (x << 3) + (c ^ '0');
		c = getchar();
	}
	return f == 1 ? x : -x;
}

void print(long long x){
	if (x < 0){
		putchar('-');
		print(-x);
		return ;
	}
	if (x >= 10) print(x / 10);
	putchar(char(x % 10 + '0'));
}

int main(){
	n = read(), m = read(), x = read(), y = read();
	for (int i = 1; i <= n; ++i)
		a[i] = read();
	for (int i = 1; i <= m; ++i)
		b[i] = read();
	sort(a + 1, a + n + 1);
	sort(b + 1, b + m + 1);
	aa = b[1];
	if (aa <= x || aa <= a[n] || aa > y){
		cout << "War" << endl;
		return 0;
	}
	cout << "No War" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int n,h,w;
	scanf("%d%d%d",&n,&h,&w);
	int ans=0;
	for(int i=0;i<n;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		if(a>=h&&b>=w)ans++;
	}
	printf("%d",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int N, i;
    cin >> N >> i;
    cout << N+1-i << endl;
    return 0;
}



Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    double A = Double.parseDouble(sc.next());
    double B = Double.parseDouble(sc.next());
    double H = Double.parseDouble(sc.next());
    double M = Double.parseDouble(sc.next());
    double radH = -Math.toRadians((H + M / 60D) * 30D) + 90D;
    double radM = -Math.toRadians(M * 6D) + 90D;
    double hX = A * Math.cos(radH);
    double hY = A * Math.sin(radH);
    double mX = B * Math.cos(radM);
    double mY = B * Math.sin(radM);
    double distance = Math.sqrt((hX - mX) * (hX - mX) + (hY - mY) * (hY - mY));
    System.out.println(distance);
  }
}

Measured memory_bytes: 35744