akhauriyash/Code-Regression huggingface dataset:
'''
黒マスの条件
行ボタン押 and (not 列ボタン押)
(not 行ボタン押） and 列ボタン押

行列の押したボタンは上左詰めできるので、
位置は関係がない
押したボタン数を考えたらよい

k, lを行、列ボタンの押下数とする
'''

N, M, K = map(int, input().split())
flg = False
for k in range( N+1):
    for l in range(M+1):
        if K == k * (M - l) + l * (N - k):
            flg = True
            break
print('Yes' if flg else 'No')

Measured memory_bytes: 3060
s=input()
q=int(input())
mae=""
usr=""
flg=True
for i in range(q):    
    a=list(map(str,input().split()))
    if a[0]=="1":
        if flg:
            flg=False
        elif flg==False:
            flg=True
    if a[0]=="2":
        if a[1]=="1":
            if flg:
                mae=a[2]+mae
            else:
                usr=usr+a[2]
        if a[1]=="2":
            if flg:
                usr=usr+a[2]
            else:
                mae=a[2]+mae
if flg:
    ans=mae+s+usr
else:
    ans=usr[::-1]+s[::-1]+mae[::-1]
print(ans)

Measured memory_bytes: 224620
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"math"
)

func main() {
	solve(os.Stdin, os.Stdout)
}

func solve(in io.Reader, out io.Writer) {
	var bs = NewBufScanner(in)
	var bw = NewBufWriter(out)
	defer bw.w.Flush()

	n := bs.IntScan()
	as := []int{}

	for i := 0; i < n; i++ {
		as = append(as,  bs.IntScan())
	}

	answers := []answer{}
	max := maxIndex(as)
	min := minIndex(as)
	if abs(as[max]) >= abs(as[min]) {
		val := as[max]
		for i := 0; i < n; i++ {
			as[i] += val
			answers = append(answers, answer{x: max, y: i})
		}

		for i := 0; i < n - 1; i++ {
			as[i+1] += as[i]
			answers = append(answers, answer{x: i, y: i+1})
		}
	} else {
		val := as[min]
		for i := 0; i < n; i++ {
			as[i] += val
			answers = append(answers, answer{x: min, y: i})
		}

		for i := n-1; i > 0; i-- {
			as[i-1] += as[i]
			answers = append(answers, answer{x: i, y: i-1})
		}
	}

	bw.Printf("%d\n", len(answers))
	for _, a := range answers {
		bw.Printf("%d %d\n", a.x+1, a.y+1)
	}
}


type answer struct {
	x int
	y int
}

func maxIndex(l []int) int {
	max := math.MinInt32
	idx := -1
	for i, v := range l {
		if max <= v {
			max = v
			idx = i
		}
	}
	return idx
}

func minIndex(l []int) int {
	min := math.MaxInt32
	idx := -1
	for i, v := range l {
		if min >= v {
			min = v
			idx = i
		}
	}
	return idx
}


func abs(x int) int {
	return int(math.Abs(float64(x)))
}

// BufScanner original scanner
type BufScanner struct {
	s *bufio.Scanner
}

// NewBufScanner constructer
func NewBufScanner(in io.Reader) *BufScanner {
	s := bufio.NewScanner(in)
	s.Buffer(make([]byte, 1024), 1e+9)
	s.Split(bufio.ScanWords)
	return &BufScanner{
		s: s,
	}
}

// Scan Scan Data
func (b *BufScanner) Scan() string {
	b.s.Scan()
	return b.s.Text()
}

// IntScan Scan Data
func (b *BufScanner) IntScan() int {
	v, err := strconv.Atoi(b.Scan())
	if err != nil {
		panic(err)
	}
	return v
}

// BufWriter original writer
type BufWriter struct {
	w *bufio.Writer
}

// NewBufWriter constructer
func NewBufWriter(out io.Writer) *BufWriter {
	w := bufio.NewWriter(out)
	return &BufWriter{
		w: w,
	}
}

// Printf Output file
func (b *BufWriter) Printf(format string, a ...interface{}) {
	fmt.Fprintf(b.w, format, a...)
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
#define int long long
#define endl '\n'
using namespace std;
 
typedef long long ll;
#define db(x) cerr << #x << ": " << x << '\n';
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; FOR(i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; FOR(i, 1, n) {FOR(j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) FOR (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) FOR (i, 1, n) {FOR (j, 1, m) cout << a[i][j] << " "; cout << endl;}
#define all(v) v.begin(), v.end()
#define sz(v) (int)(v.size())
#define rz(v, n) v.resize((n) + 1);
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define vpi vector <pi>
#define vvi vector <vi>
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	readb(n, x);
	readarr(s, n);
	sort(s + 1, s + n + 1);
	
	int dp[x + 1] = {}, sum = 0;
	FORD (j, x, 0) dp[j] = j % s[1];
	
	FOR (i, 2, n)
	    FORD (j, x, 0)
	    {
	        if (j < s[i]) dp[j] = dp[j]*i % mod;
	        else dp[j] = (dp[j]*(i - 1) + dp[j % s[i]]) % mod;
	    }
	
	print(dp[x]);
}



















Measured memory_bytes: 1024
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();


    int P = A + B;
    int Q = P % 2;
    if(Q == 1 ) {
      System.out.println("IMPOSSIBLE");
    }else{
      System.out.println(P / 2);
    }
  }
}


Measured memory_bytes: 22100
if __name__ == '__main__':
	N,K = map(int, input().split())
	s = [0] * N
	for _ in range(K):
		d = int(input())
		a = [int(a) for a in input().split()]
		for i in a:
			s[i-1] += 1

	print(s.count(0))

	

Measured memory_bytes: 9196
#include "bits/stdc++.h"

using namespace std;

void Main() {
    int N;
    cin >> N;
    vector<string> S(N, "");
    for (int i = 0; i < N; ++i) {
        cin >> S[i];
    }

    set<string> prizes;
    for (int i = 0; i < N; ++i) {
        prizes.insert(S[i]);
    }
    int n = prizes.size();

    cout << n << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 25092
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <deque>
#include <map>
using namespace std;
int main() {
	string s;
	cin >> s;
	int n = s.size();
	sort(s.begin(), s.end());
	for (int i = 1; i < n; i++) {
		if (s[i] == s[i - 1]) {
			cout << "no" << endl;
			return 0;
		}
	}
	cout << "yes" << endl;
	return 0;
}

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

using namespace std;

int main () {
  
  int A, B, X;
  cin >> A >> B >> X;

  bool ans;

  if (X < A || X > A + B) {
    ans = false;
  } else {
    ans = true;
  }

  if (ans) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }

  return 0;
}

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

 int l=s.size();
 int k=l/2;
 int found=0;
 int i=0,j=l-1;
 while(i<=j)
 {if(s[i]!=s[j])
    {found=1;
    break;}
  i++;j--;
 }

 string s1=s.substr(0,k);
 string s2=s.substr(k+1,k);

 int found1=0,found2=0;

  i=0,j=k-1;
 while(i<=j)
 {if(s1[i]!=s1[j])
    {found1=1;
    break;}
  i++;j--;
 }

 i=0;j=k-1;
 while(i<=j)
 {if(s2[i]!=s2[j])
    {found2=1;
    break;}
  i++;j--;
 }
 if(found1==0&&found2==0&&found==0)
 {
   cout<<"Yes";}
 else
 {cout<<"No";}

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <tuple>

using namespace std;

const int MOD = 1000000007;
typedef long long ll;

struct UnionFind {
  vector<int> par;

  UnionFind(int n) : par(n, -1) { }
  void init(int n) { par.assign(n, -1); }

  int root(int x) {
    if (par[x] < 0) return x;
    else return par[x] = root(par[x]);
  }

  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (par[x] > par[y]) swap(x, y); // merge technique
    par[x] += par[y];
    par[y] = x;
    return true;
  }

  int size(int x) {
    return -par[root(x)];
  }
};

int main()
{
  int N;
  cin>>N;
  vector<pair<int,int> > x(N), y(N);
  for(int i=0;i<N;i++){
    int tmpx,tmpy;
    cin>>tmpx>>tmpy;
    x[i]=make_pair(tmpx,i);
    y[i]=make_pair(tmpy,i);
  }

  vector<tuple<int, int, int> > edges;
  edges.reserve(210000);
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  for(int i=0;i<N-1;i++){
    edges.push_back(
      make_tuple(x[i+1].first-x[i].first, x[i].second, x[i+1].second)
    );
    edges.push_back(
      make_tuple(y[i+1].first-y[i].first, y[i].second, y[i+1].second)
    );
  }

  sort(edges.begin(), edges.end());
  UnionFind uf(N);
  ll ans=0;

  for(auto p :edges){
    int c,i,j;
    tie(c,i,j)=p;

    if(!uf.issame(i,j)){
      uf.merge(i,j);
      ans+=c;
    }
  }
  cout<<ans<<endl;

}


Measured memory_bytes: 4608
main :: IO ()
main = do
  s <- getLine
  solver s

solver :: String -> IO ()
solver s
  = print $ if s !! 1 /= 'S'
      then length $ filter (=='R') s
      else if 'R' `elem` s then 1 else 0

solver' :: String -> IO ()
solver' s
  | s == "SSS" = print 0
  | s == "RSS"
  || s== "RSR"
  || s== "SRS"
  || s== "SSR" = print 1
  | s == "RRS"
  || s== "SRR" = print 2
  | otherwise = print 3

Measured memory_bytes: 3768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    ll mn = INF;
    for(int i = 0; i <= n - k; i++){
        ll l = a[i], r = a[i + k - 1];
        mn = min(mn, abs(l - r) + min(abs(l), abs(r)));
    }
    cout << mn << "\n";
}

Measured memory_bytes: 4000
#include <bits/stdc++.h>
#define FOR(i, k, n) for(int i = (k); i < (n); i++)
#define FORe(i, k, n) for(int i = (k); i <= (n); i++)
#define FORr(i, k, n) for(int i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(int i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using ll = long long;

const int INF = 1001001001;
ll gcd(ll a, ll b){ return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b){ return a/gcd(a,b)*b; }

int main(void){
  int n;
  cin >> n;
  vector<ll> a(n);
  REP(i, n) cin >> a[i];
  ll ans = 0;
  REP(i, n) ans = gcd(ans, a[i]);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>a
#define pb push_back
#define sz(x) int(x.size())

#define mp make_pair
#define all(a) (a).begin(),(a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

class UnionFind{
  public:
  vi Parent;
  UnionFind(int n){
    Parent = vi(n,-1);
  }

  int root(int a){
    if(Parent[a] < 0) return a;
    else return Parent[a] = root(Parent[a]);
  }

  int size(int a){
    return -Parent[root(a)];
  }

  bool merge(int a, int b){
    a = root(a);
    b = root(b);
    if(a == b) return false;

    if(size(a) < size(b)) swap(a,b);
    Parent[a] += Parent[b];
    Parent[b] = a;

    return true;
  }
};

class Factrial{
  public:
  vl Fac;
  Factrial(int MAX){
    Fac = vl(MAX+1);
    rep(i,MAX) {
      if(i == 0) Fac[i+1] = 1;
      else Fac[i+1] = ((i+1)*Fac[i])%MOD;
    }
  }
};

class Eratosthenes{
  public:
  vi P;
  vb Prime;
  Eratosthenes(int MAX){
    Prime = vb(MAX+1,true);
    for(int i = 2; i <= MAX; i++) {
      if(Prime[i]){
        P.pb(i);
        for(int j = i*2; j <= MAX; j += i) {
          Prime[j] = false;
        }
      }
    }
  }
  int size(){
    return P.size();
  }
};

int main(){
  int n; cin >> n;
  int m = 55555;
  Eratosthenes E(m);
  vi a;
  while(sz(a) < n){
    rep(i,E.size()) {
      if(E.P[i]%5 == 1) a.pb(E.P[i]);
    }
  }
  rep(i,n) cout << a[i] << " ";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int N = 100010;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(auto &t:a)cin>>t;return i;}
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T> void prArr(T a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

int func(int n,int mod){
  if(n < mod) return n;
  return func(n/mod,mod) + n % mod;
}

signed main(){
  int n,s;
  cin>>n>>s;

  if(n == s){
    cout<<n+1<<endl;
    return 0;
  }

  for(int i=2;i<=1e6;i++){
    if(func(n,i) != s) continue;
    cout<<i<<endl;
    return 0;
  }

  int ans = INF;
  for(int i=1;i<=1e6;i++){
    int b = (n-s+i)/i;
    if(b <= 1 || func(n,b) != s) continue;
    Min(ans,b);
  }
  
  if(ans == INF) ans = -1;
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<queue>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> P;
typedef long long int ll;
typedef pair<ll,ll> LLP;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define INF 1000000007
#define MOD 1000000007
#define ARRAY_MAX 70

char mp[ARRAY_MAX][ARRAY_MAX];
int sx,sy;//スタート
int gx,gy;//ゴール
int h,w;
int d[ARRAY_MAX][ARRAY_MAX];

int bfs(){

    queue<P> que;
    REP(i,ARRAY_MAX){
        REP(j,ARRAY_MAX){
            d[i][j] = INF;//最短距離の初期化
        }
    }

    que.push(P(sy,sx));//y,xの順
    d[sy][sx] = 0;

    while(que.size()){

        P p = que.front();//first:y,second:x
        que.pop();
        if(p.first == gy && p.second == gx){
            break;
        }
        for(int i = 0;i < 4;i++){
            int ny = p.first + dy[i];
            int nx = p.second + dx[i];

            if(0 <= nx && nx < 2*w-1 && 0 <= ny && ny < 2*h-1 && mp[ny][nx] != '*' && d[ny][nx] == INF){
                //移動先が配列内かつ道である場合
                que.push(P(ny,nx));

                if((i == 0 && nx % 2 == 1) || (i == 1 && ny % 2 == 1) || (i == 2 && ny % 2 == 1) || (i == 3 && nx % 2 == 1)){
                    d[ny][nx] = d[p.first][p.second];
                }else{
                    d[ny][nx] = d[p.first][p.second] + 1;
                }
            }
        }
    }
    return d[gy][gx];
}



int main(){

    while(cin >> w >> h,w){
        
        sx = sy = 0;
        gx = 2*w-2;
        gy = 2*h-2;
        REP(i,ARRAY_MAX){
            REP(j,ARRAY_MAX){
                //とりあえず全て*で埋める
                //道は後で置き換える
                mp[i][j] = '*';
            }
        }

        REP(i,2*h-1){

            if(i % 2 == 0){
                //縦棒を構築
                for(int j = 0;j < 2*w;j+=2){
                    mp[i][j] = '&';//道に直す
                }
                REP(j,w-1){
                    int a;
                    cin >> a;
                    if(!a){
                        //壁がないなら道に直す
                        mp[i][2*j+1] = '&';
                    }else{
                        mp[i][2*j+1] = '*';
                    }
                }
            }else{
                //横棒を構築
                REP(j,w){
                    int a;
                    cin >> a;
                    if(!a){
                        //壁でないなら道に直す
                        mp[i][2*j] = '&';
                    }else{
                        mp[i][2*j] = '*';
                    }
                }
            }
        }

        //迷路の構築終了
        int ans = bfs();
        if(ans == INF){
            cout << "0" << endl;
        }else{
            cout << ans+1 << endl;
        }
    }

    return 0;
}



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

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

int main()
{
    int k,x; cin>>k>>x;
    int tot=2*k-1;
    int fi=x-k+1;
    while(tot) { cout<<fi<<' '; tot--; fi++;}
    return 0;
}

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

int n,m;

int main() {
    cin >> n >> m;
    if (n%2==1) {
        for (int i=1;i<=m;i++) {cout << i << " " << n-i << endl;}
    }
    else {
        int z=1;
        for (int i=1;i<=m;i++) {
                if (i*4>n) z=0;
                cout << i << " " << n-i+z << endl;
        }
    }

}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> lp;
typedef pair<ll,pair<ll,ll>> lpp;
#define rep(i,n) for(ll i = 0;i<((ll)(n));i++)
#define reg(i,a,b) for(ll i = ((ll)(a));i<=((ll)(b));i++)
#define irep(i,n) for(ll i = ((ll)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(ll i = ((ll)(b));i>=((ll)(a));i--)
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T = int> void print(vector<T> v){for(auto a:v)cout<<a<<" ";cout<<endl;}

template<int MOD>
struct ModInt {
	static const int Mod = MOD;
	unsigned x;
	ModInt() : x(0) { }
	ModInt(signed sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	ModInt(signed long long sig) { int sigt = sig % MOD; if (sigt < 0) sigt += MOD; x = sigt; }
	int get() const { return (int)x; }

	ModInt &operator+=(ModInt that) { if ((x += that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator-=(ModInt that) { if ((x += MOD - that.x) >= MOD) x -= MOD; return *this; }
	ModInt &operator*=(ModInt that) { x = (unsigned long long)x * that.x % MOD; return *this; }
	ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
	ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
	ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
	ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
	ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
	ModInt inverse() const {
		signed a = x, b = MOD, u = 1, v = 0;
		while (b) {
			signed t = a / b;
			a -= t * b; std::swap(a, b);
			u -= t * v; std::swap(u, v);
		}
		if (u < 0) u += Mod;
		ModInt res; res.x = (unsigned)u;
		return res;
	}
};
typedef ModInt<1000000007> mint;

mint pow(ll a, ll n){
	mint r=1, x=a;
		while(n){
			r*=((n%2)?x:1);
			x*=x;
			n>>=1;
		}
		return r;
}

vector<mint> fact, factinv;
void nCr_computeFactinv(int N) {
	N = min(N, mint::Mod - 1);
	fact.resize(N + 1); factinv.resize(N + 1);
	fact[0] = 1;
	reg(i, 1, N) fact[i] = fact[i - 1] * i;
	factinv[N] = fact[N].inverse();
	for (int i = N; i >= 1; i --) factinv[i - 1] = factinv[i] * i;
}
mint nCr(int n, int r) {
	if (n >= mint::Mod)
		return nCr(n % mint::Mod, r % mint::Mod) * nCr(n / mint::Mod, r / mint::Mod);
	return r > n ? 0 : fact[n] * factinv[n - r] * factinv[r];
}
mint nPr(int n, int r) {
	if (r<0)return 0;
	return r > n ? 0 : fact[n] * factinv[n-r];
}
mint nHr(int n, int r) { return r == 0 ? 1 : nCr(n + r - 1, r); }

/*
ac
Tが与えられたときに、Sに操作を施してTを作れるかという判定問題として考える	s
*/

ll k;
string s;
mint ans;

int main(void){
	cin>>k>>s;
	nCr_computeFactinv(2000010);
	reg(i,0,k)ans += nCr(k+s.size()-i-1, s.size()-1) * pow((ll)25,k-i) * pow((ll)26,i);
	cout<<ans.get()<<endl;
	return 0;
}

Measured memory_bytes: 19972
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lll = __int128_t;
typedef pair<ll,ll> P;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
const ll longinf=1ll<<60;
const int inf=(1<<30)-1;

int main(){
      int a;
      string s;
      cin>>a>>s;
      if(a>=3200){
            cout<<s<<endl;
      }
      else{
            cout<<"red"<<endl;
      }
      return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
typedef long long ll;
const ll MOD=1e9+7;
int h,w,a,b;
const int maxf=2e5+10;
ll f[maxf],frev[maxf];
ll pow(ll b,ll p,ll k=MOD)
{
	ll t=1,y=b;
	while(p!=0)
	{
		if((p&1)==1) t=t*y%k;
		y=y*y%k;p=p>>1;
	}
	return t;
}
void preload()
{
    f[0]=1;frev[0]=pow(1,MOD-2);
    for(int i=1;i<=2e5;i++)
    {
        f[i]=(f[i-1]*i)%MOD;
        frev[i]=pow(f[i],MOD-2);
    }
}
ll C(ll n,ll m)
{
    return f[n]%MOD*frev[m]%MOD*frev[n-m]%MOD;
}
ll counter(int x,int y,int xx,int yy)
{
    ll tot=(yy-y)+(xx-x);
    ll d=xx-x;
    return C(tot,d)%MOD;
}
int main()
{
    preload();
    scanf("%d%d%d%d",&h,&w,&a,&b);
    ll tot=counter(1,1,h,w);
    for(ll i=1;i<=b;i++)
    {
        ll t=counter(1,1,h-a,i)*counter(h-a+1,i,h,w)%MOD;
        tot=((tot-t)%MOD+MOD)%MOD;
    }
    printf("%lld\n",tot);
}


Measured memory_bytes: 3328
#include <stdio.h>
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <algorithm>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;

typedef long long ll;

ll N, Y;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    /*N, Yの入力*/
    cin >> N >> Y;
    
    /* 10000a+5000b+1000c=Y, a+b+c=Nとすると
     * 9000a+4000b=Y-1000Nを満たすa,bを求めれば良い */
    for (ll a = 0; (9000 * a) <= (Y - (1000 * N)); a++) {
        for (ll b = 0; (4000 * b) <= (Y - (1000 * N) - (9000 * a)); b++) {
            if (a + b > N) {
                break;
            }
            if (((9000 * a) + (4000 * b)) == Y - (1000 * N)) {
                cout << a << " " << b << " " << (N - a - b) << endl;
                return 0;
            }
        }
    }
    
    cout << "-1 -1 -1" << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  for (int i = 0; i < h; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < w+2; i++) {
    cout << '#';
  }
  cout << endl;
  for (int i = 0; i < h; i++) {
    cout << '#' << a[i] << '#' << endl;
  }
  for (int i = 0; i < w + 2; i++) {
    cout << '#';
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int n,a,b,c,d;cin>>n;
  	a=n/1000,b=n/100%10,c=n/10%10,d=n%10;
	char p='+',m='-';
	if(a+b+c+d==7)cout<<a<<p<<b<<p<<c<<p<<d<<"=7"<<endl;
	else if(a+b+c-d==7)cout<<a<<p<<b<<p<<c<<m<<d<<"=7"<<endl;
	else if(a+b-c+d==7)cout<<a<<p<<b<<m<<c<<p<<d<<"=7"<<endl;
	else if(a+b-c-d==7)cout<<a<<p<<b<<m<<c<<m<<d<<"=7"<<endl;
	else if(a-b+c+d==7)cout<<a<<m<<b<<p<<c<<p<<d<<"=7"<<endl;
	else if(a-b+c-d==7)cout<<a<<m<<b<<p<<c<<m<<d<<"=7"<<endl;
	else if(a-b-c+d==7)cout<<a<<m<<b<<m<<c<<p<<d<<"=7"<<endl;
	else if(a-b-c-d==7)cout<<a<<m<<b<<m<<c<<m<<d<<"=7"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
const int MOD=(int)1e9+7;
using namespace std;
int main(){
    int n;
    cin>>n;
    long long ans=1;
    for(int i = 1; i <= n; ++i){
        ans*=i;
        ans%=MOD;
}
cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll INF = 1e9;
const long long INFL = 1LL<<60;

int calc(const int& a) {
  if (a == 1) {
    return 300000;
  } else if (a == 2) {
    return 200000;
  } else if (a == 3) {
    return 100000;
  } else {
    return 0;
  }
}

int main()
{
  int x, y;
  cin >> x >> y;
  int ans = 0;
  ans += calc(x);
  ans += calc(y);
  if (x == 1 && y == 1) ans += 400000;

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 100100;
int n;
int a[N];

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	sort(a, a + n);
	if (n % 3 == 0) {
		n /= 3;
		if (a[0] == a[n - 1] && a[n] == a[2 * n - 1] && a[2 * n] == a[3 * n - 1] && (a[0] ^ a[n] ^ a[2 * n]) == 0)
			printf("Yes\n");
		else
			printf("No\n");
	} else {
		if (a[n - 1] == 0)
			printf("Yes\n");
		else
			printf("No\n");
		return 0;
	}

	return 0;
}


Measured memory_bytes: 640
// Example program
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string S;
    string T;
    cin>>S>>T;
    if(S.size() + 1 != T.size()){
        cout<<"No"<<endl;
        return 0;
    }
    
    for(int i=0; i<S.size();i++){
        char s = S[i];
        char t = T[i];
        if(s != t){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
typedef long long ll;
const int N = 1000000;

int main() {
    int n; cin >> n;
    int sum = 0;
    for (int i = 0; i < n; ++i) {
        int l,r;
        cin >> l >> r;
        sum += r - l + 1;
    }
    print(sum);
}

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

int n,m;
map<string,int> regi;
string s;
bool now=1;

int main(){
  int i;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> s;
    regi[s]=1;
  }
  cin >> m;
  for(i=0;i<m;i++){
    cin >> s;
    if(regi.find(s)==regi.end())cout << "Unknown " << s << endl;
    else {
      if(now){
	cout << "Opened by " << s << endl;
	now=0;
      }
      else {
	cout << "Closed by " << s << endl;
	now++;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3240
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  string S;
  cin>>S;
  
  vector<char> vec(S.size());
  for(int i=0;i<S.size();i++){
    vec[i]=S[i];
  }
  sort(vec.begin(),vec.end());
  
  
  bool check=true;
  
  for(int i=0;i<S.size();i++){
    if(vec[i]==vec[i+1]){
      check=false;
      break;
    }
  }
  
  
  if(check){
    cout<<"yes"<<endl;
  }
  else{
    cout<<"no"<<endl;
  }
}

Measured memory_bytes: 3612
#include<set>
#include<iostream>
#include<ctime>
#include<string>
#include<cstdlib>
#include<algorithm>
#include<random>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<functional>
#include<string.h>
#include<limits.h>
using namespace std;

signed main() {
	string a; cin >> a;
	if (a.length() >= 4 && a.substr(0, 4) == "YAKI") {
		puts("Yes");
	}
	else {
		puts("No");
	}
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

void die() {
  cout << "No\n";
  exit(0);
}

void solve() {
  string s, t;
  cin >> s >> t;
  map<char, char> st, ts;
  for(int i = 0; i < s.size(); i++) {
    if(st.count(s[i]) && st[s[i]] != t[i]) {
      die();
    }
    if(ts.count(t[i]) && ts[t[i]] != s[i]) {
      die();
    }
    st[s[i]] = t[i];
    ts[t[i]] = s[i];
  }
  cout << "Yes\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


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

/*解説AC*/
int main(void){
    int n;
    ll d, a;
    cin>>n>>d>>a;
    vector<pair<ll, ll> > v(n);
    rep(i, n){
        ll x, h;
        cin>>x>>h;
        v[i] = make_pair(x, h);
    }
    sort(v.begin(), v.end());
    queue<pair<ll, ll> > que;
    ll ans = 0;
    ll tot = 0;
    rep(i, n){
        ll x = v[i].first;
        ll h = v[i].second;
        while(!que.empty() && que.front().first<x){
            tot -= que.front().second;
            que.pop();
        }
        h -= tot;
        if(h>0){
            ll num = (h+a-1)/a;
            ans += num;
            ll damage = num*a;
            tot += damage;
            que.emplace(x+2*d, damage);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4992
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    s = input()
    s = s.replace("BC", "P")
    s = s.replace("B", "T")
    s = s.replace("C", "T")
    s = s.split("T")
    ans = 0
    for ss in s:
        p = 0
        for i in range(len(ss) - 1, -1 ,-1):
            if ss[i] == 'P':
                p += 1
            elif ss[i] == 'A':
                ans += p
    print(ans)





    


if __name__ == '__main__':
    main()


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

bool binary_search(int n,int l, int r)
{
	if (r - l == 1)
	{
		if (S[r] == n) return true;
		else return false;
	}
	int m = (l + r) / 2;
	if (S[m] >= n)
	{
		return binary_search(n,l,m);
	}
	else
	{
		return binary_search(n,m,r);
	}
}

int main()
{
	int n,q,t,ans = 0;
	cin >> n;
	rep(i,n)
	{
		cin >> S[i];
	}
	cin >> q;
	rep(i,q)
	{
		cin >> t;
		if (binary_search(t,-1,n)) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3372
/*  ex3_2
    B30095    */
#include <stdio.h>

int main(void){
    int numOfPencils;
    scanf("%d", &numOfPencils);

    switch (numOfPencils % 10){  // ones' place
        case 2: case 4: case 5: case 7: case 9:
            printf("hon");
            break;
        case 0: case 1: case 6: case 8:
            printf("pon");
            break;
        case 3:
            printf("bon");
            break;
        default:
            break;
    }

    return 0;
}

Measured memory_bytes: 1692
#include <bits/stdc++.h>
using namespace std;
#pragma region Macros
typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
const long long MOD=1e9+7;
// const long long MOD=998244353;
const int INF=1e9;
const long long IINF=1e18;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
const char dir[4]={'D','R','U','L'};
#define LOCAL

template<typename T>
istream &operator>>(istream &is,vector<T> &v){
    for (T &x:v) is >> x;
    return is;
}
template<typename T>
ostream &operator<<(ostream &os,const vector<T> &v){
    for (int i=0;i<v.size();++i){
        os << v[i] << (i+1==v.size()?"": " ");
    }
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const pair<T,U> &p){
    cout << '(' << p.first << ',' << p.second << ')';
    return os;
}
template<typename T,typename U>
ostream &operator<<(ostream &os,const map<T,U> &m){
    os << '{';
    for (auto itr=m.begin();itr!=m.end();++itr){
        os << '(' << itr->first << ',' << itr->second << ')';
        if (++itr!=m.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os,const set<T> &s){
    os << '{';
    for (auto itr=s.begin();itr!=s.end();++itr){
        os << *itr;
        if (++itr!=s.end()) os << ',';
        --itr;
    }
    os << '}';
    return os;
}

void debug_out(){cerr << '\n';}
template<class Head,class... Tail>
void debug_out(Head&& head,Tail&&... tail){
    cerr << head;
    if (sizeof...(Tail)>0) cerr << ", ";
    debug_out(move(tail)...);
}
#ifdef LOCAL
#define debug(...) cerr << " ";\
cerr << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << '\n';\
cerr << " ";\
debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<typename T> T gcd(T x,T y){return y!=0?gcd(y,x%y):x;}
template<typename T> T lcm(T x,T y){return x/gcd(x,y)*y;}

template<class T1,class T2> inline bool chmin(T1 &a,T2 b){
    if (a>b){a=b; return true;} return false;
}
template<class T1,class T2> inline bool chmax(T1 &a,T2 b){
    if (a<b){a=b; return true;} return false;
}
#pragma endregion

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int D; cin >> D;
    vector<int> c(26); cin >> c;
    vector<vector<int>> s(D,vector<int>(26)); cin >> s;
    vector<int> last(26,-1);
    int now=0;
    for (int i=0;i<D;++i){
        int t; cin >> t; --t;
        now+=s[i][t]; last[t]=i;
        for (int j=0;j<26;++j) now-=c[j]*(i-last[j]);
        cout << now << '\n';
    }
}

Measured memory_bytes: 3656
import sys
import math

x,n=list(map(int,input().split()))
l=list(map(int,input().split()))
dic={}
if n==0:
    print(x)
else:
    for i in l:
        dic[i]=0
    k=0
    while True:
        if not x-k in dic:  
            print(x-k)
            break
        if not x+k in dic:  
            print(x+k)
            break
        k+=1

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll l;
    cin >> l;
    double a = (double)l / (3.0);
    double ans = a * a * a;
    printf("%.10lf\n", ans);
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#include<deque> // new!! 
#define rep(i,rept)	for(ll i = 0; i<rept;i++)
typedef long long ll;
const ll MOD = 1e9 + 7;
using namespace std;

int main() {
	//五日目
	ll n = 0, kiyomaru = 0;
	vector<ll> a;
	deque<ll> dq;
	int ans[200000] = {};
	cin >> n;
	rep(i, n) {
		cin >> kiyomaru;
		if (n % 2 == 1) {
			if (i % 2 == 0) {
				dq.push_front(kiyomaru);
			}
			else {
				dq.push_back(kiyomaru);
			}
		}
		else {
			if (i % 2 == 1) {
				dq.push_front(kiyomaru);
			}
			else {
				dq.push_back(kiyomaru);
			}
		}
	}
	rep(i, n) {
		cout << dq[i] << " ";
	}
	cout << endl;
	
	return 0;
}

Measured memory_bytes: 3840
#include <iostream>
#include <string>

using namespace std;

int main()
{
    while (1)
    {
        int n, k, c=0;
        string a[10], val[10000], t;
        bool no;
        cin>>n>>k;
        if (n==0 && k==0) break;
        for (int i=0; i<n; i++) cin>>a[i];
        if (k==2)
        {
            for (int i=0; i<n; i++)
            {
                for (int j=0; j<n; j++)
                {
                    if (i==j) continue;
                    no=true;
                    t=a[i]+a[j];
                    for (int k=0; k<c; k++) if (val[k]==t) { no=false; k=c; }
                    if (no) { val[c]=t; c++; }
                }
            }
        }
        if (k==3)
        {
            for (int i=0; i<n; i++)
            {
                for (int j=0; j<n; j++)
                {
                    for (int k=0; k<n; k++)
                    {
                        if (i==j || j==k || i==k) continue;
                        no=true;
                        t=a[i]+a[j]+a[k];
                        for (int l=0; l<c; l++) if (val[l]==t) { no=false; l=c; }
                        if (no) { val[c]=t; c++; }
                    }
                }
            }
        }
        if (k==4)
        {
            for (int i=0; i<n; i++)
            {
                for (int j=0; j<n; j++)
                {
                    for (int k=0; k<n; k++)
                    {
                        for (int l=0; l<n; l++)
                        {
                            if (i==j || j==k || k==l || i==k || i==l || j==l) continue;
                            no=true;
                            t=a[i]+a[j]+a[k]+a[l];
                            for (int m=0; m<c; m++) if (val[m]==t) { no=false; m=c; }
                            if (no) { val[c]=t; c++; }
                        }
                    }
                }
            }
        }
        cout<<c<<'\n';
    }
    return 0;
}



Measured memory_bytes: 3208
//Author: AnandRaj uux
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll; 

#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test() int t;cin>>t;while(t--)
#define forn(i,f,n) for(int i=f;i<f+n;i++)
#define rforn(i,l,n) for(int i=l;i>l-n;i--)
#define all(v) v.begin(),v.end()
#define prin(V) for(auto v:V) cout<<v<<" ";cout<<endl
#define take(V,f,n) for(int i=f;i<f+n;i++) cin>>V[i]
#define what(x) cerr<<#x<<" = "<<x<<endl
#define KStest() int t,t1;cin>>t;t1=t;while(t--)
#define KScout cout<<"Case #"<<t1-t<<": "

const int MOD = 998244353,MAX = 1e5+5;
/////////////////FastExp///////////////////
ll powN(ll a,ll p)
{
	if(p==0) return 1;
	ll z=powN(a,p/2);
	z=(z*z)%MOD;
	if(p%2) z=(z*a)%MOD;
	return z;
}
/////////////////FastExp///////////////////
//////////////////Sieve////////////////////
vector<bool> is_prime(MAX+1, true);
void Sieve()
{
	is_prime[0] = is_prime[1] = false;
	int i,j;
	for (i = 2; i*i <= MAX; i++) 
	{
    	if (is_prime[i]) 
    	{
        	for (j = i * i; j <= MAX; j += i)
            {
				is_prime[j] = false;
    		}
    	}
	}
}
//////////////////Sieve////////////////////

int main()
{
	int s,w;
	cin>>s>>w;
	if(w>=s) cout<<"unsafe"<<endl;
	else cout<<"safe"<<endl;
}		

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <set>
using namespace std;
using ll = long long;
#define PI (acos(-1))

int main()
{
  int A, B, C;
  cin >> A >> B >> C;

  int K;
  cin >> K;

  int x = 0;

  while (K > 0)
  {
    K--;

    if (C > B && B > A)
    {
      x = 1;
      break;
    }

    if (B > A)
    {
      C *= 2;
    }
    else
    {
      B *= 2;
    }
  }

  if(C>B && B>A){
    x = 1;
  }

  if (x == 1)
  {
    cout << "Yes";
  }
  else
  {
    cout << "No";
  }
}


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

int main() {
	int n;
	long long L[87];
	scanf("%d",&n);
	L[0] = 2;
	L[1] = 1;
	for (int i = 2; i <= n; i++) {
		L[i] = (long long)L[i - 1] + L[i - 2];
	}
	printf("%lld", L[n]);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    map<int, int> mp;
    mp[-1] = 3;
    ll ans = 1;
    for(int i = 0; i < n; i++) {
        (ans *= max(mp[a[i] - 1] - mp[a[i]], 0)) %= MOD;
        mp[a[i]]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5376
while True:
    n = int(input())
    if n == -1:
        break
    x,y = 1,0
    for i in range(1,n):
        l = (x**2 + y**2)** -0.5
        x,y = x - l*y , y + l*x
    print(x)
    print(y)


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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


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

  string s,t;
  cin >> s;
  cin >> t;

  ll ans = 0;
  REP(i, 3){
    if(s[i] == t[i])
      ans++;
  }

  cout << ans << endl;
  
}


Measured memory_bytes: 256
#include <stdio.h>

int h;

int getleft(int i){
  i=i*2;
  if(i>h) return 500002;
  else return i;
}

int getright(int i){
  i=i*2+1;
  if(i>h) return 500002;
  else return i;
}

void maxHeapify(int A[],int i){
  int l = getleft(i),r = getright(i);
  int largest,j;

  if( l <= h && A[l] > A[i]) largest = l;
  else largest = i;
  if( r <= h && A[r] > A[largest]) largest = r;
  if (largest != i){
    j=A[i];
    A[i]=A[largest];
    A[largest]=j;
    maxHeapify(A,largest);
  }
}

void buildMaxHeap(int A[]){
    int i;
    for(i=h/2;i>=1;i--){
      maxHeapify(A,i);
    }
}

int main(){
	int i,A[500001];
	
	scanf("%d",&h);
	
	for(i=1;i<=h;i++){
	  scanf("%d",&A[i]);
	}

	buildMaxHeap(A);

	for(i=1;i<=h;i++){
	  printf(" %d",A[i]);
	}
	printf("\n");
	return 0;
 }

Measured memory_bytes: 2552
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)

int main() {

	string s; cin >> s;

	rep(i, 0, s.size() - 1) {
		if (s[i] == s[i + 1]) {
			cout << "Bad" << endl;
			return 0;
		}
	}

	cout << "Good" << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,n) for(int i=s;i<n;i++)
typedef long long ll;
const double PI = acos(-1);
int main(){
    double a,b,x;
    cin >> a >> b >> x;
    double theta;
    theta=atan(2*(b-x/pow(a,2))/a);
    if(theta>atan(2*x/pow(a,3))){
        theta = atan(a*pow(b,2)/(2*x));
    }
    double ans=180/PI*theta;

    printf("%.7f\n",ans);
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
char c;
bool C;
int main()
{
    while(scanf("%c",&c)!=EOF)
    {
        if(c=='C')
            C=true;
        if(C)
            if(c=='F')
            {
                puts("Yes");
                return 0;
            }
    }
    puts("No");
    return 0;
}

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

using namespace std;

int main() {
	string s, t;

	cin >> s;
	for (auto c : s) {
		// cout << c << endl;
		if (c == 'B') {
			if (!t.empty()) {
				t.pop_back();
			}
		} else {
			t += c;
		}
	}
	cout << t << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String str  = sc.nextLine();
        String[] astr = str.split(" "); //状況に合わせて
        int[] a = Stream.of(astr).mapToInt(x->{
            try{
                return Integer.parseInt(x) -1;
            }
            catch(Exception e){
                e.printStackTrace();
            }
            return 0;
        }).toArray();
        String str2  = sc.nextLine();
        String[] astr2 = str2.split(" "); //状況に合わせて
        int[] b = Stream.of(astr2).mapToInt(x->{
            try{
                return Integer.parseInt(x);
            }
            catch(Exception e){
                e.printStackTrace();
            }
            return 0;
        }).toArray();

        String str3  = sc.nextLine();
        String[] astr3 = str3.split(" "); //状況に合わせて
        int[] c = Stream.of(astr3).mapToInt(x->{
            try{
                return Integer.parseInt(x);
            }
            catch(Exception e){
                e.printStackTrace();
            }
            return 0;
        }).toArray();
        sc.close();
        int manzoku = 0;
        int before = 21;
        for(int i=0;i<a.length;i++){
            manzoku += b[a[i]];
            //System.out.println(b[a[i]]);
            if(before +1 == a[i]){
                manzoku += c[a[i-1]];
                //System.out.println(c[a[i-1]]);
            }
            before = a[i];
        }
        System.out.println(manzoku);
    }
}

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

int main(void){
  int N;
  cin >> N;
  double x, sum = 0;
  string u;
  for(int i = 0; i < N; i++){
    cin >> x >> u;
    if(u == "JPY") sum += x;
    if(u == "BTC") sum += 380000 * x;
  }
  cout << sum;
  return 0;
}

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

using namespace std;

std::string ab("AB");

int count_ab(const std::string& st) {
    int ret{0};
    std::size_t pos = st.find(ab);
    while (pos != std::string::npos) {
        ++ret;
        pos = st.find(ab, pos + ab.length());
    }
    return ret;
}

int main(int argc, char** argv) {
    int n, ans{0}, a_ended{0}, b_started{0}, both{0};
    cin >> n;
    std::string str;
    for (int i=0; i < n; ++i) {
        cin >> str;
        ans += count_ab(str);
        if (str.back() == 'A') {
            if (str.front() == 'B') {
                ++both;
            } else {
                ++a_ended;
            }
        } else if(str.front() == 'B') {
            ++b_started;
        }
    }

    ans += min(a_ended, b_started) + both;
    if (a_ended == 0 && b_started == 0 && both != 0) {
        --ans;
    }

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


Measured memory_bytes: 256