akhauriyash/Code-Regression huggingface dataset:
#[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)*}
    };
}

#[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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
      n: usize,
      aa: [usize; n],
    }

    let mut ans = 0;
    let mut j = 0;
    let mut sa = 0;
    for i in 0..n {
        if i > 0 {
            sa -= aa[i-1];
        }
        while j < n {
            if sa + aa[j] == sa ^ aa[j] {
                sa += aa[j];
                j += 1;
            } else {
                break;
            }
        }
        ans += j - i;
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
import bisect
n,q=map(int,input().split())
s=list(input())
l=[0]*q
r=[0]*q
for i in range(q):
    l[i],r[i]=map(int,input().split())
cnt=[]
ans=0
a=[]
a1=[]
for j in range(1,n):
    if s[j-1]+s[j]=='AC':
        ans+=1
        a.append(j-1)
        a1.append(j)
        cnt.append([j-1,j,ans])
for k in range(q):
    print(bisect.bisect_right(a1,r[k]-1)-bisect.bisect_left(a,l[k]-1))
    #print(bisect.bisect_right(a1,r[k]-1),bisect.bisect_left(a,l[k]-1))
#print(cnt)
#print(a)
#print(a1)

Measured memory_bytes: 66808
n = int(input())
R = len(str(n))


def dfs(ans, r, stop):
    if len(str(ans)) == stop:
        if ans <= n:
            if "3" in str(ans) and "5" in str(ans) and "7" in str(ans):
                return 1
            else:
                return 0
        else:
            return 0

    ret = [dfs(ans * 10 + j, r + 1, stop) for j in (3, 5, 7,)]

    return sum(ret)


x = 0
for i in range(3, R+1):
    x += dfs(0, 0, i)

print(x)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
  
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
  
using namespace std;
  
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;

int add(int &sum, int &n, int &cnt, int value){
    if(!n) return 0;
    n--;
    cnt++;
    sum+=value;
    return 1;
}

int main(){
    int a, b, c, d, e;
    while(cin >> a >> b >> c >> d >> e, a|b|c|d|e){
        int na, nb, nc;
        cin >> na >> nb >> nc;
        int sum = 0;
        if(nc >= d){
            sum += nc*e;
            nc = 0;
        }
        int cnt = nc, ssum = nc*c;
        while(na|nb){
            if(cnt == d) break;
            if(add(ssum, nb, cnt, b)) continue;
            if(add(ssum, na, cnt, a)) continue;
        }
        sum += nb*b + na*a + min(ssum, d*e);
        cout << sum << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
using System;
using System.Linq;

class Program
{
    static void Main()
    {
        var a = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToList();

        if (a[0] < a[1])
        {
            Console.WriteLine("a < b");
        }
        else if (a[0] > a[1])
        {
            Console.WriteLine("a > b");
        }
        else
        {
            Console.WriteLine("a == b");
        }
    }
}



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

int main() { 
    int a, b, ans = 0;
    cin >> a >> b;
//Yse No
    string sa, sb;
    for(int i = 0; i < b; ++i) {
        sa += to_string(a);
    }
    for(int i = 0; i < a; ++i) {
        sb += to_string(b);
    }
    if(sa > sb) {
        cout << sb<< '\n';
    } else {
        cout << sa << '\n';
    }
}


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

using namespace std;
typedef unsigned int UINT;
typedef long long LLONG;
typedef unsigned long long ULLONG;

#if 1
//No.2
int main()
{
	UINT x;
	cin >> x;

	int precious = 0;
	precious += (x / 500) * 1000;
	precious += (x % 500) / 5 * 5;

	cout << precious;

	return 0;
}
#endif

Measured memory_bytes: 256
#include <bits/stdc++.h>
/*
1 莠ｺ縺ｮ逶｣隕門藤繧帝・鄂ｮ縺吶ｋ縺ｨ騾｣邯壹＠縺・2D + 1 譛ｬ縺ｮ繧翫ｓ縺斐・譛ｨ繧堤屮隕悶〒縺阪∪縺吶ょ燕縺九ｉ鬆・↓隧ｰ繧√※驟咲ｽｮ縺吶ｋ
(萓九∴縺ｰ譛蛻昴・逶｣隕門藤縺ｫ縺ｯ 1, 2, ..., 2D + 1 逡ｪ逶ｮ縺ｮ譛ｨ繧堤屮隕悶＆縺帙ｋ) 縺ｮ縺梧怙驕ｩ縺ｪ縺ｮ縺ｧ縲∫ｭ斐∴縺ｯ N 繧・2D + 1 縺ｧ
蜑ｲ縺｣縺溷・繧贋ｸ翫￡縺ｫ縺ｪ繧翫∪縺吶ゆｸ闊ｬ逧・↓縲∵紛謨ｰ A, B 縺ｫ蟇ｾ縺励※ A
B 縺ｮ蛻・ｊ荳翫￡縺ｯ A+B竏・
B 縺ｮ蝠・→遲峨＠縺・〒縺吶ゅ＠
縺溘′縺｣縺ｦ縲∽ｻ雁屓縺ｮ蝣ｴ蜷医・ N+2D
2D+1 縺ｮ蝠・′遲斐∴縺ｫ縺ｪ繧翫∪縺吶・++ 縺ｧ縺ｮ螳溯｣・ｾ九ｒ莉･荳九↓謖吶￡縺ｾ縺・*/
using namespace std;
int main() {
  int N, D; cin >> N >> D;
  cout<< (N + D * 2) / (D * 2 + 1)<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int x,n,p[101],y,z,a,b,i,j,swap,q=0,s;
    scanf("%d%d",&x,&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&p[i]);
    }
    for(i=0;i<n-1;i++)
    {
        for(j=0;j<n-i-1;j++)
        {
            if(p[j]>p[j+1])
            {
                swap=p[j];
                p[j]=p[j+1];
                p[j+1]=swap;
            }
        }
    }
    for(i=0;;i++)
    {
        if(p[i]==x)
        {
            q=1;
            s=i;
            break;
        }
        else if(i==n)
        {
            break;
        }
    }
    y=x+1;
    z=x;
    if(q==0)
        printf("%d",x);
    else
    {
        for(i=s+1;i<n;i++)
        {
            if(p[i]>y)
                break;
            else if(p[i]==y)
                y++;
            else
                continue;
        }
        for(i=s;i>=0;i--)
        {
            if(p[i]<z)
                break;
            else if(p[i]==z)
                z--;
            else
                continue;
        }
        a=y-x;
        b=x-z;
        if(a<b)
            printf("%d",y);
        else
            printf("%d",z);
    }
    return 0;
}


Measured memory_bytes: 1728
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#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 rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
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;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
#pragma endregion
signed main() { 
    int n;cin >> n;
    vi a(n);
    rep(i, n)cin >> a[i];
    vi v=a;
    sort(all(v));
    int p = v[n/2-1],q = v[(n+1)/2];
    rep(i, n) {
        if(a[i]<=p)cout << q << endl;
        else cout << p << endl;
    }
    return 0;
}

Measured memory_bytes: 6320
while True:
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    w=0
    for a in range(1,n+1):
        for b in range(1,n+1):
            for c in range(1,n+1):
                if a>=b or b>=c :
                    pass
                elif a+b+c==x:
                    w+=1
                else:
                    pass
    print(w)


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
 
// 型名の省略
typedef unsigned int uint;
typedef long long lint;
typedef unsigned long long ulint;
 
const int MOD = 1000000007;
const lint INF = 1LL << 60;
const double PI=acos(-1.0);
 
// cinとcoutの高速化
#define endl "\n"
struct cinacc{cinacc(){cin.tie(0);ios::sync_with_stdio(false);}}cinaccc;
struct coutacc{coutacc(){cout.setf(ios::fixed);cout.precision(12);}}coutaccc;
 
// 繰り返し
#define rep(i,n) for(lint i=0;i<(lint)(n);i++)
#define reps(i,n) for(lint i=0;i<=(lint)(n);i++)
#define rrep(i,n) for(lint i=(lint)(n)-1;i>0;i--)
#define rreps(i,n) for(lint i=(lint)(n)-1;i>=0;i--)

#define pb push_back

#define p pair<int, int>
#define plint pair<lint, lint>

#define ALL(s) (s.begin(), s.end())
#define SZ(s) (s.size())

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

// Union-Find-Tree
class UnionFind {
    vector<int> par;
    UnionFind(int n):par(n){rep(i,n)par[i]=i;}
    int root(int x){if(par[x]==x)return x;return par[x]=root(par[x]);}
    void unite(int x,int y){int rx=root(x);int ry=root(y);if(rx==ry)return;par[rx]=ry;}
    bool same(int x,int y){return root(x)==root(y);}
};

// Final Weapon!
// #define int lint

#define MAX_N 100000
lint dp[MAX_N];

int main(void) {
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];
    rep(i, n) dp[i] = INF;
    dp[0] = 0;
    for(int i = 1; i < n; i++) {
        chmin(dp[i], dp[i-1] + abs(h[i-1] - h[i]));
        if(i > 1) chmin(dp[i], dp[i-2] + abs(h[i-2] - h[i]));
    }
    cout << dp[n-1];
    return 0;
}


Measured memory_bytes: 1408
#include <stdio.h>
 int main(void){
   int x,y,k;
   for ( ; ; ){
     scanf("%d %d",&x,&y);
     if (x == 0 && y == 0){
       break;
     }
     if (x > y){
       k = y, y = x, x = k;
     }
     printf("%d %d\n",x,y);
   }
   return 0;
 }


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

using namespace std;

const int size = 2e5 + 7;
long long int dp[2][size];
int mod = 1e9 + 7;  	
vector<int> graph[size];

long long int solve(int flag, int parent, int u){
	if(dp[flag][u] != -1) return dp[flag][u];
	long long int ans = 1, l =1, r = 1;
	bool hasChild = false;
	for(int v: graph[u]){
		if(v == parent) continue;
		hasChild = true;
		if(flag == 0){
			ans *= (solve(1, u, v) + solve(0, u, v))%mod;
		}
		else{
			ans *= solve(0, u, v)%mod;
		}
		ans %= mod;
	}
	if(!hasChild) return 1;
	// if(flag == 0) ans += r;
	dp[flag][u] = ans;
	return ans;
}

int main(){
	int n;
	cin>>n;
	for(int x=0;x<n-1;x++){
		int u, v;
		cin>>u>>v;
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
	int  root = -1;
	for(int x=1;x<=n;x++){
		if(graph[x].size() == 1) root = x;
	}
	for(int x=0;x<size;x++) dp[0][x] = dp[1][x] = -1;
	// cout<<root<<"\n";
	cout<<(solve(0,-1,1) + solve(1,-1,1))%mod;
	// cout<<<<"\n";
	return 0;
}

Measured memory_bytes: 19584
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int oddCount = 0;
		
		for(int i=1; i<=N; i++) {
			String temp = String.valueOf(i);
			if(temp.length() % 2 != 0) {
				oddCount++;
			}
		}
		System.out.println(oddCount);
		sc.close();
	}
}

Measured memory_bytes: 27604
#include <bits/stdc++.h>
using namespace std;
int main(){
  int H,W;
  cin >> H >> W;
  vector<vector<char>> str(H,vector<char>(W));
  for(int i=0;i<H;i++){
  	for(int j=0;j<W;j++){
    	cin >> str.at(i).at(j);
    }
  }
  vector<vector<int>> num(H+2,vector<int>(W+2,0));
  for(int i=0;i<H;i++){
  	for(int j=0;j<W;j++){
    	if(str.at(i).at(j)=='#') {
          num.at(i).at(j)++;
          num.at(i).at(j+1)++;
          num.at(i).at(j+2)++;
          num.at(i+1).at(j)++;
          num.at(i+1).at(j+2)++;
          num.at(i+2).at(j)++;
          num.at(i+2).at(j+1)++;
          num.at(i+2).at(j+2)++;
    }
  }
  }
  for(int i=0;i<H;i++){
  	for(int j=0;j<W;j++){
    	if(str.at(i).at(j)=='.') cout <<num.at(i+1).at(j+1);
      	else cout << '#';
    }
  cout << endl;
  }
}

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

const int N = 3003;
const int MOD = 1e9 + 7;
char str[N];
string s;
int n;

int dp[N][N];

int nxt(int idx , int x){
    if(idx+1 == n)return x;
    if(s[idx+1] == '<')return x;
    return x-1;
}

int solve(int idx , int x){
    //[0,n-idx-1]
    if(idx == n)return 1;
    if(x < 0 || x > n-idx-1)return 0;
    int &ret = dp[idx][x];
    if(~ret)return ret;
    if(s[idx] == '<')ret = solve(idx,x+1);
    else ret = solve(idx,x-1);

    ret += solve(idx+1,nxt(idx,x));
    if(ret >= MOD)
        ret -= MOD;
    return ret;
}

int main()
{

    scanf("%d%s",&n,str);
    s = '<' + string(str);
    memset(dp,-1,sizeof dp);
    printf("%d\n",solve(0,0));


    return 0;
}


Measured memory_bytes: 246528
"use strict";
function I(s,f){this._s=s.split("\n");this._c=0;this._l=0;this._f=f||Number}I.prototype.a=function(){var l=this._s[this._l];if(!l)return;var t=l.trim().split(" ");var a=t[this._c];this._c++;if(t.length===this._c){this._c=0;this._l++}return this._f(a)};I.prototype.l=function(){var l=this._s[this._l];if(!l)return;this._c=0;this._l++;return l.split(" ").map(this._f)};
// function build2DArray(r,u,a){for(var f=a||0,n=[],o=0;o<r;o++){for(var h=[],i=0;i<u;i++)h.push(f);n.push(h)}return n}
 
const mod = 998244353;
function main(input) {
  var o = new I(input);
 
  var n = o.a();
  var a = [];
  for (var i = 0; i<n; i++) {
    a.push(o.a());
  }
 
  var sum = a.reduce((acc, cur) => acc + cur, 0);
 
  var total = 1;
  for (var i = 0; i < n; i++) {
    total = (total * 3) % mod;
  }
 
  var ans1 = 0; // R >= S/2

  var dp1 = [1];
  
  for (var i = 1; i <= n; i++) {
    var dp2 = Array(dp1.length+a[i - 1]).fill(0);
    for (var j = 0; j < dp1.length; j++) {
      dp2[j] += dp1[j] * 2;
      dp2[j] %= mod;

      var next = j + a[i - 1];
      if (next <= sum) {
        dp2[next] += dp1[j];
      }
    }
    dp1 = dp2;
  }

  for (var j = Math.ceil(sum/2); j <= sum; j++) {
    ans1 += dp1[j];
  }
 
  var ans2 = 0;
  if (sum % 2 === 0) {
    var dp3 = [1];
    dp3[0] = 1;
    for (var i = 1; i <= n; i++) {
      var dp4 = Array(dp3.length+a[i-1]).fill(0);
      for (var j = 0; j < dp3.length; j++) {
        dp4[j] += dp3[j];
        dp4[j] %= mod;
  
        var next = j + a[i - 1];
        if (next <= sum) {
          dp4[next] += dp3[j];
        }
      }
  
      dp3 = dp4;
    }
   
    ans2 = dp3[sum/2];
  }
 
  let ans = (total - ans1 * 3 + ans2 * 3) % mod;
  ans = (ans + mod) % mod;
 
  console.log(ans);
}
 
 
main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 56208
import math

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

x=0

s = []
for i in range(math.floor(math.sqrt(m))+3):
	if m%(i+1)==0:
		s.append(i+1)
		s.append(m//(i+1))




for i in s:
	if m%(i)==0 and m//(i)>n-1:
		x=max(x,i)
print(x)


Measured memory_bytes: 3060
#include <stdio.h>
main(){
  int n,i,j,k,l,a,c;
  while(scanf("%d",&n) !=EOF){
    a=0;
    if(a<=36){
      for(i=0;i<=9;i++){
	c=i;
	for(j=0;j<=9;j++){
	  c+=j;
	  for(k=0;k<=9;k++){
	    c+=k;
	    for(l=0;l<=9;l++){
	      c+=l;
	      if(c==n){
		a++;
		c-=l;
		break;
	      }
	      c-=l;
	    }
	    c-=k;
	  }
	  c-=j;
	}
	c-=i;
      }


    }
    printf("%d\n",a);
  }
  return 0;
}

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

int main () {
	int N;
	cin >> N;
	for (int i=1; i<10; i++) {
		if (N%i==0 && N/i<10) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>
#include <deque>

using namespace std;

#define mod 1000000007


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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef  long long ll;
const int mod =1e9+7;
const int N = (int)2e5 + 5;

void solve(){
		string a,b;
		cin>>a>>b;
		rep(i,min(sz(a),sz(b))){
			cout<<a[i]<<b[i];
		}
		for(int i=min(sz(a),sz(b));i<max(sz(a),sz(b));i++){
			cout<<(sz(b)>sz(a)?b[i]:a[i]);
		}
}

int main(){
	Red;
	int t=1;
	// cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 256
/*
 * fizzbuzz.cpp
 *
 *  Created on: 2017/06/12
 *      Author: Nishio
 */
#include<bits/stdc++.h>
#define REP(i,n,N) for(ll i=(n);i<(ll)(N);i++)
#define p(s) cout<<(s)<<endl;
#define F first
#define S second
typedef long long ll;
using namespace std;

ll calc1(ll k,ll l,ll r) {
	ll F=(r-1)/3-(l-1)/3;
	ll B=(r-1)/5-(l-1)/5;
	ll FB=(r-1)/15-(l-1)/15;
	ll ret=k*(r-l)-(F+B)*k+(F+B)*4+FB*k;//number - (F || B) - (F && B)
	return ret;
}

ll calc2(ll n) {
	ll ret=0;
	string S=to_string(n);
	REP(i,1,S.size()) {
		ret+=calc1(i,pow(10,i-1),pow(10,i));
	}
	ret += calc1(S.size(),pow(10,S.size()-1),n+1);
	return ret;
}
int main() {
	ll s;
	cin>>s;
	ll l=0, r=1e18;
	ll beg=0;
	while(r-l>1) {
		ll m=(l+r)/2;
		if(calc2(m)>=s) {
			beg=m;
			r=m;
		}
		else l=m;
	}
	string str;
	REP(i,beg,beg+40) {
		if(str.size()>40)
			break;

		if(i%15==0) str+="FizzBuzz";
		else if(i%3==0) str+="Fizz";
		else if(i%5==0) str+="Buzz";
		else str+=to_string(i);
	}
	cout<<str.substr(s-calc2(beg-1)-1,20)<<endl;
	return 0;
}

Measured memory_bytes: 3404
// Author : Nachiket Kanore
// Institute : PICT, Pune

/* It does not matter how slowly you go as long as you do not stop.*/

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define rep(x,s,e) for(int x=s;x<=(e);x++)
#define repn for(int x=0;x<n;x++)
#define rep1n for(int x=1;x<=n;x++)
#define rep1m for(int y=1;y<=m;y++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define precise(x) cout << fixed << setprecision(x)
#define bits(x) __builtin_popcount(x)
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;


void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define see(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define see(x...)
#endif

const int inf = 1e18;
const int N = 1005;


int32_t main(){
    FAST;

    double a, b;    cin >> a >> b;
    double avg = ( a + b ) /2;

    int ans = round(avg);
    cout << ans << endl;

    return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
long long int solve(long long int *arr,long long int n,long long int back,long long int front,long long int **dp)
{
    if(front<back)
    {
        return 0;
    }
    if(dp[back][front]!=0)
    {
        return dp[back][front];
    }
    
    long long int a = arr[back] + min(solve(arr,n,back+2,front,dp),solve(arr,n,back+1,front-1,dp));
    
    long long int b =arr[front]+min(solve(arr,n,back,front-2,dp),solve(arr,n,back+1,front-1,dp));
    
    long long int ans =max(a,b);
    dp[back][front]=ans;
   // cout<<front<<back<<" ans is"<<ans<<endl;
    return ans;
}
 int main()
{
    long long int t;
    cin>>t;
   
    long long int* arr = new long long int[t];
    
    long long int **dp=new long long int*[t];
    for(long long int l=0;l<t;l++)
    {
        dp[l]=new long long int[t]{0};
    }
    long long int sum =0;
    for(long long int i=0;i<t;i++)
    {
        cin>>arr[i];
        sum =sum+arr[i];
    }
   
    long long int k = solve(arr,t,0,t-1,dp);
    cout<<2*k-sum;

    return 0;
}

Measured memory_bytes: 70784
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#define ll long long int
#define lim 100010
#define INF 1e9
#define mod 1000000007
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define ABS(x) ((x)>0?(x):-(x))


int main(void){
	int a,p;
	scanf("%d%d",&a,&p);
	p+=3*a;
	printf("%d",p/2);
	return 0;
}

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

int main(){
    string s;cin>>s;
    string ans="AC";
    
    if(s[0]!='A') ans="WA";

    int count=0;
    for(int i=1;i<s.size();i++)if(isupper(s[i])){
        if(i==1||i==s.size()-1||s[i]!='C') ans="WA";
        if(s[i]=='C') count++;
    }

    if(count!=1) ans="WA";

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
#include <deque>
#define inf 1e9+7
#define pb push_back
#define make make_pair
#define kaku(a) cout << a << endl;
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}
 
typedef pair<ll,ll> Pair;
const ll MAX_L=10000;

int main(){
    ll n,m;
    cin >> n >>m;
    ll cost[m+1];//1-indexed
    ll key[m+1];//1-indexed
    for(ll i=1;i<=m;i++) key[i]=0;
    for(ll i=1;i<=m;i++){
        ll a;
        cin >> cost[i]>> a;
        ll joutai=0;
        for(ll i=0;i<a;i++){
            ll b;cin>>b;b--;
            joutai+=1LL<<b;
        }
        key[i]=joutai;
      //kaku(joutai);
    }
  //OK
    ll N=1LL<<n;
    ll d[m+1][N];
    //OK
    //初期化
    for(ll i=0;i<N;i++){
        for(ll j=0;j<=m;j++){
          if(i==0) d[j][i]=0;
          else d[j][i]=inf;
        }
    }
  //OK
  //dp
    for(ll i=1;i<=m;i++){
        for(ll j=0;j<N;j++){
            ll p=(j|key[i]);
          d[i][j]=min(d[i][j],d[i-1][j]);
            ll e=min(d[i-1][p],d[i-1][j]+cost[i]);
            d[i][p]=min(e,d[i][p]);
        }
    }
    
    if(d[m][N-1]==inf) cout << -1 << endl;
    else cout << d[m][N-1] << endl;
}



Measured memory_bytes: 32256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[][] as = new int[3][3];
        for( int i = 0 ; i < 3 ; i++ ){
            String[] params = sc.nextLine().split(" ");
            for( int j = 0 ; j < 3 ; j++ ){
                as[i][j] = Integer.parseInt( params[j] );
            }
        }
        int n = Integer.parseInt( sc.nextLine() );
        int[] bs = new int[n];
        for( int i = 0 ; i < n ; i++ ){
            bs[i] = Integer.parseInt( sc.nextLine() );
            for( int j = 0 ; j < 3 ; j++ ){
                for( int k = 0 ; k < 3 ; k++ ){
                    if( as[j][k] == bs[i] ){
                        as[j][k] = 0;
                    }
                }
            }
        }

        // 斜めのチェック
        if( as[0][0] == 0 && as[1][1] == 0 && as[2][2] == 0 ){
            System.out.println( "Yes" );
            return;
        }
        if( as[0][2] == 0 && as[1][1] == 0 && as[2][0] == 0 ){
            System.out.println( "Yes" );
            return;
        }
        for( int i = 0 ; i < 3 ; i++ ){
            if( as[i][0] == 0 && as[i][1] == 0 && as[i][2] == 0 ){
                System.out.println("Yes");
                return;
            }
            if( as[0][i] == 0 && as[1][i] == 0 && as[2][i] == 0 ){
                System.out.println("Yes");
                return;
            }
        }

        System.out.println( "No" );

    }

}


Measured memory_bytes: 23124
using System;


class Program
    {
        public static void Main()
        {
            for(int i=1; i<= 9; i++)
            {
                for(int j=1; j<=9; j++)
                {
                    Console.WriteLine(i + "x" + j + "=" + i * j);
                }
            }
        }
    }

Measured memory_bytes: 8916
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		while(true){
			int h = stdIn.nextInt();
			int m = stdIn.nextInt();
			int s = stdIn.nextInt();
			
			if(h==-1&&m==-1&&s==-1){
				return;
			}
			
			int min = 120-((h*60)+m);
			int hour=0;
			if(s!=0){
				if(min==0){
					hour--;
				}
				min--;
				s=60-s;
			}
			
			int[] a = new int[6];
			if(min>=120){
				a[0]=2;
				a[1]=0;
			}
			else if(min>=60){
				a[0]++;
				a[1]=min-60;
			}
			else{
				a[1]=min;
			}
			a[2]=s;
			a[0]+=hour;
			System.out.printf("%02d:%02d:%02d\n",a[0],a[1],a[2]);
			
			a[3]=a[0]*3;
			a[4]=a[1]*3;
			a[5]=a[2]*3;
			
			if(a[5]>=60){
				a[4]++;
				a[5]-=60;
			}
			if(a[5]>=60){
				a[4]++;
				a[5]-=60;
			}
			if(a[4]>=60){
				a[3]++;
				a[4]-=60;
			}
			if(a[4]>=60){
				a[3]++;
				a[4]-=60;
			}
			
			System.out.printf("%02d:%02d:%02d\n",a[3],a[4],a[5]);
		}
	}
}

Measured memory_bytes: 12000
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <climits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#define _USE_MATH_DEFINES
#include <math.h>
#include <complex>

using namespace std;
typedef long long ll;
#define ln '\n'
#define rep(i,n) for(int i=0;i<(n);++i)
#define drep(i,n) int i = 0;for(;i<(n);++i)
#define FOR(i,s,e) for(int i=s;i<=(e);++i)
#define FORR(i,s,e) for(int i=s;i>=(e);--i)
#define fore(a, x) for(auto& a : x)
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ft first
#define sd second
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define Fill(a,b) memset(a,b,sizeof(a))
template<typename T1, typename T2> bool Max(T1& a, T2 b) { return a<b ? a = b, 1 : 0; }
template<typename T1, typename T2> bool Min(T1& a, T2 b) { return a>b ? a = b, 1 : 0; }


const int N = 300, K = 17, inf = 1e9 + 1;
ll a[N][N];


void solve() {
  int n;
  cin >> n;
  rep(i, n)rep(j, n)cin >> a[i][j];
  ll ans = 0;
  rep(i, n)rep(j, i) {
    bool need = 1;
    rep(k, n)if (k != i&&k != j) {
      int t = a[i][k] + a[k][j];
      if (t < a[i][j]) {
        cout << -1 << ln;
        return;
      }
      if (t == a[i][j])need = 0;
    }
    if (need)ans += a[i][j];
  }
  
  cout << ans << ln;
}

void init() {
}

int main(void) {
  ios::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(20);
  //freopen("C:\\Users\\LENOVO\\Documents\\Visual Studio 2015\\Projects\\Test\\Input\\in.in", "r", stdin);

  init();
  int TC = 1;
#if 0
  cin >> TC; cin.get();
#endif
  FOR(TI, 1, TC) {
    //cout << "Case #" << TI << ": ";
    solve();
  }
  
  
  return 0;
}



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

template <typename T>
struct BIT {
	int n;
	vector<T> tree;
	T def = 0;
	
	BIT(int n) : n(n + 1) {
		tree.assign(n + 1, def);
	}
	
	T sum(int index) {
		T r = 0;
		for (; index; index -= index & -index) {
			r += tree[index];
		}
		return r;
	}
	
	void add(int index, T x) {
		for (; index < n; index += index & -index) {
			tree[index] += x;
		}
	}
};

int main() {
	int n, q;
	cin >> n >> q;
	BIT<int> bit(n);
	for (int i = 0; i < q; i++) {
		bool b;
		int x, y;
		cin >> b >> x >> y;
		if (b) {
			cout << bit.sum(y) - bit.sum(x - 1) << endl;
		} else {
			bit.add(x, y);
		}
	}
}

Measured memory_bytes: 3132
// Aizu Vol-1 0184: Tsuruga Castle
// 2017.8.2

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

char *gets(char *);
char buf[100], *p;

int getInt(void)
{
	register int n = 0;
	//	while (isspace(*p)) p++;
	while (isdigit(*p)) n = 10 * n + (*p++ - '0');
	return n;
}

int cnt[15];

int main()
{
	int i, n, k;

	while (1) {
		gets(p = buf);
		if (!(n = getInt())) break;
		memset(cnt, 0, sizeof(cnt));
		i = n;
		while (i--) {
			gets(p = buf);
			k = *p++ - '0';
			if (*p >= '0') {
				if (*++p < '0') cnt[k]++;
			} else cnt[0]++;
		}
		for (i = k = 0; i < 6; i++) printf("%d\n", cnt[i]), k += cnt[i];
		printf("%d\n", n - k);
	}
	return 0;
}

Measured memory_bytes: 524
n,k=map(int,input().split())
r=0
for q in range(n+1):
    if q==0:
        for b in range(1,n+1):r+=max(min(b,k)-1,0)
    else:
        for b in range(1,n//q+1):r+=min(k,n-q*b+1,b)
print(n*n-r)

Measured memory_bytes: 3316
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 10005
typedef long long ll;
int n, k;
char Min, Max, ans[N], S[N];
void Check(char *S, int k)
{
	char T[N];
	int now = n, len = 0;
	while (now >= 1 && S[now] == Min)
		now--, len++;
	while (k != 0 && len < n)
		len *= 2, k--;
	if (len >= n)
	{
		for (int i = 1; i <= n; i++)
			ans[i] = Min;
		printf("%s\n", ans + 1);
		exit(0);
	}
	for (int i = 1; i <= len; i++)
		T[i] = Min;
	for (int i = len + 1; i <= n; i++)
		T[i] = S[now--];
	for (int i = 1; i <= n; i++)
		if (T[i] < ans[i])
		{
			for (int j = 1; j <= n; j++)
				ans[j] = T[j];
			return;
		}
		else
			if (T[i] > ans[i])
				return;
}
int main()
{
	scanf("%d%d", &n, &k);
	scanf("%s", S + 1);
	Min = 'z', Max = 'a';
	for (int i = 1; i <= n; i++)
	{
		Min = min(Min, S[i]);
		Max = max(Max, S[i]);
		S[2 * n - i + 1] = S[i];
		ans[i] = 'z';
	}
	if (Min == Max)
	{
		printf("%s\n", S + 1);
		return 0;
	}
	if (S[n] == Min)
		Check(S, k);
	for (int i = n; i <= 2 * n; i++)
		if (S[i] == Min)
			Check(S + i - n, k - 1);
	printf("%s\n", ans + 1);
}


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

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

int main() {
	int n,k,ans=0;
	cin>>n>>k;
	int a[n];
	
	rep(i,n){
		cin>>a[i];
	}
	sort(a,a+n);
	
	rep(i,k){
		ans=ans+a[i];
	}
	
	cout<<ans<<endl;
	
	// your code goes here
	return 0;
}

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
using ll = long long;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
// vector<vector<ll>> vec(100,vector<ll>(3,0));
int main(){
  ll n;
  cin >> n;
  ll sum = 0;
  if(n >= (int)pow(10,4)){
    if(n == 100000){sum --;}
    sum += (n-(int)pow(10,4))+1;
    sum += 909;
  }else if(n >= (int)pow(10,3)){
    sum = 909;
  }else if(n >= (int)pow(10,2)){
    sum += (n-(int)pow(10,2))+1;
    sum += 9;
  }else if(n >= (int)pow(10,1)){
    sum = 9;
  }else{
    sum = n;
  }
  cout << sum;
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}



int main(){
    int a,b;cin>>a>>b;
    cout<<(a>b?a-1:a);
}



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

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin >> n;
    vector<int> t(n);
    for(auto &x : t){
        cin >> x;
    }
    int sum = accumulate(ALL(t), 0);
    int m;
    cin >> m;
    while(m--){
        int pos, s;
        cin >> pos >> s;
        cout << sum - t[pos - 1] + s << nl;
    }
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(100001)


def solve(n: int, m: int, A: "List[int]", B: "List[int]"):
    par = [i for i in range(n)]
    nums = [1] * n
    def get_root(a):
        if par[a] == a:
            return a
        root = get_root(par[a])
        par[a] = root
        return par[a]
    def merge(a, b):
        root_a = get_root(a)
        root_b = get_root(b)
        if root_a == root_b:
            return 0
        else:
            ret = nums[root_a] * nums[root_b]
            group = nums[root_a] + nums[root_b]
            par[root_a] = root_b
            nums[root_b] = group
            return ret

    con = 0
    ret = []
    pairs = n * (n - 1) // 2
    ret.append(pairs - con)
    for i in range(m - 1):
        idx = m - i - 1
        a = A[idx] - 1
        b = B[idx] - 1
        con += merge(a, b)
        ret.append(pairs - con)
    ret.reverse()
    for c in ret:
        print(c)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    A = [int()] * (M)  # type: "List[int]" 
    B = [int()] * (M)  # type: "List[int]" 
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
    solve(N, M, A, B)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38832
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
  int x; cin >> x;
  if (x == 7 || x == 5 || x == 3) cout << "YES" << endl;
  else cout << "NO" << endl;
}


Measured memory_bytes: 888
package main

import (
	"fmt"
)

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

func abs(n int) int {
	if n < 0 {
		return -n
	}
	return n
}

func main() {
	var N, X int
	fmt.Scan(&N, &X)
	x := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&x[i])
	}

	ans := abs(x[0] - X)
	for _, v := range x {
		ans = gcd(ans, abs(v-X))
	}

	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;

int main(void)
{
    string s;
    int k;
    cin >> s >> k;
    set<string> st;
    REP(i, s.length())
    {
        rep(j, i, s.length())
        {
            if (j - i + 1 > k)
                break;
            st.insert(s.substr(i, j - i + 1));
        }
    }
    int cnt = 1;
    for (auto i : st)
    {
        if (cnt == k)
        {
            cout << i << endl;
            break;
        }
        cnt++;
    }
}

Measured memory_bytes: 1664
import string

alphabet = string.ascii_lowercase

S = input()
count = list(map(lambda x: S.count(x), alphabet))

# add the alphaebts
for a in alphabet:
    if count[alphabet.index(a)] == 0:
        print(S + a)
        exit()

count = [0 for _ in range(len(alphabet))]
cand = ""

# change the alphabets
for i, s in enumerate(S[::-1]):
    cand += s
    if i == len(S) - 1:
        print(-1)
        exit()
    res = ""
    for a in cand:
        if ord(S[-(i + 2)]) < ord(a):
            if res and res < S[: len(S) - i - 2] + a:
                exit
            else:
                res = S[: len(S) - i - 2] + a
    if res:
        print(res)
        exit()


Measured memory_bytes: 3960
n = int(input())
a = list(map(int,input().split()))
ans = 0
place = [0]*n
active = sorted(a,reverse=True)
for i in range(n):
    place[i] = a.index(active[i])
    a[a.index(active[i])] = -1

#dp[x][y] x,y:0~n+1 (x[-1]=x[n+1]=0にすることで端の処理を楽にする)
dp = [[0 for i in range(n+2)]for j in range(n+2)]

for i in range(n):
    dp[0][i+1] = dp[0][i]+active[i]*abs(n-i-1-place[i])
    dp[i+1][0] = dp[i][0]+active[i]*abs(place[i]-i)



def check(mat):
    for i in range(len(mat)):
        print(mat[i])
    print("\n")


for i in range(n):
    for x in range(i+2):
        y = i+1 - x
        if x != 0 and y != 0:
            dp[x][y] = max(dp[x-1][y]+active[i]*abs(place[i]-x+1),dp[x][y-1]+active[i]*abs(n-y-place[i]))
            if i == n-1:
                ans = max(ans,dp[x][y])

print(ans)




Measured memory_bytes: 102468
K = input()
N = len(K)
D = int(input())
MOD = 10 ** 9 + 7

dp = [[[0 for k in range(2)] for j in range(D)] for i in range(N+1)]

dp[0][0][0] = 1
for i, n in enumerate(K):
    n = int(n)
    for j in range(D):
        for k in range(2):
            for d in range(10 if k else n+1):
                dp[i+1][(j+d) % D][k or d < n] += dp[i][j][k]
                dp[i+1][(j+d) % D][k or d < n] %= MOD

print((dp[N][0][0] + dp[N][0][1] - 1) % MOD)


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

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> S(h+2, vector<char>(w+2, '#'));
    rep(i, h) rep(j, w){
        cin >> S.at(i+1).at(j+1);
    }

    vector<vector<int>> dist(h+2, vector<int>(w+2, -1));
    queue<int> quex, quey;
    int sx=0, sy=0;
    bool bl = false;
    int res = 0;
    rep(i, h) rep(j, w){
        if(S.at(i+1).at(j+1)=='.'){
            sx = j+1;
            sy = i+1;
            //cout << sx << " " << sy << endl;

            dist.at(sy).at(sx) = 0;
            quex.push(sx);
            quey.push(sy);
    
            while(!quex.empty() && !quey.empty()){
                int x = quex.front();
                int y = quey.front();
                quex.pop();
                quey.pop();
                res = max(res, dist.at(y).at(x));

                if(S.at(y).at(x+1)=='.' && dist.at(y).at(x+1)==-1){
                    quex.push(x+1);
                    quey.push(y);
                    dist.at(y).at(x+1) = dist.at(y).at(x) + 1;
                }

                if(S.at(y).at(x-1)=='.' && dist.at(y).at(x-1)==-1){
                    quex.push(x-1);
                    quey.push(y);
                    dist.at(y).at(x-1) = dist.at(y).at(x) + 1;
                }

                if(S.at(y+1).at(x)=='.' && dist.at(y+1).at(x)==-1){
                    quex.push(x);
                    quey.push(y+1);
                    dist.at(y+1).at(x) = dist.at(y).at(x) + 1;
                }


                if(S.at(y-1).at(x)=='.' && dist.at(y-1).at(x)==-1){
                    quex.push(x);
                    quey.push(y-1);
                    dist.at(y-1).at(x) = dist.at(y).at(x) + 1;
                }

            }

            //cout << res << endl;
            rep(i, h) rep(j, w){
                dist.at(i+1).at(j+1) = -1;
            }
        }
        else continue;
    }

    cout << res << endl;

}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

void ABC147B()
{
	string S;
	cin >> S;
	int N = S.size();
	int ct = 0;
	for (int i = 0; i < N / 2; ++i)
	{
		if (S[i] != S[N - 1 - i])
			++ct;
	}
	cout << ct << endl;
}
int main()
{
	ABC147B();
	return 0;
}


Measured memory_bytes: 256
class Dice
  def initialize(t, s, e, w, n, b)
    $north = n
    $south = s
    $east = e
    $west = w
    $top = t
    $bottom = b
  end

  def execute_orders(orders)
    length = orders.length
    for i in 0...length
      if orders[i] == "N"
        move_north
      elsif orders[i] == "S"
        move_south
      elsif orders[i] == "E"
        move_east
      elsif orders[i] == "W"
        move_west
      else
        puts "error!"
      end
    end
  end

  def check_dices_same(order_t, order_s, order_e, order_w, order_n, order_b)
      70.times do
        execute_orders(["N", "W"].sample)
        return true if $top == order_t && $south == order_s && $east == order_e && $west == order_w && $north == order_n && $bottom == order_b
      end
    return false
  end


  private
  def move_north
    north = $north
    south = $south
    top = $top
    bottom = $bottom
    $north = top
    $top = south
    $bottom = north
    $south = bottom
  end

  def move_south
    north = $north
    south = $south
    top = $top
    bottom = $bottom
    $south = top
    $bottom = south
    $north = bottom
    $top = north
  end

  def move_east
    top = $top
    bottom = $bottom
    east = $east
    west = $west
    $east = top
    $bottom = east
    $west = bottom
    $top = west
  end

  def move_west
    top = $top
    bottom = $bottom
    east = $east
    west = $west
    $west = top
    $bottom = west
    $east = bottom
    $top = east
  end
end

dice_numbers_1 = gets.chomp.split.map(&:to_i)
dice_numbers_2 = gets.chomp.split.map(&:to_i)
dice1 = Dice.new(dice_numbers_1[0], dice_numbers_1[1], dice_numbers_1[2], dice_numbers_1[3], dice_numbers_1[4], dice_numbers_1[5])
if dice1.check_dices_same(dice_numbers_2[0], dice_numbers_2[1], dice_numbers_2[2], dice_numbers_2[3], dice_numbers_2[4], dice_numbers_2[5])
  puts "Yes"
else
  puts "No"
end

Measured memory_bytes: 8732
// Tazoe

#include <iostream>
using namespace std;

int main()
{
	int t1, t2, t3, t4;
	cin >> t1;
	cin >> t2;
	cin >> t3;
	cin >> t4;

	int total = t1+t2+t3+t4;
	int x = total/60;
	int y = total%60;

	cout << x << '\n';
	cout << y << '\n';

	return 0;
}

Measured memory_bytes: 0