akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define pp pop_back
#define in insert
#define ff first
#define ss second
#define  show for(int j=0;j<v.size();j++) cout<<v[j]<<" ";
#define ld long double
#define e endl
#define bc __builtin_popcount
#define MOD 1000000007
#define INT_SIZE 32
#define me(x) memset(x,0,sizeof(x))
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
int main()
{
     ll n;
     cin>>n;
     ll ans=0;
     for(int i=1;i<=n;i++)
     {
          if(i%15!=0&&i%3!=0&&i%5!=0)
               ans+=i;
     }
     cout<<ans<<e;
}





Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int A = scan.nextInt();
		int B = scan.nextInt();

		// AとBの偶奇が異なるとき、A-KとB-Kの偶奇は異なる
		if(A % 2 != B % 2) {
			System.out.println("IMPOSSIBLE");
		}else {
			// AとBの偶奇が等しいとき
			System.out.println((A + B) / 2);
		}

	}
}

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

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

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

namespace _20170409_AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            for (;;)
            {
                int[] iArr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                int m = iArr[0];
                int f = iArr[1];
                int r = iArr[2];

                if (m == -1 && f == -1 && r == -1)
                {
                    break;
                }

                string result;
                if (m == -1 || f == -1)
                {
                    result = "F";
                }
                else if (m + f >= 80)
                {
                    result = "A";
                }
                else if (m + f >= 65)
                {
                    result = "B";
                }
                else if (m + f >= 50)
                {
                    result = "C";
                }
                else if (m + f >= 30)
                {
                    if (r >= 50)
                    {
                        result = "C";
                    }
                    else
                    {
                        result = "D";
                    }
                }
                else
                {
                    result = "F";
                }

                Console.WriteLine(result);
            }

            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9372
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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)*}
    };
}

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:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        s: [i64; n],
    }
    let mut ma = 0;
    for c in 1..n - 1 {
        let div = (n - 1) % c == 0;
        let mut tot = 0;
        for v in 0..(n - 1) / c {
            tot += s[c * v] + s[n - 1 - c * v];
            let a = n - 1 - c * v;
            if div && c * v >= a {
                break;
            }
            ma = max(ma, tot);
        }
    }
    puts!("{}\n", ma);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
int n, k;
int rk[100002];
int tmp[100002];

bool compare_sa(int i, int j){
  if(rk[i]!=rk[j]) return rk[i]<rk[j];
  else{
    int ri, rj;
    if(i+k<=n) ri=rk[i+k];
    else ri=-1;
    if(j+k<=n) rj=rk[j+k];
    else rj=-1;
    return ri<rj;
  }
}

void construct_sa(string s, int *sa){
  n=s.size();
  for(int i=0; i<=n; i++){
    sa[i]=i;
    if(i<n){
      rk[i]=s[i]-'0';
    }else{
      rk[i]=-1;
    }
  }
  for(k=1; k<=n; k*=2){
    sort(sa, sa+n+1, compare_sa);
    tmp[sa[0]]=0;
    for(int i=1; i<=n; i++){
      tmp[sa[i]]=tmp[sa[i-1]];
      if(compare_sa(sa[i-1], sa[i])) tmp[sa[i]]++;
    }
    for(int i=0; i<=n; i++) rk[i]=tmp[i];
  }
}

int main()
{
	ll h;
  cin>>n>>h;
  string s;
  cin>>s;
  ll w[100001]={}, ws[100001];
  ws[0]=0;
  ll ct=0;
  ll z=0;
  for(int i=0; i<n; i++){
    if(s[i]=='0'){
      ct++;
    }else{
      w[i]=ct+1;
      z+=ct*(ct+1)/2;
      ct=0;
    }
  }
  w[n]=ct+1;
  z+=ct*(ct+1)/2;
  if(h<=z){
    cout<<0<<endl;
    return 0;
  }
  ws[0]=0;
  for(int i=1; i<=n; i++) ws[i]=ws[i-1]+w[i-1];
  h-=z;
  int sa[100001];
  construct_sa(s, sa);
  //for(int i=0; i<=n; i++) cout<<sa[i]<<" ";
  //cout<<endl;
  for(int d=1; d<=n; d++){
    if(ws[n-d+1]<h){
      h-=ws[n-d+1];
      continue;
    }
    for(int i=1; i<=n; i++){
      if(sa[i]>n-d || s[sa[i]]=='0') continue;
      if(h<=w[sa[i]]){
        for(int j=0; j<d; j++) cout<<s[sa[i]+j];
        cout<<endl;
        return 0;
      }
      h-=w[sa[i]];
    }
  }
	return 0;
}


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

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	ll n, m;
  cin >> n >> m;
  if(n == 1) n = 3;
  if(m == 1) m = 3;
  cout << (n - 2) * (m - 2) << endl;
	return 0;
}



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

typedef long long ll;
typedef pair<int, int> Pii;

void readline(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readline(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}

int main(){

    int N;
    cin >> N;
    
    vector<int> A(N);

    readline(N, A);

    sort(A.begin(), A.end());

    cout << A[N - 1] - A[0];

    return 0;
    
}

Measured memory_bytes: 256
#include<stdio.h>
  int f[1000];
int main()
{
  int i,j,k,l,m,n,num,p;

  scanf("%d%d",&j,&k);
  for (i=0;i<k;i++)
  {
      scanf("%d%d",&m,&n);
      f[m]++;
      f[n]++;
  }
for (i=1;i<j+1;i++)
    printf("%d\n",f[i]);
  return 0;
}


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

using i64 = int64_t;

i64 dp[100005][2]={0};

int main(){
    int n;
    cin >> n;
    vector<i64> v={0};
    for(int i=0;i<n;++i){
        i64 a;
        cin >> a;
        v.push_back(a);
    }
    dp[1][0] = v[1]; dp[1][1] = -v[1];
    for(int i=1;i<n;++i){
        dp[i+1][0] = max(dp[i][0]+v[i+1], dp[i][1]-v[i+1]);
        dp[i+1][1] = max(dp[i][0]-v[i+1], dp[i][1]+v[i+1]);
    }
    cout << dp[n][0] << endl;

    return 0;
}


Measured memory_bytes: 2676
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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 (b<a) { a=b; return 1; } return 0; }
int n;
vector<vector<int>> v;
vector<int> disF,disS;
void dfs(int now,int pre,int dis,bool f){
    if(f) disF[now]=dis;
    else  disS[now]=dis;
    for(auto x:v[now]){
        if(x==pre) continue;
        dfs(x,now,dis+1,f);
    }
}
int main(){
    /*考察
    グラフが木であることからフェネックとすぬけが衝突するのは一か所のみ
    お互いの最善策としてその衝突するポイントまでいち早くとりにいく
    衝突したのち好きに自分のところを塗る
    FとSからdfsして距離を測って相手より近い点を全部とっていいのでは？
    距離が同じところは衝突するところだから先行のフェネックがとればいい
     */
    string F="Fennec",S="Snuke";
    cin>>n;
    v.resize(n);
    disF.resize(n);disS.resize(n);
    rep(i,n-1){
        int a,b;
        cin>>a>>b;a--;b--;
        v[a].push_back(b);v[b].push_back(a);
    }
    dfs(0,-1,0,true);dfs(n-1,-1,0,false);
    int Fennec=0,Snuke=0;
    rep(i,n){
        if(disF[i]<=disS[i]) Fennec++;
        else Snuke++;
    }
    if(Fennec>Snuke) cout<<F<<endl;
    else cout<<S<<endl;
    return 0;
}

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

using namespace std;

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

    string s,f="CODEFESTIVAL2016";

    cin>>s;
    int r=0;
    for(int i=0;i<16;i++)
    {
        if(s[i]==f[i])
            continue;
        else
            r++;
    }

    cout<<r;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const ll MOD = (ll) 998244353;
const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20) << setiosflags(ios::fixed);
    string v[3] = {"Sunny", "Cloudy", "Rainy"};
    string s;
    cin >> s;
    if (s == v[0]) cout << v[1] << endl;
    else if (s == v[1]) cout << v[2] << endl;
    else cout << v[0] << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <list>

using namespace std;



int main() {

    int n;scanf("%d",&n);
    printf("%d",n/3);
    return 0;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    typedef pair<int, int> P;
    P red[n];
    for (int i = 0; i < n; i++) cin >> red[i].first >> red[i].second;
    P blue[n];
    for (int i = 0; i < n; i++) cin >> blue[i].first >> blue[i].second;
    sort(red, red + n, [](P x, P y){return x.first > y.first;});
    sort(blue, blue + n, [](P x, P y){return x.second < y.second;});
    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (blue[j].first != -1 && red[i].first < blue[j].first && red[i].second < blue[j].second) {
                res++;
                blue[j].first = -1;
                break;
            }
        }
    }
    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int inf = 1e9 + 9;
string str;
int solve(string str , char c){
	bool ok = 1;
	for(char x : str){
		if(x != c){
			ok = 0;
		}
	}
	if(ok){
		return 0;
	}
	if(str.size() == 1){
		return inf;
	}
	string res = "";
	for(int i = 0 ; i + 1 < str.size() ; ++i){
		if(str[i] == c || str[i + 1] == c){
			res += c;
		}
		else{
			res += str[i];
		}
	}
	return 1 + solve(res , c);
}
int main(){
	cin >> str;
	int ans = inf;
	for(char i = 'a' ; i <= 'z' ; ++i){
		ans = min(ans , solve(str , i));
	}
	printf("%d\n" , ans);
}

Measured memory_bytes: 764
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

N, K = two_int()
A = many_int()

dicts={}
for i in A:
    if i in dicts:
        dicts[i]+=1
    else:
        dicts[i]=1

items = []
for k,v in dicts.items():
    items.append([k,v])

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

sums = 0
for i in items[:len(items) - K]:
    sums += i[1]

print(sums)

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

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl
#define PRINT_ARRAY(P) for(int i=0; i<P.size(); i++) cout << P[i] << endl;
#define PRINT_ARRAY_INLINE(P) for(int i=0; i<P.size(); i++) cout << P[i] << " ";

// integerの各桁を足す
int sum_digits(int num);

int main() {
    int n;
    cin >> n;
    vector<int> a(n);

    for(int i=0; i<n; i++) cin >> a[i];
    int num_delete = 0;
    sort(a.begin(), a.end());
    int current_number = 0;
    int num_current_number = 0;
    for(int i=0; i<n; i++) {
        if(current_number == 0) { // 現在のnumberが初期化された状態
            if(i > 0 && a[i] == 1) {
                num_delete += 1;
            }
            current_number = a[i]; 
        }
        if(current_number == a[i]) { //数字が同じ
            num_current_number++;
            if(num_current_number == current_number) {
                current_number = 0;
                num_current_number = 0;
            } 
        } else { // 数字が違う -> 綺麗じゃないから排除
            num_delete += num_current_number;
            current_number = a[i];
            num_current_number = 1;
        }
    }
    // 最後の精算
    if(num_current_number < current_number) {
        num_delete += num_current_number;
    }
    cout << num_delete << endl;

    return 0;
}

/******************************/
/***** DECRARED FUNCTIONS *****/
/******************************/

// integerの各桁を足す
int sum_digits(int num) {
    int rtn = 0;
    string num_str = to_string(num);
    for(int i=0; i<num_str.size(); i++) {
        rtn += num_str[i] - '0';
    }   
    return rtn;
}



Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
using namespace std;

void solve(){
  int a, b; cin >> a >> b;
  if(a + b < 10) cout << a + b << endl;
  else cout << "error" << endl;
  return;
}

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = Long.parseLong(sc.next());
        long k = Long.parseLong(sc.next());
        if (k % 2 != 0) {
            long temp = n / k;
            System.out.println(temp * temp * temp);
        } else {
            long temp = n / k;
            long temp2 = (n + k / 2) / k;
            System.out.println(temp * temp * temp + temp2 * temp2 * temp2);
        }
    }
}

Measured memory_bytes: 23252
S = input()
cnt = [[0,0],[0,0]]
for i, s in enumerate(S):
    x = int(i) % 2
    y = int(s)
    cnt[x][y] += 1
if cnt[0][0] > cnt[1][0]:
    print(cnt[0][1] + cnt[1][0])
else:
    print(cnt[0][0] + cnt[1][1])

Measured memory_bytes: 3188
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            int gcd = BigInteger.valueOf(x).gcd(BigInteger.valueOf(y)).intValue();
            System.out.println((x + 1) + (y + 1) - (gcd + 1));
        }
    }
}



Measured memory_bytes: 26504
// template version 1.15
using namespace std;
#include <bits/stdc++.h>

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
  #define cerrendl 42
#endif
//}}}

signed main() {
  string s,t;cin>>s>>t;
  int a,b;cin>>a>>b;
  string u;cin>>u;
  if (u==s) a--;
  else b--;
  cout << a << " " << b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    for(int i = n - m; i >= 0; i--) {
        bool flag = true;
        for(int j = 0; j < m; j++) {
            if(s[i + j] == '?' || s[i + j] == t[j]) {
                continue;
            } else {
                flag = false;
            }
        }
        if(flag) {
            for(int j = 0; j < m; j++) {
                s[i + j] = t[j];
            }
            for(int k = 0; k < n; k++) {
                if(s[k] == '?') {
                    s[k] = 'a';
                }
            }
            cout << s << endl;
            return 0;
        }
    }
    cout << "UNRESTORABLE" << endl;
}


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

#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f){cout<<(f?"YES":"NO")<<endl;}

int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    //cout<<std::fixed<<std::setprecision(10);

    string S; cin >> S;
    
    int ans = 2 * count(ALL(S), '+') - 4;

    cout << ans << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int n,max=0,sum=0,i;
    int buff[10];

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&buff[i]);
        sum += buff[i];
        if(max<buff[i]){ max = buff[i];}
    }
    sum -= max;
    if(max<sum){
        printf("Yes");
    }else{  printf("No");}
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define MAXSIZE 2000000000
int count;
void Merge(int arr[],int left,int mid,int right)
{
	int l=mid-left,r=right-mid,i,j,k;
	int *A1=(int *)malloc(sizeof(int)*(l+1));
	int *A2=(int *)malloc(sizeof(int)*(r+1));
	for(i=0;i<l;i++)
	A1[i]=arr[left+i];
	for(i=0;i<r;i++)
	A2[i]=arr[mid+i];
	A1[l]=A2[r]=MAXSIZE;
	i=j=0;
	for(k=left;k<right;k++)	
	{
	if(A1[i]>A2[j])
	arr[k]=A2[j++];
	else
	arr[k]=A1[i++];
	count++;
	}
	
	
}
void MergeSort(int arr[],int left,int right)
{
	if(left+1<right)
	{
		int mid=(left+right)/2;
		MergeSort(arr,left,mid);
		MergeSort(arr,mid,right);
		Merge(arr,left,mid,right);
	}	
}
int main(int argc, char *argv[])
{
	int arr[500000];
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%d",&arr[i]);
	MergeSort(arr,0,n);
	for(i=0;i<n;i++)
	if(i+1==n)
	printf("%d\n",arr[i]);
	else
	printf("%d ",arr[i]);
	printf("%d\n",count);
}


Measured memory_bytes: 64484
using System;

namespace myApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine().Split(' ');
            var a = int.Parse(str[0]);
            var b = int.Parse(str[1]);
            var t = int.Parse(str[2]);
        
            Console.WriteLine(t / a * b);
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
struct node {
	long long gt,rk,rnk;
} nod[4];
bool cmp(const node &a,const node &b){
	return a.rk<b.rk;
}
int main() {
	long long n;
	nod[0].gt=1;nod[1].gt=2;nod[2].gt=4;nod[3].gt=8;
	for(int j=0;j<4;j++){
		cin>>n;
		if(j==0) nod[j].rk=n*8,nod[j].rnk=n;
		if(j==1) nod[j].rk=n*4,nod[j].rnk=n;
		if(j==2) nod[j].rk=n*2,nod[j].rnk=n;
		if(j==3) nod[j].rk=n*1,nod[j].rnk=n;
	}
	cin>>n;
	n*=4;
	sort(nod,nod+4,cmp);
	long long ans=0;
	for(int j=0;j<4;j++){
		if(n<nod[j].gt)
			continue;
		else{
			long long tmp=n/nod[j].gt;
			ans+=tmp*nod[j].rnk;
			n-=tmp*nod[j].gt;
		}
	}
	cout<<ans;
}


Measured memory_bytes: 256
//raja1999

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string> 
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
//#define int ll

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;


//std::ios::sync_with_stdio(false);

int main(){
	std::ios::sync_with_stdio(false); cin.tie(NULL);
	int s,w;
	int a,b,c,d,val,val1;
	cin>>a>>b>>c>>d;
	val=c/b;
	if(c%b){
		val++;
	}
	val1=a/d;
	if(a%d){
		val1++;
	}
	if(val<=val1){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
} 


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}

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

    string S;
    cin >> S;
    if (S[2] == S[3] and S[4] == S[5]) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

typedef long long cat;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

void DFS(int R, int par, vector< vector< pair<int, int> > > &G, vector<int> &X, vector<int> &Xs) {
	int x =0;
	ALL_THE(G[R], it) if(it->ff != par) {
		X[it->ff] =it->ss;
		DFS(it->ff, R, G, X, Xs);
		x ^=Xs[it->ff];
	}
	Xs[R] ^=x;
	X[R] ^=x;
	Xs[R] ^=X[R];
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector< vector< pair<int, int> > > G(N);
	for(int i =0; i < N-1; i++) {
		int x,y,a;
		cin >> x >> y >> a;
		G[x].push_back(make_pair(y, a));
		G[y].push_back(make_pair(x, a));
	}
	vector<int> X(N, 0), Xs(N, 0);
	DFS(0, 0, G, X, Xs);
	int cnt[16];
	memset(cnt, 0, sizeof(cnt));
	for(int i =0; i < N; i++) cnt[X[i]]++;
	int ans =0, s =0;
	for(int i =1; i < 16; i++) {
		ans +=cnt[i]/2;
		cnt[i] %=2;
		s +=cnt[i];
	}
	vector<int> x0sets;
	for(int i =2; i < (1<<16); i +=2) {
		int x =0;
		for(int j =1; j < 16; j++) if((i>>j)&1) if(cnt[j]) x ^=j;
		if(x == 0) x0sets.push_back(i);
	}
	vector<int> cnt_sets(1<<16, -N);
	int b0 =1;
	for(int i =1; i < 16; i++) if(cnt[i] == 0) b0 +=1<<i;
	cnt_sets[b0] =0;
	for(int i =0; i < (1<<16); i++) if(cnt_sets[i] >= 0)
		ALL_THE(x0sets, it) if((i&(*it)) == 0)
			cnt_sets[i+(*it)] =max(cnt_sets[i+(*it)], cnt_sets[i]+1);
	ans +=s-cnt_sets[(1<<16)-1];
	cout << ans << "\n";
	return 0;}

// look at my code
// my code is amazing


Measured memory_bytes: 14208
//
//  respect the past, embrace the future
//  flipping signs
//

#include  <algorithm>
#include  <iostream>
#include  <climits>
#include  <cstdlib>
#include  <cstring>
#include  <cmath>
#include  <cstdio>
#include  <unordered_map>
#include  <map>
#include  <set>
#include  <stack>
#include  <string>
#include  <vector>
#include  <queue>

using namespace :: std;

using vpll = vector <pair <long long, long long> >;
using pll = pair <long long, long long>;
using vll = vector <long long>;
using ll = long long;

#define N (long long) (2e6 + 7)
#define M (long long) (1e9 + 7)
#define INF (long long) (2e18)
#define F first
#define S second

inline void fastInputOutput () {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
}

inline void ReadWriteFromFile () {
  freopen("../in.txt", "r", stdin);
  freopen("../out.txt", "w", stdout);
}

ll n, ans, a[N], mn = INF, cnt, neg;

int32_t main (int argc, char *argv[]) {
  fastInputOutput();
  // ReadWriteFromFile();
  
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    neg += (a[i] < 0);
    cnt += (!a[i]);
    ans += abs(a[i]);
    mn = min(mn, abs(a[i]));
  }
  if (!cnt && (neg & 1))
    ans -= mn * 2;
  cout << ans;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main(){
  int n, x, y; cin >> n >> x >> y;
  x--; y--;
  vector<int> k(n, 0);
  for(int i=0; i<n; i++) {
    for(int j=i+1; j<n; j++) {
      int d = min(j-i, abs(i-x)+abs(j-y)+1);
      k[d]++;
    }
  }
  for(int i=1; i<n; i++) cout << k[i] << endl;

  return 0;
}

// EOF


Measured memory_bytes: 256
import javax.print.DocFlavor;
import java.awt.*;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {

    static String br = System.getProperty("line.separator");
    static Scanner sc = new Scanner(System.in);
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        int N = nextInt();

        char[] S = next().toCharArray();

        int count = 1;
        for(int i=1; i<N; i++){
            if(S[i-1] != S[i]){
                count++;
            }
        }
        println(count);
    }

    static long a(long n){
        return n < 2L ? 1L : n*a(n-2);
    }

    static int nextInt() {
        return Integer.parseInt(next());
    }

    static Long nextLong() {
        return Long.parseLong(next());
    }

    static String next() {
        return sc.next();
    }

    static String nextLine(){
        return sc.nextLine();
    }

    static void println(Object o) {
        out.println(o);
        out.flush();
    }

    static void print(Object o) {
        PrintWriter out = new PrintWriter(System.out);
        out.print(o);
        out.flush();
    }
}


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

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

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

    string S; cin >> S;

    int cnt1 = 0;
    int cnt2 = 0;
    for (int i = 0;i < S.size();i++){
        if(S[i] == '0'){
            if(i%2 == 1) cnt1++;
            if(i%2 == 0) cnt2++;
        }else{
            if(i%2 == 0) cnt1++;
            if(i%2 == 1) cnt2++;
        }
    }

    cout << min(cnt1,cnt2) << endl;

    return 0;

}

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

using namespace std;

int n=0;	
string s="";
int dp[5001][5001];

int main()
{
	cin >> n;	
	cin >> s;
	for (int i=0; i<n; i++)
	{
		for (int j=i+1; j<n; j++)
		{
			if (s[i]==s[j])
				dp[i][j] = 1;
		}
	}		
	for (int i=0; i<n; i++)
	{
		for (int j=i+1; j<n; j++)
		{
			int x = dp[i][j];	
			if (x==0)
				continue;
			if (i+1<n && j+1<n && i+1<j-x+1 && s[i+1]==s[j+1])
				dp[i+1][j+1] = dp[i][j]+1;	
		}
	}
	int Max=0;
	for (int i=0; i<n; i++)
		for (int j=0; j<n; j++)
			Max = max(Max, dp[i][j]);
	cout << Max;
	return 0;
}


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

int main(){
    int N, K;
    double ans = 0;
    cin >> N >> K;
    vector<double> p(N), E(N), sumE(N, 0);
    for(int i = 0; i < N; ++i)cin >> p[i];
    double bufe = 0;
    for(int i = 0; i < N; ++i){
        E[i] = (1/p[i])*(p[i]*(p[i]+1)/2);
    }
    for(int i = 0; i < N; ++i){
        if(i == 0){
            for(int i = 0; i < K; ++i) sumE[0] += E[i];
        }
        else if(i+K-1 < N)sumE[i] = sumE[i-1] - E[i-1] + E[i+K-1];
        else break;
    }
    sort(sumE.begin(), sumE.end(), greater<double>());
    cout << setprecision(16) << sumE[0] << endl;
    return 0;
}

Measured memory_bytes: 7968
using System;
namespace Sample
{
  class Sample
  {
      static void Main()
      {
       string str = Console.ReadLine();
       string[] arr =  str.Split(' ');
       int x = int.Parse(arr[0]);
       int y = int.Parse(arr[1]);
       Console.WriteLine("{0}", x - y + 1);
        
      }
  }
}

Measured memory_bytes: 11220
def main():
    N = int(input())
    p = [int(i) for i in input().split()]

    min_ = 2 * 10**6
    ans = 0
    for i in range(N):
        if p[i] < min_:
            min_ = p[i]
            ans += 1

    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 26012
#include<stdio.h>

int main(void) {

	int a, b, c, d=0;

	scanf("%d %d %d", &a, &b, &c);

	for (; a <= b; a++) {
		if (c % a == 0)
		{
			d++;
		}
	}
	printf("%d\n", d);
	return 0;
}

Measured memory_bytes: 1852
from math import sqrt
N = int(input())
L = [0 for _ in range(N)]
for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            a = x**2 + y**2 + z**2 + x*y + x*z + y*z
            if a >=1 and a <= N:
                L[a-1] +=1
for x in L:
    print(x)

Measured memory_bytes: 9140
from collections import defaultdict

MOD = 998244353

def combination(a, b):
    if b > a - b:
        return combination(a, a - b)
    return fact[a] * ifact[b] * ifact[a-b]


N, M, K = map(int, input().split())

# 階乗を前処理
fact = defaultdict(int)
fact[0] = 1
for i in range(1, N+1):
    fact[i] = fact[i-1] * i
    fact[i] %= MOD
# 階乗の逆元を前処理
ifact = defaultdict(int)
ifact[N] = pow(fact[N], MOD-2, MOD)
for i in reversed(range(1, N + 1)):
    ifact[i-1] = ifact[i] * i
    ifact[i-1] %= MOD

ans = 0
color = M
for x in reversed(range(N)):
    now = color
    now *= combination(N-1, x)
    now %= MOD
    if x <= K:
        ans += now
        ans %= MOD
    color *= M - 1
    color %= MOD

print(ans)


Measured memory_bytes: 65188
h, w, k = map(int, input().split())
grid = []
for i in range(h):
    grid.append(input())

count = 0
for i in range(2**h):
    row = []
    r = 0
    while i:
        if i & 1:
            row.append(r)
        i >>= 1
        r += 1

    for j in range(2**w):
        col = []
        c = 0
        while j:
            if j & 1:
                col.append(c)
            j >>= 1
            c += 1

        black = 0
        for r in row:
            for c in col:
                if grid[r][c] == "#":
                    black += 1

        if black == k:
            count += 1

print(count)


Measured memory_bytes: 68008
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <unordered_map>
#include <unordered_set>

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define lcm(a, b) ((a * b) / gcd(a, b))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define UN(v) sort(all(v)), v.resize(unique(all(v))-v.begin())

#define endl '\n'

const long long INF = 100000000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;

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

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

void solve() {
    lli n;
    cin >> n;
    lli ans = INF;
    for (lli i = 1; i * i <= n; ++i) {

        if (n % i == 0) {
            ans = min(ans, (i - 1) + (n / i - 1));
        }
    }
    cout << ans << endl;
}

int main()
{
    IOS;
    //comment it out
    //freopen("input.txt", "r", stdin);
    lli t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
# define sz(x) (int)((x).size())
# define f first 
# define s second
# define pb push_back
# define ub upper_bound
# define lb lower_bound
# define all(x) x.begin(), x.end()
# define pqueue priority_queue
# define Speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
# define rep(i,n) for(int i=0;i<n;++i)
# define forn(i,n) for(int i=1;i<=n;++i)

using namespace std;

# define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
# define debug cerr<<"ERROR"<<endl
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}


template<class T> void umin(T &a,T b){a=min(a,b);}
template<class T> void umax(T &a,T b){a=max(a,b);}

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

const int dx[]={1,0,-1,0,-1,-1,1,1};
const int dy[]={0,1,0,-1,-1,1,-1,1}; 
const int inf=1e9,mod=1e9+7,N=1e6+5;

void solve(){	
	int n;
	cin>>n;
	int a[n],b[n];
	rep(i,n)cin>>a[i],b[i]=a[i];
	sort(b,b+n);
	int x=b[n/2-1],y=b[n/2];
	if(x==y){
		rep(i,n)cout<<x<<'\n';
		return;
	}
	rep(i,n){
		if(a[i]<=x)cout<<y<<'\n';
		else if(a[i]>y)cout<<x<<'\n';
		else cout<<x<<'\n';
	}
}
// 6
// 5 5 4 4 3 3
// 3 3 4  4 5 5
int main(){
 	Speed();
	int T=1; 
	//cin>>T;	
	while(T--)solve();
}


Measured memory_bytes: 5104
#include <stdio.h>

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

	d = a / b;
	r = a % b;
	f = (double)a / b;

	printf("%d %d %f", d, r, f);

	return 0;
}

Measured memory_bytes: 636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=105,p=1000000007;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
ll readl(){
	ll f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int typ,T,k,ans;
ll n,m,f[N];
struct num{
	ll x,y;
	num(ll _x=0,ll _y=0){x=_x;y=_y;}
}a[N][N];
int main(){
//	freopen("gcd.in","r",stdin);
//	freopen("gcd.out","w",stdout);
	f[0]=f[1]=1;
	for (int i=2;i<=90;i++) f[i]=f[i-1]+f[i-2];
	a[0][1]=num(1,1);
	for (int i=1;i<90;i++){
		for (int j=1;j<=i;j++)
		a[i][j]=num(a[i-1][j].x+a[i-1][j].y,a[i-1][j].x);
		a[i][i+1]=num(a[i-1][1].x*2+a[i-1][1].y,a[i-1][1].x);
	}
	typ=1;//read();
	T=read();
	while (T--){
		n=readl();m=readl();
		if (n>m) swap(n,m);
		if (typ==1){
			if (n==1){printf("1 %d\n",m%p);continue;}
			else if (m==2) {puts("1 4");continue;}
			ans=0;
			for (k=1;(f[k+1]<=n)&&(f[k+2]<=m);k++);
			for (int i=1;i<=k;i++){
				ll x=a[k-1][i].x,y=a[k-1][i].y;
				if ((x<=n)&&(y<=m)) ans=(ans+(m-y)/x)%p;
				if ((x<=m)&&(y<=n)) ans=(ans+(n-y)/x)%p;
			}
			printf("%d %d\n",k,ans);
		}
		else{
			ans=((n==1) ? m : (n+m))%p;
			for (k=2;(f[k+1]<=n)&&(f[k+2]<=m);k++)
			for (int i=1;i<=k;i++){
				ll x=a[k-1][i].x,y=a[k-1][i].y;
				if ((x<=n)&&(y<=m)) ans=(ans+(m-y)/x)%p;
				if ((x<=m)&&(y<=n)) ans=(ans+(n-y)/x)%p;
			}
			printf("%d\n",ans);
		}
	}
	return 0;
}

Measured memory_bytes: 4224
m, d = map(int, input().split())

count = 0
for i in range(1, m+1):
    for j in range(1, d+1):
        a = j % 10
        b = j // 10
        if a >= 2 and b >=2:
            if i == a*b:
                count += 1
print(count)

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

using namespace std;

int main(void) {
    string S;
    int64_t K;
    cin >> S >> K;
    for(int64_t i=0; i<K; i++) {
        if(S.at(i) != '1') {
            cout << S.at(i) << endl;
            return 0;
        }
    }
    cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 256
def gcd(a, b):
    if a < b:
        return gcd(b, a)
    while b > 0:
        a, b = b, a % b
    return a

n = int(input())
a = list(map(int, input().split()))
l = a[:]
r = a[:]

for i in range(n-1):
    l[i+1] = gcd(l[i], l[i+1])
    r[-i-2] = gcd(r[-i-1], r[-i-2])

max_val = max(l[-2], r[1])
for i in range(1, n-1):
    max_val = max(max_val, gcd(l[i-1], r[i+1]))
print(max_val)



Measured memory_bytes: 86924
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<vector>
using namespace std;
int main()
{
    long long a,b,c,k,sum=0;
    cin>>a>>b>>c>>k;
    if(a<k && k>0)
    {
        sum = sum + a;
        k = k-a;
    }
    else if(a>=k && k>0)
    {
        sum = sum + k; cout<<sum; return 0;
    }
    if(k>0)
    {
        k = k-b;
    }
    if(k>0)
    {
        sum = sum-k;
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 3652
import sys
sys.setrecursionlimit(10**7)
s=raw_input()
t=raw_input()

len_s=len(s)
len_t=len(t)

s="@"+s
t="_"+t


dp=[ [ 0 for j in range(len_t+1) ] for i in range(len_s+1)   ]
S=""
l=0

for i in range(1,len_s+1):
	for j in range(1,len_t+1):
		if s[i]==t[j]:
			dp[i][j]=dp[i-1][j-1]+1
		else:			
			dp[i][j]=max( dp[i-1][j] , dp[i][j-1] )


def lcs(i,j):
	ans=""
	if dp[i][j]==0:
		return ans
	else:
		if s[i]==t[j]:
			ans+=lcs( i-1, j -1)+s[i]
		else:
			if dp[i-1][j]>=dp[i][j-1]:
				ans+=lcs( i-1, j )
			else:
				ans+=lcs( i, j-1)
	return ans

print lcs(len_s, len_t)



Measured memory_bytes: 106240
#define _USE_MATH_DEFINES

#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>


using namespace std;

/* cout << fixed << setprecision(5); */



int main()
{	
	int H, W;

	while (cin >> H >> W)
	{
		if (H == 0 && W == 0)
		{
			break;
		}



		for (int j = 0; j < H; j++)
		{



			for (int i = 0; i < W; i++)
			{
				cout << "#";
			}

			cout << endl;

		}

		cout << endl;


	}

	

	return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

typedef long long LL;
static LL INF = (1LL<<62);


LL S;

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

	cin >> S;
	LL a, c;
	LL b, d;
	for(a=1; ; a++){
		if( a >= 1000000000LL || a*a > S){
			break;
		}
	}

	d = a;
	LL u = (a*d) - S;
	b = 1;
	c = u;
	if(c > 1000000000LL){
		while(c >= 1000000000LL){
			d--;
			u = abs((a*d) - S);
			c = u;
		}
	}
	printf("0 0 %lld %lld %lld %lld\n", a, c, b, d);
	return 0;
}

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

using namespace std;

using ll = long long;

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

    int N, M;
    cin >> N >> M;
    int max_L = (int) 1;
    int min_R = (int) N;

    while (M--) {
        int L, R;
        cin >> L >> R;
        max_L = max(max_L, L);
        min_R = min(min_R, R);
    }

    cout << max(0, min_R - max_L + 1) << '\n';

    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def read():
    N, M = map(int, input().strip().split())
    return N, M


def divisor(n):
    divisors = []
    i = 1
    while i * i <= n:
        if n % i == 0:
            divisors.append(i)
            if i * i != n:
                divisors.append(n // i)
        i += 1
    return list(sorted(divisors))


def solve(N, M):
    D = divisor(M)
    ans = 1
    for p in D:
        n = M // p
        if n >= N:
            ans = max(ans, p)
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


Measured memory_bytes: 9076
N = int(input())
A = input()
B = input()
C = input()

ans = 0
for i in range(N):
    a = A[i]
    b = B[i]
    c = C[i]
    if a == b == c:
        continue
    else:
        if a == b and b != c:
            ans += 1
        elif a == c and b != c:
            ans += 1
        elif b == c and a != b:
            ans += 1
        else:
            ans += 2
print(ans)


Measured memory_bytes: 38384
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
    private long fac[];
    private long finv[];
    private long inv[];
    private static int MAX_LEN = 2100000;
    private static int MOD = 1000000007;
    public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.COMinit();
        main.solve();
    }

    private long pow(int base, int count, long MOD) {
        if (count == 0) {
            return 1;
        }
        if (count % 2 == 1) {
            long t = ((long) base) * pow(base, count - 1, MOD);
            t %= MOD;
            return t;
        }
        long t = pow(base, count / 2, MOD);
        t %= MOD;
        t *= t;
        t %= MOD;
        return t;
    }
    public void solve() throws Exception {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int K = scan.nextInt();
        String S = scan.next();
        int N = S.length();
        long ans = 0;
        for (int i = 0; i <= K; i++) {
            long t1 = COM(i + N - 1, i);
            long t2 = pow(25, i, MOD);
            long t3 = pow(26, K - i, MOD);
            long t = t1 * t2;
            t %= MOD;
            t *= t3;
            t %= MOD;
            ans += t;
            ans %= MOD;
        }
        System.out.println(ans);
    }
    void COMinit() {
        this.fac = new long[MAX_LEN];
        this.finv = new long[MAX_LEN];
        this.inv = new long[MAX_LEN];
        this.fac[0] = this.fac[1] = 1;
        this.finv[0] = this.finv[1] = 1;
        this.inv[1] = 1;
        for (int i = 2; i < MAX_LEN; i++) {
            fac[i] = fac[i-1] * i % MOD;
            inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
            finv[i] = finv[i-1] * inv[i] % MOD;
        }
    }
    long COM(int n, int k) {
        if (n < k) {
            return 0;
        };
        if (n <0 || k < 0) {
            return 0;
        }
        return fac[n] * (finv[k] * finv[n - k]%MOD)%MOD;
    }
}


Measured memory_bytes: 109664
#include <stdio.h>

int main(void)
{
	int a,b,c,sa[7];
		for (a=0;a<7;a++){
		scanf("%d %d",&b,&c);
		sa[a]=b-c;
		}
		for (a=0;a<7;a++){
		printf("%d\n",sa[a]);
		}
	return 0;
}


Measured memory_bytes: 2112