akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll gcd(ll a, ll b){
	return ((b)?gcd(b,a%b):a);
}

int main(void){
	ll a,b,g,i,ans=1ll;
	cin >> a >> b;
	g = gcd(a,b);
	for(i=2ll; i*i<=g; ++i){
		if(g%i){
			continue;
		}
		++ans;
		while(!(g%i)){
			g /= i;
		}
	}
	if(g>1ll){
		++ans;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
import bisect
import sys

input=sys.stdin.readline

n=int(input())
a=[int(input()) for _ in range(n)]

#A=[float('inf')*n ]

A=[float('inf')]

for i in range(n):
    if a[i]>A[-1]:
        A.append(a[i])
    else:
        idx=bisect.bisect_left(A,a[i])
        A[idx]=a[i]

print(len(A))


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

int main() {
    int a, b;
    scanf("%d %d", &a, &b);

    if (a < b) {
        printf("a < b");
    } else if (a > b) {
        printf("a > b");
    } else {
        printf("a == b");
    }

    printf("\n");

/***
    int h = S / (60 * 60);
    int m = (S - h * (60 * 60)) / 60;
    int s = S % 60;

    cout << h << ':' << m << ':' << s;


    //scanf("%d %d", &a, &b);
    //cin >> a >> b;
    //c = a + b;
    //cout << a << " + " << b << " = " << c << '\n';
    //printf("%d %d\n", a * b, 2 * (a + b));
***/

    return 0;
}

Measured memory_bytes: 1176
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }

vector<vector<pair<int, int>>> g;
vector<int> dp;
void dfs(int u, int par) {
    if (~dp[u]) return ;
    dp[u] = 0;
    for (auto &p: g[u]) if (p.first != par) {
        int v = p.first, c = p.second;
        dfs(v, u);
        chmax(dp[u], dp[v] + c);
    }
}

int main() {
    int n, m; cin >> n >> m;
    g.resize(n);
    while (m--) {
        int a, b, c; cin >> a >> b >> c;
        g[a].emplace_back(b, c);
    }
    dp.assign(n, -1);
    for (int i = 0; i < n; i++) dfs(i, -1);
    cout << *max_element(dp.begin(), dp.end()) << endl;
    return 0;
}


Measured memory_bytes: 3092
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

def kaijo(i):
  x = i
  while i > 1:
    i -= 1
    x = x * i
  return x

nokori = list(range(1,N+1))
cnt = 0
for keta in range(1,N+1):
#  print("今は"+str(keta)+"桁目の"+str(P[keta-1])+"を見ています")
#  print("あと"+str(N-keta))
  nokori.sort()
#  print(str(nokori) + "の残りリストの中で何番目に小さいか？")
  banme = nokori.index(P[keta-1])+1
#  print(banme)
  cnt = cnt + kaijo(N-keta) * (banme -1) + 1
  nokori.remove(P[keta-1])
#  print("削除後:"+str(nokori))
#  print("cnt"+str(cnt))
#print(cnt)

nokori = list(range(1,N+1))
cntQ = 0
for keta in range(1,N+1):
#  print("今は"+str(keta)+"桁目の"+str(Q[keta-1])+"を見ています")
#  print("あと"+str(N-keta))
  nokori.sort()
#  print(str(nokori) + "の残りリストの中で何番目に小さいか？")
  banme = nokori.index(Q[keta-1])+1
#  print(banme)
  cntQ = cntQ + kaijo(N-keta) * (banme -1) + 1
  nokori.remove(Q[keta-1])
print(abs(cnt - cntQ))




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


using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 1000000007;


int main() {

	string s;
	int q;
	cin >> s;
	cin >> q;
	int cnt = 0;

	string se = "";
	string ato = "";

	REP(qi, q) {
		int t;
		cin >> t;
		if (t == 1) {
			cnt++;
		}
		else {
			int f;
			cin >> f;
			char c;
			cin >> c;
			if (cnt % 2 == 0) {
				if (f == 1)se += c;
				else ato += c;
			}
			else {
				if (f == 1)ato += c;
				else se += c;
			}
		}
	}


	if (cnt % 2) {
		reverse(ALL(s));
		swap(se, ato);
	}

	reverse(ALL(se));

	cout << se + s + ato << endl;


}

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

int main()
{
	string s, p;
	cin >> s;
	string pcin;
	int ans = 0;
	size_t found = 0;
	while (cin >> pcin)
	{
		if (pcin == "END_OF_TEXT")
		{
			break;
		}
		//p += pcin + " ";
		transform(pcin.begin(), pcin.end(), pcin.begin(), ::tolower);
		if (pcin == s)
		{
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int& a : A) cin >> a;
  int x = N - K, y = K - 1;
  cout << 1 + x / y + (x % y != 0) << endl;
}

Measured memory_bytes: 640
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			if(n == 0){
				break;
			}
			String[] team = new String[n];
			int[] score = new int[n];
			for(int i = 0;i < n;i++){
				team[i] = scan.next();
				for(int j = 1;j < n;j++){
					int t = scan.nextInt();
					score[i] += (t == 0)?n:(t == 2)?1:0;
				}
			}
			for(int i = 0;i < n;i++){
				for(int j = n-1;j > i;j--){
					if(score[j] > score[j-1]){
						swap(score,team,j-1,j);
					}
				}
			}
			for(int i = 0;i < n;i++){
				System.out.println(team[i]);
			}
        }
	}
	
	public static void swap(int[] a,String[] b,int i,int j){
		int t = a[j];a[j] = a[i];a[i] = t;
		String tt = b[j];b[j] = b[i];b[i] = tt;
	}
}

Measured memory_bytes: 23316
public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		int r = scan.nextInt();
		int c = scan.nextInt();

		int[][] arr  = new int[r][c];
		int sum = 0;
		int kai = 0;
		for(int i = 0; i < r; i++){
			sum = 0;
			for(int j = 0; j < c; j++){
				arr[i][j] = scan.nextInt();
				System.out.print(arr[i][j] + " ");
				sum += arr[i][j];
			}
			kai += sum;
			System.out.println(sum);
		}

		for(int i = 0; i < c; i++){
			sum = 0;
			for(int j = 0; j < r; j++){
				sum += arr[j][i];
			}
			System.out.print(sum + " ");
		}
		System.out.println(kai);
	}
}

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

int main(){
    int a, b, c;
    while( cin >> a >> b >> c ){
        int n[11], m = 0;
        fill( n, n + 11, 1 );
        n[a] = n[b] = n[c] = 0;
        for(int i = 1; i < 11; i++){
            if( n[i] && a+b+i <= 20 ) m++;
        }
        if( m >= 4 ) cout << "YES" << endl;
        else cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 1156
def main():
    from heapq import heappush, heappop

    INF = 1 << 60
    MX_AG = 2500

    N, M, S = map(int, input().split())
    S = min(S, MX_AG)  # それ以上のAgは不要

    g = tuple(set() for _ in range(N))
    for _ in range(M):
        u, v, a, b = map(int, input().split())
        u -= 1
        v -= 1
        g[u].add((v, a, b))
        g[v].add((u, a, b))

    exchange = []
    for _ in range(N):
        c, d = map(int, input().split())
        exchange.append((c, d))

    h = [(0, S, 0)]

    time = [[INF] * (MX_AG + 1) for _ in range(N)]
    time[0][S] = 0
    # time[location][r_Ag]:=minimum_time_to_reach

    while h:
        t, ag, loc = heappop(h)
        for to, fare, dt in g[loc]:
            n_Ag = ag - fare
            if n_Ag < 0: continue
            cf = time[to][n_Ag]
            n_time = t + dt
            if cf <= n_time: continue
            time[to][n_Ag] = n_time
            heappush(h, (n_time, n_Ag, to))

        e_time = t + exchange[loc][1]
        e_Ag = ag + exchange[loc][0]
        if e_Ag > MX_AG: continue
        cf = time[loc][e_Ag]
        if cf <= e_time: continue
        time[loc][e_Ag] = e_time
        heappush(h, (e_time, e_Ag, loc))

    for to in range(1, N):
        print(min(time[to]))


if __name__ == '__main__':
    main()


Measured memory_bytes: 23960
//ABC098B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <numeric>
using namespace std;

int main() {
	int n;
	string s;
	cin >> n >> s;
	int ans = 0;
	for(int i=0;i<n-1;i++){
		int count = 0;
		for(char j='a';j<='z';j++){
			bool l = false, r = false;
			for(int k=0;k<=i;k++){
				if(s.at(k) == j){
					l = true;
				}
			}
			for(int k=i+1;k<n;k++){
				if(s.at(k) == j){
					r = true;
				}
			}
			if(l && r){
				count++;
			}
		}
		ans = max(ans,count);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val k = sc.nextInt()
    val s = sc.next().toCharArray().toMutableList()
    s[k - 1] = s[k - 1].toLowerCase()
    println(s.joinToString(""))
}

Measured memory_bytes: 33876
#include<iostream>
#include<cstring>
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;

const int INF = 100000000;
typedef pair<int,int> P;

char maze[300][300];
int n,m;
int sx,sy;
int gx,gy;

int d[300][300];

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

int bfs()
{
    queue<P> que;
    for(int i = 0; i<n; i++)
    {
        for(int j = 0; j<m; j++)
        {
            d[i][j] = INF;
        }
    }
    que.push(P(sx,sy));
    d[sx][sy] = 0;
    while(que.size())
    {
        P p = que.front();// 小的p 是 大P 类型的。
        que.pop();
        if(p.first == gx && p.second == gy)
            break;
        for(int i = 0; i<4; i++)
        {
            int nx = p.first + dx[i];
            int ny = p.second + dy[i];
            if(nx>=0 && nx<=n && ny>=0 && ny<=m && maze[nx][ny] != '#' &&d [nx][ny] == INF)
            {
                que.push(P(nx,ny));
                d[nx][ny] = d[p.first][p.second] + 1;
            }
        }
    }
    return d[gx][gy];
}


int main()
{
    int ans1=0,ans2=0;
    cin>>n>>m;
    for(int i = 0; i<n; i++)
    {
        for(int j = 0; j<m; j++)
        {
            cin>>maze[i][j];
            if(maze[i][j]=='.')ans1++;
        }
    }
    sx=0,sy=0,gx=n-1,gy=m-1;
    int resourt = bfs();
    //cout<<resourt<<" "<<ans1<<endl;
    if(resourt==INF)cout<<-1;
    else cout<<ans1-resourt-1<<endl;
    return 0;
}






































































Measured memory_bytes: 384
//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
using namespace std;
typedef  long long ll ;
int main() {
    int n;
    cin>>n;
    int dp[n],a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    {
        dp[0]=0;
        dp[1]=abs(a[1]-a[0]);
        for(int i=2;i<n;i++)dp[i]=min((dp[i-2]+abs(a[i-2]-a[i])),(dp[i-1]+abs(a[i-1]-a[i])));
    }
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1024
N,C=map(int,input().split())
D=[list(map(int,input().split())) for i in range(C)]
A=[list(map(int,input().split())) for i in range(N)]
X=[[0]*C for i in range(3)]
for c in range(C):
  for i in range(N):
    for j in range(N):
      X[(i+j)%3][c]+=D[A[i][j]-1][c]
P=10**20
for i in range(C):
  for j in range(C):
    for k in range(C):
      if len(set([i,j,k]))==3:
        P=min(P,X[0][i]+X[1][j]+X[2][k])
print(P)

Measured memory_bytes: 75760
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int INF = 1000000007;
int n;
int a[100000];
int dp[100001];

signed main() {
	int i;
	
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) a[i] *= -1;
	
	rep(i, n + 1) dp[i] = INF;
	dp[0] = -INF;
	
	rep(i, n) {
		dp[upper_bound(dp, dp + n + 1, a[i]) - dp] = a[i];
	}
	
	for (i = n; i >= 0; i--) if (dp[i] != INF) break;
	cout << i << endl;
	return 0;
}

Measured memory_bytes: 1024
def main():
    N, C, K = map(int, input().split())
    T = []
    for _ in range(N):
        t = int(input())
        T.append(t)
    T.sort()

    busmintime = 0
    busmaxtime = K
    ans = 0
    cnt = 0
    i = 0
    for _ in range(N**2):
        busmintime = T[i]
        cnt += 1
        busmaxtime = busmintime + K
        for j in range(i+1, N):
            jtime = T[j]
            if jtime > busmaxtime or cnt == C:
                ans += 1
                cnt = 0
                i = j
                break
            cnt += 1
        if j == N-1:
            ans += 1
            break

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 13384
#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(s) int(s.size())

typedef long long ll;
typedef unsigned long long ull;

using namespace std;

vector<double> ans;
int n;
vector<pair<int, int> > a;

void solve(set<int> s, int c, double curr, int start){
    if(c == n){ 
        ans.pb(curr);
        return;
    }
    fore(i, 0, n){
        if(i == start || s.find(i) != s.end())continue;
        s.insert(i);
        solve(s, c+1, curr+sqrt((a[start].fst-a[i].fst)*(a[start].fst-a[i].fst) + (a[start].snd-a[i].snd)*(a[start].snd-a[i].snd)), i);
        s.erase(i);
    }
}

int main() {FIN;
    cin>>n;
    fore(i,0,n){
        int b,c;
        cin>>b>>c;
        a.pb(make_pair(b,c));
    }
    fore(i, 0, n){
        set<int> s;
        s.insert(i);
        solve(s, 1, 0.0, i);
    }
    double res = 0.0;
    fore(i, 0, ans.size()){
        res += ans[i];
    }
    res /= ans.size();
    cout<<fixed<<setprecision(10)<<res<<"\n";
}


Measured memory_bytes: 892
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N;
  cin>>N;
  ll keta;
  ll two;
  ll sum;
  vector<ll> ans(1000, 0);
  if(N==0) {
    cout<<0<<endl;
    return 0;
  }
  while(N!=0){
    if(N>0) {
      two = 1;
      keta = -1;
      sum = 0;
      while(sum<N) {
        sum += two;
        two *= 4;
        keta += 2;
      }
      ans[keta] = 1;
      two = 1;
      for(ll i=0;i<keta-1;++i) {
        two *= -2;
      }
      N -= two;
    }
    else {
      two = 2;
      keta = 0;
      sum = 0;
      while(sum>N) {
        sum -= two;
        two *= 4;
        keta += 2;
      }
      ans[keta] = 1;
      two = 1;
      for(ll i=0;i<keta-1;++i) {
        two *= -2;
      }
      N -= two;
    }
  }
  bool aru = false;
  for(int i=1000-1;i>0;--i) {
    if(aru) cout<<ans[i];
    else if(ans[i]==1) {
      aru = true;
      cout<<ans[i]; 
    }
  }
  cout<<endl;
}



Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  vector<int64> a(n), b(n), c(n);
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld%lld", &a[i], &b[i], &c[i]);
  }
  vector<int64> A(n);
  int64 best = 0;
  for (int k = 0; k < 8; ++k) {
    for (int i = 0; i < n; ++i) {
      A[i] = 0;
      A[i] += (k & 1) ? a[i] : -a[i];
      A[i] += (k & 2) ? b[i] : -b[i];
      A[i] += (k & 4) ? c[i] : -c[i];
    }
    sort(A.begin(), A.end(), greater<int64>());
    int64 cur = 0;
    for (int i = 0; i < m; ++i) cur += A[i];
    best = max(best, cur);
  }
  printf("%lld\n", best);
  return 0;
}


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

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

    //int t=1; cin>>t; while(t--)
    {
        int n;
        cin >> n;
        for(int i=1;i*i<=n;i++)
        {
            if(n % i == 0 && i<10 && n / i < 10 )
                return cout << "Yes\n",0;
        }
        cout << "No\n";
    }

    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
    return 0;
}


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

int main() {
  char a, b, c;
  cin >> a >> b >> c;
  if (a == '7' || b == '7' || c == '7' ){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3592
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
    int n, m, x;
    cin >> n >>  m >> x;
    vector<int> M(m+1);
    Graph C(n+1, M);
    for(int i=0;i<=m;i++){
        C[0][i] = 0;
    }
    for(int i=1;i<=n;i++){
        for(int j=0;j<=m;j++){
            cin >> C[i][j];
            C[0][j] += C[i][j];
        }
    }

    bool flg = true;
    int ans = 1e7;
    for(int i=1;i<=m;i++){
        if(C[0][i] < x){
            flg = false;
            ans = -1;
        }
    }
    if(flg){
        for(int bit=0;bit<(1<<n);bit++){
            vector<int> Sum(m+1, 0);
            bool check = true;
            for(int i=0;i<n;i++){
                if(bit&(1<<i)){
                    for(int j=0;j<=m;j++){
                        Sum[j] += C[i+1][j];
                    }
                }
            }
            for(int j=1;j<=m;j++){
                if(Sum[j] < x){
                    check = false;
                    break;
                }
            }
            if(check && Sum[0] < ans){
                ans = Sum[0];
            }
        }
    }

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

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int Maxn = 110;
int s[Maxn], n;
int main() {
	int i, j, k;
	scanf("%d", &n);
	int mx = 0;
	for(i = 1; i <= n; i++){
		int x;
		scanf("%d", &x);
		s[x]++;
		if(x > mx) mx = x;
	}
	if(mx&1){
		for(i = mx; i > mx/2; i--) if(s[i] < 2){ printf("Impossible\n"); return 0; }
		if(s[mx/2+1] > 2){ printf("Impossible\n"); return 0; }
		for(i = mx/2; i >= 1; i--) if(s[i]){ printf("Impossible\n"); return 0; }
		printf("Possible\n");
	} else {
		for(i = mx; i > mx/2; i--) if(s[i] < 2){ printf("Impossible\n"); return 0; }
		if(s[mx/2] != 1){ printf("Impossible\n"); return 0; }
		for(i = mx/2-1; i >= 1; i--) if(s[i]){ printf("Impossible\n"); return 0; }
		printf("Possible\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

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

int GCD(int x,int y){
  if(x<y){
    swap(x,y);
  }
  while(x%y!=0){
    int temp=x;
    x=y;
    y=temp%y;
  }
  return y;
}

int digitsum(int x){
  int sum=0;
  while(x>0){
    sum+=(x%10);
    x/=10;
  }
  return sum;
}

int main() {
  ll MOD=1000000007;
  ll s;
  cin>>s;
  ll func[2001];
  func[0]=1;
  for(int i=1;i<=2000;i++){
    func[i]=mod(func[i-1]*i,MOD);
  }
  ll revfunc[2001];
  revfunc[2000]=modpow(func[2000],MOD-2,MOD);
  for(int i=1999;i>=0;i--){
    revfunc[i]=mod(revfunc[i+1]*(i+1),MOD);
  }
  ll ans=0;
  for(int i=1;s-3*i>=0;i++){
    ll temp=mod(func[s-1-2*i]*mod(revfunc[s-3*i]*revfunc[i-1],MOD),MOD);
    ans=mod(ans+temp,MOD);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <deque>
#include <stack>
using namespace std;

int main()
{
	//freopen("input.txt", "r", stdin); /*freopen("output.txt","w",stdout);*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	/*int n;
	cin>>n;
	long long a,b;
	long long c;
	for(int i=0;i<n;i++)
	{
		cin>>c;
		if(i==0)
		{
			a=1;
			b=c;
		}
		else
		{
			a=a*c+b;
			b=b*c;
		}
		for(int ii=2;ii<=sqrt(min(a,b));ii++)
		{
			while(a%ii==0&&b%ii==0)
			{
				a/=ii;
				b/=ii;
			}
		}
	}
	cout<<fixed<<setprecision(15)<<(double)b/a;*/
	

	//freopen("input.txt", "r", stdin); /*freopen("output.txt","w",stdout);*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string x;
	cin>>x;
	if(x=="Sunny")cout<<"Cloudy";
	else if(x=="Cloudy")cout<<"Rainy";
	else cout<<"Sunny";

	return 0;
}


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

int main(){
    vector<vector<char> > c(4);
    vector<vector<int> > len(4);
    for(int i=0; i<3; i++){
        while(1){
            char letter;
            int n;
            cin >> letter;
            if(letter == '$') break;
            cin >> n;
            c[i].push_back(letter);
            len[i].push_back(n);
        }
    }

    int asize = c[0].size();
    int bsize = c[1].size();
    int csize = c[2].size();
    for(int i=0; i<asize-bsize+1; i++){
        bool flag = true;
        for(int j=0; j<bsize; j++){
            if(c[0][i+j] == c[1][j]){
                if(j==0 || j==bsize-1){
                    if(len[0][i+j]<len[1][j]){
                        flag = false;
                        break;
                    }
                }else{
                    if(len[0][i+j]!=len[1][j]){
                        flag = false;
                        break;
                    }
                }
            }else{
                flag = false;
                break;
            }
        }
        if(flag){
            int s=i;
            for(int j=0; j<s; j++){
                c[3].push_back(c[0][j]);
                len[3].push_back(len[0][j]);
            }
            if(bsize!=1){
                c[3].push_back(c[0][s]);
                len[3].push_back(len[0][s]-len[1][0]);
            }
            for(int j=0; j<csize; j++){
                c[3].push_back(c[2][j]);
                len[3].push_back(len[2][j]);
            }
            c[3].push_back(c[0][s+bsize-1]);
            len[3].push_back(len[0][s+bsize-1] -len[1].back());
            for(int j=s+bsize; j<asize; j++){
                c[3].push_back(c[0][j]);
                len[3].push_back(len[0][j]);
            }
            break;
        }
    }

    if(c[3].empty()){
        c[3] = c[0];
        len[3] = len[0];
    }
    for(int i=0; i<(int)c[3].size(); i++){
        int n=len[3][i];
        char curr = c[3][i];
        for(; i<(int)c[3].size()-1; i++){
            if(curr==c[3][i+1] || len[3][i+1]==0){
                n+=len[3][i+1];
            }else{
                break;
            }
        }
        if(n!=0){
            cout << curr << " " << n << " ";
        }
    }
    cout << "$" << endl;
    
    return 0;
}

Measured memory_bytes: 3184
#include <stdio.h>
#include <iostream>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF (1LL<<60)
typedef long long Int;

struct BIT {
    static const int N = 200000;
    Int x[N];
    void init() {
        rep (i, N) x[i] = -INF;
    }
    void add(int k, Int a) {
        for(; k<N; k|=k+1) x[k] = max(x[k], a);
    }
    Int sum(int k) {
        Int s = -INF;
        for(; k>=0; k=(k&(k+1))-1) s = max(s, x[k]);
        return s;
    }
} bit;

int n, x[200000];

int main() {
    scanf("%d", &n);
    rep (i, n) scanf("%d", x+i);
    Int s = 0;
    rep (i, n) s += x[i];
    bit.init();
    bit.add(0, 0);
    Int ans = 0;
    rep (i, n) {
        const Int cur = bit.sum(x[i]) + x[i];
        bit.add(x[i], cur);
        ans = max(ans, cur);
    }
    cout << s-ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;

#define ff first
#define ss second

const int MAXN = 1e3 + 7;
const ll INF = 1e18 + 7;
const ll MOD = 998244353;
const ll P = 311;
const int BLOCK = 720;

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int m, d;
    cin >> m >> d;
    int ans = 0;
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= d; j++) {
            int a = j % 10, b = j / 10;
            if (j >= 0 && a >= 2 && b >= 2 && a * b == i) {
                ans++;
            }
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

int f(int x){
  int res = 0;
  while(x > 0){
    res = x % 10;
    x /= 10;
  }
  return res;
}

signed main(){

  int n; cin >> n;

  map<pair<int, int>, int> mp;
  for(int i = 1; i <= n; i++){
    int p = f(i), q = i % 10;
    mp[{p, q}]++;
  }

  int ans = 0;
  for(int i = 0; i < 10; i++){
    for(int j = 0; j < 10; j++){
      ans += mp[{i, j}] * mp[{j, i}];
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
# 1<=K<=N-1なので少なくとも１回は制約を考える必要ある
# 合計スコアを出力
#
# Kこ前のやつで場合分けすれば良いのかな

# Kのあまりが同じ数列で、同じ手が連続した場合だけ点数を取りこぼす
# rrrrr なら3*R点しかとれない. rrrrなら2*R点
# xがt個連続するとすると, 点数はx*(t+1)//2点
# 連続しないなら必ず勝てる

N, K = list(map(int, input().split()))
R, S, P = list(map(int, input().split()))
T = [c for c in input()]

score = dict(r=P, s=R, p=S)  # 筐体がrならPで勝つ,...
total = 0
for res in range(K):  # Kで割ったあまり
    i = res
    while i < N:
        lasthand = T[i]
        cont = 0
        while i < N and T[i] == lasthand:
            cont += 1
            i += K
        total += (cont+1)//2 * score[lasthand]

print(total)


Measured memory_bytes: 4212
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <queue>
#include <stack>
#include <string.h>
#include <list>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)


int main(){
    int n,k;
    cin >> n >> k;
    int res,A[n];
    rep(i,n) cin >> A[i];
    res = ceil((n-1)/(k-1));
    if((n-1)%(k-1) != 0) res++;
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
int a,b,c,d;
signed main(){
    cin>>a>>b>>c>>d;
    int x=a-c;
    int y=b-d;
    cout<<x*y<<endl;
    return 0;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from collections import deque

n, m = na()
ab = nan(m)

g = [[] for _ in range(n)]
for i in range(m):
    a, b = ab[i]
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

def bfs(va, vb):
    q = deque()
    q.append((0, 0))
    dist = [-1] * n
    while len(q):
        p, d = q.popleft()
        if dist[p] != -1:
            continue
        dist[p] = d
        for nv in g[p]:
            if (p == va and nv == vb) or (p == vb and nv == va):
                continue
            q.append((nv, dist[p] + 1))
    
    for i in range(n):
        if dist[i] == -1:
            return 1
    return 0

proc = [False] * n
def dfs(v, p):
    if proc[v]:
        return 0
    proc[v] = True
    res = 0
    for nv in g[v]:
        if nv == p:
            continue
        res += bfs(nv, v)
        res += dfs(nv, v)
    return res

print(dfs(0, -1))

Measured memory_bytes: 3380
def main():
    H = map(int, open(0).read().split()[1:])
    ans = 0
    prev = int(1e9+7)
    cnt = -1
    for cur in H:
        if prev >= cur:
            cnt += 1
        else:
            if ans < cnt:
                ans = cnt
            cnt = 0
        prev = cur
    if ans < cnt:
        ans = cnt
    print(ans)
    return


main()


Measured memory_bytes: 11200
#include <iostream>
using namespace std;
int main(void){
    int N, p;
    cin >> N;
    
    int count = 0;
    for (int i = 1; i <= N; i++) {
        cin >> p;
        if (p != i)
            count++;
    }
    
    if (count <= 2)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

public static void main(String[] args) {
Scanner inp = new Scanner(System.in);

while (true) {
int h = inp.nextInt();
int w = inp.nextInt();
if (h == 0 && w == 0)
break;
else if (h >= 1 && w <= 300) {

for(int i = 0; i < h; i++) {
for(int j = 0; j < w; j++) {
if(i % 2 == 0){
if(j % 2 == 0)
System.out.print('#');
else
System.out.print('.');
}
else{
if(j % 2 == 0)
System.out.print('.');
else
System.out.print('#');
}
}
System.out.println();
}

System.out.println();
}
}

}
}


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

using namespace std;

int main(void) {
  int N; cin >> N;
  vector<int> st;

  for (int i = 0; i < N; i++) {
    int h; cin >> h;
    st.push_back(h);
  }

  st.erase(unique(st.begin(), st.end()), st.end());
  for (int i = 1; i < st.size()-1; i++) {
    if (st[i-1] < st[i]) {
      if (st[i] < st[i+1] || st[i]-1 == st[i+1]) continue;
      else {
        cout << "No" << endl;
        return 0;
      }
    } else if (st[i-1]-1 == st[i]) {
      if (st[i] < st[i+1]) continue;
      else {
        cout << "No" << endl;
        return 0;
      }
    } else {
        cout << "No" << endl;
        return 0;
    }
    cout << "a";
  }

  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 892
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	int a,b,c=0;
  	a=sc.nextInt();
  	b=sc.nextInt();
  	for(int d=b*10;d<(b+1)*10;d+=1){
  		if((int)(d*0.08)==a){
  			c=d;
  			break;
  		}else{
  			c=-1;
  		}
  	}
  	System.out.print(c);
  }
}

Measured memory_bytes: 23636
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){
		int[][][] house = new int[4][3][10];
		int n = scan.nextInt();

		for(int i = 0; i < n; i++){
			int b = scan.nextInt();
			int f = scan.nextInt();
			int r = scan.nextInt();
			int v = scan.nextInt();
			house[b - 1][f - 1][r - 1] += v;
		}

		for(int i = 0; i < 4; i++){
			for(int j = 0; j < 3; j++){
				for(int k = 0; k < 10; k++){
					if(k != 9){
						System.out.printf(" %d", house[i][j][k]);
					} else{
						System.out.printf(" %d\n", house[i][j][k]);
					}
				}
			}
			if(i != 3){
				System.out.println("####################");
			}
		}
	}
}

Measured memory_bytes: 30592
n,m,l=map(int,input().split())
A=[[0 for i in range(m)] for j in range(n)]
B=[[0 for i in range(l)] for j in range(m)]
C=[[0 for i in range(l)] for j in range(n)]
for i in range(n):
    A[i]=list(map(int,input().split()))
for i in range(m):
    B[i]=list(map(int,input().split()))
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j]+=A[i][k]*B[k][j]
for i in range(n):
    print(" ".join(map(str,C[i])))



Measured memory_bytes: 6896
#include<bits/stdc++.h>
#define int long long
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

const int N = 1e5 , M = 1e5;
vector<vector<int>> g(N+1);
vector<int>dp(N+1);
vector<int>vis(N+1);
vector<int>topo;
int n,m,mxl=0;

void dfs(int u)
{
	vis[u]=1;
	for(auto v:g[u])
	if(!vis[v])dfs(v);
	topo.push_back(u);
}

int32_t main()
{
	IOS
	cin >> n >> m ;
	for(int i=0;i<m;i++)
	{
		int u,v;cin>>u>>v;
		g[u].push_back(v);
	}
	for(int i=1;i<=n;i++)
	if(!vis[i])dfs(i);
	
	reverse(topo.begin(),topo.end());
	for(int i=0;i<n;i++)
	{
		int u = topo[i];
		dp[u]=max(dp[u],1LL);
		mxl=max(mxl,dp[u]);
		for(auto v:g[u])
		{
			dp[v]=max(dp[v],dp[u]+1);
		}
	}
	cout << mxl-1 << endl;
		
	
	
	
	
	
}


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

int main() {
	int cnt = 0;
	for (int i = 0; i < 4; i++) {
		char a;
		cin >> a;
		if (a == '2') {
			cnt++;
		}
	}
	cout << cnt << endl;
	getchar();
	getchar();
	return 0;
}

Measured memory_bytes: 256
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int N;
  cin >>N;
  vector<int> a(N);
  REP(i, N) {
    cin >> a.at(i);
  }
  
  int sum = 0;
  REP(i, N) {
    if (((i+1) % 2 == 1) && (a.at(i) % 2 == 1)) sum++;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
/*#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>
*/
#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}
inline int   in(){int n;scanf("%lld",&n);return n;}
inline void out(int n){printf("%lld\n",n);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

const int MAX_V = 1010;

int m,n;
int V;
vi G[MAX_V];
int match[MAX_V];
bool used[MAX_V];
vi blue(MAX_V/2);
vi red(MAX_V/2);

void add_edge(int u,int v) {
    G[u].pb(v);
    G[v].pb(u);
}

bool dfs(int v){
    used[v]=true;
    for(int i=0;i<G[v].size();i++){
        int u=G[v][i],w=match[u];
        if(w<0 || (!used[w] && dfs(w))) {
            match[v]=u;
            match[u]=v;
            return true;
        }
    }
    return false;
}

int bipartite_matching(){
    int res=0;
    memset(match,-1,sizeof(match));
    for(int v=0;v<V;v++){
        if(match[v]<0){
            memset(used,0,sizeof(used));
            if(dfs(v)){
                res++;
            }
        }
    }
    return res;
}

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

void init(){
    V=m+n;
    rep(i,MAX_V){
        G[i].clear();
    }
}

void solve(){
    init();
    rep(i,m) cin>>blue[i];
    rep(i,n) cin>>red[i];
    rep(i,m){
        rep(j,n){
            if(gcd(blue[i],red[j])>1){
                add_edge(i,m+j);
            }
        }
    }
    out(bipartite_matching());
}

signed main() {
    io();

    while(cin>>m>>n,n){
        solve();
    }

    return 0;
}



Measured memory_bytes: 7396
(declaim (optimize (speed 3) (debug 0) (safety 0)))
(let ((x (read))
      (y (read)))
  (format t "~A~%" (+ (abs (- (abs y) (abs x)))
                      (if (< y x)
                        (if (> (* x y) 0) 2 1)
                        (if (and (< x 0) (> y 0)) 1 0)))))

Measured memory_bytes: 12136
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
  "container/heap"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

type edge struct {
	from, to, cost int
}

type edgeSlice []edge

func (es edgeSlice) Len() int {
	return len(es)
}
func (es edgeSlice) Less(i, j int) bool {
	return es[i].cost < es[j].cost
}
func (es edgeSlice) Swap(i, j int) {
	es[i], es[j] = es[j], es[i]
}
func (es *edgeSlice) Push(x interface{}) {
	oe := *es
	*es = append(oe, x.(edge))
}
func (es *edgeSlice) Pop() interface{} {
	oe := *es
	n := len(oe) - 1
	x := oe[n]
	*es = oe[:n]
	return x
}

func main() {
	defer stdout.Flush()

	k := readInt()

	g := make([][]edge, k)
	for i := range g {
		g[i] = make([]edge, 2)
		g[i][0] = edge{i, (i + 1) % k, 1}
		g[i][1] = edge{i, (i * 10) % k, 0}
	}

	pq := new(edgeSlice)
	push := func(e edge) {
		heap.Push(pq, e)
	}
	pop := func() edge {
		return heap.Pop(pq).(edge)
	}

	ans := make([]int, k)
	for i := range ans {
		ans[i] = math.MaxInt32
	}
	ans[1] = 0
	for _, es := range g[1] {
		push(es)
	}

	for pq.Len() != 0 {
		e := pop()
		if ans[e.to] <= ans[e.from]+e.cost {
			continue
		}
		ans[e.to] = ans[e.from] + e.cost
		for _, es := range g[e.to] {
			push(es)
		}
	}

	println(ans[0] + 1)

}

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

int main() {
  int h,w;
  cin >> h >> w;
  vector<string>fi(h);
  for(int i = 0;i < h;i++) cin >> fi[i];
  int dx[4] = {1,0,-1,0};
  int dy[4] = {0,1,0,-1};
  using pint = pair<int,int>;
  queue<pint>que;
  vector<vector<int>>dis(h,vector<int>(w,-1));
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      if(fi[i][j] == '#'){
        dis[i][j] = 0;
        que.push(pint(i,j));
      }
    }
  }
  while(!que.empty()){
    pint cur = que.front();
    que.pop();
    for(int dir = 0;dir < 4;dir++){
      int nx = cur.first+dx[dir];
      int ny = cur.second+dy[dir];
      if(nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
      if(dis[nx][ny] == -1){
        dis[nx][ny] = dis[cur.first][cur.second]+1;
        que.push(pint(nx,ny));
      }
    }
  }
  int res = 0;
  for(int i = 0;i < h;i++){
    for(int j = 0;j < w;j++){
      res = max(res,dis[i][j]);
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 13456
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val an = readLine()!!.split(" ").map(String::toInt)
    var min = Long.MAX_VALUE
    for (i in -100..100) {
        var num = 0L
        for (a in an) {
            num += (a - i) * (a - i)
        }
        min = Math.min(min, num)
    }
    println(min)
}

Measured memory_bytes: 37684
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.lang.Math;

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            double R = sc.nextDouble();

            double ans = R*2*Math.PI;
            
            System.out.println(ans);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}

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

int main()
{
    unsigned long X;
    unsigned long sum, count;

    cin >> X;
    sum = 100;
    count = 0;

    while (count < X)
    {
        sum += sum * 0.01;
        if (sum >= X)
        {
            count++;
            cout << count;
            break;
        }
        count++;
    }
}

Measured memory_bytes: 3596
#include <iostream>
#include <bitset>


using namespace std;

const int maxn=1e5+5;

bitset < maxn > bio;
int br[maxn];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n, m;
	cin >> n >> m;
	string s;
	int x;
	int a=0, b=0;
	for(int i=0; i<m; i++){
		cin >> x >> s;
		if(!bio[x]){
			if(s=="AC"){
				b+=br[x];
				a++;
				bio[x]=1;
			}
			else{
				br[x]++;
			}
		}
	}
	cout << a << " " << b << '\n';
	return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  ll N,A,B;
  cin>>N>>A>>B;
  ll ans=0;
  if(abs(A-B)%2==1){
    ans+=min(A-1,N-B);
    ans+=abs(A-B)/2+1;
  }
  else{
    ans+=abs(A-B)/2;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define debugVec(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl
#define pb push_back
#define ff first
#define ss second
#define all(v) (v).begin(), (v).end()
#define mod (int)(998244353)
using namespace std;
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

signed main(){

    fastIO
    
    int n , k;
    cin >> k >> n;
    int a[n];
    int mn = 1e18;
    for (int i = 0; i < n; i++){
    	cin >> a[i];
    }
    mn = min(mn, a[n-1] - a[0]);
    // trace(mn);
    mn = min(mn, k - (a[1] - a[0]));
    // trace(mn);
    for (int i = 1; i < n ; i++){
    	mn = min(mn, k - (a[i] - a[i-1]));
    	// trace(mn);
    	mn = min (mn, k - (a[(i+1)%n] - a[i]));
    	// trace(mn);
    }
    cout << mn << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;

int main(){
  string S;
  cin >> S;
  int ans=0;
  rep(i,4){
    if(S[i]=='+') ans++;
    else ans--;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

typedef int64_t  ll;
typedef uint64_t ull;

ll n, h[100000], ans, tmp;
int main(void) {
    ll i;
    cin >> n;
    for (i = 0; i < n; i++) {
        cin >> h[i];
    }
    for (i = 0; i < n-1; i++) {
        if (h[i+1] <= h[i]) tmp++;
        else {
            ans = max(ans, tmp);
            tmp = 0;
        }
    }
    ans = max(ans, tmp);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
nums = list(map(int, input().split()))
N, K, Q = nums[0], nums[1], nums[2]
A = []
C = [0 for _ in range(N)]
for i in range(Q):
    C[int(input())-1] += 1
for i in range(N):
    if K-Q+C[i] > 0:
        print('Yes')
    else:
        print('No')


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

int main() {
  int n,k;
  cin >> n >> k;
  
  for(int i=0; i<=100; i++){
    if(pow(k,i) <= n && n < pow(k,i+1)){
      cout << i+1 << endl;
      break;
    }
  }
	return 0;
}


Measured memory_bytes: 256