akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  while (true) {
    const int N = 5;
    bool g[N][N];
    fill(&g[0][0], &g[N - 1][N - 1] + 1, false);
    for (int i = 0; i < 3; ++i) {
      int src, dst;
      if (cin >> src >> dst) {
        --src;
        --dst;
        g[src][dst] = g[dst][src] = true;
      } else {
        return 0;
      }
    }
    vector<int> v;
    v.push_back(0);
    v.push_back(1);
    v.push_back(2);
    v.push_back(3);
    sort(v.begin(), v.end());
    bool f = false;
    do {
      f = f || (g[v[0]][v[1]] && g[v[1]][v[2]] && g[v[2]][v[3]]);
    } while (next_permutation(v.begin(), v.end()));
    cout << (f ? "YES" : "NO") << endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;
using ll = long long;

#define FOR(i, N) for (int i = 0; i < N; i++)


vector<ll> binary_gauss_jordan(const vector<ll>& x) {
	vector<ll> y(x);
	int sz = x.size();

	FOR(i, sz) {
		auto imax = max_element(y.begin() + i, y.end()) - y.begin();
		if (y[imax] == 0) break;

		swap(y[i], y[imax]);

		ll msb = 1;

		while ((msb << 1) <= y[i]) msb <<= 1;

		FOR(j, sz)
			if (j != i && y[j] & msb) y[j] ^= y[i];
	}
	return y;
}

int main(void) {
	int N;

	cin >> N;

	vector<ll> A(N);
	ll total = 0;

	FOR(i, N) cin >> A[i];
	FOR(i, N) total ^= A[i];
	FOR(i, N) A[i] &= ~total;

	auto A_std = binary_gauss_jordan(A);

	ll ans = 0;
	FOR(i, A_std.size()) ans = max(ans, ans ^ A_std[i]);

	cout << (2LL * ans + total) << endl;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int N,K;
    scanf("%d%d",&N,&K);
    vector<int>A(N);
    for(int i=0;i<N;i++)scanf("%d",&A[i]);
    auto i=lower_bound(A.begin(),A.end(),1)-A.begin();
    vector<int>ret(K);
    int r,l,t;
    for(int j=0;j<K;j++){
        t=i-j;
        l=t/(K-1)+!!(t%(K-1));
        r=(N-1-t)/(K-1)+!!((N-1-t)%(K-1));
        ret[j]=l+r;
    }
    printf("%d\n",*min_element(ret.begin(),ret.end()));
}

Measured memory_bytes: 1024
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a,dp[1000001],dp2[1000001];
vector<ll> v,u;
int main(void){
    for(ll i=1;i<1000;i++){
        a+=i*(i+1)/2;
        //cout<<a<<endl;
        if(a<=1000000){
            v.push_back(a);
            if(a%2==1)u.push_back(a);
        }
        else break;
    }
    for(int i=0;i<=1000000;i++)dp[i]=i;
    for(int i=0;i<=1000000;i++)dp2[i]=i;
    for(int i=1;i<v.size();i++){
        for(int j=0;j+v[i]<=1000000;j++){
            dp[j+v[i]]=min(dp[j+v[i]],dp[j]+1);
        }
    }
    for(int i=1;i<u.size();i++){
        for(int j=0;j+u[i]<=1000000;j++){
            dp2[j+u[i]]=min(dp2[j+u[i]],dp2[j]+1);
        }
    }
    while(1){
    cin>>n;
    if(n==0)return 0;
        cout<<dp[n]<<" "<<dp2[n]<<endl;
    }
}



Measured memory_bytes: 18780
k,a,b = map(int,input().split())
if a>=b-2:
    print(1+k)
elif a==1 and k>=2:
    print(1+(b-a)*(k//2)+(k%2))
elif k<a+1:
    print(1+k)
else:
    alpha = k-(a+1)
    print(b+(b-a)*(alpha//2)+(alpha%2))


Measured memory_bytes: 2940
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

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

    int n;
    cin >> n;
    vector<int> t(n);
    for (int i = 0; i < n; i++) cin >> t[i];

    int cumlcm = 1;
    for (auto &&i : t) {
        cumlcm = lcm(i, cumlcm);
    }

    const int ans = cumlcm;
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.List;
import java.util.Scanner;

public class Main {

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

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

		int N = sc.nextInt();

		int ans=getDigitsum(N);

		boolean buf=N%ans==0;

		output(buf,"Yes","No");

	}

	public static int getDigitsum(int N) {

		int sum=0;

		while(N>0) {
			sum+=N%10;
			N/=10;
		}

		return sum;

	}

	//以下テンプレート

	public static int[] extgcd(int a, int b) {

		int x0 = 1;
		int x1 = 0;

		int y0 = 0;
		int y1 = 1;

		while (b != 0) {
			int q = a / b;
			int r = a % b;

			int x2 = x0 - q * x1;
			int y2 = y0 - q * y1;

			a = b;
			b = r;

			x0 = x1;
			x1 = x2;

			y0 = y1;
			y1 = y2;
		}

		return new int[] { a, x0, y0 };

	}

	static int gcd(int a, int b) {

		if (b == 0)
			return a;

		if (a < b) {
			int t = a;
			a = b;
			b = t;
		}

		return gcd(b, a % b);

	}

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

	static void swap(int[] a) {
		int t;

		t = a[0];
		a[0] = a[1];
		a[1] = t;

		return;
	}

	static <T> void output(List<T> list) {

		for (int i = 0; i < list.size(); i++) {
			System.out.print(list.get(i));

			if (i != list.size() - 1) {
				System.out.print(" ");
			} else {
				nl();
			}
		}

	}

	static void output(String[][] str) {

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				print(str[i][j]);
			}

			nl();
		}

	}

	static void output(boolean flg, String Yes, String No) {

		if (flg) {
			pln(Yes);
		} else {
			pln(No);
		}

	}

	static void output(String[][] str, int digit) {

		String dig = "%" + String.valueOf(digit) + "s";

		for (int i = 0; i < str.length; i++) {
			for (int j = 0; j < str[i].length; j++) {
				System.out.printf(dig, str[i][j]);
			}
			nl();
		}

	}

	static void pln(String str) {
		System.out.println(str);
	}

	static void pln(int x) {
		System.out.println(x);
	}

	static void print(String str) {
		System.out.print(str);
	}

	static void print(int x) {
		System.out.print(x);
	}

	static void print(String str, int times) {
		for (int i = 0; i < times; i++) {
			print(str);
		}
	}

	static void print(int x, int times) {
		for (int i = 0; i < times; i++) {
			print(x);
		}
	}

	static void nl() {
		System.out.println();
	}

}


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

int main() {
    int A,N;
    cin >> N >> A;
    bool ok = false;
    for (int X=0; X<=N; X+=500) {
        if(N-X<=A){
            ok = true;
        }
    }
    if(ok == true) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
using System;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');

            int r = int.Parse(s[0]);
            int D = int.Parse(s[1]);
            long X = int.Parse(s[2]);

            long Next = 0;


            for (int i = 0; i < 10; i++)
            {
                Next = X * r - D;
                Console.WriteLine(Next.ToString());
                X = Next;
            }
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define VI vector<int>
#define VVI vector<vector<int>>
#define UM unordered_map
#define MP map
#define ST set
#define US unordered_set
#define V vector
#define S string
#define D deque
#define L list
#define Q queue
#define PQ priority_queue
#define DB double
#define LDB long double
#define FOR(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define FFOR(i, n) for (int(i) = 0; (i) <= (n); ++(i))
#define RFOR(i, n) for (int(i) = (n)-1; (i) >= 0; --(i))
#define all(v) (v).begin(), (v).end()

const int dr[] = {0, 1, 0, -1};
const int dc[] = {1, 0, -1, 0};

int nxt()
{
    int n;
    cin >> n;
    return n;
}

LL llnxt()
{
    LL l;
    cin >> l;
    return l;
}

LDB ldbnxt()
{
    LDB n;
    cin >> n;
    return n;
}

DB dbnxt()
{
    DB n;
    cin >> n;
    return n;
}

void bfs(VVI &graph, int start)
{
    int n = graph.size();
    Q<int> q;
    V<bool> visited(n);
    q.push(start);
    visited[start] = true;
    while (not q.empty())
    {
        auto curr = q.front();
        q.pop();
        for (auto i : graph[curr])
        {
            if (not visited[i])
            {
                q.push(i);
                visited[i] = true;
            }
        }
    }
}
int main()
{
    int n;
    cin >> n;
    UM<int, int> l, r;
    LL ans = 0;
    FOR(i, n)
    {
        int t;
        cin >> t;
        ++l[i + t];
        ++r[i - t];
    }
    for (auto [val, cnt] : l)
    {
        // cout << val << " " << cnt << endl;
        ans += (LL)cnt * r[val];
    }
    cout << ans;
}

Measured memory_bytes: 26288
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <stdio.h>
#include <cstring>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <numeric>
#include <regex>
#include <locale>
#include <fstream>
#include <stdlib.h>
#include <cctype>

//#include <map>

using namespace std;

class cFunc{
public:
	string sfunc;
	int arg1;
	int arg2;
	string arg3;

	cFunc(string s)
	{
		istringstream iss;
		iss.str(s);
		iss >> sfunc >> arg1 >> arg2 >> arg3;
	}
};


int main()
{
	string str;
	vector<string> vf;
	int q;

	cin >> str;
	cin >> q;
	cin.ignore();
	for (int i = 0; i < q; i++)
	{
		string temp;
		getline(cin, temp);
		vf.push_back(temp);
	}

	for (int i = 0; i < q; i++)
	{
		cFunc cf(vf.at(i));
		if (cf.sfunc == "replace")
		{
			str.replace(cf.arg1,cf.arg2 - cf.arg1 + 1,cf.arg3);
		}
		else if (cf.sfunc == "reverse")
		{
			reverse(str.begin() + cf.arg1, str.begin() + cf.arg2 + 1);
		}
		else if (cf.sfunc == "print")
		{
			string temp;
			temp = str.substr(cf.arg1, cf.arg2 - cf.arg1 + 1);
			cout << temp << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3232
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long

constexpr ll mod = 1000000007;

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

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

mint solve(ll n) {
	mint sgn = mint(n % 2 ? -1 : 1);
	mint res = -mint(37033746750LL) * (mint(-1) + sgn);
	res -= mint(2409750LL) * (mint(48887) + mint(33033) * sgn) * mint(n);
	res -= mint(1485) * (mint(123573553LL) + mint(22215375LL) * sgn) * mint(n).pow(2);
	res -= mint(486) * (mint(-27084097LL) + mint(9634625LL) * sgn) * mint(n).pow(3);
	res -= mint(75075) * (mint(-1091603LL) + mint(2835) * sgn) * mint(n).pow(4);
	res += mint(24061186240LL) * mint(n).pow(5);
	res -= mint(5184859680LL) * mint(n).pow(6);
	res -= mint(3761934176LL) * mint(n).pow(7);
	res -= mint(562504800LL) * mint(n).pow(8);
	res += mint(54503020LL) * mint(n).pow(9);
	res += mint(31381350LL) * mint(n).pow(10);
	res += mint(5099276LL) * mint(n).pow(11);
	res += mint(450450LL) * mint(n).pow(12);
	res += mint(23240LL) * mint(n).pow(13);
	res += mint(660) * mint(n).pow(14) + mint(8) * mint(n).pow(15);
	res /= mint(334764638208000LL);
	return res;
}

int main(void) {
	int T; cin >> T;
	while (T--) {
		ll N; cin >> N;
		cout << solve(N) << endl;
	}
	return 0;
}

Measured memory_bytes: 3648
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>
#include <cmath>
#include <iomanip>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int N, K;
    cin >> N >> K;

    int res = 0;
    while (N) {
        N /= K;
        res++;
    }
    cout << res << "\n";

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int c,n,T,t,maxs=INT_MAX;
    cin >> n >> T;
    for(int i=0;i<n;i++) {
        cin >> c >> t;
        if(c<maxs && t<=T) {maxs=c;}
    }
    if(maxs==INT_MAX) {cout << "TLE" << endl;}
    else cout << maxs;
}


Measured memory_bytes: 256
#include<cstdio>
char s[5];
bool mark[5];
int main()
{
	scanf("%s",s);
	for(int i=0;i<3;i++)
		if(!mark[s[i]-'a']) mark[s[i]-'a']=1;
		else
		{
			printf("No\n");
			return 0;
		}
	printf("Yes\n");
}


Measured memory_bytes: 128
import java.io.*;
import java.util.*;

class Main {

    void solve(){

	Scanner sc = new Scanner( System.in );
	int n = sc.nextInt();

	int xmin = 2000, xmax = 0;
	for ( int i=0; i<n; ++i ) {
	    int x = sc.nextInt();
	    if ( x < xmin ) xmin = x;
	    if ( x > xmax ) xmax = x;
	}

	System.out.println( xmax - (xmin + xmax)/2 );
    }

    public static void main( String[] a ) { new Main().solve(); }
}



Measured memory_bytes: 29952
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)#それぞれの要素がどの要素の子であるか

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]#それぞれの要素の根を再帰的に求める

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same_check(self, x, y):
        return self.find(x) == self.find(y)#x,yが同じ集合に属するかどうか


n, m = map(int, input().split())

node = [0]*m
for i in range(m):
  a, b = map(int, input().split())
  node[i] = (a, b)

ans = m
for i in range(m):
  union = UnionFind(n)
  for j in range(m):
    if i == j:
      continue
    union.union(node[j][0], node[j][1])
  key = True
  for j in range(n):
    for k in range(j+1, n):
      if union.same_check(j+1, k+1) == False:
        key = False
  if key:
    ans -= 1
print(ans)

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

using namespace std;

const int DIM = 1e5 + 7;

pair <int, int> v[DIM];

main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	
	for(int i = 1; i <= n; i++)
	{
		cin >> v[i].first;
		v[i].second = i;
	}
	
	sort(v + 1, v + 1 + n);
	
	for(int i = 1; i <= n; i++)
		cout << v[i].second << ' ';
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H,W;
    cin >> H >> W;
    int sx,sy,gx,gy;
    cin >> sx >> sy >> gx >> gy;
    sx--; sy--; gx--; gy--;
    vvec<char> S(H,vec<char>(W));
    for(auto& v:S) for(auto& c:v) cin >> c;
    int inf = 1e9;
    vvec<int> dist(H,vec<int>(W,inf));
    dist[sx][sy] = 0;
    deque<pair<int,int>> Q;
    Q.push_front({sx,sy});
    
    vec<int> dx = {-1,1,0,0},dy = {0,0,-1,1};
    
    auto in = [&](int x,int y){
        return 0<=x && x<H && 0<=y && y<W && S[x][y]!='#';
    };
    while(!Q.empty()){
        auto [x,y] = Q.front(); Q.pop_front();
        for(int k=0;k<4;k++){
            int nx = x+dx[k],ny = y+dy[k];
            if(!in(nx,ny)) continue;
            if(dist[nx][ny]>dist[x][y]){
                dist[nx][ny] = dist[x][y];
                Q.push_front({nx,ny});
            }
        }
        for(int a=-2;a<=2;a++) for(int b=-2;b<=2;b++){
            int nx = x+a,ny = y+b;
            if(!in(nx,ny)) continue;
            if(dist[nx][ny]>dist[x][y]+1){
                dist[nx][ny] = dist[x][y]+1;
                Q.push_back({nx,ny});
            }
        }
    }
//    for(int i=0;i<H;i++) for(int j=0;j<W;j++) cerr << dist[i][j] << (j!=W-1? " ":"\n");
    cout << (dist[gx][gy]==inf? -1:dist[gx][gy]) << "\n";
}

Measured memory_bytes: 8696
#include<bits/stdc++.h>
using namespace std;
int main() {
    int n,m;cin>>n>>m;
    int k,a;vector<int>num(m);
    for(int i=0;i<n;i++){
        cin>>k;
        for(int j=0;j<k;j++){
            cin>>a;
            num.at(a-1)++;
        }
    }
    int ans=0;
    for(int i=0;i<m;i++)if(num.at(i)==n)ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 384
import java.util.*;
import java.util.Map.Entry;
 
 
 class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        
        long ans=0;
        if(a==0) {
        	if(x!=1) {
        		ans++;
        	}
        }
        
        ans=ans+b/x-(a-1)/x;
        System.out.println(ans);        	
                		
    }

}

Measured memory_bytes: 22228
#include<bits/stdc++.h>
using namespace std ;
int main()
{
    ios::sync_with_stdio(false) ;
    cin.tie(0) ;
    cout.tie(0) ;
    string s ;
    char m = 's' ;
    char w = 'e' ;
    cin>>s ;
    if(s[s.size()-1]=='s')
    {
        cout<<s+w+m<<endl ;
    }
    else
    {
        cout<<s+m<<endl ;
    }

    return 0 ;
}


Measured memory_bytes: 3624
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <stack>
#include <set>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int r;
    cin >> r;
    if (r < 1200) {
        cout << "ABC" << endl;
    } else if (r < 2800) {
        cout << "ARC" << endl;
    } else {
        cout << "AGC" << endl;
    }
    return 0;
}

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

int main(){
    long n,a,b;
    cin>>n>>a>>b;
    long c=a+b;
    long p=n%c;
    long q=n/c;
    long r=q*a;
    if (p<a) r+=p;
    else r+=a;
    cout<<r<<endl;
}

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

int gcd(int a, int b);

int main(){
    int n,tmp,i,j,k,res = 0;

    cin >> n;

    for( i = 1; i <= n; i ++){
        for( j = 1; j <= n; j++){
            for( k = 1; k <= n; k++){
                tmp = gcd(i,j);
                res += gcd(tmp,k);
            }
        }
    }
    cout << res << "\n";
}

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

    return gcd(b,a%b);
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>

using namespace std;

#define FIZZ 10000000
#define BUZZ 20000000
#define FIZZBUZZ 30000000

int x[100000], y[10000], n, m, num, turn, C, cnt, L; string S; char T[11] = "0123456789";
int main() {
	while (true) {
		memset(x, 0, sizeof(x));
		memset(y, 0, sizeof(y));
		num = 1; turn = 1; cnt = 0;
		cin >> n >> m; L = n;
		if (n == 0 && m == 0) { break; }
		for (int i = 1; i <= m; i++) { 
			cin >> S; 
			if (S == "Fizz") { x[i] = FIZZ; }
			else if (S == "Buzz") { x[i] = BUZZ; }
			else if (S == "FizzBuzz") { x[i] = FIZZBUZZ; }
			else if (S.size() >= 10) { x[i] = -1; }
			else {
				for (int j = 0; j < S.size(); j++) {
					for (int k = 0; k < 10; k++) {
						if (S[j] == T[k]) { x[i] += (int)pow(10, S.size() - j - 1)*k; goto E; }
					}
					x[i] = 0; goto F;
				E:;
				}
			F:;
			}
		}
		while (num <= m && L > 1) {
			if (y[turn] == 1) { goto G; }
			if (num % 15 == 0) { C = FIZZBUZZ; }
			else if (num % 5 == 0) { C = BUZZ; }
			else if (num % 3 == 0) { C = FIZZ; }
			else { C = num; }
			if (C != x[num]) { y[turn] = 1; L--; }
			num++;
		G:;
			turn++;
			if (turn > n) { turn -= n; }
		}
		for (int i = 1; i <= n; i++) {
			if (y[i] == 0) {
				if (cnt >= 1) { cout << ' '; }
				cout << i;
				cnt++;
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 1692
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;


void main() {
    auto w = ["Sunny", "Cloudy", "Rainy"];
    string s;
    scan(s);
    auto i = w.countUntil(s);
    writeln(w[(i + 1) % 3]);
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 256
D,G = [int(x) for x in input().split()]
pc = [0]*D
for i in range(D):
    pc[i] = [int(x) for x in input().split()]


mincnt = 10**9

for i in range(1 << D):
    score = 0
    cnt = 0
    full = []
    non_full = []

    for j in range(D):
        if((i>>j & 1) == 1):
            full += [[(j+1)*100]+pc[j]]
        else:
            non_full += [[(j+1)*100]+pc[j]]

    non_full.reverse()

    for j in full:
        score += j[0]*j[1]+j[2]
        cnt += j[1]
    if(score < G):
        for j in non_full:
            a = 1
            while(score+j[0]*a < G and a<j[1]):
                a += 1
            score += j[0]*a
            cnt += a
            if(score >= G):
                mincnt=min(cnt,mincnt)
                break
    else:
        mincnt=min(cnt,mincnt)
    
print(mincnt)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define MAXN 100010
using namespace std;
long long n,q,k;
vector<pair<long long,long long> > graph[MAXN];
long long dis[MAXN];
void dfs(long long now,long long father)
{
	for(long long i=0;i<graph[now].size();i++)
	{
		if(graph[now][i].first==father)
			continue;
		dis[graph[now][i].first]=dis[now]+graph[now][i].second;
		dfs(graph[now][i].first,now);
	}
}
main()
{
	cin>>n;
	for(long long i=0;i<n-1;i++)
	{
		long long a,b,c;
		cin>>a>>b>>c;
		--a,--b;
		graph[a].push_back(make_pair(b,c));
		graph[b].push_back(make_pair(a,c));
	}
	cin>>q>>k;
	--k;
	dfs(k,-1);
	while(q--)
	{
		long long x,y;
		cin>>x>>y;
		--x,--y;
		cout<<(long long)dis[x]+dis[y]<<endl;
	}
	return 0;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
  int k;
	string s;
  cin >> k >> s;
  if(s.size() <= k){
    cout << s << endl;
  }else{
    string sub = s.substr(0,k);
    sub += "...";
    cout << sub << endl;
  }

  return 0;
}


Measured memory_bytes: 3636
import math

n=int(input())

if n==0 :
    print(0)
else:


    A=[]
    lim=int(math.log2(abs(n)))
    for i in range(lim+4):
        n%=2**(lim+4-i)
        A.append(n)
        


    ans=""

    #print(A)

    if A[lim+4-1]==1:
        ans+="1"
    else:
        ans+="0"

    bi=0
    st=1
    for i in range(1,lim+4): #(-2)^i の位を決める
        if bi==0:
            st+=2**(i-1)
        #print(A[lim-i-1])
        if A[lim+4-i-1]>=st and A[lim+4-i-1]<st+2**i :
            ans+="1"
        else:
            ans+="0"
        bi=(bi+1)%2

    #print(ans)

    ans2=""
    zero=0
    for i in range(len(ans)):
        if ans[-i-1]=="0" and zero==1:
            ans2+="0"
        elif ans[-i-1]=="1":
            zero=1
            ans2+="1"

    print(ans2)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, a, b;
  string s;
  cin >> n >> a >> b >> s;
  ll cnt = 0, cb = 0;
  rep(i, n) {
    bool ans = true;
    if(s[i] == 'a') {
      if(cnt >= a + b)
        ans = false;
      else
        cnt++;
    } else if(s[i] == 'b') {
      if(cnt >= a + b || cb >= b)
        ans = false;
      else
        cnt++;
      cb++;
    } else
      ans = false;
    cout << (ans ? "Yes" : "No") << '\n';
  }
}

Measured memory_bytes: 3752
class Solution:
    def main(self):
        N = int(input())
        v = list(map(int, input().split()))
        v = sorted(v)
        res = v[0]
        for i in range(1, N):
            res = (res + v[i]) / 2

        print(res)


if __name__ == '__main__':
    Solution().main()

Measured memory_bytes: 3060
N, K = map(int, input().split())
a = list(map(int, input().split()))

a_hash = {}
for i in a:
    if i in a_hash:
        a_hash[i] += 1
    else:
        a_hash[i] = 1

a_hash = sorted(a_hash.items(), key = lambda x: x[1])

ans = 0
if len(a_hash) > K:
    tmp = len(a_hash) - K
    for i in range(tmp):
        ans += a_hash[i][1]
print(ans)

Measured memory_bytes: 38964
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <functional>
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <string>
#include <vector>
 
using namespace std;
typedef long long ll;
using gra = vector<vector<ll>>;
using gram = vector<unordered_map<ll,ll>>;
 
typedef unsigned long long ull;
 
template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
 
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template <class T> T dup(T a, T b) { return (a + b - 1) / b; }
template <class T> T modpow(T x, T p, T m) { T a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
// template <class T> void prim(T a) { for(ll i=0;i<a.size();++i) { cout << a[i]; } cout << "\n"; }
 
#define mod 1000000007LL
#define INF 10000000000000000LL
 
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (int i = 1; i <= n; ++i)
#define rrep(i, n) for (int i = (n - 1); i >= 0; --i)
#define rrep1(i, n) for (int i = n; i > 0; --i)
 
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
//#define modpow(x, p, m) { ll a=1; while(p){ if(p%2)a =a*x%m; x = x+x%m; p/=2; } return a; }
 
#define m0(h) memset(h, 0, sizeof(h))
#define m1(h) memset(h, 1, sizeof(h))
#define m(h, n) memset(h, (n), sizeof(h))
#define all(n) (n).begin(),(n).end()
#define bit(n) (1LL << (n))
#define pb push_back
 
//#ifdef LOCAL
//
//#define dpri(...) fprintf(stderr, __VA_ARGS__)
//#define pria(g) rep(i,g.size()){ cout << i << "{"; rep(j,g[i].size()) cout << g[i][j] << " "; cout << "}" << "\n"; }
//#else
//#define dpri(...) 42
//#define pria(g) 42
//#endif
 
 
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ---------------------
  // コーディング開始
  // ---------------------
  string n;
  cin >> n;
  ll s=0;
  rep(i,n.length()){
   s += n[i] - '0';
  }
  if(stoi(n)%s==0){
    pri("Yes");
    return 0;
  }
  pri("No");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int D, G, ans = 1000000007;
  std::cin >> D >> G;
  vvi pc = vv(D, 2, 0, int);
  for(int i=0;i<D;i++) std::cin >> pc[i][0] >> pc[i][1];

  for(int i=0;i<(1<<D);i++){
    int point = 0, prob=0;
    std::vector<int> amari;
    for(int j=0;j<D;j++){
      if(((1<<j)|i)==i) {
        point+=(pc[j][0]*(j+1)*100) + pc[j][1];
        prob+=pc[j][0];
      }else{
        amari.push_back(j);
      }
    }
    sort(amari.begin(), amari.end());
    reverse(amari.begin(), amari.end());

    if(point >= G){
      ans = min(ans, prob);
    }else if(point + ((amari[0]+1)*100*(pc[amari[0]][0]-1)) >= G){
      ans = min(ans, prob + (G-point)/((amari[0]+1)*100) + ((G-point)%((amari[0]+1)*100)==0?0:1));
    }
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n, d;
    cin >> n >> d;
    if (n % (2 * d + 1) == 0)
        cout << n / ((2 * d + 1)) << endl;
    else
        cout << n / ((2 * d + 1)) + 1 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

int A, B, C;

int main(void)
{
	scanf("%d %d %d", &A, &B, &C);

	int res = min({ abs(A - B) + abs(B - C), abs(A - C) + abs(B - C), abs(A - B) + abs(A - C) });

	printf("%d\n", res);

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define all(v) ((v).begin()),((v).end())
#define ll long long
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
double const EPS = 1e-12, PI = acos(-1);
const int N = 2e5 + 9, M = 5e3 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const ll inf = 1e18;

vector<pair<int, int>> st[N];
vector<pair<int, int>> en[N];
ll f[N], tree[4*N], lazy[4*N];

void propagate(int node, int start, int end) {
  if(!lazy[node])
    return;
  tree[node] += lazy[node];
  if(start != end) {
    lazy[node * 2] += lazy[node];
    lazy[node * 2 + 1] += lazy[node];
  }
  lazy[node] = 0;
}

ll query(int node, int start, int end, int l, int r) {
  propagate(node, start, end);
  if(start > r || end < l)
    return -inf;
  if(start >= l && end <= r) {
    return tree[node];
  }
  int mid = (start + end) / 2;
  ll p1 = query(node * 2, start, mid, l, r);
  ll p2 = query(node * 2 + 1, mid + 1, end, l, r);
  return max(p1, p2);
}

void update(int node, int start, int end, int l, int r, ll val) {
  propagate(node, start, end);
  if(start > r || end < l)
    return;
  if(start >= l && end <= r) {
    lazy[node] += val;
    propagate(node, start, end);
    return;
  }
  int mid = (start + end) / 2;
  update(node * 2, start, mid, l, r, val);
  update(node * 2 + 1,mid + 1, end, l, r, val);
  tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
}

int main() {
  fastIO;
#ifdef LOCAL
  freopen("input.in", "rt", stdin);
#endif
  int n, m, l, r, val;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    cin >> l >> r >> val;
    st[l].push_back({l - 1, val});
    en[r].push_back({l - 1, val});
  }
  for (int i = 1; i <= n; ++i) {
    for(auto it: st[i])
      update(1, 0, n, 0, it.first, it.second);
    f[i] = query(1, 0, n, 0, i - 1);
    update(1, 0, n, i, i, f[i]);
    for(auto it: en[i])
      update(1, 0, n, 0, it.first, -it.second);
  }
  ll ans = 0;
  for (int i = 1; i <= n; ++i)
    ans = max(ans, f[i]);
  cout << ans;
  return 0;
}


Measured memory_bytes: 36224
// input! macro is published in the following URLs.
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// https://github.com/tanakh/competitive-rs.git
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        pss: [(usize, String); m],
    }
    let mut penalties = vec![0; n];
    let mut acs = vec![false; n];
    for (p, s) in pss {
        if s == "WA" {
            if !acs[p - 1] {
                penalties[p - 1] += 1;
            }
        } else if s == "AC" {
            acs[p - 1] = true;
        }
    }
    let ans = format!(
        "{} {}",
        acs.iter().filter(|&&ac| ac).count(),
        (0..n)
            .map(|i| if acs[i] { penalties[i] } else { 0 })
            .sum::<usize>(),
    );
    println!("{}", ans);
}


Measured memory_bytes: 8444
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

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

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

int main(void){
	int n,a,b;
	cin >> n >> a >> b;
	cout << min(a,b) << " " << (max(a+b-n,0)) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long LL;

bool flg(int x, int y) {
	if (x&(1 << y))return true;
	else return false;
}

int main() {
	int n;
	while (cin >> n, n) {
		int p[20];
		int sum = 0;
		for (int i = 0;i < n;i++) {
			cin >> p[i];
			sum += p[i];
		}
		int ans = 1.8e9;
		for (int i = 0;i < (1 << n);i++) {
			int a = 0;
			for (int j = 0;j< n;j++) {
				if (flg(i, j))a += p[j];
			}
			ans = min(ans, (abs(a - (sum - a))));
		}
		cout << ans << endl;
	}
	return 0;
}

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

int main(){
    int n,a;
    cin >> n;
    int number[n];
    
    for(int i = 1; i <= n; i++){  // 1~nまでの箱を入れた
        cin >> a;
        number[i] = a;
        
    }
    
    for(int j = n; j> 1 ;j--){
        cout << number[j] << " " ;
    }
    
    cout << number[1];
    cout << endl;
    
    
    
    
    return 0;
}


Measured memory_bytes: 3104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll h,w,n;
  cin>>h>>w>>n;
  vector<ll> ans(10,0);
  ans[0]=(h-2)*(w-2);
  map<P,ll> cnt;
  rep(i,n){
    int a,b;
    cin>>a>>b;
    rep(j,3)rep(k,3){
      if(1<=a-j && a+2-j<=h && 1<=b-k && b+2-k<=w){
        cnt[P(a-j,b-k)]++;
      }
    }
  }
  for(auto itr:cnt){
    ans[itr.se]++;
    ans[0]--;
  }
  cout_vec(ans);
}

Measured memory_bytes: 56576
<?php
$n = intval(trim(fgets(STDIN)));
$s = trim(fgets(STDIN));

$max = 0;
for($i = 0; $i < $n; $i++){
    for($j = $i+$max+1; $j < $n; $j++){
        $ss = substr($s, $i, $j-$i);
        if(strpos($s, $ss, $j) === false){
            break;
        }else{
            $max=max($max,$j-$i);
        }
    }
}
echo $max;


Measured memory_bytes: 4732
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=998244353;
const int M=1e9+7;
#define inf 0x3f3f3f3f
//std::ios::sync_with_stdio(0);
bool cmp(int x,int y,int z)
{

    if(x+y<=z)
         return false;
    else
         return true;
}
int main()
{
    std::ios::sync_with_stdio(0);
    map<int,int>q;
    vector<int>v;
    int n;
    cin>>n;
    int x;
    int cnt=0;
    for(int i=0;i<n;i++)
         {
             cin>>x;
             q[x]++;
             if(q[x]==1)
             v.push_back(x);
         }
    sort(v.begin(),v.end());
    if(v.size()<3)
        cout<<0<<endl;
    else
    {for(int i=0;i<v.size()-2;i++)
        for(int j=i+1;j<v.size()-1;j++)
           for(int k=j+1;k<v.size();k++)
    {
        if(cmp(v[i],v[j],v[k]))
            cnt+=q[v[i]]*q[v[j]]*q[v[k]];
    }
    cout<<cnt<<endl;}


}


Measured memory_bytes: 3668
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <queue>
#include <tuple>

using namespace std;

using int64 = long long;

const int64 INF = (1LL<<60);

int main() {
    int64 a, b, c;
    cin >> a >> b >> c;

    // a + b + 2 sqrt(a * b) < c
    // 2 * sqrt(a * b) < (c - a - b)
    // 4 * a * b < (c - a - b) ^ 2

    int64 d = c - a - b;

    if (d <= 0) {
        cout << "No\n";
        return 0;
    }

    cout << (4 * a * b < d * d ? "Yes\n" : "No\n"); 

    return 0;
}

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

#ifdef _PRINTDEBUG
  #include "lib/printdebug.hpp"
#else
  #define printdebug(...) 1
#endif
#define MOD_1_000_000_007 (1000000007)
#define IINF (1<<28)
#define LINF (1LL<<60)
#define rep(i, n)      REP(i, 0, (n))
#define repc(i, n)     REPC(i, 0, (n))
#define REP(i, n, m)   for (int i = (int)(n); i <  (int)(m); i++)
#define REPC(i, n, m)  for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
#define yesno(cond)       YESNO((cond), "Yes", "No")
#define YESNO(cond, a, b) cout << ((cond) ? (a) : (b)) << "\n"

namespace solver {
  using namespace std;
  typedef long long ll;

  int N, K;
  string S;

  void init() {
    cin >> N >> K >> S;
  }

  void solve() {
    bool cur = true;
    int a = 0;
    rep(i, N) {
      if((cur && S[i] == 'L') || (!cur && S[i] == 'R')) {
        cur = !cur;
        if(!cur) {
          a += 2;
          if(i == 0) a--;
        }
      }
    }
    if(cur) a++;
    cout << min(N - 1, N - a + 2 * K) << "\n";
  }
}

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 512
def main():
    N, K = map(int, input().split())
    H = [int(input()) for _ in range(N)]
    H.sort()
    retval = float("inf")
    for i in range(N - K + 1):
        retval = min(H[i+K-1] - H[i], retval)
    print(retval)


if __name__ == "__main__":
    main()


Measured memory_bytes: 51160
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
 
typedef long long ll;
typedef vector <bool> v_bool;
typedef vector <ll> v_ll;
typedef vector <vector <ll> > vv_ll;
typedef vector < pair <ll,ll> > vp_ll;
typedef pair <ll,ll> p_ll;
 
bool TEST=false;
ll MOD = 1000000007;
 
void show(){if (TEST){cout << endl;}}
void show(string x){if (TEST){cout << x;}}
void show(string x,bool enter){
  if (TEST){if (enter) cout << "<#> " << x << endl;else cout << x;}
}
void show(ll x){if (TEST){cout << x;}}
void show(ll x,bool enter){
  if (TEST){if (enter) cout << "<#> " << x << endl;else cout << x;}
}
void show(p_ll p){
  if (TEST){cout << "{ ";show(p.first);cout << " ";show(p.second);cout << " }";}
}
void show(v_ll v){
  if (TEST){
    cout << "<begin> ";
    for (ll i=0;i<v.size();i++){show(v[i]); cout << " ";}cout <<"<end>"<< endl;
}}
void show(vv_ll v){
  if (TEST){
    cout << "//////////" << endl;
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << endl;
}}}
void show(vp_ll v){
  if (TEST){
    cout << "//////////" << endl;
    for (ll i=0;i<v.size();i++){
      show(v[i]); cout << endl;
}}}
 
ll mod(ll x){
  ll n=MOD;
  ll ret=x%n;
  if (ret<0)ret+=n;
  return ret;
}
void mod_self(ll &x){
  x=mod(x);
}
ll mod_inv(ll x){
  ll n=MOD;
  ll y = x,z = n-2, ret=1;
  y=mod(y);
  while (z>0){
    if(z%2==1) ret=mod(ret*y);
    y=mod(y*y);
    z/=2;
  }
  return ret;
}
ll mod_pow(ll x,ll a){
  ll y = x,z = a,ret=1;
  y=mod(y);
  if (z<0)z=-z;
  while (z>0){
    if(z%2==1) ret=mod(ret*y);
    y=mod(y*y);
    z/=2;
  }
  if (a<0) ret=mod_inv(ret);
  return ret;
}
v_ll mod_nck(ll n){
  v_ll nck(n+1,0);
  nck[0]=1;
  for (ll i=1;i<=n;i++){
    nck[i]=mod(nck[i-1]*(n+1-i));
    nck[i]=mod(nck[i]*mod_inv(i));
  }
  return nck;
}
v_ll mod_factorial(ll n){
  v_ll fct(n+1,0);
  fct[0]=1;
  for (ll i=1;i<=n;i++){
    fct[i]=mod(fct[i-1]*i);
  }
  return fct;
}
 
ll N,K;
int main(){
  cin >> N >> K;
    ll ans=0;
    for(ll i=0;i<N;i++){
        ll h;
        cin >> h;
        if (h>=K) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int fibonacci(int);
void makeFibonacci(void);

int F[50];

int main(){
  int n;

  makeFibonacci();
  
  scanf("%d",&n);
  printf("%d\n",fibonacci(n));
  return 0;
}

void makeFibonacci(){
  int i;
  
  for(i=0;i<50;i++){
    if(i==0||i==1){
      F[i]=1;
    }
    else{
      F[i] = fibonacci(i-1)+fibonacci(i-2);
    }
  }
}

int fibonacci(int n){
  return F[n];
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 
string S, T;
  cin >> S >> T;

int N = S.size();    
char s[N]; 
char now; 
bool a = false;  
  
  for(int i = 0;i < N;i++){
  s[i] = S.at(i);  
  }

  for(int j = 0;j < N;j++){
  int cnt = 0;  
  for(int i = 0;i < N;i++){
  if(s[i] == T.at(i)) cnt++;  
  }
  if(cnt == N){
  a = true;
    break;
  }  
  else{
  now = s[N - 1];
  for(int i = N - 2;i >= 0;i--){
   s[i + 1] = s[i];
  }
  s[0] = now;  
  }  
  }

  if(a) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
  
}

Measured memory_bytes: 256
use std::io::Read;

fn run() {
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();
    let mut it = s.trim().split_whitespace();
    let n: usize = it.next().unwrap().parse().unwrap();
    let mut g = vec![std::collections::BTreeSet::new(); n];
    for _ in 1..n {
        let x: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;
        let y: usize = it.next().unwrap().parse::<usize>().unwrap() - 1;
        g[x].insert(y);
        g[y].insert(x);
    }
    let mut q = vec![];
    let mut stack = vec![(0, 0)];
    while let Some((v, p)) = stack.pop() {
        q.push(v);
        g[v].remove(&p);
        for &u in &g[v] {
            stack.push((u, v));
        }
    }
    let mut dp = vec![(1, 1); n];
    const MOD: u64 = 1_000_000_007;
    for &v in q.iter().rev() {
        for &u in &g[v] {
            dp[v].0 = dp[v].0 * (dp[u].0 + dp[u].1) % MOD;
            dp[v].1 = dp[v].1 * dp[u].0 % MOD;
        }
    }
    let ans = (dp[0].0 + dp[0].1) % MOD;
    println!("{}", ans);
}

fn main() {
    run();
}


Measured memory_bytes: 26876
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	var a = make([]int, n)
	for i := range a {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)

	var scoreOfAlice, scoreOfBob int
	for i := range a {
		switch {
		case i%2 == 0:
			scoreOfAlice += a[n-i-1]
		default:
			scoreOfBob += a[n-i-1]
		}
	}

	fmt.Println(scoreOfAlice - scoreOfBob)
}


Measured memory_bytes: 512
#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;

  int result = 0;
  if (a <= 9 && b <= 9) {
    result = a * b;
  } else {
    result = -1;
  }
  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdlib>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;
vector<int> x;

int main(){
    int n, k;
    int tmpl, tmpr;
    int lr, rl;
    int ans = 1000000000;
    cin >> n >> k;
    x.resize(n);
    rep(i,n) cin >> x[i];
    for(int i=0; i<=n-k; i++){
        tmpl = x[i];
        tmpr = x[i+k-1];
        lr = abs(tmpl) + abs(tmpr-tmpl);
        rl = abs(tmpr) + abs(tmpl-tmpr);
        if(ans > lr){
            ans = lr;
        }
        if(ans > rl){
            ans = rl;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,x,y;
  cin >> n >> x >> y;
  
  vector<int>ans(n);
  
  for(int i=1; i<n; i++){
   for(int j=i+1; j<n+1; j++){
     int a;
     int s;
     a = j-i;
     if(i<=x){
       if(j<=y){
         s = x-i+y-j+1;
       }
       else s = x-i+j-y+1;
     }
     
     else{
      if(j<=y){
       s = i-x+y-j+1; 
      }
       else s=i-x+j-y+1;
       
     }
     
     a = min(s,a);
     ans[a]++;
     
   }
  }
  
  for(int i=1; i<n; i++){
   cout << ans[i] << endl; 
  }
  
  
  
}


Measured memory_bytes: 256